diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-02-16 12:00:43 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2016-02-18 12:16:19 +0200 |
commit | ce83b0f9559ca0ad4af3d77b5d865d63b42dd536 (patch) | |
tree | d257a628abc4e64f77aeae2a33502d73cff9ecff /samples | |
parent | 53dbe52f7dea31e5f160d6965a07a54f6d43a634 (diff) |
net: echo_server: Add support for Bluetooth
This enables using echo_server with Bluetooth by passing
CONF_FILE=prj_bt.conf, it is also enabled for testing so changes to
echo_server are actually tested with NETWORKING_WITH_BT.
Change-Id: I1d949798c7a9689ebc2d342ae7342dce32f319e5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/net/echo_server/Makefile | 9 | ||||
-rw-r--r-- | samples/net/echo_server/prj_bt.conf | 14 | ||||
-rw-r--r-- | samples/net/echo_server/src/Makefile | 5 | ||||
-rw-r--r-- | samples/net/echo_server/src/echo-server.c | 18 | ||||
-rw-r--r-- | samples/net/echo_server/testcase.ini | 7 |
5 files changed, 49 insertions, 4 deletions
diff --git a/samples/net/echo_server/Makefile b/samples/net/echo_server/Makefile index bb775feba..545edd9e5 100644 --- a/samples/net/echo_server/Makefile +++ b/samples/net/echo_server/Makefile @@ -20,7 +20,12 @@ NET_IFACE ?= slip MDEF_FILE = prj.mdef KERNEL_TYPE ?= nano BOARD ?= qemu_x86 -CONF_FILE = prj_$(NET_IFACE).conf +CONF_FILE ?= prj_$(NET_IFACE).conf include $(ZEPHYR_BASE)/Makefile.inc -include $(ZEPHYR_BASE)/samples/net/echo_server/Makefile.ipstack + +ifeq ($(CONFIG_NETWORKING_WITH_BT), n) + include $(ZEPHYR_BASE)/samples/net/echo_server/Makefile.ipstack +else + QEMU_EXTRA_FLAGS = -serial unix:/tmp/bt-server-bredr +endif diff --git a/samples/net/echo_server/prj_bt.conf b/samples/net/echo_server/prj_bt.conf new file mode 100644 index 000000000..addbb8262 --- /dev/null +++ b/samples/net/echo_server/prj_bt.conf @@ -0,0 +1,14 @@ +CONFIG_BLUETOOTH=y +CONFIG_BLUETOOTH_LE=y +CONFIG_BLUETOOTH_DEBUG=y +CONFIG_BLUETOOTH_SMP=y +CONFIG_BLUETOOTH_SIGNING=y +CONFIG_BLUETOOTH_PERIPHERAL=y +CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL=y +CONFIG_NETWORKING=y +CONFIG_NETWORKING_WITH_LOGGING=y +CONFIG_NETWORKING_WITH_6LOWPAN=y +CONFIG_6LOWPAN_COMPRESSION_IPHC=y +CONFIG_NETWORKING_WITH_BT=y +CONFIG_IP_BUF_RX_SIZE=5 +CONFIG_IP_BUF_TX_SIZE=3 diff --git a/samples/net/echo_server/src/Makefile b/samples/net/echo_server/src/Makefile index 70d144c05..d91eff504 100644 --- a/samples/net/echo_server/src/Makefile +++ b/samples/net/echo_server/src/Makefile @@ -2,5 +2,10 @@ ccflags-y +=-I${srctree}/net/ip/contiki ccflags-y +=-I${srctree}/net/ip/contiki/os/lib ccflags-y +=-I${srctree}/net/ip/contiki/os ccflags-y +=-I${srctree}/net/ip +ccflags-y +=-I${srctree}/samples/bluetooth/ obj-y = echo-server.o + +ifeq ($(CONFIG_NETWORKING_WITH_BT), y) + obj-y += ../../../bluetooth/ipsp/src/ipss.o +endif diff --git a/samples/net/echo_server/src/echo-server.c b/samples/net/echo_server/src/echo-server.c index 4cbf947b4..12f4b2abe 100644 --- a/samples/net/echo_server/src/echo-server.c +++ b/samples/net/echo_server/src/echo-server.c @@ -35,7 +35,10 @@ #include <contiki/ip/uip.h> #include <contiki/ipv6/uip-ds6.h> -#if !defined(CONFIG_ETHERNET) +#include <bluetooth/bluetooth.h> +#include <ipsp/src/ipss.h> + +#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_BLUETOOTH) /* The peer is the client in our case. Just invent a mac * address for it because lower parts of the stack cannot set it * in this test as we do not have any radios. @@ -70,6 +73,7 @@ static inline void init_server() { PRINT("%s: run echo server\n", __func__); +#if !defined(CONFIG_BLUETOOTH) #if !defined(CONFIG_ETHERNET) net_set_mac(my_mac, sizeof(my_mac)); #endif @@ -111,6 +115,7 @@ static inline void init_server() uip_ds6_addr_add(addr, 0, ADDR_MANUAL); } #endif +#endif } static inline void reverse(unsigned char *buf, int len) @@ -138,7 +143,7 @@ static inline struct net_buf *prepare_reply(const char *name, */ reverse(ip_buf_appdata(buf), ip_buf_appdatalen(buf)); -#if !defined(CONFIG_ETHERNET) +#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_BLUETOOTH) /* Set the mac address of the peer in net_buf because * there is no radio layer involved in this test app. * Normally there is no need to do this. @@ -263,6 +268,15 @@ void main(void) init_server(); +#if defined(CONFIG_NETWORKING_WITH_BT) + if (bt_enable(NULL)) { + PRINT("Bluetooth init failed\n"); + return; + } + ipss_init(); + ipss_advertise(); +#endif + #if defined(CONFIG_MICROKERNEL) receive(); #else diff --git a/samples/net/echo_server/testcase.ini b/samples/net/echo_server/testcase.ini index 14bbcb8fb..6cd740b2c 100644 --- a/samples/net/echo_server/testcase.ini +++ b/samples/net/echo_server/testcase.ini @@ -3,3 +3,10 @@ tags = net build_only = true arch_whitelist = x86 platform_whitelist = minnowboard + +[test_bt] +tags = net,bluetooth +build_only = true +extra_args = CONF_FILE="prj_bt.conf" +arch_whitelist = x86 +platform_whitelist = minnowboard |