diff --git a/samples/net/echo_client/Makefile b/samples/net/echo_client/Makefile index 4857da5c111..dcd86fba2bb 100644 --- a/samples/net/echo_client/Makefile +++ b/samples/net/echo_client/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_client/prj_bt.conf b/samples/net/echo_client/prj_bt.conf new file mode 100644 index 00000000000..d976641fdc0 --- /dev/null +++ b/samples/net/echo_client/prj_bt.conf @@ -0,0 +1,15 @@ +CONFIG_TEST_RANDOM_GENERATOR=y +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_client/src/Makefile b/samples/net/echo_client/src/Makefile index 6a6ee4f0a11..108f8b5a38d 100644 --- a/samples/net/echo_client/src/Makefile +++ b/samples/net/echo_client/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-client.o + +ifeq ($(CONFIG_NETWORKING_WITH_BT), y) + obj-y += ../../../bluetooth/ipsp/src/ipss.o +endif diff --git a/samples/net/echo_client/src/echo-client.c b/samples/net/echo_client/src/echo-client.c index 218eab43fec..d9dc6ccb6cd 100644 --- a/samples/net/echo_client/src/echo-client.c +++ b/samples/net/echo_client/src/echo-client.c @@ -44,6 +44,9 @@ #include #include +#include +#include + /* Generated by http://www.lipsum.com/ * 3 paragraphs, 176 words, 1230 bytes of Lorem Ipsum */ @@ -58,6 +61,7 @@ static const char *lorem_ipsum = static int expecting; static int ipsum_len; +#if !defined(CONFIG_BLUETOOTH) #if defined(CONFIG_NETWORKING_IPV6_NO_ND) /* The peer is the server in our case. Just invent a mac * address for it because lower parts of the stack cannot set it @@ -67,6 +71,7 @@ static uint8_t peer_mac[] = { 0x0a, 0xbe, 0xef, 0x15, 0xf0, 0x0d }; #endif static uint8_t my_mac[] = { 0x15, 0x0a, 0xbe, 0xef, 0xf0, 0x0d }; +#endif #if defined(CONFIG_NETWORKING_WITH_IPV6) #if 0 @@ -107,6 +112,7 @@ static inline void init_app(void) sys_rand32_init(); +#if !defined(CONFIG_BLUETOOTH) net_set_mac(my_mac, sizeof(my_mac)); #if defined(CONFIG_NETWORKING_WITH_IPV4) @@ -140,6 +146,7 @@ static inline void init_app(void) uip_ds6_addr_add(addr, 0, ADDR_MANUAL); } #endif +#endif } static inline void reverse(unsigned char *buf, int len) @@ -371,6 +378,15 @@ void main(void) ipsum_len = strlen(lorem_ipsum); +#if defined(CONFIG_NETWORKING_WITH_BT) + if (bt_enable(NULL)) { + PRINT("Bluetooth init failed\n"); + return; + } + ipss_init(); + ipss_advertise(); +#endif + if (!get_context(&unicast, &multicast)) { PRINT("%s: Cannot get network context\n", __func__); return; diff --git a/samples/net/echo_client/testcase.ini b/samples/net/echo_client/testcase.ini index 14bbcb8fb30..6cd740b2c0f 100644 --- a/samples/net/echo_client/testcase.ini +++ b/samples/net/echo_client/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 diff --git a/samples/net/echo_server/prj_bt.conf b/samples/net/echo_server/prj_bt.conf index addbb8262d4..b9c347e21f1 100644 --- a/samples/net/echo_server/prj_bt.conf +++ b/samples/net/echo_server/prj_bt.conf @@ -1,6 +1,7 @@ CONFIG_BLUETOOTH=y CONFIG_BLUETOOTH_LE=y CONFIG_BLUETOOTH_DEBUG=y +CONFIG_BLUETOOTH_DEBUG_L2CAP=y CONFIG_BLUETOOTH_SMP=y CONFIG_BLUETOOTH_SIGNING=y CONFIG_BLUETOOTH_PERIPHERAL=y