introduced protected function to break doSendRead

This commit is contained in:
Jakob Meier 2021-12-14 19:39:38 +01:00
parent ceb87b5abb
commit 9a858eb54c
2 changed files with 15 additions and 0 deletions

View File

@ -684,6 +684,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);
@ -950,6 +955,10 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
} }
} }
ReturnValue_t DeviceHandlerBase::doSendReadHook() {
return RETURN_OK;
}
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches, ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches,
uint8_t *numberOfSwitches) { uint8_t *numberOfSwitches) {
return DeviceHandlerBase::NO_SWITCH; return DeviceHandlerBase::NO_SWITCH;

View File

@ -1094,6 +1094,12 @@ protected:
*/ */
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:
/** /**