Merge pull request 'do send read hook' (#545) from meier/doSendReadHook into development

Reviewed-on: fsfw/fsfw#545
This commit is contained in:
Ulrich Mohr 2022-02-07 14:42:05 +01:00
commit 9b17b282c6
2 changed files with 13 additions and 0 deletions

View File

@ -665,6 +665,11 @@ void DeviceHandlerBase::doGetWrite() {
void DeviceHandlerBase::doSendRead() { void DeviceHandlerBase::doSendRead() {
ReturnValue_t result; ReturnValue_t result;
result = doSendReadHook();
if (result != RETURN_OK) {
return;
}
size_t replyLen = 0; size_t replyLen = 0;
if (cookieInfo.pendingCommand != deviceCommandMap.end()) { if (cookieInfo.pendingCommand != deviceCommandMap.end()) {
replyLen = getNextReplyLength(cookieInfo.pendingCommand->first); replyLen = getNextReplyLength(cookieInfo.pendingCommand->first);
@ -920,6 +925,8 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
} }
} }
ReturnValue_t DeviceHandlerBase::doSendReadHook() { return RETURN_OK; }
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) { ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;
} }

View File

@ -1082,6 +1082,12 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/ */
void commandSwitch(ReturnValue_t onOff); void commandSwitch(ReturnValue_t onOff);
/**
* @brief This function can be used to insert device specific code during the do-send-read
* step.
*/
virtual ReturnValue_t doSendReadHook();
private: private:
/** /**
* State a cookie is in. * State a cookie is in.