Update FSFW #13
@ -430,12 +430,7 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
|||||||
DeviceReplyInfo info;
|
DeviceReplyInfo info;
|
||||||
info.maxDelayCycles = maxDelayCycles;
|
info.maxDelayCycles = maxDelayCycles;
|
||||||
info.periodic = periodic;
|
info.periodic = periodic;
|
||||||
if(info.periodic) {
|
|
||||||
info.delayCycles = info.maxDelayCycles;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
info.delayCycles = 0;
|
info.delayCycles = 0;
|
||||||
}
|
|
||||||
info.replyLen = replyLen;
|
info.replyLen = replyLen;
|
||||||
info.dataSet = dataSet;
|
info.dataSet = dataSet;
|
||||||
info.command = deviceCommandMap.end();
|
info.command = deviceCommandMap.end();
|
||||||
@ -474,7 +469,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
|
|||||||
auto replyIter = deviceReplyMap.find(deviceReply);
|
auto replyIter = deviceReplyMap.find(deviceReply);
|
||||||
if (replyIter == deviceReplyMap.end()) {
|
if (replyIter == deviceReplyMap.end()) {
|
||||||
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
||||||
return RETURN_FAILED;
|
return COMMAND_NOT_SUPPORTED;
|
||||||
} else {
|
} else {
|
||||||
DeviceReplyInfo *info = &(replyIter->second);
|
DeviceReplyInfo *info = &(replyIter->second);
|
||||||
if (maxDelayCycles != 0) {
|
if (maxDelayCycles != 0) {
|
||||||
@ -486,6 +481,25 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply) {
|
||||||
|
auto replyIter = deviceReplyMap.find(deviceReply);
|
||||||
|
if (replyIter == deviceReplyMap.end()) {
|
||||||
|
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
||||||
|
return COMMAND_NOT_SUPPORTED;
|
||||||
|
} else {
|
||||||
|
DeviceReplyInfo *info = &(replyIter->second);
|
||||||
|
if(not info->periodic) {
|
||||||
|
return COMMAND_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
if(enable) {
|
||||||
|
info->delayCycles = info->maxDelayCycles;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
info->delayCycles = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
|
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
|
||||||
LocalPoolDataSetBase *dataSet) {
|
LocalPoolDataSetBase *dataSet) {
|
||||||
|
@ -456,7 +456,9 @@ protected:
|
|||||||
* @param replyLen Will be supplied to the requestReceiveMessage call of
|
* @param replyLen Will be supplied to the requestReceiveMessage call of
|
||||||
* the communication interface.
|
* the communication interface.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
* by the device repeatedly without request) or not. Default is aperiodic (0)
|
* by the device repeatedly without request) or not. Default is aperiodic (0).
|
||||||
|
* Please note that periodic replies are disabled by default. You can enable them with
|
||||||
|
* #updatePeriodicReply
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
@ -471,7 +473,9 @@ protected:
|
|||||||
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
||||||
* until it times out.
|
* until it times out.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
* by the device repeatedly without request) or not. Default is aperiodic (0)
|
* by the device repeatedly without request) or not. Default is aperiodic (0).
|
||||||
|
* Please note that periodic replies are disabled by default. You can enable them with
|
||||||
|
* #updatePeriodicReply
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
@ -487,6 +491,14 @@ protected:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables a periodic reply for a given command. It sets to delay cycles to the specified
|
||||||
|
* maximum delay cycles for a given reply ID if enabled or to 0 if disabled.
|
||||||
|
* @param enable Specify whether to enable or disable a given periodic reply
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ReturnValue_t updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function returns the reply length of the next reply to read.
|
* @brief This function returns the reply length of the next reply to read.
|
||||||
*
|
*
|
||||||
@ -500,12 +512,10 @@ protected:
|
|||||||
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand);
|
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a helper method to facilitate updating entries
|
* @brief This is a helper method to facilitate updating entries in the reply map.
|
||||||
* in the reply map.
|
|
||||||
* @param deviceCommand Identifier of the reply to update.
|
* @param deviceCommand Identifier of the reply to update.
|
||||||
* @param delayCycles The current number of delay cycles to wait.
|
* @param delayCycles The current number of delay cycles to wait. As stated in
|
||||||
* As stated in #fillCommandAndCookieMap, to disable periodic commands,
|
* #fillCommandAndReplyMap, to disable periodic commands, this is set to zero.
|
||||||
* this is set to zero.
|
|
||||||
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
||||||
* until it times out. By passing 0 the entry remains untouched.
|
* until it times out. By passing 0 the entry remains untouched.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
|
Loading…
Reference in New Issue
Block a user