WIP: somethings wrong.. #19
@ -12,6 +12,8 @@
|
|||||||
#include <framework/ipc/QueueFactory.h>
|
#include <framework/ipc/QueueFactory.h>
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
||||||
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
||||||
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
||||||
@ -37,6 +39,12 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
|||||||
CommandMessage::MAX_MESSAGE_SIZE);
|
CommandMessage::MAX_MESSAGE_SIZE);
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
insertInCommandMap(RAW_COMMAND_ID);
|
insertInCommandMap(RAW_COMMAND_ID);
|
||||||
|
if (comCookie == nullptr) {
|
||||||
|
sif::error << "DeviceHandlerBase: ObjectID 0x" << std::hex <<
|
||||||
|
std::setw(8) << std::setfill('0') << this->getObjectId() <<
|
||||||
|
std::dec << ": Do not pass nullptr as a cookie, consider "
|
||||||
|
"passing a dummy cookie instead!" << std::endl;
|
||||||
|
}
|
||||||
if (this->fdirInstance == nullptr) {
|
if (this->fdirInstance == nullptr) {
|
||||||
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
|
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
|
||||||
defaultFDIRParentId);
|
defaultFDIRParentId);
|
||||||
@ -353,8 +361,8 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
|||||||
info.delayCycles = 0;
|
info.delayCycles = 0;
|
||||||
info.replyLen = replyLen;
|
info.replyLen = replyLen;
|
||||||
info.command = deviceCommandMap.end();
|
info.command = deviceCommandMap.end();
|
||||||
std::pair<DeviceReplyIter, bool> result = deviceReplyMap.emplace(replyId, info);
|
auto resultPair = deviceReplyMap.emplace(replyId, info);
|
||||||
if (result.second) {
|
if (resultPair.second) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -366,11 +374,8 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
|
|||||||
info.expectedReplies = 0;
|
info.expectedReplies = 0;
|
||||||
info.isExecuting = false;
|
info.isExecuting = false;
|
||||||
info.sendReplyTo = NO_COMMANDER;
|
info.sendReplyTo = NO_COMMANDER;
|
||||||
std::pair<std::map<DeviceCommandId_t, DeviceCommandInfo>::iterator, bool> returnValue;
|
auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
|
||||||
returnValue = deviceCommandMap.insert(
|
if (resultPair.second) {
|
||||||
std::pair<DeviceCommandId_t, DeviceCommandInfo>(deviceCommand,
|
|
||||||
info));
|
|
||||||
if (returnValue.second) {
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
} else {
|
} else {
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
@ -648,8 +653,8 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
|||||||
uint8_t * *data, uint32_t * len) {
|
uint8_t * *data, uint32_t * len) {
|
||||||
size_t lenTmp;
|
size_t lenTmp;
|
||||||
|
|
||||||
if (IPCStore == NULL) {
|
if (IPCStore == nullptr) {
|
||||||
*data = NULL;
|
*data = nullptr;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return RETURN_FAILED;
|
return RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -660,7 +665,7 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
|||||||
} else {
|
} else {
|
||||||
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result,
|
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result,
|
||||||
storageAddress.raw);
|
storageAddress.raw);
|
||||||
*data = NULL;
|
*data = nullptr;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1054,8 +1059,8 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
|||||||
// if (mode != MODE_OFF) {
|
// if (mode != MODE_OFF) {
|
||||||
// replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
// replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
||||||
// } else {
|
// } else {
|
||||||
//// result = switchCookieChannel(
|
// result = switchCookieChannel(
|
||||||
//// DeviceHandlerMessage::getIoBoardObjectId(message));
|
// DeviceHandlerMessage::getIoBoardObjectId(message));
|
||||||
// if (result == RETURN_OK) {
|
// if (result == RETURN_OK) {
|
||||||
// replyReturnvalueToCommand(RETURN_OK);
|
// replyReturnvalueToCommand(RETURN_OK);
|
||||||
// } else {
|
// } else {
|
||||||
|
@ -481,9 +481,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void setParentQueue(MessageQueueId_t parentQueueId);
|
virtual void setParentQueue(MessageQueueId_t parentQueueId);
|
||||||
|
|
||||||
|
/** @brief Implementation required for HasActionIF */
|
||||||
ReturnValue_t executeAction(ActionId_t actionId,
|
ReturnValue_t executeAction(ActionId_t actionId,
|
||||||
MessageQueueId_t commandedBy, const uint8_t* data,
|
MessageQueueId_t commandedBy, const uint8_t* data,
|
||||||
size_t size) override;
|
size_t size) override;
|
||||||
|
|
||||||
Mode_t getTransitionSourceMode() const;
|
Mode_t getTransitionSourceMode() const;
|
||||||
Submode_t getTransitionSourceSubMode() const;
|
Submode_t getTransitionSourceSubMode() const;
|
||||||
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
||||||
@ -607,12 +609,16 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Communication object used for device communication
|
* Communication object used for device communication
|
||||||
*/
|
*/
|
||||||
DeviceCommunicationIF *communicationInterface = nullptr;
|
DeviceCommunicationIF * communicationInterface = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cookie used for communication
|
* Cookie used for communication
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
CookieIF * comCookie = nullptr;
|
CookieIF * comCookie = nullptr;
|
||||||
|
=======
|
||||||
|
CookieIF * comCookie;
|
||||||
|
>>>>>>> mueller_framework
|
||||||
|
|
||||||
struct DeviceCommandInfo {
|
struct DeviceCommandInfo {
|
||||||
bool isExecuting; //!< Indicates if the command is already executing.
|
bool isExecuting; //!< Indicates if the command is already executing.
|
||||||
|
Loading…
Reference in New Issue
Block a user