diff --git a/example/inquiry.c b/example/inquiry.c index 61461f5e8..371f9a128 100644 --- a/example/inquiry.c +++ b/example/inquiry.c @@ -67,7 +67,7 @@ int getDeviceIndexForAddress( bd_addr_t addr){ return -1; } -void next(){ +void next(void){ int i; int found = 0; @@ -226,4 +226,5 @@ int main (int argc, const char * argv[]){ bt_send_cmd(&btstack_set_power_mode, HCI_POWER_ON ); run_loop_execute(); bt_close(); + return 0; } \ No newline at end of file diff --git a/example/l2cap-server.c b/example/l2cap-server.c index 4e44a07f6..da00a68ab 100644 --- a/example/l2cap-server.c +++ b/example/l2cap-server.c @@ -191,4 +191,5 @@ int main (int argc, const char * argv[]){ bt_send_cmd(&btstack_set_power_mode, HCI_POWER_ON ); run_loop_execute(); bt_close(); + return 0; } \ No newline at end of file diff --git a/example/l2cap-throughput.c b/example/l2cap-throughput.c index f434eeb84..ef229ee9b 100644 --- a/example/l2cap-throughput.c +++ b/example/l2cap-throughput.c @@ -53,11 +53,11 @@ uint32_t counter = 0; timer_source_t timer; -void update_packet(){ +void update_packet(void){ net_store_32( packet, 0, counter++); } -void prepare_packet(){ +void prepare_packet(void){ int i; counter = 0; net_store_32( packet, 0, 0); @@ -223,4 +223,5 @@ int main (int argc, const char * argv[]){ run_loop_execute(); bt_close(); + return 0; } \ No newline at end of file diff --git a/example/rfcomm-cat.c b/example/rfcomm-cat.c index b783566e2..b18cb5e8d 100644 --- a/example/rfcomm-cat.c +++ b/example/rfcomm-cat.c @@ -59,12 +59,7 @@ char pin[17]; void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ bd_addr_t event_addr; uint16_t mtu; - uint16_t psm; uint16_t rfcomm_channel_id; - uint16_t rfcomm_channel_nr; - uint8_t credits; - static uint32_t packet_counter = 0; - static char packet_info[30]; // "packets: 1234567890" switch (packet_type) { @@ -104,8 +99,6 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint rfcomm_channel_id = READ_BT_16(packet, 12); mtu = READ_BT_16(packet, 14); printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_channel_id, mtu); - uint8_t message[] = "Hello World from BTstack!\n"; - // bt_send_rfcomm(rfcomm_channel_id, message, sizeof(message)); } break; @@ -150,7 +143,6 @@ int main (int argc, const char * argv[]){ } } else if (!strcmp(argv[arg], "-p") || !strcmp(argv[arg], "--pin")) { arg++; - int pin1,pin2,pin3,pin4; if(arg >= argc) { usage(argv[0]); return 1; diff --git a/example/rfcomm-echo.c b/example/rfcomm-echo.c index 4c9b3bfaa..4460e6c85 100644 --- a/example/rfcomm-echo.c +++ b/example/rfcomm-echo.c @@ -124,12 +124,8 @@ void create_spp_service(uint8_t *service, int service_id){ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ bd_addr_t event_addr; uint16_t mtu; - uint16_t psm; - uint8_t rfcomm_channel_nr; + uint16_t rfcomm_channel_nr; uint16_t rfcomm_channel_id; - uint8_t credits; - static uint32_t packet_counter = 0; - static char packet_info[30]; // "packets: 1234567890" switch (packet_type) { @@ -213,7 +209,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_channel_id, mtu); uint8_t message[] = "Hello World from BTstack!\n"; - // bt_send_rfcomm(rfcomm_channel_id, message, sizeof(message)); + bt_send_rfcomm(rfcomm_channel_id, message, sizeof(message)); } break; diff --git a/example/test.c b/example/test.c index 3b6ec2bdd..ab51089b3 100644 --- a/example/test.c +++ b/example/test.c @@ -174,4 +174,5 @@ int main (int argc, const char * argv[]){ bt_send_cmd(&btstack_set_power_mode, HCI_POWER_ON ); run_loop_execute(); bt_close(); + return 0; } \ No newline at end of file diff --git a/src/daemon.c b/src/daemon.c index c35381228..77e9522bd 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -121,7 +121,7 @@ static void dummy_bluetooth_status_handler(BLUETOOTH_STATE state){ log_dbg("Bluetooth status: %u\n", state); }; -static void daemon_no_connections_timeout(void){ +static void daemon_no_connections_timeout(struct timer *ts){ if (clients_require_power_on()) return; // false alarm :) log_dbg("No active client connection for %u seconds -> POWER OFF\n", DAEMON_NO_ACTIVE_CLIENT_TIMEOUT/1000); hci_power_control(HCI_POWER_OFF); @@ -460,10 +460,12 @@ static void usage(const char * name) { log_dbg(" --tcp use TCP server socket instead of local unix socket\n"); } +#ifdef USE_BLUETOOL static void * run_loop_thread(void *context){ run_loop_execute(); return NULL; } +#endif int main (int argc, char * const * argv){ diff --git a/src/hci.c b/src/hci.c index 0f6652bfd..9d6cf3dc3 100644 --- a/src/hci.c +++ b/src/hci.c @@ -42,6 +42,10 @@ #include #include +#ifndef EMBEDDED +#include // gethostbyname +#endif + #include "debug.h" #include "hci_dump.h" diff --git a/src/hci_transport_h4.c b/src/hci_transport_h4.c index ca1112ea3..5804ce5b2 100644 --- a/src/hci_transport_h4.c +++ b/src/hci_transport_h4.c @@ -192,7 +192,7 @@ static int h4_open(void *transport_config){ return 0; } -static int h4_close(void){ +static int h4_close(void *transport_config){ // first remove run loop handler run_loop_remove_data_source(hci_transport_h4->ds);