mirror of
				https://github.com/thelsing/knx.git
				synced 2025-10-26 10:26:25 +01:00 
			
		
		
		
	Make max APDU length and interface object list configurable in device object
This commit is contained in:
		
							parent
							
								
									3625f31d95
								
							
						
					
					
						commit
						8a3d5edd8f
					
				| @ -15,6 +15,11 @@ Bau07B0::Bau07B0(Platform& platform) | ||||
|     uint16_t maskVersion; | ||||
|     popWord(maskVersion, _descriptor); | ||||
|     _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) | ||||
|  | ||||
| @ -16,4 +16,6 @@ class Bau07B0 : public BauSystemB | ||||
|   private: | ||||
|     TpUartDataLinkLayer _dlLayer; | ||||
|     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}; | ||||
| }; | ||||
| @ -16,6 +16,18 @@ Bau27B0::Bau27B0(Platform& platform) | ||||
|     uint16_t maskVersion; | ||||
|     popWord(maskVersion, _descriptor); | ||||
|     _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
 | ||||
|  | ||||
| @ -20,6 +20,8 @@ class Bau27B0 : public BauSystemB | ||||
|     RfMediumObject _rfMediumObj; | ||||
| 
 | ||||
|     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, | ||||
|                                                   uint8_t* knxSerialNumber); | ||||
|  | ||||
| @ -17,6 +17,11 @@ Bau57B0::Bau57B0(Platform& platform) | ||||
|     uint16_t maskVersion; | ||||
|     popWord(maskVersion, _descriptor); | ||||
|     _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) | ||||
|  | ||||
| @ -18,4 +18,6 @@ class Bau57B0 : public BauSystemB | ||||
|     IpParameterObject _ipParameters; | ||||
|     IpDataLinkLayer _dlLayer; | ||||
|     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}; | ||||
| }; | ||||
| @ -35,7 +35,7 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t& | ||||
|             *data = _prgMode; | ||||
|             break; | ||||
|         case PID_MAX_APDU_LENGTH: | ||||
|             pushWord(254, data); | ||||
|             pushWord(_maxApduLength, data); | ||||
|             break; | ||||
|         case PID_SUBNET_ADDR: | ||||
|             *data = ((_ownAddress >> 8) & 0xff); | ||||
| @ -45,13 +45,8 @@ void DeviceObject::readProperty(PropertyID propertyId, uint32_t start, uint32_t& | ||||
|             break; | ||||
|         case PID_IO_LIST: | ||||
|         { | ||||
|             uint32_t ifObjs[] = { | ||||
|                 6, // length
 | ||||
|                 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); | ||||
| 
 | ||||
|             for (uint32_t i = start; i < (_ifObjs[0] + 1) && i < count; i++) | ||||
|                 pushInt(_ifObjs[i], data); | ||||
|             break; | ||||
|         } | ||||
|         case PID_DEVICE_DESCRIPTOR: | ||||
| @ -263,6 +258,26 @@ void DeviceObject::maskVersion(uint16_t 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[] =  | ||||
| { | ||||
|     { PID_OBJECT_TYPE, false, PDT_UNSIGNED_INT, 1, ReadLv3 | WriteLv0 }, | ||||
|  | ||||
| @ -37,6 +37,10 @@ public: | ||||
|     void version(uint16_t value); | ||||
|     uint16_t maskVersion(); | ||||
|     void maskVersion(uint16_t value); | ||||
|     uint16_t maxApduLength(); | ||||
|     void maxApduLength(uint16_t value); | ||||
|     const uint32_t* ifObj(); | ||||
|     void ifObj(const uint32_t* value); | ||||
| protected: | ||||
|     uint8_t propertyCount(); | ||||
|     PropertyDescription* propertyDescriptions(); | ||||
| @ -51,4 +55,6 @@ private: | ||||
|     uint8_t _hardwareType[6] = { 0, 0, 0, 0, 0, 0}; | ||||
|     uint16_t _version = 0; | ||||
|     uint16_t _maskVersion = 0x0000; | ||||
|     uint16_t _maxApduLength = 254; | ||||
|     const uint32_t* _ifObjs; | ||||
| }; | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user