From e34216fe351350029cfcc357117de4dcf56c37f8 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 2 Apr 2018 14:43:57 -0600 Subject: [PATCH] apps/examples/bluetooth/btsak: Remove some garbage left in clones files; Do proper initialization of IOCTL structure used to start advertising. --- wireless/bluetooth/btsak/btsak_advertise.c | 26 ++++++++++------------ wireless/bluetooth/btsak/btsak_scan.c | 22 ------------------ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/wireless/bluetooth/btsak/btsak_advertise.c b/wireless/bluetooth/btsak/btsak_advertise.c index 64580f67c..57a40a6e0 100644 --- a/wireless/bluetooth/btsak/btsak_advertise.c +++ b/wireless/bluetooth/btsak/btsak_advertise.c @@ -49,6 +49,8 @@ #include #include +#include +#include #include #include "btsak.h" @@ -62,19 +64,6 @@ # define CONFIG_BTSAK_NINSTANCES 3 #endif -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* Describes one command */ - -struct btsak_command_s -{ - FAR const char *name; - CODE void (*handler)(FAR struct btsak_s *btsak, int argc, FAR char *argv[]); - FAR const char *help; -}; - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -141,7 +130,16 @@ static void btsak_cmd_advertisestart(FAR struct btsak_s *btsak, FAR char *cmd, memset(&start, 0, sizeof(struct bt_advertisestart_s)); strncpy(start.as_name, btsak->ifname, HCI_DEVNAME_SIZE); - start.as_type = BT_LE_ADV_IND; + + start.as_type = BT_LE_ADV_IND; + + start.as_ad.len = 2; + start.as_ad.type = BT_EIR_FLAGS; + start.as_ad.data[0] = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; + + start.as_sd.len = sizeof("btsak"); + start.as_sd.type = BT_EIR_NAME_COMPLETE; + strcpy((FAR char *)start.as_sd.data, "btsak"); /* Perform the IOCTL to start advertising */ diff --git a/wireless/bluetooth/btsak/btsak_scan.c b/wireless/bluetooth/btsak/btsak_scan.c index cb2213b6f..12fb3c249 100644 --- a/wireless/bluetooth/btsak/btsak_scan.c +++ b/wireless/bluetooth/btsak/btsak_scan.c @@ -53,28 +53,6 @@ #include "btsak.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#if !defined(CONFIG_BTSAK_NINSTANCES) || CONFIG_BTSAK_NINSTANCES <= 0 -# undef CONFIG_BTSAK_NINSTANCES -# define CONFIG_BTSAK_NINSTANCES 3 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* Describes one command */ - -struct btsak_command_s -{ - FAR const char *name; - CODE void (*handler)(FAR struct btsak_s *btsak, int argc, FAR char *argv[]); - FAR const char *help; -}; - /**************************************************************************** * Private Functions ****************************************************************************/