From fa968b996507eeb4df0af746ce3c1347895a155f Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 15 Aug 2018 08:06:12 +0200 Subject: [PATCH] daemon: fix example compile --- platform/daemon/example/inquiry.c | 9 +++++++-- platform/daemon/example/l2cap_server.c | 11 ++++++++--- platform/daemon/example/l2cap_throughput.c | 11 ++++++++--- platform/daemon/example/le_scan.c | 9 +++++++-- platform/daemon/example/rfcomm_cat.c | 11 ++++++++--- platform/daemon/example/rfcomm_echo.c | 11 ++++++++++- platform/daemon/example/rfcomm_test.c | 11 ++++++++--- platform/daemon/example/test.c | 11 ++++++++--- 8 files changed, 64 insertions(+), 20 deletions(-) diff --git a/platform/daemon/example/inquiry.c b/platform/daemon/example/inquiry.c index d5c7d562a..b04f2c70e 100644 --- a/platform/daemon/example/inquiry.c +++ b/platform/daemon/example/inquiry.c @@ -49,7 +49,12 @@ #include #include "btstack_client.h" + +#ifdef _WIN32 #include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif #define MAX_DEVICES 10 struct device { @@ -239,9 +244,9 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe int main (int argc, const char * argv[]){ // start stack #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/l2cap_server.c b/platform/daemon/example/l2cap_server.c index dbe07c381..454f7510e 100644 --- a/platform/daemon/example/l2cap_server.c +++ b/platform/daemon/example/l2cap_server.c @@ -49,10 +49,15 @@ #include #include "btstack_client.h" -#include "btstack_run_loop_posix.h" #include "hci_cmd.h" #include "classic/sdp_util.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + int l2cap_reg_fail = 0; hci_con_handle_t con_handle; @@ -200,9 +205,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint int main (int argc, const char * argv[]){ #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/l2cap_throughput.c b/platform/daemon/example/l2cap_throughput.c index 523186517..752f22c4a 100644 --- a/platform/daemon/example/l2cap_throughput.c +++ b/platform/daemon/example/l2cap_throughput.c @@ -49,9 +49,14 @@ #include #include "btstack_client.h" -#include "btstack_run_loop_posix.h" #include "hci_cmd.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + #define PSM_TEST 0xdead #define PACKET_SIZE 1000 @@ -208,9 +213,9 @@ int main (int argc, const char * argv[]){ } #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/le_scan.c b/platform/daemon/example/le_scan.c index 18740de62..2cf0e0000 100644 --- a/platform/daemon/example/le_scan.c +++ b/platform/daemon/example/le_scan.c @@ -47,7 +47,12 @@ #include #include "btstack_client.h" + +#ifdef _WIN32 #include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ @@ -82,9 +87,9 @@ int main (int argc, const char * argv[]){ printf("- connecting to BTstack Daemon\n"); // start stack #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/rfcomm_cat.c b/platform/daemon/example/rfcomm_cat.c index 6dd89db03..fcd882749 100644 --- a/platform/daemon/example/rfcomm_cat.c +++ b/platform/daemon/example/rfcomm_cat.c @@ -56,9 +56,14 @@ #include #include "btstack_client.h" -#include "btstack_run_loop_posix.h" #include "classic/sdp_util.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + // input from command line arguments bd_addr_t addr = { }; hci_con_handle_t con_handle; @@ -166,9 +171,9 @@ int main (int argc, const char * argv[]){ } #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/rfcomm_echo.c b/platform/daemon/example/rfcomm_echo.c index e3c18151a..dc0607df8 100644 --- a/platform/daemon/example/rfcomm_echo.c +++ b/platform/daemon/example/rfcomm_echo.c @@ -52,9 +52,14 @@ #include #include "btstack_client.h" -#include "btstack_run_loop_posix.h" #include "classic/sdp_util.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + // input from command line arguments bd_addr_t addr = { }; hci_con_handle_t con_handle; @@ -153,7 +158,11 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint int main (int argc, const char * argv[]){ +#ifdef _WIN32 + btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else btstack_run_loop_init(btstack_run_loop_posix_get_instance()); +#endif int err = bt_open(); if (err) { fprintf(stderr,"Failed to open connection to BTdaemon, err %d\n",err); diff --git a/platform/daemon/example/rfcomm_test.c b/platform/daemon/example/rfcomm_test.c index 9456adfb3..f18b2aa57 100644 --- a/platform/daemon/example/rfcomm_test.c +++ b/platform/daemon/example/rfcomm_test.c @@ -52,9 +52,14 @@ #include #include "btstack_client.h" -#include "btstack_run_loop_posix.h" #include "classic/sdp_util.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + #define NUM_ROWS 25 #define NUM_COLS 80 @@ -178,9 +183,9 @@ int main (int argc, const char * argv[]){ printf("created test data: \n%s\n", test_data); #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) { diff --git a/platform/daemon/example/test.c b/platform/daemon/example/test.c index c1cdaa715..ec89b1c6b 100644 --- a/platform/daemon/example/test.c +++ b/platform/daemon/example/test.c @@ -50,9 +50,14 @@ #include "btstack_client.h" #include "btstack_run_loop.h" -#include "btstack_run_loop_posix.h" #include "hci_cmd.h" +#ifdef _WIN32 +#include "btstack_run_loop_posix.h" +#else +#include "btstack_run_loop_posix.h" +#endif + // bd_addr_t addr = {0x00, 0x03, 0xc9, 0x3d, 0x77, 0x43 }; // Think Outside Keyboard // bd_addr_t addr = {0x00, 0x19, 0x1d, 0x90, 0x44, 0x68 }; // WiiMote // bd_addr_t addr = {0x76, 0x6d, 0x62, 0xdb, 0xca, 0x73 }; // iPad @@ -103,9 +108,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint int main (int argc, const char * argv[]){ #ifdef _WIN32 - btstack_run_loop_init(btstack_run_loop_posix_get_instance()); -#else btstack_run_loop_init(btstack_run_loop_windows_get_instance()); +#else + btstack_run_loop_init(btstack_run_loop_posix_get_instance()); #endif int err = bt_open(); if (err) {