Make max APDU length and interface object list configurable in device object

This commit is contained in:
nanosonde 2019-10-27 10:54:42 +01:00
parent 3625f31d95
commit 8a3d5edd8f
8 changed files with 57 additions and 8 deletions

View File

@ -15,6 +15,11 @@ Bau07B0::Bau07B0(Platform& platform)
uint16_t maskVersion; uint16_t maskVersion;
popWord(maskVersion, _descriptor); popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion); _deviceObj.maskVersion(maskVersion);
// Set which interface objects are available in the device object
// This differs from BAU to BAU with different medium types.
// See PID_IO_LIST
_deviceObj.ifObj(_ifObjs);
} }
InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx) InterfaceObject* Bau07B0::getInterfaceObject(uint8_t idx)

View File

@ -16,4 +16,6 @@ class Bau07B0 : public BauSystemB
private: private:
TpUartDataLinkLayer _dlLayer; TpUartDataLinkLayer _dlLayer;
uint8_t _descriptor[2] = {0x07, 0xb0}; uint8_t _descriptor[2] = {0x07, 0xb0};
const uint32_t _ifObjs[6] = { 5, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG};
}; };

View File

@ -16,6 +16,18 @@ Bau27B0::Bau27B0(Platform& platform)
uint16_t maskVersion; uint16_t maskVersion;
popWord(maskVersion, _descriptor); popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion); _deviceObj.maskVersion(maskVersion);
// Set the maximum APDU length
// ETS will consider this value while programming the device
// For KNX-RF we use a smallest allowed value for now,
// although long frame are also supported by the implementation.
// Needs some experimentation.
_deviceObj.maxApduLength(15);
// Set which interface objects are available in the device object
// This differs from BAU to BAU with different medium types.
// See PID_IO_LIST
_deviceObj.ifObj(_ifObjs);
} }
// see KNX AN160 p.74 for mask 27B0 // see KNX AN160 p.74 for mask 27B0

View File

@ -20,6 +20,8 @@ class Bau27B0 : public BauSystemB
RfMediumObject _rfMediumObj; RfMediumObject _rfMediumObj;
uint8_t _descriptor[2] = {0x27, 0xB0}; uint8_t _descriptor[2] = {0x27, 0xB0};
const uint32_t _ifObjs[7] = { 6, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_RF_MEDIUM};
void domainAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, uint8_t* rfDoA, void domainAddressSerialNumberWriteIndication(Priority priority, HopCountType hopType, uint8_t* rfDoA,
uint8_t* knxSerialNumber); uint8_t* knxSerialNumber);

View File

@ -17,6 +17,11 @@ Bau57B0::Bau57B0(Platform& platform)
uint16_t maskVersion; uint16_t maskVersion;
popWord(maskVersion, _descriptor); popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion); _deviceObj.maskVersion(maskVersion);
// Set which interface objects are available in the device object
// This differs from BAU to BAU with different medium types.
// See PID_IO_LIST
_deviceObj.ifObj(_ifObjs);
} }
InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx) InterfaceObject* Bau57B0::getInterfaceObject(uint8_t idx)

View File

@ -18,4 +18,6 @@ class Bau57B0 : public BauSystemB
IpParameterObject _ipParameters; IpParameterObject _ipParameters;
IpDataLinkLayer _dlLayer; IpDataLinkLayer _dlLayer;
uint8_t _descriptor[2] = {0x57, 0xb0}; uint8_t _descriptor[2] = {0x57, 0xb0};
const uint32_t _ifObjs[7] = { 6, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER};
}; };

View File

@ -35,7 +35,7 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t&
*data = _prgMode; *data = _prgMode;
break; break;
case PID_MAX_APDU_LENGTH: case PID_MAX_APDU_LENGTH:
pushWord(254, data); pushWord(_maxApduLength, data);
break; break;
case PID_SUBNET_ADDR: case PID_SUBNET_ADDR:
*data = ((_ownAddress >> 8) & 0xff); *data = ((_ownAddress >> 8) & 0xff);
@ -45,13 +45,8 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t&
break; break;
case PID_IO_LIST: case PID_IO_LIST:
{ {
uint32_t ifObjs[] = { for (uint32_t i = start; i < (_ifObjs[0] + 1) && i < count; i++)
6, // length pushInt(_ifObjs[i], data);
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER};
for (uint32_t i = start; i < (ifObjs[0] + 1) && i < count; i++)
pushInt(ifObjs[i], data);
break; break;
} }
case PID_DEVICE_DESCRIPTOR: case PID_DEVICE_DESCRIPTOR:
@ -263,6 +258,26 @@ void DeviceObject::maskVersion(uint16_t value)
_maskVersion = value; _maskVersion = value;
} }
void DeviceObject::maxApduLength(uint16_t value)
{
_maxApduLength = value;
}
uint16_t DeviceObject::maxApduLength()
{
return _maxApduLength;
}
const uint32_t* DeviceObject::ifObj()
{
return _ifObjs;
}
void DeviceObject::ifObj(const uint32_t* value)
{
_ifObjs = value;
}
static PropertyDescription _propertyDescriptions[] = static PropertyDescription _propertyDescriptions[] =
{ {
{ PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 }, { PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 },

View File

@ -37,6 +37,10 @@ public:
void version(uint16_t value); void version(uint16_t value);
uint16_t maskVersion(); uint16_t maskVersion();
void maskVersion(uint16_t value); void maskVersion(uint16_t value);
uint16_t maxApduLength();
void maxApduLength(uint16_t value);
const uint32_t* ifObj();
void ifObj(const uint32_t* value);
protected: protected:
uint8_t propertyCount(); uint8_t propertyCount();
PropertyDescription* propertyDescriptions(); PropertyDescription* propertyDescriptions();
@ -51,4 +55,6 @@ private:
uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0}; uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0};
uint16_t _version = 0; uint16_t _version = 0;
uint16_t _maskVersion = 0x0000; uint16_t _maskVersion = 0x0000;
uint16_t _maxApduLength = 254;
const uint32_t* _ifObjs;
}; };