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) 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& apdu = frame.apdu();
apdu.type(Restart); apdu.type(Restart);
uint8_t* data = apdu.data(); 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); _bau.deviceDescriptorReadAppLayerConfirm(priority, hopType, tsap, secCtrl, *data & 0x3f, data + 1);
break; break;
case Restart: case Restart:
case RestartMasterReset:
{ {
// These reserved bits must be 0 // These reserved bits must be 0
uint8_t reservedBits = *data & 0x1e; uint8_t reservedBits = data[0] & 0x1e;
if (reservedBits != 0) if (reservedBits != 0)
return; return;
// handle erase code for factory reset (setting FDSK again as toolkey, etc.) // 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; EraseCode eraseCode = EraseCode::Void;
uint8_t channel = 0; uint8_t channel = 0;
if (restartType == RestartType::MasterReset) if (restartType == RestartType::MasterReset)
{ {
eraseCode = (EraseCode) (*data + 1); eraseCode = (EraseCode) data[1];
channel = *data + 2; channel = data[2];
} }
_bau.restartRequestIndication(priority, hopType, tsap, secCtrl, restartType, eraseCode, channel); _bau.restartRequestIndication(priority, hopType, tsap, secCtrl, restartType, eraseCode, channel);
break; break;

View File

@ -543,10 +543,6 @@ void BauSystemB::connectConfirm(uint16_t tsap)
void BauSystemB::nextRestartState() void BauSystemB::nextRestartState()
{ {
// TODO:
SecurityControl secCtrl;
secCtrl.dataSecurity = DataSecurity::none;
switch (_restartState) switch (_restartState)
{ {
case Idle: 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); 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); Property* prop = property(id);
if (prop == nullptr) if (prop == nullptr)

View File

@ -128,7 +128,7 @@ class InterfaceObject : public SaveRestore
* *
* @param[out] resultData The result data for the function * @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. * 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, DeviceDescriptorRead = 0x300,
DeviceDescriptorResponse = 0x340, DeviceDescriptorResponse = 0x340,
Restart = 0x380, Restart = 0x380,
RestartMasterReset = 0x381,
AuthorizeRequest = 0x3d1, AuthorizeRequest = 0x3d1,
AuthorizeResponse = 0x3d2, AuthorizeResponse = 0x3d2,
KeyWrite = 0x3d3, KeyWrite = 0x3d3,