Fix FunctionPropertyExtStateRead, fix restart. MILESTONE: Working physical programming of IA and toolkey with confirmed restart. Reading deviceinfos working.

This commit is contained in:
Nanosonde 2020-06-30 20:46:10 +02:00
parent 780001bd59
commit de87c2a3a3
5 changed files with 9 additions and 11 deletions

View File

@ -469,7 +469,7 @@ void ApplicationLayer::restartRequest(AckType ack, Priority priority, HopCountTy
void ApplicationLayer::restartResponse(AckType ack, Priority priority, HopCountType hopType, const SecurityControl& secCtrl, uint8_t errorCode, uint16_t processTime)
{
CemiFrame frame(3);
CemiFrame frame(4);
APDU& apdu = frame.apdu();
apdu.type(Restart);
uint8_t* data = apdu.data();
@ -882,20 +882,21 @@ void ApplicationLayer::individualIndication(HopCountType hopType, Priority prior
_bau.deviceDescriptorReadAppLayerConfirm(priority, hopType, tsap, secCtrl, *data & 0x3f, data + 1);
break;
case Restart:
case RestartMasterReset:
{
// These reserved bits must be 0
uint8_t reservedBits = *data & 0x1e;
uint8_t reservedBits = data[0] & 0x1e;
if (reservedBits != 0)
return;
// handle erase code for factory reset (setting FDSK again as toolkey, etc.)
RestartType restartType = (RestartType) (*data & 0x3f);
RestartType restartType = (RestartType) (data[0] & 0x3f);
EraseCode eraseCode = EraseCode::Void;
uint8_t channel = 0;
if (restartType == RestartType::MasterReset)
{
eraseCode = (EraseCode) (*data + 1);
channel = *data + 2;
eraseCode = (EraseCode) data[1];
channel = data[2];
}
_bau.restartRequestIndication(priority, hopType, tsap, secCtrl, restartType, eraseCode, channel);
break;

View File

@ -543,10 +543,6 @@ void BauSystemB::connectConfirm(uint16_t tsap)
void BauSystemB::nextRestartState()
{
// TODO:
SecurityControl secCtrl;
secCtrl.dataSecurity = DataSecurity::none;
switch (_restartState)
{
case Idle:

View File

@ -101,7 +101,7 @@ void InterfaceObject::command(PropertyID id, uint8_t* data, uint8_t length, uint
prop->command(data, length, resultData, resultLength);
}
void InterfaceObject::state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength)
void InterfaceObject::state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t& resultLength)
{
Property* prop = property(id);
if (prop == nullptr)

View File

@ -128,7 +128,7 @@ class InterfaceObject : public SaveRestore
*
* @param[out] resultData The result data for the function
*/
virtual void state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t resultLength);
virtual void state(PropertyID id, uint8_t* data, uint8_t length, uint8_t* resultData, uint8_t &resultLength);
/**
* Read the Description of a property of the interface object. The output parameters are only valid if nuberOfElements is not zero.
*

View File

@ -179,6 +179,7 @@ enum ApduType
DeviceDescriptorRead = 0x300,
DeviceDescriptorResponse = 0x340,
Restart = 0x380,
RestartMasterReset = 0x381,
AuthorizeRequest = 0x3d1,
AuthorizeResponse = 0x3d2,
KeyWrite = 0x3d3,