diff --git a/example/gatt_battery_query.c b/example/gatt_battery_query.c index f78edd655..a78b4ec33 100644 --- a/example/gatt_battery_query.c +++ b/example/gatt_battery_query.c @@ -291,7 +291,7 @@ static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa if (cmdline_addr_found){ printf("\nDisconnected %s\n", bd_addr_to_str(cmdline_addr)); - exit(0); + return; } printf("\nDisconnected %s\n", bd_addr_to_str(report.address)); @@ -304,14 +304,17 @@ static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa } } +#ifdef HAVE_POSIX_STDIN static void usage(const char *name){ fprintf(stderr, "\nUsage: %s [-a|--address aa:bb:cc:dd:ee:ff]\n", name); fprintf(stderr, "If no argument is provided, GATT browser will start scanning and connect to the first found device.\nTo connect to a specific device use argument [-a].\n\n"); } +#endif int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ +#ifdef HAVE_POSIX_STDIN int arg = 1; cmdline_addr_found = 0; @@ -326,6 +329,10 @@ int btstack_main(int argc, const char * argv[]){ usage(argv[0]); return 0; } +#else + UNUSED(argc); + UNUSED(argv); +#endif hci_event_callback_registration.callback = &hci_event_handler; hci_add_event_handler(&hci_event_callback_registration); diff --git a/example/gatt_browser.c b/example/gatt_browser.c index f61bfb3fa..d3afaac23 100644 --- a/example/gatt_browser.c +++ b/example/gatt_browser.c @@ -201,7 +201,6 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac break; case HCI_EVENT_DISCONNECTION_COMPLETE: printf("\nGATT browser - DISCONNECTED\n"); - exit(0); break; default: break; @@ -266,14 +265,17 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint } /* LISTING_END */ +#ifdef HAVE_POSIX_STDIN static void usage(const char *name){ fprintf(stderr, "\nUsage: %s [-a|--address aa:bb:cc:dd:ee:ff]\n", name); fprintf(stderr, "If no argument is provided, GATT browser will start scanning and connect to the first found device.\nTo connect to a specific device use argument [-a].\n\n"); } +#endif int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]){ +#ifdef HAVE_POSIX_STDIN int arg = 1; cmdline_addr_found = 0; @@ -287,6 +289,10 @@ int btstack_main(int argc, const char * argv[]){ usage(argv[0]); return 0; } +#else + UNUSED(argc); + UNUSED(argv); +#endif gatt_client_setup(); diff --git a/example/sdp_general_query.c b/example/sdp_general_query.c index 5872e8eec..a2ad5840d 100644 --- a/example/sdp_general_query.c +++ b/example/sdp_general_query.c @@ -169,7 +169,6 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel break; case SDP_EVENT_QUERY_COMPLETE: printf("General query done with status %d.\n\n", sdp_event_query_complete_get_status(packet)); - exit(0); break; } }