diff options
Diffstat (limited to 'samples/net/coap_server/src')
-rw-r--r-- | samples/net/coap_server/src/Makefile | 5 | ||||
-rw-r--r-- | samples/net/coap_server/src/coap-server.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/samples/net/coap_server/src/Makefile b/samples/net/coap_server/src/Makefile index cbc08b105..ab8a00133 100644 --- a/samples/net/coap_server/src/Makefile +++ b/samples/net/coap_server/src/Makefile @@ -6,9 +6,14 @@ ccflags-y +=-I${srctree}/net/ip/tinydtls ccflags-y +=-I${srctree}/net/ip/er-coap ccflags-y +=-I${srctree}/net/ip/rest-engine ccflags-y +=-I${srctree}/net/ip +ccflags-y +=-I${srctree}/samples/bluetooth/ obj-y = coap-server.o +ifeq ($(CONFIG_NETWORKING_WITH_BT), y) + obj-y += ../../../bluetooth/ipsp/src/ipss.o +endif + obj-y += \ resources/res-plugtest-create1.o \ resources/res-plugtest-create2.o \ diff --git a/samples/net/coap_server/src/coap-server.c b/samples/net/coap_server/src/coap-server.c index f45bd7923..503d04f54 100644 --- a/samples/net/coap_server/src/coap-server.c +++ b/samples/net/coap_server/src/coap-server.c @@ -59,6 +59,10 @@ char fiberStack[STACKSIZE]; #include <net/tinydtls.h> #endif +#include <bluetooth/bluetooth.h> +#include <ipsp/src/ipss.h> + +#if !defined(CONFIG_BLUETOOTH) #if defined(CONFIG_NETWORKING_IPV6_NO_ND) /* The peer is the client in our case. Just invent a mac * address for it because lower parts of the stack cannot set it @@ -70,6 +74,7 @@ static uint8_t peer_mac[] = { 0x15, 0x0a, 0xbe, 0xef, 0xf0, 0x0d }; /* 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 @@ -107,6 +112,7 @@ static inline void init_app(void) { PRINT("%s: run coap server\n", __func__); +#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 } #if defined(DTLS_PSK) @@ -303,6 +310,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 + /* Activate the application-specific resources. */ rest_activate_resource(&res_plugtest_test, "test"); rest_activate_resource(&res_plugtest_longpath, "seg1/seg2/seg3"); |