mirror of
https://github.com/thelsing/knx.git
synced 2025-08-03 13:48:15 +02:00
added timeout for unloading to write memory
This commit is contained in:
parent
649adeaf53
commit
d15cda5a15
@ -164,6 +164,9 @@ void BauSystemB::memoryRoutingTableWriteIndication(Priority priority, HopCountTy
|
|||||||
|
|
||||||
if (_deviceObj.verifyMode())
|
if (_deviceObj.verifyMode())
|
||||||
memoryRoutingTableReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress, data);
|
memoryRoutingTableReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress, data);
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number,
|
void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number,
|
||||||
@ -173,6 +176,9 @@ void BauSystemB::memoryWriteIndication(Priority priority, HopCountType hopType,
|
|||||||
|
|
||||||
if (_deviceObj.verifyMode())
|
if (_deviceObj.verifyMode())
|
||||||
memoryReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress, data);
|
memoryReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress, data);
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number,
|
void BauSystemB::memoryReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number,
|
||||||
@ -193,6 +199,9 @@ void BauSystemB::memoryExtWriteIndication(Priority priority, HopCountType hopTyp
|
|||||||
_memory.writeMemory(memoryAddress, number, data);
|
_memory.writeMemory(memoryAddress, number, data);
|
||||||
|
|
||||||
applicationLayer().memoryExtWriteResponse(AckRequested, priority, hopType, asap, secCtrl, ReturnCodes::Success, number, memoryAddress, _memory.toAbsolute(memoryAddress));
|
applicationLayer().memoryExtWriteResponse(AckRequested, priority, hopType, asap, secCtrl, ReturnCodes::Success, number, memoryAddress, _memory.toAbsolute(memoryAddress));
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::memoryExtReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number, uint32_t memoryAddress)
|
void BauSystemB::memoryExtReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t number, uint32_t memoryAddress)
|
||||||
@ -252,6 +261,9 @@ void BauSystemB::userMemoryWriteIndication(Priority priority, HopCountType hopTy
|
|||||||
|
|
||||||
if (_deviceObj.verifyMode())
|
if (_deviceObj.verifyMode())
|
||||||
userMemoryReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress);
|
userMemoryReadIndication(priority, hopType, asap, secCtrl, number, memoryAddress);
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::propertyDescriptionReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t objectIndex,
|
void BauSystemB::propertyDescriptionReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t objectIndex,
|
||||||
@ -311,6 +323,9 @@ void BauSystemB::propertyValueWriteIndication(Priority priority, HopCountType ho
|
|||||||
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);
|
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);
|
||||||
|
|
||||||
propertyValueReadIndication(priority, hopType, asap, secCtrl, objectIndex, propertyId, numberOfElements, startIndex);
|
propertyValueReadIndication(priority, hopType, asap, secCtrl, objectIndex, propertyId, numberOfElements, startIndex);
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::propertyValueExtWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, ObjectType objectType, uint8_t objectInstance,
|
void BauSystemB::propertyValueExtWriteIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, ObjectType objectType, uint8_t objectInstance,
|
||||||
@ -329,6 +344,9 @@ void BauSystemB::propertyValueExtWriteIndication(Priority priority, HopCountType
|
|||||||
{
|
{
|
||||||
applicationLayer().propertyValueExtWriteConResponse(AckRequested, priority, hopType, asap, secCtrl, objectType, objectInstance, propertyId, numberOfElements, startIndex, returnCode);
|
applicationLayer().propertyValueExtWriteConResponse(AckRequested, priority, hopType, asap, secCtrl, objectType, objectInstance, propertyId, numberOfElements, startIndex, returnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t objectIndex,
|
void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hopType, uint16_t asap, const SecurityControl& secCtrl, uint8_t objectIndex,
|
||||||
@ -765,6 +783,9 @@ void BauSystemB::propertyValueWrite(ObjectType objectType, uint8_t objectInstanc
|
|||||||
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);
|
obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);
|
||||||
else
|
else
|
||||||
numberOfElements = 0;
|
numberOfElements = 0;
|
||||||
|
|
||||||
|
if(_unloadStartet != 0)
|
||||||
|
_unloadStartet = millis(); // reset unload timer
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory& BauSystemB::memory()
|
Memory& BauSystemB::memory()
|
||||||
|
@ -130,4 +130,6 @@ class BauSystemB : protected BusAccessUnit
|
|||||||
BeforeRestartCallback _beforeRestart = 0;
|
BeforeRestartCallback _beforeRestart = 0;
|
||||||
FunctionPropertyCallback _functionProperty = 0;
|
FunctionPropertyCallback _functionProperty = 0;
|
||||||
FunctionPropertyCallback _functionPropertyState = 0;
|
FunctionPropertyCallback _functionPropertyState = 0;
|
||||||
|
|
||||||
|
unsigned long _unloadStartet = 0;
|
||||||
};
|
};
|
||||||
|
@ -33,6 +33,17 @@ void BauSystemBCoupler::loop()
|
|||||||
#ifdef USE_DATASECURE
|
#ifdef USE_DATASECURE
|
||||||
_appLayer.loop();
|
_appLayer.loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_DATASECURE
|
||||||
|
if(_unloadStartet == 0 && _secIfObj.getWasUnloaded())
|
||||||
|
{
|
||||||
|
_unloadStartet = millis();
|
||||||
|
} else if(millis() - _unloadStartet > 5000)
|
||||||
|
{
|
||||||
|
writeMemory();
|
||||||
|
_unloadStartet = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BauSystemBCoupler::configured()
|
bool BauSystemBCoupler::configured()
|
||||||
|
@ -49,6 +49,24 @@ void BauSystemBDevice::loop()
|
|||||||
#ifdef USE_DATASECURE
|
#ifdef USE_DATASECURE
|
||||||
_appLayer.loop();
|
_appLayer.loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(_unloadStartet == 0)
|
||||||
|
{
|
||||||
|
if(_addrTable.getWasUnloaded()
|
||||||
|
|| _assocTable.getWasUnloaded()
|
||||||
|
|| _groupObjTable.getWasUnloaded()
|
||||||
|
#ifdef USE_DATASECURE
|
||||||
|
|| _secIfObj.getWasUnloaded()
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_unloadStartet = millis();
|
||||||
|
}
|
||||||
|
} else if(millis() - _unloadStartet > 5000)
|
||||||
|
{
|
||||||
|
writeMemory();
|
||||||
|
_unloadStartet = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BauSystemBDevice::sendNextGroupTelegram()
|
void BauSystemBDevice::sendNextGroupTelegram()
|
||||||
|
@ -58,6 +58,11 @@ void TableObject::loadState(LoadState newState)
|
|||||||
|
|
||||||
beforeStateChange(newState);
|
beforeStateChange(newState);
|
||||||
_state = newState;
|
_state = newState;
|
||||||
|
|
||||||
|
if(newState == LS_UNLOADED)
|
||||||
|
{
|
||||||
|
_wasUnloaded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -411,4 +416,9 @@ void TableObject::initializeDynTableProperties(size_t propertiesSize, Property**
|
|||||||
memcpy(allProperties + propertyCount, ownProperties, sizeof(ownProperties));
|
memcpy(allProperties + propertyCount, ownProperties, sizeof(ownProperties));
|
||||||
|
|
||||||
InterfaceObject::initializeProperties(sizeof(allProperties), allProperties);
|
InterfaceObject::initializeProperties(sizeof(allProperties), allProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TableObject::getWasUnloaded()
|
||||||
|
{
|
||||||
|
return _wasUnloaded;
|
||||||
}
|
}
|
@ -35,6 +35,8 @@ class TableObject: public InterfaceObject
|
|||||||
static void beforeTablesUnloadCallback(BeforeTablesUnloadCallback func);
|
static void beforeTablesUnloadCallback(BeforeTablesUnloadCallback func);
|
||||||
static BeforeTablesUnloadCallback beforeTablesUnloadCallback();
|
static BeforeTablesUnloadCallback beforeTablesUnloadCallback();
|
||||||
|
|
||||||
|
bool getWasUnloaded();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* This method is called before the interface object enters a new ::LoadState.
|
* This method is called before the interface object enters a new ::LoadState.
|
||||||
@ -91,4 +93,6 @@ class TableObject: public InterfaceObject
|
|||||||
* The size of the memory block cannot be used because it is changed during alignment to page size.
|
* The size of the memory block cannot be used because it is changed during alignment to page size.
|
||||||
*/
|
*/
|
||||||
uint32_t _size = 0;
|
uint32_t _size = 0;
|
||||||
|
|
||||||
|
bool _wasUnloaded = false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user