mirror of
https://github.com/thelsing/knx.git
synced 2025-05-07 01:15:35 +02:00
save work
This commit is contained in:
parent
9c45500e0e
commit
47b582068b
@ -251,8 +251,8 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop
|
|||||||
void BauSystemB::functionPropertyCommandIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
void BauSystemB::functionPropertyCommandIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
||||||
uint8_t propertyId, uint8_t* data, uint8_t length)
|
uint8_t propertyId, uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
uint8_t resultLength = 0;
|
|
||||||
uint8_t resultData[32];
|
uint8_t resultData[32];
|
||||||
|
uint8_t resultLength = sizeof(resultData);
|
||||||
|
|
||||||
InterfaceObject* obj = getInterfaceObject(objectIndex);
|
InterfaceObject* obj = getInterfaceObject(objectIndex);
|
||||||
if(obj)
|
if(obj)
|
||||||
@ -264,8 +264,8 @@ void BauSystemB::functionPropertyCommandIndication(Priority priority, HopCountTy
|
|||||||
void BauSystemB::functionPropertyStateIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
void BauSystemB::functionPropertyStateIndication(Priority priority, HopCountType hopType, uint16_t asap, uint8_t objectIndex,
|
||||||
uint8_t propertyId, uint8_t* data, uint8_t length)
|
uint8_t propertyId, uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
uint8_t resultLength = 0;
|
|
||||||
uint8_t resultData[32];
|
uint8_t resultData[32];
|
||||||
|
uint8_t resultLength = sizeof(resultData);
|
||||||
|
|
||||||
InterfaceObject* obj = getInterfaceObject(objectIndex);
|
InterfaceObject* obj = getInterfaceObject(objectIndex);
|
||||||
if(obj)
|
if(obj)
|
||||||
|
@ -994,3 +994,21 @@ bool SecureApplicationLayer::isSecurityModeEnabled()
|
|||||||
{
|
{
|
||||||
return _securityModeEnabled;
|
return _securityModeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SecureApplicationLayer::clearFailureLog()
|
||||||
|
{
|
||||||
|
println("clearFailureLog()");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecureApplicationLayer::getFailureCounters(uint8_t* data)
|
||||||
|
{
|
||||||
|
memset(data, 0, 8);
|
||||||
|
println("getFailureCounters()");
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t SecureApplicationLayer::getFromFailureLogByIndex(uint8_t index, uint8_t* data, uint8_t maxDataLen)
|
||||||
|
{
|
||||||
|
print("getFromFailureLogByIndex(): Index: ");
|
||||||
|
println(index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -28,6 +28,9 @@ class SecureApplicationLayer : public ApplicationLayer
|
|||||||
|
|
||||||
void setSecurityMode(bool enabled);
|
void setSecurityMode(bool enabled);
|
||||||
bool isSecurityModeEnabled();
|
bool isSecurityModeEnabled();
|
||||||
|
void clearFailureLog();
|
||||||
|
void getFailureCounters(uint8_t* data);
|
||||||
|
uint8_t getFromFailureLogByIndex(uint8_t index, uint8_t* data, uint8_t maxDataLen);
|
||||||
|
|
||||||
// from transport layer
|
// from transport layer
|
||||||
virtual void dataGroupIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu) override;
|
virtual void dataGroupIndication(HopCountType hopType, Priority priority, uint16_t tsap, APDU& apdu) override;
|
||||||
|
@ -88,7 +88,7 @@ SecurityInterfaceObject::SecurityInterfaceObject()
|
|||||||
uint8_t info = data[2];
|
uint8_t info = data[2];
|
||||||
if (id == 0 && info == 0)
|
if (id == 0 && info == 0)
|
||||||
{
|
{
|
||||||
//TODO: clearFailureLog();
|
obj->_secAppLayer->clearFailureLog();
|
||||||
resultData[0] = id;
|
resultData[0] = id;
|
||||||
resultLength = 1;
|
resultLength = 1;
|
||||||
}
|
}
|
||||||
@ -107,13 +107,15 @@ SecurityInterfaceObject::SecurityInterfaceObject()
|
|||||||
// failure counters
|
// failure counters
|
||||||
if (id == 0 && info == 0)
|
if (id == 0 && info == 0)
|
||||||
{
|
{
|
||||||
//TODO:
|
resultData[0] = id;
|
||||||
// var counters = ByteBuffer.allocate(10).put((byte) id).put((byte) info).put(failureCountersArray());
|
resultData[1] = info;
|
||||||
// return new ServiceResult(counters.array());
|
obj->_secAppLayer->getFailureCounters(&resultData[2]); // Put 8 bytes in the buffer
|
||||||
|
resultLength = 2 + 8;
|
||||||
}
|
}
|
||||||
// query latest failure by index
|
// query latest failure by index
|
||||||
else if(id == 1)
|
else if(id == 1)
|
||||||
{
|
{
|
||||||
|
uint8_t maxBufferSize = resultLength;
|
||||||
// TODO:
|
// TODO:
|
||||||
//int index = info;
|
//int index = info;
|
||||||
//int i = 0;
|
//int i = 0;
|
||||||
@ -122,6 +124,16 @@ SecurityInterfaceObject::SecurityInterfaceObject()
|
|||||||
// return new ServiceResult(ByteBuffer.allocate(2 + msgInfo.length).put((byte) id)
|
// return new ServiceResult(ByteBuffer.allocate(2 + msgInfo.length).put((byte) id)
|
||||||
// .put((byte) index).put(msgInfo).array());
|
// .put((byte) index).put(msgInfo).array());
|
||||||
//}
|
//}
|
||||||
|
uint8_t index = info;
|
||||||
|
uint8_t numBytes = obj->_secAppLayer->getFromFailureLogByIndex(index, &resultData[2], maxBufferSize);
|
||||||
|
if ( numBytes > 0)
|
||||||
|
{
|
||||||
|
resultData[0] = id;
|
||||||
|
resultData[1] = index;
|
||||||
|
resultLength += numBytes;
|
||||||
|
resultLength = 2 + numBytes;
|
||||||
|
return;
|
||||||
|
}
|
||||||
resultData[0] = 0xF8; // DataVoid
|
resultData[0] = 0xF8; // DataVoid
|
||||||
resultData[1] = id;
|
resultData[1] = id;
|
||||||
resultLength = 2;
|
resultLength = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user