From 8972c7b5731f4b3dbcf7ff6c229d4b6677727e77 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 9 Jul 2020 16:22:52 +0200 Subject: [PATCH] Glue standalone application to a device layer for POSIX platforms --- Makefile-Standalone | 8 ++++++++ config/standalone/standalone-chip.mk | 14 ++++++++++++-- src/include/platform/CHIPDeviceEvent.h | 1 + src/include/platform/ConnectivityManager.h | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile-Standalone b/Makefile-Standalone index 158cb95f7b94d5..7116b8295499c5 100644 --- a/Makefile-Standalone +++ b/Makefile-Standalone @@ -192,6 +192,14 @@ ifeq ($(ENABLE_CHIPOBLE_TEST),1) configure_OPTIONS += --enable-chipoble-test=yes endif +ifeq ($(HOSTOS),darwin) +configure_OPTIONS += --with-device-layer=darwin +endif + +ifeq ($(HOSTOS),linux) +configure_OPTIONS += --with-device-layer=linux +endif + ifndef BuildJobs BuildJobs := $(shell getconf _NPROCESSORS_ONLN) endif diff --git a/config/standalone/standalone-chip.mk b/config/standalone/standalone-chip.mk index e189f64736764f..63158eeeb57cfb 100644 --- a/config/standalone/standalone-chip.mk +++ b/config/standalone/standalone-chip.mk @@ -58,10 +58,10 @@ CHIP_OUTPUT_DIR = $(OUTPUT_DIR)/chip # An optional file containing application-specific configuration overrides. CHIP_PROJECT_CONFIG = $(wildcard $(PROJECT_ROOT)/include/CHIPProjectConfig.h) -# Architcture on which CHIP is being built. +# Architecture on which CHIP is being built. CHIP_BUILD_ARCH = $(shell $(CHIP_ROOT)/third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$$//g') -# Archtecture for which CHIP will be built. +# Architecture for which CHIP will be built. CHIP_HOST_ARCH := $(CHIP_BUILD_ARCH) @@ -114,6 +114,14 @@ else CHIP_CONFIGURE_OPTIONS += --enable-optimization=no endif +# Enable a device layer depending on the target +ifeq ($(findstring darwin,$(CHIP_HOST_ARCH)),darwin) +CHIP_CONFIGURE_OPTIONS += --with-device-layer=darwin +endif + +ifeq ($(findstring linux,$(CHIP_HOST_ARCH)),linux) +CHIP_CONFIGURE_OPTIONS += --with-device-layer=linux +endif # ================================================== # Adjustments to standard build settings to @@ -135,6 +143,7 @@ STD_LDFLAGS += -L$(CHIP_OUTPUT_DIR)/lib # Add CHIP libraries to standard libraries list. STD_LIBS += \ -lCHIP \ + -lDeviceLayer \ -lInetLayer \ -lnlfaultinjection \ -lSystemLayer @@ -149,6 +158,7 @@ STD_COMPILE_PREREQUISITES += install-chip # Add the CHIP libraries as prerequisites for linking the application. STD_LINK_PREREQUISITES += \ $(CHIP_OUTPUT_DIR)/lib/libCHIP.a \ + $(CHIP_OUTPUT_DIR)/lib/libDeviceLayer.a \ $(CHIP_OUTPUT_DIR)/lib/libInetLayer.a \ $(CHIP_OUTPUT_DIR)/lib/libnlfaultinjection.a \ $(CHIP_OUTPUT_DIR)/lib/libSystemLayer.a diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index 337e3b1d2a1918..ace79c752268ef 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -275,6 +275,7 @@ typedef void (*AsyncWorkFunct)(intptr_t arg); #include CHIPDEVICEPLATFORMEVENT_HEADER #endif +#include #include namespace chip { diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index 8021582df42bf1..106eaab5f75821 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -154,7 +154,7 @@ class ConnectivityManager bool HaveServiceConnectivity(void); // CHIPoBLE service methods - typedef void (*BleConnectionReceivedFunct)(BLEEndPoint * endpoint); + typedef void (*BleConnectionReceivedFunct)(Ble::BLEEndPoint * endpoint); void AddCHIPoBLEConnectionHandler(BleConnectionReceivedFunct handler); void RemoveCHIPoBLEConnectionHandler(void); CHIPoBLEServiceMode GetCHIPoBLEServiceMode(void);