daemon: use windows run loop and uart block

This commit is contained in:
Matthias Ringwald 2018-08-14 22:56:39 +02:00
parent 092bd57e49
commit b9dcd1cc6b
8 changed files with 45 additions and 3 deletions

View File

@ -238,7 +238,11 @@ 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());
#endif
int err = bt_open();
if (err) {
printf("Failed to open connection to BTdaemon\n");

View File

@ -199,7 +199,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_posix_get_instance());
#else
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
#endif
int err = bt_open();
if (err) {
printf("Failed to open connection to BTdaemon\n");

View File

@ -207,7 +207,11 @@ 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());
#endif
int err = bt_open();
if (err) {
printf("Failed to open connection to BTdaemon\n");

View File

@ -81,7 +81,11 @@ int main (int argc, const char * argv[]){
printf("le_scan started\n");
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());
#endif
int err = bt_open();
if (err) {
printf("-> Failed to open connection to BTstack Daemon\n");

View File

@ -165,7 +165,11 @@ int main (int argc, const char * argv[]){
arg++;
}
#ifdef _WIN32
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
#else
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
#endif
int err = bt_open();
if (err) {
fprintf(stderr,"Failed to open connection to BTdaemon, err %d\n",err);

View File

@ -177,7 +177,11 @@ int main (int argc, const char * argv[]){
create_test_data();
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());
#endif
int err = bt_open();
if (err) {
fprintf(stderr,"Failed to open connection to BTdaemon, err %d\n",err);

View File

@ -102,7 +102,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_posix_get_instance());
#else
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
#endif
int err = bt_open();
if (err) {
printf("Failed to open connection to BTdaemon\n");

View File

@ -54,12 +54,13 @@
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <getopt.h>
#ifdef _WIN32
#include "Winsock2.h"
#endif
#include <getopt.h>
#include "btstack.h"
#include "btstack_client.h"
#include "btstack_debug.h"
@ -67,7 +68,12 @@
#include "btstack_event.h"
#include "btstack_linked_list.h"
#include "btstack_run_loop.h"
#ifdef _WIN32
#include "btstack_run_loop_windows.h"
#else
#include "btstack_run_loop_posix.h"
#endif
#include "btstack_version.h"
#include "classic/btstack_link_key_db.h"
#include "classic/rfcomm.h"
@ -1992,8 +1998,12 @@ int main (int argc, char * const * argv){
hci_transport_config_uart.device_name = UART_DEVICE;
#ifndef HAVE_PLATFORM_IPHONE_OS
#ifdef _WIN32
uart_block_implementation = btstack_uart_block_windows_instance();
#else
uart_block_implementation = btstack_uart_block_posix_instance();
#endif
#endif
#ifdef HAVE_PLATFORM_IPHONE_OS
// use default (max) UART baudrate over netgraph interface
@ -2026,7 +2036,11 @@ int main (int argc, char * const * argv){
btstack_device_name_db = BTSTACK_DEVICE_NAME_DB_INSTANCE();
#endif
#ifdef _WIN32
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
#else
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
#endif
// init power management notifications
if (control && control->register_for_power_notifications){