new cookieIF
This commit is contained in:
parent
029b2133e6
commit
59812199fd
@ -16,23 +16,22 @@ 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;
|
||||||
|
|
||||||
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, address_t logicalAddress_,
|
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||||
object_id_t deviceCommunication, Cookie * cookie_, size_t maxReplyLen,
|
CookieIF * comCookie_, size_t maxReplyLen, uint8_t setDeviceSwitch,
|
||||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||||
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
|
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
|
||||||
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
||||||
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||||
deviceCommunicationId(deviceCommunication), cookie(cookie_),
|
deviceCommunicationId(deviceCommunication), comCookie(comCookie_),
|
||||||
deviceThermalStatePoolId(thermalStatePoolId), deviceThermalRequestPoolId(thermalRequestPoolId),
|
deviceThermalStatePoolId(thermalStatePoolId), deviceThermalRequestPoolId(thermalRequestPoolId),
|
||||||
healthHelper(this, setObjectId), modeHelper(this), parameterHelper(this),
|
healthHelper(this, setObjectId), modeHelper(this), parameterHelper(this),
|
||||||
fdirInstance(fdirInstance), hkSwitcher(this),
|
fdirInstance(fdirInstance), hkSwitcher(this),
|
||||||
defaultFDIRUsed(fdirInstance == nullptr), switchOffWasReported(false),
|
defaultFDIRUsed(fdirInstance == nullptr), switchOffWasReported(false),
|
||||||
executingTask(nullptr), actionHelper(this, nullptr), cookieInfo(),
|
executingTask(nullptr), actionHelper(this, nullptr), cookieInfo(),
|
||||||
logicalAddress(logicalAddress_), childTransitionDelay(5000),
|
childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
|
||||||
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(SUBMODE_NONE),
|
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch)
|
||||||
deviceSwitch(setDeviceSwitch)
|
|
||||||
{
|
{
|
||||||
this->cookie->setMaxReplyLen(maxReplyLen);
|
this->comCookie->setMaxReplyLen(maxReplyLen);
|
||||||
commandQueue = QueueFactory::instance()->
|
commandQueue = QueueFactory::instance()->
|
||||||
createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE);
|
createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE);
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
@ -44,6 +43,7 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, address_t logicalA
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeviceHandlerBase::~DeviceHandlerBase() {
|
DeviceHandlerBase::~DeviceHandlerBase() {
|
||||||
|
delete comCookie;
|
||||||
if (defaultFDIRUsed) {
|
if (defaultFDIRUsed) {
|
||||||
delete fdirInstance;
|
delete fdirInstance;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (getRmapAction()) {
|
switch (getComAction()) {
|
||||||
case SEND_WRITE:
|
case SEND_WRITE:
|
||||||
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
||||||
buildInternalCommand();
|
buildInternalCommand();
|
||||||
@ -506,7 +506,7 @@ void DeviceHandlerBase::replyToReply(DeviceReplyMap::iterator iter,
|
|||||||
void DeviceHandlerBase::doSendWrite() {
|
void DeviceHandlerBase::doSendWrite() {
|
||||||
if (cookieInfo.state == COOKIE_WRITE_READY) {
|
if (cookieInfo.state == COOKIE_WRITE_READY) {
|
||||||
|
|
||||||
ReturnValue_t result = communicationInterface->sendMessage(cookie,
|
ReturnValue_t result = communicationInterface->sendMessage(comCookie,
|
||||||
rawPacket, rawPacketLen);
|
rawPacket, rawPacketLen);
|
||||||
|
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
@ -527,7 +527,7 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
ReturnValue_t result = communicationInterface->getSendSuccess(cookie);
|
ReturnValue_t result = communicationInterface->getSendSuccess(comCookie);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
if (wiretappingMode == RAW) {
|
if (wiretappingMode == RAW) {
|
||||||
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
||||||
@ -548,7 +548,7 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
|
|
||||||
void DeviceHandlerBase::doSendRead() {
|
void DeviceHandlerBase::doSendRead() {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
result = communicationInterface->requestReceiveMessage(cookie, requestLen);
|
result = communicationInterface->requestReceiveMessage(comCookie, requestLen);
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
cookieInfo.state = COOKIE_READ_SENT;
|
cookieInfo.state = COOKIE_READ_SENT;
|
||||||
} else {
|
} else {
|
||||||
@ -575,7 +575,7 @@ void DeviceHandlerBase::doGetRead() {
|
|||||||
|
|
||||||
cookieInfo.state = COOKIE_UNUSED;
|
cookieInfo.state = COOKIE_UNUSED;
|
||||||
|
|
||||||
result = communicationInterface->readReceivedMessage(cookie, &receivedData,
|
result = communicationInterface->readReceivedMessage(comCookie, &receivedData,
|
||||||
&receivedDataLen);
|
&receivedDataLen);
|
||||||
|
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -688,7 +688,7 @@ void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
|||||||
|
|
||||||
//Default child implementations
|
//Default child implementations
|
||||||
|
|
||||||
DeviceHandlerBase::CommunicationAction_t DeviceHandlerBase::getRmapAction() {
|
DeviceHandlerBase::CommunicationAction_t DeviceHandlerBase::getComAction() {
|
||||||
switch (pstStep) {
|
switch (pstStep) {
|
||||||
case 0:
|
case 0:
|
||||||
return SEND_WRITE;
|
return SEND_WRITE;
|
||||||
@ -1050,6 +1050,7 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
|||||||
replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
||||||
} else {
|
} else {
|
||||||
// rework in progress
|
// rework in progress
|
||||||
|
result = RETURN_OK;
|
||||||
//result = switchCookieChannel(
|
//result = switchCookieChannel(
|
||||||
// DeviceHandlerMessage::getIoBoardObjectId(message));
|
// DeviceHandlerMessage::getIoBoardObjectId(message));
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
@ -1276,7 +1277,7 @@ void DeviceHandlerBase::debugInterface(uint8_t positionTracker, object_id_t obje
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t DeviceHandlerBase::getLogicalAddress() {
|
uint32_t DeviceHandlerBase::getLogicalAddress() {
|
||||||
return logicalAddress;
|
return this->comCookie->getAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerBase::performOperationHook() {
|
void DeviceHandlerBase::performOperationHook() {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <framework/tasks/ExecutableObjectIF.h>
|
#include <framework/tasks/ExecutableObjectIF.h>
|
||||||
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
|
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
|
||||||
#include <framework/datapool/HkSwitchHelper.h>
|
#include <framework/datapool/HkSwitchHelper.h>
|
||||||
|
#include <framework/devicehandlers/CookieIF.h>
|
||||||
#include <framework/serialize/SerialFixedArrayListAdapter.h>
|
#include <framework/serialize/SerialFixedArrayListAdapter.h>
|
||||||
#include <framework/ipc/MessageQueueIF.h>
|
#include <framework/ipc/MessageQueueIF.h>
|
||||||
#include <framework/tasks/PeriodicTaskIF.h>
|
#include <framework/tasks/PeriodicTaskIF.h>
|
||||||
@ -93,9 +94,9 @@ public:
|
|||||||
* @param fdirInstance
|
* @param fdirInstance
|
||||||
* @param cmdQueueSize
|
* @param cmdQueueSize
|
||||||
*/
|
*/
|
||||||
DeviceHandlerBase(object_id_t setObjectId, address_t logicalAddress_,
|
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||||
object_id_t deviceCommunication, Cookie* cookie_, size_t maxReplyLen,
|
CookieIF * comCookie_, size_t maxReplyLen, uint8_t setDeviceSwitch,
|
||||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||||
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
||||||
FailureIsolationBase* fdirInstance = nullptr, size_t cmdQueueSize = 20);
|
FailureIsolationBase* fdirInstance = nullptr, size_t cmdQueueSize = 20);
|
||||||
|
|
||||||
@ -422,22 +423,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
size_t requestLen = 0;
|
size_t requestLen = 0;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * This union (or std::variant) type can be used to set comParameters which
|
|
||||||
// * are passed in the open() and reOpen() calls to the communication
|
|
||||||
// * interface
|
|
||||||
// * TODO: I don't know if we should use C++17 features but if we do we propably
|
|
||||||
// * should also write a function to get either a storeId handle
|
|
||||||
// * or an array handle so these values can be set conveniently.
|
|
||||||
// * The good think is that if there are many parameters, they can
|
|
||||||
// * be stored in the IPC pool. But maybe two uint32_t parameters are enough.
|
|
||||||
// * Simple = Good. It is downwards compatible and one can still store
|
|
||||||
// * 4 bytes of parameters AND a store ID.
|
|
||||||
// */
|
|
||||||
// comParameters_t comParameters;
|
|
||||||
// uint32_t comParameter1 = 0;
|
|
||||||
// uint32_t comParameter2 = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mode the device handler is currently in.
|
* The mode the device handler is currently in.
|
||||||
*
|
*
|
||||||
@ -515,7 +500,7 @@ protected:
|
|||||||
* Cookie used for communication. This is passed to the communication
|
* Cookie used for communication. This is passed to the communication
|
||||||
* interface.
|
* interface.
|
||||||
*/
|
*/
|
||||||
Cookie *cookie;
|
CookieIF *comCookie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MessageQueue used to receive device handler commands and to send replies.
|
* The MessageQueue used to receive device handler commands and to send replies.
|
||||||
@ -666,7 +651,7 @@ protected:
|
|||||||
*
|
*
|
||||||
* @return The Rmap action to execute in this step
|
* @return The Rmap action to execute in this step
|
||||||
*/
|
*/
|
||||||
virtual CommunicationAction_t getRmapAction();
|
virtual CommunicationAction_t getComAction();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the device command to send for raw mode.
|
* Build the device command to send for raw mode.
|
||||||
@ -959,7 +944,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* cached from ctor for initialize()
|
* cached from ctor for initialize()
|
||||||
*/
|
*/
|
||||||
const uint32_t logicalAddress;
|
//const uint32_t logicalAddress = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for timing out mode transitions.
|
* Used for timing out mode transitions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user