net: coap_observe_client: Add support for Bluetooth
This enables using coap-observe-client with Bluetooth by passing CONF_FILE=prj_bt.conf, it is also enabled for testing so changes to coap-observe-client are actually tested with NETWORKING_WITH_BT. Change-Id: I02705f855c1974b065557986f9b231201ba310a7 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
86a4eeb740
commit
f32a837c9b
5 changed files with 43 additions and 3 deletions
|
@ -19,8 +19,12 @@
|
|||
MDEF_FILE = prj.mdef
|
||||
KERNEL_TYPE ?= nano
|
||||
BOARD ?= qemu_x86
|
||||
CONF_FILE = prj_$(ARCH).conf
|
||||
|
||||
QEMU_EXTRA_FLAGS = -serial none -serial unix:/tmp/slip.sock
|
||||
CONF_FILE ?= prj_$(ARCH).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
|
||||
|
|
8
samples/net/coap_observe_client/prj_bt.conf
Normal file
8
samples/net/coap_observe_client/prj_bt.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
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_ER_COAP=y
|
||||
CONFIG_ER_COAP_CLIENT=y
|
||||
CONFIG_ER_COAP_DEBUG=y
|
|
@ -6,5 +6,10 @@ ccflags-y +=-I${srctree}/net/ip/contiki/os
|
|||
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}/samples/bluetooth/
|
||||
|
||||
obj-y = coap-observe-client.o
|
||||
|
||||
ifeq ($(CONFIG_NETWORKING_WITH_BT), y)
|
||||
obj-y += ../../../bluetooth/ipsp/src/ipss.o
|
||||
endif
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
#include "er-coap-engine.h"
|
||||
#include "er-coap-observe-client.h"
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <ipsp/src/ipss.h>
|
||||
|
||||
#if defined(CONFIG_NANOKERNEL)
|
||||
#define STACKSIZE 2000
|
||||
char fiberStack[STACKSIZE];
|
||||
|
@ -50,6 +53,7 @@ char fiberStack[STACKSIZE];
|
|||
|
||||
static coap_observee_t *obs;
|
||||
|
||||
#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
|
||||
|
@ -61,6 +65,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
|
||||
|
@ -99,6 +104,7 @@ static inline void init_app(void)
|
|||
{
|
||||
PRINT("%s: run coap observe client\n", __func__);
|
||||
|
||||
#if !defined(CONFIG_BLUETOOTH)
|
||||
net_set_mac(my_mac, sizeof(my_mac));
|
||||
|
||||
#if defined(CONFIG_NETWORKING_WITH_IPV4)
|
||||
|
@ -127,6 +133,7 @@ static inline void init_app(void)
|
|||
uip_ds6_addr_add(addr, 0, ADDR_MANUAL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DTLS_PSK)
|
||||
|
@ -318,6 +325,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
|
||||
|
||||
coap_ctx = coap_context_new((uip_ipaddr_t *)&in6addr_my, MY_PORT);
|
||||
if (!coap_ctx) {
|
||||
PRINT("Cannot get CoAP context.\n");
|
||||
|
|
|
@ -10,3 +10,10 @@ build_only = true
|
|||
extra_args = KERNEL_TYPE=micro
|
||||
arch_whitelist = x86
|
||||
platform_whitelist = qemu_x86
|
||||
|
||||
[test_bt]
|
||||
tags = net,bluetooth
|
||||
build_only = true
|
||||
extra_args = CONF_FILE="prj_bt.conf"
|
||||
arch_whitelist = x86
|
||||
platform_whitelist = qemu_x86
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue