1
0
forked from fsfw/fsfw

separate step for performOp now

This commit is contained in:
2020-10-12 18:28:07 +02:00
parent 140aa3ab42
commit dbcd06527e
3 changed files with 29 additions and 16 deletions

View File

@ -72,8 +72,13 @@ DeviceHandlerBase::~DeviceHandlerBase() {
ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
this->pstStep = counter;
this->lastStep = this->pstStep;
if (getComAction() == SEND_WRITE) {
if (getComAction() == CommunicationAction::NOTHING) {
return HasReturnvaluesIF::RETURN_OK;
}
if (getComAction() == CommunicationAction::PERFORM_OPERATION) {
cookieInfo.state = COOKIE_UNUSED;
readCommandQueue();
doStateMachine();
@ -83,26 +88,29 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
hkSwitcher.performOperation();
hkManager.performHkOperation();
performOperationHook();
return RETURN_OK;
}
if (mode == MODE_OFF) {
return RETURN_OK;
}
switch (getComAction()) {
case SEND_WRITE:
if ((cookieInfo.state == COOKIE_UNUSED)) {
case CommunicationAction::SEND_WRITE:
if (cookieInfo.state == COOKIE_UNUSED) {
// if no external command was specified, build internal command.
buildInternalCommand();
}
doSendWrite();
break;
case GET_WRITE:
case CommunicationAction::GET_WRITE:
doGetWrite();
break;
case SEND_READ:
case CommunicationAction::SEND_READ:
doSendRead();
break;
case GET_READ:
case CommunicationAction::GET_READ:
doGetRead();
cookieInfo.state = COOKIE_UNUSED;
break;
default:
break;
@ -821,24 +829,27 @@ void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
}
//Default child implementations
DeviceHandlerIF::CommunicationAction_t DeviceHandlerBase::getComAction() {
DeviceHandlerIF::CommunicationAction DeviceHandlerBase::getComAction() {
switch (pstStep) {
case 0:
return SEND_WRITE;
return CommunicationAction::PERFORM_OPERATION;
break;
case 1:
return GET_WRITE;
break;
return CommunicationAction::SEND_WRITE;
break;
case 2:
return SEND_READ;
return CommunicationAction::GET_WRITE;
break;
case 3:
return GET_READ;
return CommunicationAction::SEND_READ;
break;
case 4:
return CommunicationAction::GET_READ;
break;
default:
break;
}
return NOTHING;
return CommunicationAction::NOTHING;
}
MessageQueueId_t DeviceHandlerBase::getCommandQueue() const {