removed obsolete comment
This commit is contained in:
parent
cb919ada2a
commit
b594bc2a97
@ -74,7 +74,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static const uint8_t STEP_OFFSET = 1;//!< Increase of value of this per step
|
static const uint8_t STEP_OFFSET = 1;//!< Increase of value of this per step
|
||||||
HasActionsIF* owner;//!< Pointer to the owner
|
HasActionsIF* owner;//!< Pointer to the owner
|
||||||
MessageQueueIF* queueToUse;//!< Queue to be used as response sender, has to be set with @c setQueueToUse
|
MessageQueueIF* queueToUse;//!< Queue to be used as response sender, has to be set with
|
||||||
StorageManagerIF* ipcStore;//!< Pointer to an IPC Store, initialized during construction or initialize(MessageQueueIF* queueToUse_) or with setQueueToUse(MessageQueueIF *queue)
|
StorageManagerIF* ipcStore;//!< Pointer to an IPC Store, initialized during construction or initialize(MessageQueueIF* queueToUse_) or with setQueueToUse(MessageQueueIF *queue)
|
||||||
/**
|
/**
|
||||||
*Internal function called by handleActionMessage(CommandMessage* command)
|
*Internal function called by handleActionMessage(CommandMessage* command)
|
||||||
|
@ -255,9 +255,9 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode,
|
|||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(
|
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(
|
||||||
DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
|
DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
|
||||||
uint8_t periodic, uint8_t expectedReplies, bool hasDifferentReplyId, DeviceCommandId_t replyId) {
|
uint8_t periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId) {
|
||||||
//No need to check, as we may try to insert multiple times.
|
//No need to check, as we may try to insert multiple times.
|
||||||
insertInCommandMap(deviceCommand,expectedReplies);
|
insertInCommandMap(deviceCommand);
|
||||||
if (hasDifferentReplyId) {
|
if (hasDifferentReplyId) {
|
||||||
return insertInReplyMap(replyId, maxDelayCycles, periodic);
|
return insertInReplyMap(replyId, maxDelayCycles, periodic);
|
||||||
} else {
|
} else {
|
||||||
@ -283,10 +283,9 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::insertInCommandMap(
|
ReturnValue_t DeviceHandlerBase::insertInCommandMap(
|
||||||
DeviceCommandId_t deviceCommand, uint8_t expectedReplies) {
|
DeviceCommandId_t deviceCommand) {
|
||||||
DeviceCommandInfo info;
|
DeviceCommandInfo info;
|
||||||
info.expectedReplies = 0;
|
info.expectedReplies = 0;
|
||||||
info.expectedRepliesWhenEnablingReplyMap = expectedReplies;
|
|
||||||
info.isExecuting = false;
|
info.isExecuting = false;
|
||||||
info.sendReplyTo = NO_COMMANDER;
|
info.sendReplyTo = NO_COMMANDER;
|
||||||
std::pair<std::map<DeviceCommandId_t, DeviceCommandInfo>::iterator, bool> returnValue;
|
std::pair<std::map<DeviceCommandId_t, DeviceCommandInfo>::iterator, bool> returnValue;
|
||||||
@ -713,7 +712,6 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
DeviceCommandId_t foundId, uint32_t foundLen) {
|
DeviceCommandId_t foundId, uint32_t foundLen) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(foundId);
|
DeviceReplyMap::iterator iter = deviceReplyMap.find(foundId);
|
||||||
MessageQueueId_t commander;
|
|
||||||
|
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||||
@ -730,17 +728,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
|||||||
} else {
|
} else {
|
||||||
info->delayCycles = 0;
|
info->delayCycles = 0;
|
||||||
}
|
}
|
||||||
|
result = interpretDeviceReply(foundId, receivedData);
|
||||||
DeviceCommandMap::iterator commandIter = deviceCommandMap.find(foundId);
|
|
||||||
// could be a reply only packet
|
|
||||||
if(commandIter == deviceCommandMap.end()) {
|
|
||||||
commander = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
commander = commandIter->second.sendReplyTo;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = interpretDeviceReply(foundId, receivedData,commander);
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
//Report failed interpretation to FDIR.
|
//Report failed interpretation to FDIR.
|
||||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||||
@ -810,7 +798,7 @@ void DeviceHandlerBase::modeChanged(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(
|
ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(
|
||||||
DeviceCommandMap::iterator command,/* uint8_t expectedReplies, */
|
DeviceCommandMap::iterator command, uint8_t expectedReplies,
|
||||||
bool useAlternativeId, DeviceCommandId_t alternativeReply) {
|
bool useAlternativeId, DeviceCommandId_t alternativeReply) {
|
||||||
DeviceReplyMap::iterator iter;
|
DeviceReplyMap::iterator iter;
|
||||||
if (useAlternativeId) {
|
if (useAlternativeId) {
|
||||||
@ -822,7 +810,7 @@ ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(
|
|||||||
DeviceReplyInfo *info = &(iter->second);
|
DeviceReplyInfo *info = &(iter->second);
|
||||||
info->delayCycles = info->maxDelayCycles;
|
info->delayCycles = info->maxDelayCycles;
|
||||||
info->command = command;
|
info->command = command;
|
||||||
command->second.expectedReplies = command->second.expectedRepliesWhenEnablingReplyMap;
|
command->second.expectedReplies = expectedReplies;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return NO_REPLY_EXPECTED;
|
return NO_REPLY_EXPECTED;
|
||||||
|
@ -576,9 +576,8 @@ protected:
|
|||||||
* Default is aperiodic (0)
|
* Default is aperiodic (0)
|
||||||
* @return RETURN_OK when the command was successfully inserted, COMMAND_MAP_ERROR else.
|
* @return RETURN_OK when the command was successfully inserted, COMMAND_MAP_ERROR else.
|
||||||
*/
|
*/
|
||||||
// Proposal: Set expected replies for a command in insertInCommandAndReplyMap so we don't have to overwrite enableReplyInReplyMap
|
|
||||||
ReturnValue_t insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand,
|
ReturnValue_t insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand,
|
||||||
uint16_t maxDelayCycles, uint8_t periodic = 0, uint8_t expectedReplies = 1,
|
uint16_t maxDelayCycles, uint8_t periodic = 0,
|
||||||
bool hasDifferentReplyId = false, DeviceCommandId_t replyId = 0);
|
bool hasDifferentReplyId = false, DeviceCommandId_t replyId = 0);
|
||||||
/**
|
/**
|
||||||
* This is a helper method to insert replies in the reply map.
|
* This is a helper method to insert replies in the reply map.
|
||||||
@ -595,7 +594,7 @@ protected:
|
|||||||
* @param deviceCommand The command to add
|
* @param deviceCommand The command to add
|
||||||
* @return RETURN_OK if the command was successfully inserted, RETURN_FAILED else.
|
* @return RETURN_OK if the command was successfully inserted, RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand, uint8_t expectedReplies = 1);
|
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
||||||
/**
|
/**
|
||||||
* This is a helper method to facilitate updating entries in the reply map.
|
* This is a helper method to facilitate updating entries in the reply map.
|
||||||
* @param deviceCommand Identifier of the reply to update.
|
* @param deviceCommand Identifier of the reply to update.
|
||||||
@ -645,19 +644,17 @@ protected:
|
|||||||
*
|
*
|
||||||
* This is called after scanForReply() found a valid packet, it can be assumed that the length and structure is valid.
|
* This is called after scanForReply() found a valid packet, it can be assumed that the length and structure is valid.
|
||||||
* This routine extracts the data from the packet into a DataSet and then calls handleDeviceTM(), which either sends
|
* This routine extracts the data from the packet into a DataSet and then calls handleDeviceTM(), which either sends
|
||||||
* a TM packet or stores the data in the DataPool depending on whether it was an external command.
|
* a TM packet or stores the data in the DataPool depending on whether the it was an external command.
|
||||||
* No packet length is given, as it should be defined implicitly by the id.
|
* No packet length is given, as it should be defined implicitly by the id.
|
||||||
*
|
*
|
||||||
* @param id the id found by scanForReply()
|
* @param id the id found by scanForReply()
|
||||||
* @param packet
|
* @param packet
|
||||||
* @param commander the one who initiated the command, is 0 if not external commanded.
|
|
||||||
* UPDATE: This parameter does not exist anymore. Why?
|
|
||||||
* @return
|
* @return
|
||||||
* - @c RETURN_OK when the reply was interpreted.
|
* - @c RETURN_OK when the reply was interpreted.
|
||||||
* - @c RETURN_FAILED when the reply could not be interpreted, eg. logical errors or range violations occurred
|
* - @c RETURN_FAILED when the reply could not be interpreted, eg. logical errors or range violations occurred
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||||
const uint8_t *packet, MessageQueueId_t commander = 0) = 0;
|
const uint8_t *packet) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a command reply containing a raw reply.
|
* Construct a command reply containing a raw reply.
|
||||||
@ -726,19 +723,13 @@ protected:
|
|||||||
* - If the command was not found in the reply map, NO_REPLY_EXPECTED MUST be returned.
|
* - If the command was not found in the reply map, NO_REPLY_EXPECTED MUST be returned.
|
||||||
* - A failure code may be returned if something went fundamentally wrong.
|
* - A failure code may be returned if something went fundamentally wrong.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param deviceCommand
|
* @param deviceCommand
|
||||||
* @return - RETURN_OK if a reply was activated.
|
* @return - RETURN_OK if a reply was activated.
|
||||||
* - NO_REPLY_EXPECTED if there was no reply found. This is not an error case as many commands
|
* - NO_REPLY_EXPECTED if there was no reply found. This is not an error case as many commands
|
||||||
* do not expect a reply.
|
* do not expect a reply.
|
||||||
*/
|
*/
|
||||||
// Proposal: Set expected replies in insertInCommandAndReplyMap so we don't have to overwrite that function anymore.
|
|
||||||
// Replies are only checked when a write was issued and the default value here was one, so
|
|
||||||
// it should be possible to set this in the DeviceCommandMap with default value one.
|
|
||||||
// UPDATE: The default value of 0 when inserting into command and reply map is retained now by introducing a new
|
|
||||||
// variable in the DeviceCommandInfo which specifies expected replies if this function is called.
|
|
||||||
virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator cmd,
|
virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator cmd,
|
||||||
/* uint8_t expectedReplies = 1, */ bool useAlternateId = false,
|
uint8_t expectedReplies = 1, bool useAlternateId = false,
|
||||||
DeviceCommandId_t alternateReplyID = 0);
|
DeviceCommandId_t alternateReplyID = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,17 +16,11 @@ public:
|
|||||||
ModeHelper(HasModesIF *owner);
|
ModeHelper(HasModesIF *owner);
|
||||||
virtual ~ModeHelper();
|
virtual ~ModeHelper();
|
||||||
|
|
||||||
/**
|
|
||||||
* This is used by DHB to handle all mode messages issued by a service
|
|
||||||
* @param message
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
ReturnValue_t handleModeCommand(CommandMessage *message);
|
ReturnValue_t handleModeCommand(CommandMessage *message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param parentQueue the Queue id of the parent object (assembly or subsystem object).
|
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
|
||||||
* Set to 0 if no parent present
|
|
||||||
*/
|
*/
|
||||||
void setParentQueue(MessageQueueId_t parentQueueId);
|
void setParentQueue(MessageQueueId_t parentQueueId);
|
||||||
|
|
||||||
@ -34,11 +28,6 @@ public:
|
|||||||
|
|
||||||
ReturnValue_t initialize(void); //void is there to stop eclipse CODAN from falsely reporting an error
|
ReturnValue_t initialize(void); //void is there to stop eclipse CODAN from falsely reporting an error
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to notify
|
|
||||||
* @param mode
|
|
||||||
* @param submode
|
|
||||||
*/
|
|
||||||
void modeChanged(Mode_t mode, Submode_t submode);
|
void modeChanged(Mode_t mode, Submode_t submode);
|
||||||
|
|
||||||
void startTimer(uint32_t timeoutMs);
|
void startTimer(uint32_t timeoutMs);
|
||||||
|
@ -11,11 +11,12 @@ CommandingServiceBase::CommandingServiceBase(object_id_t setObjectId,
|
|||||||
uint16_t apid, uint8_t service, uint8_t numberOfParallelCommands,
|
uint16_t apid, uint8_t service, uint8_t numberOfParallelCommands,
|
||||||
uint16_t commandTimeout_seconds, object_id_t setPacketSource,
|
uint16_t commandTimeout_seconds, object_id_t setPacketSource,
|
||||||
object_id_t setPacketDestination, size_t queueDepth) :
|
object_id_t setPacketDestination, size_t queueDepth) :
|
||||||
SystemObject(setObjectId), apid(apid), service(service),
|
SystemObject(setObjectId), apid(apid), service(service), timeout_seconds(
|
||||||
timeout_seconds(commandTimeout_seconds), tmPacketCounter(0), IPCStore(NULL),
|
commandTimeout_seconds), tmPacketCounter(0), IPCStore(NULL), TCStore(
|
||||||
TCStore(NULL), commandQueue(NULL), requestQueue(NULL), commandMap(numberOfParallelCommands),
|
NULL), commandQueue(NULL), requestQueue(NULL), commandMap(
|
||||||
failureParameter1(0), failureParameter2(0), packetSource(setPacketSource),
|
numberOfParallelCommands), failureParameter1(0), failureParameter2(
|
||||||
packetDestination(setPacketDestination),executingTask(NULL) {
|
0), packetSource(setPacketSource), packetDestination(
|
||||||
|
setPacketDestination),executingTask(NULL) {
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
commandQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
requestQueue = QueueFactory::instance()->createMessageQueue(queueDepth);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user