diff --git a/samples/net/dtls_server/Makefile b/samples/net/dtls_server/Makefile index cf23c675cc..4525ede3c6 100644 --- a/samples/net/dtls_server/Makefile +++ b/samples/net/dtls_server/Makefile @@ -20,8 +20,12 @@ NET_IFACE ?= slip MDEF_FILE = prj.mdef KERNEL_TYPE ?= nano BOARD ?= qemu_x86 -CONF_FILE = prj_$(NET_IFACE).conf - -QEMU_EXTRA_FLAGS = -serial none -serial unix:/tmp/slip.sock +CONF_FILE ?= prj_$(NET_IFACE).conf include $(ZEPHYR_BASE)/Makefile.inc + +ifeq ($(CONFIG_NETWORKING_WITH_BT), n) + QEMU_EXTRA_FLAGS = -serial none -serial unix:/tmp/slip.sock +else + QEMU_EXTRA_FLAGS = -serial unix:/tmp/bt-server-bredr +endif diff --git a/samples/net/dtls_server/prj_bt.conf b/samples/net/dtls_server/prj_bt.conf new file mode 100644 index 0000000000..ac1900380f --- /dev/null +++ b/samples/net/dtls_server/prj_bt.conf @@ -0,0 +1,6 @@ +CONFIG_NETWORKING=y +CONFIG_NETWORKING_WITH_LOGGING=y +CONFIG_NETWORKING_WITH_BT=y +CONFIG_IP_BUF_RX_SIZE=5 +CONFIG_IP_BUF_TX_SIZE=3 +CONFIG_TINYDTLS=y diff --git a/samples/net/dtls_server/src/Makefile b/samples/net/dtls_server/src/Makefile index c977557c19..5b54c2c2b8 100644 --- a/samples/net/dtls_server/src/Makefile +++ b/samples/net/dtls_server/src/Makefile @@ -3,5 +3,10 @@ ccflags-y +=-I${srctree}/net/ip/contiki/os/lib ccflags-y +=-I${srctree}/net/ip/contiki/os ccflags-y +=-I${srctree}/net/ip/contiki/os/sys ccflags-y +=-I${srctree}/net/ip +ccflags-y +=-I${srctree}/samples/bluetooth/ obj-y = dtls-server.o + +ifeq ($(CONFIG_NETWORKING_WITH_BT), y) + obj-y += ../../../bluetooth/ipsp/src/ipss.o +endif diff --git a/samples/net/dtls_server/src/dtls-server.c b/samples/net/dtls_server/src/dtls-server.c index e79567488b..2504c124f8 100644 --- a/samples/net/dtls_server/src/dtls-server.c +++ b/samples/net/dtls_server/src/dtls-server.c @@ -34,6 +34,9 @@ #include +#include +#include + static const unsigned char ecdsa_priv_key[] = { 0xD9, 0xE2, 0x70, 0x7A, 0x72, 0xDA, 0x6A, 0x05, 0x04, 0x99, 0x5C, 0x86, 0xED, 0xDB, 0xE3, 0xEF, @@ -52,6 +55,7 @@ static const unsigned char ecdsa_pub_key_y[] = { 0xD0, 0x43, 0xB1, 0xFB, 0x03, 0xE2, 0x2F, 0x4D, 0x17, 0xDE, 0x43, 0xF9, 0xF9, 0xAD, 0xEE, 0x70}; +#if !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. @@ -61,6 +65,7 @@ static const unsigned char ecdsa_pub_key_y[] = { /* This is my mac address */ static uint8_t my_mac[] = { 0x0a, 0xbe, 0xef, 0x15, 0xf0, 0x0d }; +#endif #if defined(CONFIG_NETWORKING_WITH_IPV6) #if 0 @@ -88,6 +93,7 @@ static inline void init_app(void) { PRINT("%s: run dtls server\n", __func__); +#if !defined(CONFIG_BLUETOOTH) net_set_mac(my_mac, sizeof(my_mac)); #if defined(CONFIG_NETWORKING_WITH_IPV4) @@ -106,6 +112,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) @@ -394,6 +401,15 @@ void startup(void) init_app(); +#if defined(CONFIG_NETWORKING_WITH_BT) + if (bt_enable(NULL)) { + PRINT("Bluetooth init failed\n"); + return; + } + ipss_init(); + ipss_advertise(); +#endif + recv = get_context(); if (!recv) { PRINT("%s: Cannot get network context\n", __func__);