get rid of InterfaceObject::objectType() and BauSystemB::descriptor()

This commit is contained in:
Thomas Kunze 2019-12-12 23:06:46 +01:00
parent 515d18fdbf
commit 398ba7408b
17 changed files with 14 additions and 61 deletions

View File

@ -20,7 +20,6 @@ class AddressTableObject : public TableObject
AddressTableObject(Memory& memory); AddressTableObject(Memory& memory);
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
uint8_t* restore(uint8_t* buffer) override; uint8_t* restore(uint8_t* buffer) override;
ObjectType objectType() override { return OT_ADDR_TABLE; }
/** /**
* returns the number of group addresses of the object. * returns the number of group addresses of the object.

View File

@ -9,7 +9,6 @@ class ApplicationProgramObject : public TableObject
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override; void writeProperty(PropertyID id, uint16_t start, uint8_t* data, uint8_t& count) override;
uint8_t propertySize(PropertyID id) override; uint8_t propertySize(PropertyID id) override;
ObjectType objectType() override { return OT_APPLICATION_PROG; }
uint8_t* data(uint32_t addr); uint8_t* data(uint32_t addr);
uint8_t getByte(uint32_t addr); uint8_t getByte(uint32_t addr);
uint16_t getWord(uint32_t addr); uint16_t getWord(uint32_t addr);

View File

@ -7,7 +7,6 @@ class AssociationTableObject : public TableObject
public: public:
AssociationTableObject(Memory& memory); AssociationTableObject(Memory& memory);
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
ObjectType objectType() override { return OT_ASSOC_TABLE; }
uint8_t* restore(uint8_t* buffer) override; uint8_t* restore(uint8_t* buffer) override;

View File

@ -22,9 +22,7 @@ Bau07B0::Bau07B0(Platform& platform)
#endif #endif
// Set Mask Version in Device Object depending on the BAU // Set Mask Version in Device Object depending on the BAU
uint16_t maskVersion; _deviceObj.maskVersion(0x07B0);
popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion);
// Set which interface objects are available in the device object // Set which interface objects are available in the device object
// This differs from BAU to BAU with different medium types. // This differs from BAU to BAU with different medium types.
@ -84,11 +82,6 @@ InterfaceObject* Bau07B0::getInterfaceObject(ObjectType objectType, uint8_t obje
} }
} }
uint8_t* Bau07B0::descriptor()
{
return _descriptor;
}
DataLinkLayer& Bau07B0::dataLinkLayer() DataLinkLayer& Bau07B0::dataLinkLayer()
{ {
return _dlLayer; return _dlLayer;

View File

@ -17,7 +17,6 @@ class Bau07B0 : public BauSystemB
protected: protected:
InterfaceObject* getInterfaceObject(uint8_t idx); InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
uint8_t* descriptor();
DataLinkLayer& dataLinkLayer(); DataLinkLayer& dataLinkLayer();
private: private:
@ -25,10 +24,7 @@ class Bau07B0 : public BauSystemB
#ifdef USE_CEMI_SERVER #ifdef USE_CEMI_SERVER
CemiServer _cemiServer; CemiServer _cemiServer;
CemiServerObject _cemiServerObject; CemiServerObject _cemiServerObject;
#endif
uint8_t _descriptor[2] = {0x07, 0xb0};
#ifdef USE_CEMI_SERVER
const uint32_t _ifObjs[7] = { 6, // length const uint32_t _ifObjs[7] = { 6, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_CEMI_SERVER}; OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_CEMI_SERVER};
#else #else

View File

@ -1,6 +1,5 @@
#if MEDIUM_TYPE == 2
#include "bau27B0.h" #include "bau27B0.h"
#ifdef USE_RF
#include "bits.h" #include "bits.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -23,9 +22,7 @@ Bau27B0::Bau27B0(Platform& platform)
#endif #endif
// Set Mask Version in Device Object depending on the BAU // Set Mask Version in Device Object depending on the BAU
uint16_t maskVersion; _deviceObj.maskVersion(0x27B0);
popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion);
// Set the maximum APDU length // Set the maximum APDU length
// ETS will consider this value while programming the device // ETS will consider this value while programming the device
@ -97,11 +94,6 @@ InterfaceObject* Bau27B0::getInterfaceObject(ObjectType objectType, uint8_t obje
} }
} }
uint8_t* Bau27B0::descriptor()
{
return _descriptor;
}
DataLinkLayer& Bau27B0::dataLinkLayer() DataLinkLayer& Bau27B0::dataLinkLayer()
{ {
return _dlLayer; return _dlLayer;

View File

@ -18,7 +18,6 @@ class Bau27B0 : public BauSystemB
protected: protected:
InterfaceObject* getInterfaceObject(uint8_t idx); InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
uint8_t* descriptor();
DataLinkLayer& dataLinkLayer(); DataLinkLayer& dataLinkLayer();
private: private:
@ -27,10 +26,6 @@ class Bau27B0 : public BauSystemB
#ifdef USE_CEMI_SERVER #ifdef USE_CEMI_SERVER
CemiServer _cemiServer; CemiServer _cemiServer;
CemiServerObject _cemiServerObject; CemiServerObject _cemiServerObject;
#endif
uint8_t _descriptor[2] = {0x27, 0xB0};
#ifdef USE_CEMI_SERVER
const uint32_t _ifObjs[8] = { 7, // length const uint32_t _ifObjs[8] = { 7, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_RF_MEDIUM, OT_CEMI_SERVER}; OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_RF_MEDIUM, OT_CEMI_SERVER};
#else #else

View File

@ -26,9 +26,7 @@ Bau57B0::Bau57B0(Platform& platform)
_memory.addSaveRestore(&_ipParameters); _memory.addSaveRestore(&_ipParameters);
// Set Mask Version in Device Object depending on the BAU // Set Mask Version in Device Object depending on the BAU
uint16_t maskVersion; _deviceObj.maskVersion(0x57B0);
popWord(maskVersion, _descriptor);
_deviceObj.maskVersion(maskVersion);
// Set which interface objects are available in the device object // Set which interface objects are available in the device object
// This differs from BAU to BAU with different medium types. // This differs from BAU to BAU with different medium types.
@ -84,11 +82,6 @@ InterfaceObject* Bau57B0::getInterfaceObject(ObjectType objectType, uint8_t obje
} }
} }
uint8_t* Bau57B0::descriptor()
{
return _descriptor;
}
DataLinkLayer& Bau57B0::dataLinkLayer() DataLinkLayer& Bau57B0::dataLinkLayer()
{ {
return _dlLayer; return _dlLayer;

View File

@ -15,7 +15,6 @@ class Bau57B0 : public BauSystemB
protected: protected:
InterfaceObject* getInterfaceObject(uint8_t idx); InterfaceObject* getInterfaceObject(uint8_t idx);
InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance); InterfaceObject* getInterfaceObject(ObjectType objectType, uint8_t objectInstance);
uint8_t* descriptor();
DataLinkLayer& dataLinkLayer(); DataLinkLayer& dataLinkLayer();
private: private:
@ -24,9 +23,12 @@ class Bau57B0 : public BauSystemB
#ifdef USE_CEMI_SERVER #ifdef USE_CEMI_SERVER
CemiServer _cemiServer; CemiServer _cemiServer;
CemiServerObject _cemiServerObject; CemiServerObject _cemiServerObject;
#endif
uint8_t _descriptor[2] = {0x57, 0xb0}; const uint32_t _ifObjs[8] = { 8, // length
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, OT_CEMI_SERVER};
#else
const uint32_t _ifObjs[7] = {7, // length
OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER}; OT_DEVICE, OT_ADDR_TABLE, OT_ASSOC_TABLE, OT_GRP_OBJ_TABLE, OT_APPLICATION_PROG, OT_IP_PARAMETER};
#endif
}; };
#endif #endif

View File

@ -143,7 +143,9 @@ void BauSystemB::deviceDescriptorReadIndication(Priority priority, HopCountType
if (descriptorType != 0) if (descriptorType != 0)
descriptorType = 0x3f; descriptorType = 0x3f;
_appLayer.deviceDescriptorReadResponse(AckRequested, priority, hopType, asap, descriptorType, descriptor()); uint8_t data[2];
pushWord(_deviceObj.maskVersion(), data);
_appLayer.deviceDescriptorReadResponse(AckRequested, priority, hopType, asap, descriptorType, data);
} }
void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number, void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number,

View File

@ -40,7 +40,6 @@ class BauSystemB : protected BusAccessUnit
protected: protected:
virtual DataLinkLayer& dataLinkLayer() = 0; virtual DataLinkLayer& dataLinkLayer() = 0;
virtual uint8_t* descriptor() = 0;
void memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number, void memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number,
uint16_t memoryAddress, uint8_t* data) override; uint16_t memoryAddress, uint8_t* data) override;
void memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number, void memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t number,

View File

@ -13,7 +13,6 @@ public:
uint8_t propertySize(PropertyID id) override; uint8_t propertySize(PropertyID id) override;
uint8_t* save(uint8_t* buffer) override; uint8_t* save(uint8_t* buffer) override;
uint8_t* restore(uint8_t* buffer) override; uint8_t* restore(uint8_t* buffer) override;
ObjectType objectType() override { return OT_CEMI_SERVER; }
protected: protected:
uint8_t propertyDescriptionCount() override; uint8_t propertyDescriptionCount() override;

View File

@ -14,7 +14,6 @@ public:
uint8_t* restore(uint8_t* buffer) override; uint8_t* restore(uint8_t* buffer) override;
uint16_t saveSize() override; uint16_t saveSize() override;
void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); void readPropertyDescription(uint8_t propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
ObjectType objectType() override { return OT_DEVICE; }
uint16_t induvidualAddress(); uint16_t induvidualAddress();
void induvidualAddress(uint16_t value); void induvidualAddress(uint16_t value);

View File

@ -11,7 +11,6 @@ class GroupObjectTableObject : public TableObject
GroupObjectTableObject(Memory& memory); GroupObjectTableObject(Memory& memory);
virtual ~GroupObjectTableObject(); virtual ~GroupObjectTableObject();
void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override; void readProperty(PropertyID id, uint16_t start, uint8_t& count, uint8_t* data) override;
ObjectType objectType() override { return OT_GRP_OBJ_TABLE; }
uint16_t entryCount(); uint16_t entryCount();
GroupObject& get(uint16_t asap); GroupObject& get(uint16_t asap);
GroupObject& nextUpdatedObject(bool& valid); GroupObject& nextUpdatedObject(bool& valid);

View File

@ -119,12 +119,6 @@ class InterfaceObject : public SaveRestore
// TODO: remove first version after complete property refactoring // TODO: remove first version after complete property refactoring
void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); void readPropertyDescription(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
void readPropertyDescription2(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access); void readPropertyDescription2(uint8_t& propertyId, uint8_t& propertyIndex, bool& writeEnable, uint8_t& type, uint16_t& numberOfElements, uint8_t& access);
/**
* Gets object type.
*
* @returns object type
*/
virtual ObjectType objectType() = 0;
/** /**
* Gets property with PropertyID id if it exists and nullptr otherwise. * Gets property with PropertyID id if it exists and nullptr otherwise.

View File

@ -10,12 +10,6 @@ class IpParameterObject : public InterfaceObject
{ {
public: public:
IpParameterObject(DeviceObject& deviceObject, Platform& platform); IpParameterObject(DeviceObject& deviceObject, Platform& platform);
ObjectType objectType() override
{
return OT_IP_PARAMETER;
}
uint32_t multicastAddress() const; uint32_t multicastAddress() const;
uint8_t ttl() const; uint8_t ttl() const;

View File

@ -13,7 +13,6 @@ public:
uint8_t* save(uint8_t* buffer) override; uint8_t* save(uint8_t* buffer) override;
uint8_t* restore(uint8_t* buffer) override; uint8_t* restore(uint8_t* buffer) override;
uint16_t saveSize() override; uint16_t saveSize() override;
ObjectType objectType() override { return OT_RF_MEDIUM; }
uint8_t* rfDomainAddress(); uint8_t* rfDomainAddress();
void rfDomainAddress(uint8_t* value); void rfDomainAddress(uint8_t* value);