1 #include <stdint.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <string.h> 5 #include <signal.h> 6 7 #include "btstack_config.h" 8 9 #include "btstack_debug.h" 10 #include "btstack_event.h" 11 #include "btstack_memory.h" 12 #include "btstack_run_loop.h" 13 #include "btstack_run_loop_windows.h" 14 #include "hci.h" 15 #include "hci_dump.h" 16 #include "hal_led.h" 17 // #include "btstack_link_key_db_fs.h" 18 // #include "stdin_support.h" 19 20 int btstack_main(int argc, const char * argv[]); 21 22 static int led_state = 0; 23 void hal_led_toggle(void){ 24 led_state = 1 - led_state; 25 printf("LED State %u\n", led_state); 26 } 27 28 static void sigint_handler(int param){ 29 30 #ifndef _WIN32 31 // reset anyway 32 btstack_stdin_reset(); 33 #endif 34 log_info(" <= SIGINT received, shutting down..\n"); 35 // hci_power_control(HCI_POWER_OFF); 36 // hci_close(); 37 log_info("Good bye, see you.\n"); 38 exit(0); 39 } 40 41 int main(int argc, const char * argv[]){ 42 printf("BTstack on windows booting up\n"); 43 44 /// GET STARTED with BTstack /// 45 btstack_memory_init(); 46 btstack_run_loop_init(btstack_run_loop_windows_get_instance()); 47 48 // handle CTRL-c 49 signal(SIGINT, sigint_handler); 50 51 // setup app 52 btstack_main(argc, argv); 53 54 // go 55 btstack_run_loop_execute(); 56 57 return 0; 58 } 59