Kbox-UniStack Docs

Configuration Reference

Compile-time knobs of the kbox-stack — APDU and value size macros, the property model, the empty-store pattern, and identity defaults.

This page collects the compile-time configuration of the stack: the size macros that shape its buffers, the interface-object property model, and the identity defaults. All of it is portable.

StackConfig macros

MacroDefaultNotes
KNX_APDU_MAX55Max APDU length. Valid range [15, 254] (enforced by static_assert).
KNX_FRAME_OVERHEAD9Fixed per-frame overhead in bytes.
KNX_FRAME_MAXKNX_APDU_MAX + 9Derived maximum frame size.
KNX_OBJ_VALUE_MAX54Max stored group-object value size in bytes.
#ifndef KNX_APDU_MAX
#define KNX_APDU_MAX 55u
#endif
static_assert(KNX_APDU_MAX >= 15u && KNX_APDU_MAX <= 254u, /* ... */);

#define KNX_FRAME_OVERHEAD 9u
#define KNX_FRAME_MAX (KNX_APDU_MAX + KNX_FRAME_OVERHEAD)

KNX_APDU_MAX is not just a frame limit — it sizes internal storage. Raising it (e.g. -DKNX_APDU_MAX=254 for KNX Data Secure downloads) enlarges the stack and secure storage buffers. The lower bound is 15 because Secure Wrap needs frame overhead headroom and must land in the extended-frame branch at its own ceiling.

PropertyStore & InterfaceObjectProperty

Interface-object properties (the KNX property model — object type, PID, access, element width, data) are described by InterfaceObjectProperty and handed to the stack as a PropertyStore.

struct InterfaceObjectProperty {
  uint8_t  objectIndex;
  uint8_t  propertyId;
  uint8_t  propertyIndex;
  uint8_t  type;
  uint8_t  elementWidth;
  uint16_t currentElements;
  uint16_t maxElements;
  uint8_t  readAccess;
  uint8_t  writeAccess;
  bool     writable;
  uint8_t* data;
  uint16_t dataCapacity;
  uint16_t objectType     = 0xFFFFu;
  uint16_t objectInstance = 0xFFFFu;
};

struct PropertyStore {
  const InterfaceObjectProperty* entries;
  uint16_t                       count;
};

If your application defines no extra interface-object properties, pass an empty store (no entries, count 0). StackParameters takes it by reference, so keep it at static lifetime.

// Empty-store pattern: the stack still serves its built-in objects.
static PropertyStore propertyStore{ nullptr, 0 };

KNX Data Secure adds its own Security Interface Object; its property table is wired through the secure setup, not this store. See KNX Data Secure.

Identity defaults

The device identity defaults are declared in StackParameters.h (not StackConfig.h).

ConstantValueMeaning
KNX_MANUFACTURER_ID_DEFAULT0x023EDefault KNX manufacturer id.
DEVICE_DESCRIPTOR_00x07B0Device Descriptor Type 0 — mask version (System B).
static constexpr uint16_t DEVICE_DESCRIPTOR_0        = 0x07B0u;
static constexpr uint16_t KNX_MANUFACTURER_ID_DEFAULT = 0x023Eu;

The StackParameters constructor also defaults manufacturerId to 0x023E and carries a maxApduLength (defaulting to KNX_APDU_MAX). Override the manufacturer id per device where required.