diff --git a/zephcore/adapters/ble/ZephyrBLE.cpp b/zephcore/adapters/ble/ZephyrBLE.cpp index 8818730..bc7ae69 100644 --- a/zephcore/adapters/ble/ZephyrBLE.cpp +++ b/zephcore/adapters/ble/ZephyrBLE.cpp @@ -26,11 +26,6 @@ LOG_MODULE_REGISTER(zephcore_ble, CONFIG_ZEPHCORE_BLE_LOG_LEVEL); #include "ZephyrBLE.h" -/* MAX_FRAME_SIZE from CompanionMesh.h — keep in sync */ -#ifndef MAX_FRAME_SIZE -#define MAX_FRAME_SIZE 172 -#endif - /* ========== Constants ========== */ #define DEVICE_NAME_MAX 29 diff --git a/zephcore/adapters/ble/ZephyrBLE.h b/zephcore/adapters/ble/ZephyrBLE.h index b1df197..fdc5507 100644 --- a/zephcore/adapters/ble/ZephyrBLE.h +++ b/zephcore/adapters/ble/ZephyrBLE.h @@ -9,6 +9,10 @@ #include #include +/* Maximum companion transport frame size. + * +4 over the base 172 to accommodate transport codes (region scoping). */ +#define MAX_FRAME_SIZE 176 + #ifdef __cplusplus extern "C" { #endif diff --git a/zephcore/adapters/transport/LinuxTCPTransport.c b/zephcore/adapters/transport/LinuxTCPTransport.c index 14efa2b..745592c 100644 --- a/zephcore/adapters/transport/LinuxTCPTransport.c +++ b/zephcore/adapters/transport/LinuxTCPTransport.c @@ -41,13 +41,6 @@ LOG_MODULE_REGISTER(linux_tcp_transport, LOG_LEVEL_INF); -/* Keep in sync with MAX_FRAME_SIZE in CompanionMesh.h. ZephyrBLE.cpp - * uses the same constant; we mirror it here so a single transport build - * doesn't have to pull the C++ header. */ -#ifndef MAX_FRAME_SIZE -#define MAX_FRAME_SIZE 172 -#endif - #define FRAME_QUEUE_SIZE CONFIG_ZEPHCORE_BLE_QUEUE_SIZE #define LISTEN_PORT CONFIG_ZEPHCORE_LINUX_TCP_PORT #define LISTEN_BACKLOG 1 diff --git a/zephcore/app/CompanionMesh.h b/zephcore/app/CompanionMesh.h index 43281de..dcd9f94 100644 --- a/zephcore/app/CompanionMesh.h +++ b/zephcore/app/CompanionMesh.h @@ -36,8 +36,10 @@ #define AUTO_ADD_ROOM_SERVER (1 << 3) #define AUTO_ADD_SENSOR (1 << 4) -/* Max BLE frame size — must match NUS MTU negotiated size */ -#define MAX_FRAME_SIZE 172 +/* Canonical definition is in ZephyrBLE.h; guard here for TUs that don't include it */ +#ifndef MAX_FRAME_SIZE +#define MAX_FRAME_SIZE 176 +#endif /* 1 header + 32 pubkey + 1 type + 1 flags + 1 path_len + 64 path + 32 name + 4*4 fields = 148 */ #define CONTACT_FRAME_SIZE 148