diff --git a/wireless/bluetooth/btsak/Makefile b/wireless/bluetooth/btsak/Makefile index 0d5417ced..28656a378 100644 --- a/wireless/bluetooth/btsak/Makefile +++ b/wireless/bluetooth/btsak/Makefile @@ -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 diff --git a/wireless/bluetooth/btsak/btsak.h b/wireless/bluetooth/btsak/btsak.h index 3aa05671e..400198813 100644 --- a/wireless/bluetooth/btsak/btsak.h +++ b/wireless/bluetooth/btsak/btsak.h @@ -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[]); diff --git a/wireless/bluetooth/btsak/btsak_advertise.c b/wireless/bluetooth/btsak/btsak_advertise.c index 3e115047e..c95e218b3 100644 --- a/wireless/bluetooth/btsak/btsak_advertise.c +++ b/wireless/bluetooth/btsak/btsak_advertise.c @@ -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 ****************************************************************************/ diff --git a/wireless/bluetooth/btsak/btsak_gatt.c b/wireless/bluetooth/btsak/btsak_gatt.c new file mode 100644 index 000000000..324b8a11f --- /dev/null +++ b/wireless/bluetooth/btsak/btsak_gatt.c @@ -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 + * + * 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 + +#include + +#include "btsak.h" + +/**************************************************************************** + * Public functions + ****************************************************************************/ + +/**************************************************************************** + * Name: btsak_cmd_gatt_exchange_mtu + * + * Description: + * gatt [-h] exchange_mtu [-h] 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] 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] 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] 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] [] 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] 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] command + * + ****************************************************************************/ + +void btsak_cmd_gatt_write(FAR struct btsak_s *btsak, int argc, + FAR char *argv[]) +{ +# warning Missing logic +} diff --git a/wireless/bluetooth/btsak/btsak_main.c b/wireless/bluetooth/btsak/btsak_main.c index 6ef772c2e..4d3100655 100644 --- a/wireless/bluetooth/btsak/btsak_main.c +++ b/wireless/bluetooth/btsak/btsak_main.c @@ -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] " }, { diff --git a/wireless/bluetooth/btsak/btsak_security.c b/wireless/bluetooth/btsak/btsak_security.c index 88c02571c..34dba3618 100644 --- a/wireless/bluetooth/btsak/btsak_security.c +++ b/wireless/bluetooth/btsak/btsak_security.c @@ -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 ****************************************************************************/ diff --git a/wireless/ieee802154/i8sak/Kconfig b/wireless/ieee802154/i8sak/Kconfig index 2dc9da3a7..a6ddae900 100644 --- a/wireless/ieee802154/i8sak/Kconfig +++ b/wireless/ieee802154/i8sak/Kconfig @@ -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 diff --git a/wireless/ieee802154/i8sak/Makefile b/wireless/ieee802154/i8sak/Makefile index 7c776ad21..f5a46e05f 100644 --- a/wireless/ieee802154/i8sak/Makefile +++ b/wireless/ieee802154/i8sak/Makefile @@ -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