apps/wireless/bluetooth/btsak: Plug remaining, unimplemented commands with stubs so that we can get a clean link and get on with some initial testing. We can finish the GATT queries later. Also updates Makefile to use Application.mk.

This commit is contained in:
Gregory Nutt 2018-04-03 08:16:34 -06:00
parent bd77fae5ce
commit c1ec9ab9a6
8 changed files with 168 additions and 126 deletions

View File

@ -35,104 +35,22 @@
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
include $(APPDIR)/Make.defs
# Bluetooth SAK (swiss army knife )
APPNAME = i8
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 4096
# Bluetooth SAK (Swiss Army Knife)
ASRCS =
CSRCS = btsak_advertise.c btsak_scan.c btsak_security.c
CSRCS = btsak_advertise.c btsak_gatt.c btsak_scan.c btsak_security.c
MAINSRC = btsak_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
MAINOBJ = $(MAINSRC:.c=$(OBJEXT))
# Application info
SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
CONFIG_BTSAK_PROGNAME ?= bt$(EXEXT)
CONFIG_BTSAK_PRIORITY ?= 100
CONFIG_BTSAK_STACKSIZE ?= 2048
ifneq ($(CONFIG_BUILD_KERNEL),y)
OBJS += $(MAINOBJ)
endif
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\..\libapps$(LIBEXT)
else
ifeq ($(WINTOOL),y)
BIN = ..\\..\\..\\libapps$(LIBEXT)
else
BIN = ../../../libapps$(LIBEXT)
endif
endif
ifeq ($(WINTOOL),y)
INSTALL_DIR = "${shell cygpath -w $(BIN_DIR)}"
else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_BTSAK_PROGNAME ?= bt$(EXEEXT)
PROGNAME = $(CONFIG_BTSAK_PROGNAME)
APPNAME = bt
PRIORITY = $(CONFIG_BTSAK_PRIORITY)
STACKSIZE = $(CONFIG_BTSAK_STACKSIZE)
ROOTDEPPATH = --dep-path .
# Common build
VPATH =
all: .built
.PHONY: clean depend distclean
.PRECIOUS: ../../../libapps$(LIBEXT)
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
$(COBJS) $(MAINOBJ): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
.built: $(OBJS)
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
else
install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
else
context:
endif
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
depend: .depend
clean:
$(call DELFILE, .built)
$(call CLEAN)
distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-include Make.dep
include $(APPDIR)/Application.mk

View File

@ -251,7 +251,7 @@ void btsak_cmd_gatt_exchange_mtu(FAR struct btsak_s *btsak, int argc,
FAR char *argv[]);
void btsak_cmd_discover(FAR struct btsak_s *btsak, int argc,
FAR char *argv[]);
void btsak_cmd_gatt_discover_characteristc(FAR struct btsak_s *btsak,
void btsak_cmd_gatt_discover_characteristic(FAR struct btsak_s *btsak,
int argc, FAR char *argv[]);
void btsak_cmd_gat_discover_descriptor(FAR struct btsak_s *btsak,
int argc, FAR char *argv[]);

View File

@ -55,15 +55,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 Functions
****************************************************************************/

View File

@ -0,0 +1,149 @@
/****************************************************************************
* apps/wireless/bluetooth/btsak/btsak_gatt.c
* Bluetooth Swiss Army Knife -- GATT commands
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Based loosely on the i8sak IEEE 802.15.4 program by Anthony Merlino and
* Sebastien Lorquet. Commands inspired for btshell example in the
* Intel/Zephyr Arduino 101 package (BSD license).
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
#include <nuttx/wireless/bt_core.h>
#include "btsak.h"
/****************************************************************************
* Public functions
****************************************************************************/
/****************************************************************************
* Name: btsak_cmd_gatt_exchange_mtu
*
* Description:
* gatt [-h] exchange_mtu [-h] <addr> <addr-type> command
*
****************************************************************************/
void btsak_cmd_gatt_exchange_mtu(FAR struct btsak_s *btsak, int argc,
FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_discover
*
* Description:
* gatt [-h] discover [-h] <addr> <addr-type> <uuid-type> command
*
****************************************************************************/
void btsak_cmd_discover(FAR struct btsak_s *btsak, int argc, FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_gatt_discover_characteristic
*
* Description:
* gatt [-h] characteristic [-h] <addr> <addr-type> command
*
****************************************************************************/
void btsak_cmd_gatt_discover_characteristic(FAR struct btsak_s *btsak,
int argc, FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_gat_discover_descriptor
*
* Description:
* gatt [-h] descriptor [-h] <addr> <addr-type> command
*
****************************************************************************/
void btsak_cmd_gat_discover_descriptor(FAR struct btsak_s *btsak, int argc, FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_gatt_read
*
* Description:
* gatt [-h] read [-h] <addr> <addr-type> <handle> [<offset>] command
*
****************************************************************************/
void btsak_cmd_gatt_read(FAR struct btsak_s *btsak, int argc,
FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_gatt_read_multiple
*
* Description:
* gatt [-h] read-multiple [-h] <addr> <addr-type> <handle> <nitems> command
*
****************************************************************************/
void btsak_cmd_gatt_read_multiple(FAR struct btsak_s *btsak, int argc,
FAR char *argv[])
{
# warning Missing logic
}
/****************************************************************************
* Name: btsak_cmd_gatt_write
*
* Description:
* gatt [-h] write [-h] [-h] <addr> <addr-type> <handle> <datum> command
*
****************************************************************************/
void btsak_cmd_gatt_write(FAR struct btsak_s *btsak, int argc,
FAR char *argv[])
{
# warning Missing logic
}

View File

@ -52,15 +52,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
****************************************************************************/
@ -130,7 +121,7 @@ static const struct btsak_command_s g_btsak_gatt_commands[] =
},
{
"characteristic",
(CODE void *)btsak_cmd_gatt_discover_characteristc,
(CODE void *)btsak_cmd_gatt_discover_characteristic,
"[-h] <addr> <addr-type>"
},
{

View File

@ -55,15 +55,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 Functions
****************************************************************************/

View File

@ -27,7 +27,7 @@ config IEEE802154_I8SAK_PRIORITY
config IEEE802154_I8SAK_STACKSIZE
int "i8sak stack size"
default 2048
default 4096
if NET_6LOWPAN
config IEEE802154_I8SAK_DEFAULT_PORT

View File

@ -40,9 +40,14 @@ include $(APPDIR)/Make.defs
# IEEE 802.15.4 SAK (swiss army knife )
CONFIG_IEEE802154_I8SAK_PROGNAME ?= i8$(EXEEXT)
CONFIG_IEEE802154_I8SAK_PRIORITY ?= 100
CONFIG_IEEE802154_I8SAK_STACKSIZE ?= 4096
PROGNAME = $(CONFIG_IEEE802154_I8SAK_PROGNAME)
APPNAME = i8
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 4096
PRIORITY = $(CONFIG_IEEE802154_I8SAK_PRIORITY)
STACKSIZE = $(CONFIG_IEEE802154_I8SAK_STACKSIZE)
# IEEE 802.15.4 SAK (Swiss Army Knife)
@ -79,9 +84,6 @@ else
INSTALL_DIR = $(BIN_DIR)
endif
CONFIG_IEEE802154_I8SAK_PROGNAME ?= i8$(EXEEXT)
PROGNAME = $(CONFIG_IEEE802154_I8SAK_PROGNAME)
ROOTDEPPATH = --dep-path .
# Common build