replaced DHB sizes by size_t, rework
Cookie now passed to DHB, rework in progress
This commit is contained in:
@ -2,15 +2,16 @@
|
||||
#include <framework/devicehandlers/ChildHandlerBase.h>
|
||||
#include <framework/subsystem/SubsystemBase.h>
|
||||
|
||||
ChildHandlerBase::ChildHandlerBase(uint32_t ioBoardAddress,
|
||||
object_id_t setObjectId, object_id_t deviceCommunication,
|
||||
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, address_t logicalAddress,
|
||||
object_id_t deviceCommunication, Cookie * cookie,
|
||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||
uint32_t parent, FailureIsolationBase* customFdir, uint32_t cmdQueueSize) :
|
||||
DeviceHandlerBase(ioBoardAddress, setObjectId, maxDeviceReplyLen,
|
||||
setDeviceSwitch, deviceCommunication, thermalStatePoolId,
|
||||
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir), cmdQueueSize), parentId(
|
||||
parent), childHandlerFdir(setObjectId) {
|
||||
uint32_t parent, FailureIsolationBase* customFdir, size_t cmdQueueSize) :
|
||||
DeviceHandlerBase(setObjectId, logicalAddress, deviceCommunication, cookie,
|
||||
maxDeviceReplyLen, setDeviceSwitch, thermalStatePoolId,
|
||||
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir),
|
||||
cmdQueueSize),
|
||||
parentId(parent), childHandlerFdir(setObjectId) {
|
||||
}
|
||||
|
||||
ChildHandlerBase::~ChildHandlerBase() {
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
class ChildHandlerBase: public DeviceHandlerBase {
|
||||
public:
|
||||
ChildHandlerBase(uint32_t ioBoardAddress, object_id_t setObjectId,
|
||||
object_id_t deviceCommunication, uint32_t maxDeviceReplyLen,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||
FailureIsolationBase* customFdir = NULL,
|
||||
uint32_t cmdQueueSize = 20);
|
||||
ChildHandlerBase(object_id_t setObjectId, uint32_t logicalAddress,
|
||||
object_id_t deviceCommunication, Cookie * cookie,
|
||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||
uint32_t parent, FailureIsolationBase* customFdir = nullptr,
|
||||
size_t cmdQueueSize = 20);
|
||||
virtual ~ChildHandlerBase();
|
||||
|
||||
virtual ReturnValue_t initialize();
|
||||
|
24
devicehandlers/Cookie.cpp
Normal file
24
devicehandlers/Cookie.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @file Cookie.cpp
|
||||
*
|
||||
* @date 23.03.2020
|
||||
*/
|
||||
#include <framework/devicehandlers/Cookie.h>
|
||||
|
||||
//Cookie::Cookie(address_t logicalAddress_, size_t maxReplyLen_):
|
||||
// logicalAddress(logicalAddress_), maxReplyLen(maxReplyLen_){}
|
||||
|
||||
Cookie::Cookie(address_t logicalAddress_): logicalAddress(logicalAddress_) {
|
||||
}
|
||||
|
||||
void Cookie::setMaxReplyLen(size_t maxReplyLen_) {
|
||||
maxReplyLen = maxReplyLen_;
|
||||
}
|
||||
|
||||
address_t Cookie::getAddress() const {
|
||||
return logicalAddress;
|
||||
}
|
||||
|
||||
size_t Cookie::getMaxReplyLen() const {
|
||||
return maxReplyLen;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
#ifndef COOKIE_H_
|
||||
#define COOKIE_H_
|
||||
#include <framework/devicehandlers/DeviceHandlerIF.h>
|
||||
|
||||
/**
|
||||
* @brief This datatype is used to identify different connection over a single interface
|
||||
@ -7,13 +8,27 @@
|
||||
* @details
|
||||
* To use this class, implement a communication specific child cookie. This cookie
|
||||
* can be used in the device communication interface by performing
|
||||
* a C++ dynamic cast. The cookie can be used to store all kinds of information
|
||||
* about the communication between read and send calls.
|
||||
* a C++ dynamic cast and passing it to a child device handler, which stores
|
||||
* it and passes the Cookie to the communication interface where it can be used
|
||||
* by again performing a dynamic cast.
|
||||
* The cookie can be used to store all kinds of information
|
||||
* about the communication, like slave addresses, communication status,
|
||||
* communication parameters etc.
|
||||
* @ingroup comm
|
||||
*/
|
||||
class Cookie{
|
||||
public:
|
||||
Cookie() = default;
|
||||
Cookie(address_t logicalAddress_);
|
||||
virtual ~Cookie(){}
|
||||
|
||||
void setMaxReplyLen(size_t maxReplyLen_);
|
||||
|
||||
address_t getAddress() const;
|
||||
size_t getMaxReplyLen() const;
|
||||
private:
|
||||
address_t logicalAddress = 0;
|
||||
size_t maxReplyLen = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* COOKIE_H_ */
|
||||
|
@ -6,7 +6,12 @@
|
||||
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
||||
/**
|
||||
* @defgroup interfaces Interfaces
|
||||
* @brief Communication interfaces for flight software objects
|
||||
* @brief Interfaces for flight software objects
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup communication comm
|
||||
* @brief Communication software components.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -22,9 +27,12 @@
|
||||
* 3. Request reading data from a device
|
||||
* 4. Read received data
|
||||
*
|
||||
* To identify different connection over a single interface can return so-called cookies to components.
|
||||
* To identify different connection over a single interface can return
|
||||
* so-called cookies to components.
|
||||
* The CommunicationMessage message type can be used to extend the functionality of the
|
||||
* ComIF if a separate polling task is required.
|
||||
* @ingroup interfaces
|
||||
* @ingroup comm
|
||||
*/
|
||||
class DeviceCommunicationIF: public HasReturnvaluesIF {
|
||||
public:
|
||||
@ -32,52 +40,12 @@ public:
|
||||
|
||||
static const ReturnValue_t INVALID_COOKIE_TYPE = MAKE_RETURN_CODE(0x01);
|
||||
static const ReturnValue_t NOT_ACTIVE = MAKE_RETURN_CODE(0x02);
|
||||
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0x03);
|
||||
static const ReturnValue_t TOO_MUCH_DATA = MAKE_RETURN_CODE(0x04);
|
||||
static const ReturnValue_t NULLPOINTER = MAKE_RETURN_CODE(0x05);
|
||||
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x06);
|
||||
static const ReturnValue_t CANT_CHANGE_REPLY_LEN = MAKE_RETURN_CODE(0x07);
|
||||
static const ReturnValue_t TOO_MUCH_DATA = MAKE_RETURN_CODE(0x03);
|
||||
static const ReturnValue_t NULLPOINTER = MAKE_RETURN_CODE(0x04);
|
||||
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x05);
|
||||
|
||||
virtual ~DeviceCommunicationIF() {}
|
||||
|
||||
/**
|
||||
* Open a connection. Define a communication specific cookie which can
|
||||
* be used to store information about the communication.
|
||||
* The two optional parameter provide additional flexibility to
|
||||
* set up the communication interface as desired. If there are a lot of
|
||||
* variables to set, a store ID to the parameters stored in the IPC store
|
||||
* can also be passed.
|
||||
*
|
||||
* @param cookie [out] This data class stores information about the communication.
|
||||
* @param address Logical device address
|
||||
* @param maxReplyLen Maximum length of expected reply
|
||||
* @param comParameter1 Arbitrary parameter which can be used to set up the cookie or comIF.
|
||||
* @param comParameter2 Arbitrary parameter which can be used to set up the cookie or comIF.
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t open(Cookie **cookie, address_t address,
|
||||
uint32_t maxReplyLen, uint32_t comParameter1, uint32_t comParameter2) = 0;
|
||||
|
||||
/**
|
||||
* Use an existing cookie to open a connection to a new DeviceCommunication.
|
||||
* The previous connection must not be closed.
|
||||
*
|
||||
* @param cookie
|
||||
* @param address
|
||||
* @param maxReplyLen
|
||||
* @return -@c RETURN_OK New communication set up successfully
|
||||
* - Everything else: Cookie is unchanged and can be used with
|
||||
* previous connection
|
||||
*/
|
||||
virtual ReturnValue_t reOpen(Cookie *cookie, address_t address,
|
||||
uint32_t maxReplyLen, uint32_t comParameter1, uint32_t comParameter2) = 0;
|
||||
|
||||
/**
|
||||
* Closing call of connection. Don't forget to free memory of cookie.
|
||||
* @param cookie
|
||||
*/
|
||||
virtual void close(Cookie *cookie) = 0;
|
||||
|
||||
/**
|
||||
* Called by DHB in the SEND_WRITE doSendWrite().
|
||||
* This function is used to send data to the physical device
|
||||
@ -86,21 +54,29 @@ public:
|
||||
* @param data
|
||||
* @param len
|
||||
* @return -@c RETURN_OK for successfull send
|
||||
* -Everything else triggers sending failed event with
|
||||
* returnvalue as parameter 1
|
||||
* - Everything else triggers sending failed event with
|
||||
* returnvalue as parameter 1
|
||||
*/
|
||||
virtual ReturnValue_t sendMessage(Cookie *cookie, const uint8_t *data,
|
||||
uint32_t len) = 0;
|
||||
virtual ReturnValue_t sendMessage(Cookie *cookie, const uint8_t * sendData,
|
||||
size_t sendLen) = 0;
|
||||
|
||||
/**
|
||||
* Called by DHB in the GET_WRITE doGetWrite().
|
||||
* Get send confirmation that the data in sendMessage() was sent successfully.
|
||||
* @param cookie
|
||||
* @return -@c RETURN_OK if data was sent successfull
|
||||
* - Everything else triggers sending failed event with
|
||||
* returnvalue as parameter 1
|
||||
*/
|
||||
virtual ReturnValue_t getSendSuccess(Cookie *cookie) = 0;
|
||||
|
||||
/**
|
||||
* Called by DHB in the SEND_WRITE doSendRead().
|
||||
* Instructs the Communication Interface to prepare
|
||||
* Request a reply.
|
||||
* @param cookie
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t requestReceiveMessage(Cookie *cookie) = 0;
|
||||
virtual ReturnValue_t requestReceiveMessage(Cookie *cookie, size_t requestLen) = 0;
|
||||
|
||||
/**
|
||||
* Called by DHB in the GET_WRITE doGetRead().
|
||||
@ -110,30 +86,11 @@ public:
|
||||
* @param data
|
||||
* @param len
|
||||
* @return @c RETURN_OK for successfull receive
|
||||
* Everything else triggers receiving failed with returnvalue as parameter 1
|
||||
* - Everything else triggers receiving failed with
|
||||
* returnvalue as parameter 1
|
||||
*/
|
||||
virtual ReturnValue_t readReceivedMessage(Cookie *cookie, uint8_t **buffer,
|
||||
uint32_t *size) = 0;
|
||||
|
||||
virtual ReturnValue_t setAddress(Cookie *cookie, address_t address) = 0;
|
||||
|
||||
virtual address_t getAddress(Cookie *cookie) = 0;
|
||||
|
||||
/**
|
||||
* Can be used by DeviceHandlerBase getParameter() call to set DeviceComIF parameters
|
||||
* @param cookie
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t setParameter(Cookie *cookie, uint32_t parameter) = 0;
|
||||
|
||||
/**
|
||||
* Can be used by DeviceHandlerBase getParameter() call to set DeviceComIF parameters
|
||||
* @param cookie
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
virtual uint32_t getParameter(Cookie *cookie) = 0;
|
||||
size_t *size) = 0;
|
||||
};
|
||||
|
||||
#endif /* DEVICECOMMUNICATIONIF_H_ */
|
||||
|
@ -16,37 +16,34 @@ object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
||||
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
||||
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
||||
|
||||
DeviceHandlerBase::DeviceHandlerBase(uint32_t logicalAddress_,
|
||||
object_id_t setObjectId, uint32_t maxDeviceReplyLen,
|
||||
uint8_t setDeviceSwitch, object_id_t deviceCommunication,
|
||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||
FailureIsolationBase* fdirInstance, uint32_t cmdQueueSize) :
|
||||
SystemObject(setObjectId), rawPacket(0), rawPacketLen(0), mode(MODE_OFF),
|
||||
submode(SUBMODE_NONE), pstStep(0), maxDeviceReplyLen(maxDeviceReplyLen),
|
||||
wiretappingMode(OFF), defaultRawReceiver(0), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||
requestedRawTraffic(0), powerSwitcher(NULL), IPCStore(NULL),
|
||||
deviceCommunicationId(deviceCommunication), communicationInterface(NULL),
|
||||
cookie(NULL), commandQueue(NULL), deviceThermalStatePoolId(thermalStatePoolId),
|
||||
deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this, setObjectId),
|
||||
modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK),
|
||||
ignoreMissedRepliesCount(0), fdirInstance(fdirInstance), hkSwitcher(this),
|
||||
defaultFDIRUsed(fdirInstance == NULL), switchOffWasReported(false),
|
||||
executingTask(NULL), actionHelper(this, NULL), cookieInfo(), logicalAddress(logicalAddress_),
|
||||
timeoutStart(0), childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
|
||||
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch)
|
||||
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, address_t logicalAddress_,
|
||||
object_id_t deviceCommunication, Cookie * cookie_, size_t maxReplyLen,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
|
||||
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
||||
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||
deviceCommunicationId(deviceCommunication), cookie(cookie_),
|
||||
deviceThermalStatePoolId(thermalStatePoolId), deviceThermalRequestPoolId(thermalRequestPoolId),
|
||||
healthHelper(this, setObjectId), modeHelper(this), parameterHelper(this),
|
||||
fdirInstance(fdirInstance), hkSwitcher(this),
|
||||
defaultFDIRUsed(fdirInstance == nullptr), switchOffWasReported(false),
|
||||
executingTask(nullptr), actionHelper(this, nullptr), cookieInfo(),
|
||||
logicalAddress(logicalAddress_), childTransitionDelay(5000),
|
||||
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(SUBMODE_NONE),
|
||||
deviceSwitch(setDeviceSwitch)
|
||||
{
|
||||
this->cookie->setMaxReplyLen(maxReplyLen);
|
||||
commandQueue = QueueFactory::instance()->
|
||||
createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE);
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
insertInCommandMap(RAW_COMMAND_ID);
|
||||
if (this->fdirInstance == NULL) {
|
||||
if (this->fdirInstance == nullptr) {
|
||||
this->fdirInstance =
|
||||
new DeviceHandlerFailureIsolation(setObjectId, defaultFDIRParentId);
|
||||
}
|
||||
}
|
||||
|
||||
DeviceHandlerBase::~DeviceHandlerBase() {
|
||||
communicationInterface->close(cookie);
|
||||
if (defaultFDIRUsed) {
|
||||
delete fdirInstance;
|
||||
}
|
||||
@ -105,11 +102,11 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
|
||||
result = communicationInterface->open(&cookie, logicalAddress,
|
||||
maxDeviceReplyLen, comParameter1, comParameter2);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
// result = communicationInterface->open(&cookie, logicalAddress,
|
||||
// maxDeviceReplyLen, comParameter1, comParameter2);
|
||||
// if (result != RETURN_OK) {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (IPCStore == NULL) {
|
||||
@ -551,7 +548,7 @@ void DeviceHandlerBase::doGetWrite() {
|
||||
|
||||
void DeviceHandlerBase::doSendRead() {
|
||||
ReturnValue_t result;
|
||||
result = communicationInterface->requestReceiveMessage(cookie);
|
||||
result = communicationInterface->requestReceiveMessage(cookie, requestLen);
|
||||
if (result == RETURN_OK) {
|
||||
cookieInfo.state = COOKIE_READ_SENT;
|
||||
} else {
|
||||
@ -565,10 +562,10 @@ void DeviceHandlerBase::doSendRead() {
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::doGetRead() {
|
||||
uint32_t receivedDataLen;
|
||||
size_t receivedDataLen;
|
||||
uint8_t *receivedData;
|
||||
DeviceCommandId_t foundId = 0xFFFFFFFF;
|
||||
uint32_t foundLen = 0;
|
||||
size_t foundLen = 0;
|
||||
ReturnValue_t result;
|
||||
|
||||
if (cookieInfo.state != COOKIE_READ_SENT) {
|
||||
@ -639,8 +636,8 @@ void DeviceHandlerBase::doGetRead() {
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
||||
uint8_t * *data, uint32_t * len) {
|
||||
uint32_t lenTmp;
|
||||
uint8_t ** data, size_t * len) {
|
||||
size_t lenTmp;
|
||||
|
||||
if (IPCStore == NULL) {
|
||||
*data = NULL;
|
||||
@ -751,20 +748,20 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::switchCookieChannel(object_id_t newChannelId) {
|
||||
DeviceCommunicationIF *newCommunication = objectManager->get<
|
||||
DeviceCommunicationIF>(newChannelId);
|
||||
|
||||
if (newCommunication != NULL) {
|
||||
ReturnValue_t result = newCommunication->reOpen(cookie, logicalAddress,
|
||||
maxDeviceReplyLen, comParameter1, comParameter2);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
//ReturnValue_t DeviceHandlerBase::switchCookieChannel(object_id_t newChannelId) {
|
||||
// DeviceCommunicationIF *newCommunication = objectManager->get<
|
||||
// DeviceCommunicationIF>(newChannelId);
|
||||
//
|
||||
// if (newCommunication != NULL) {
|
||||
// ReturnValue_t result = newCommunication->reOpen(cookie, logicalAddress,
|
||||
// maxDeviceReplyLen, comParameter1, comParameter2);
|
||||
// if (result != RETURN_OK) {
|
||||
// return result;
|
||||
// }
|
||||
// return RETURN_OK;
|
||||
// }
|
||||
// return RETURN_FAILED;
|
||||
//}
|
||||
|
||||
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
|
||||
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
|
||||
@ -1048,12 +1045,13 @@ ReturnValue_t DeviceHandlerBase::handleDeviceHandlerMessage(
|
||||
}
|
||||
replyReturnvalueToCommand(RETURN_OK);
|
||||
return RETURN_OK;
|
||||
case DeviceHandlerMessage::CMD_SWITCH_IOBOARD:
|
||||
case DeviceHandlerMessage::CMD_SWITCH_ADDRESS:
|
||||
if (mode != MODE_OFF) {
|
||||
replyReturnvalueToCommand(WRONG_MODE_FOR_COMMAND);
|
||||
} else {
|
||||
result = switchCookieChannel(
|
||||
DeviceHandlerMessage::getIoBoardObjectId(message));
|
||||
// rework in progress
|
||||
//result = switchCookieChannel(
|
||||
// DeviceHandlerMessage::getIoBoardObjectId(message));
|
||||
if (result == RETURN_OK) {
|
||||
replyReturnvalueToCommand(RETURN_OK);
|
||||
} else {
|
||||
|
@ -29,7 +29,7 @@ void setStaticFrameworkObjectIds();
|
||||
class StorageManagerIF;
|
||||
|
||||
/**
|
||||
* \defgroup devices Devices
|
||||
* @defgroup devices Devices
|
||||
* Contains all devices and the DeviceHandlerBase class.
|
||||
*/
|
||||
|
||||
@ -93,12 +93,11 @@ public:
|
||||
* @param fdirInstance
|
||||
* @param cmdQueueSize
|
||||
*/
|
||||
DeviceHandlerBase(address_t logicalAddress, object_id_t setObjectId,
|
||||
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch,
|
||||
object_id_t deviceCommunication,
|
||||
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||
DeviceHandlerBase(object_id_t setObjectId, address_t logicalAddress_,
|
||||
object_id_t deviceCommunication, Cookie* cookie_, size_t maxReplyLen,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
||||
FailureIsolationBase* fdirInstance = NULL, uint32_t cmdQueueSize = 20);
|
||||
FailureIsolationBase* fdirInstance = nullptr, size_t cmdQueueSize = 20);
|
||||
|
||||
/**
|
||||
* @brief This function is the device handler base core component and is called periodically.
|
||||
@ -283,8 +282,8 @@ protected:
|
||||
* - @c DeviceHandlerIF::IGNORE_FULL_PACKET Ignore the packet
|
||||
* - @c APERIODIC_REPLY if a valid reply is received that has not been requested by a command, but should be handled anyway (@see also fillCommandAndCookieMap() )
|
||||
*/
|
||||
virtual ReturnValue_t scanForReply(const uint8_t *start, uint32_t len,
|
||||
DeviceCommandId_t *foundId, uint32_t *foundLen) = 0;
|
||||
virtual ReturnValue_t scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) = 0;
|
||||
|
||||
/**
|
||||
* @brief Interpret a reply from the device.
|
||||
@ -412,11 +411,16 @@ protected:
|
||||
/**
|
||||
* Pointer to the raw packet that will be sent.
|
||||
*/
|
||||
uint8_t *rawPacket;
|
||||
uint8_t *rawPacket = nullptr;
|
||||
/**
|
||||
* Size of the #rawPacket.
|
||||
*/
|
||||
uint32_t rawPacketLen;
|
||||
size_t rawPacketLen = 0;
|
||||
|
||||
/**
|
||||
* Size of data to request.
|
||||
*/
|
||||
size_t requestLen = 0;
|
||||
|
||||
// /**
|
||||
// * This union (or std::variant) type can be used to set comParameters which
|
||||
@ -431,8 +435,8 @@ protected:
|
||||
// * 4 bytes of parameters AND a store ID.
|
||||
// */
|
||||
// comParameters_t comParameters;
|
||||
uint32_t comParameter1 = 0;
|
||||
uint32_t comParameter2 = 0;
|
||||
// uint32_t comParameter1 = 0;
|
||||
// uint32_t comParameter2 = 0;
|
||||
|
||||
/**
|
||||
* The mode the device handler is currently in.
|
||||
@ -451,12 +455,12 @@ protected:
|
||||
/**
|
||||
* This is the counter value from performOperation().
|
||||
*/
|
||||
uint8_t pstStep;
|
||||
uint8_t pstStep = 0;
|
||||
|
||||
/**
|
||||
* This will be used in the RMAP getRead command as expected length, is set by the constructor, can be modiefied at will.
|
||||
*/
|
||||
const uint32_t maxDeviceReplyLen;
|
||||
const uint32_t maxDeviceReplyLen = 0;
|
||||
|
||||
/**
|
||||
* wiretapping flag:
|
||||
@ -474,7 +478,7 @@ protected:
|
||||
* Statically initialized in initialize() to a configurable object. Used when there is no method
|
||||
* of finding a recipient, ie raw mode and reporting erreonous replies
|
||||
*/
|
||||
MessageQueueId_t defaultRawReceiver;
|
||||
MessageQueueId_t defaultRawReceiver = 0;
|
||||
|
||||
store_address_t storedRawData;
|
||||
|
||||
@ -483,19 +487,19 @@ protected:
|
||||
*
|
||||
* if #isWiretappingActive all raw communication from and to the device will be sent to this queue
|
||||
*/
|
||||
MessageQueueId_t requestedRawTraffic;
|
||||
MessageQueueId_t requestedRawTraffic = 0;
|
||||
|
||||
/**
|
||||
* the object used to set power switches
|
||||
*/
|
||||
PowerSwitchIF *powerSwitcher;
|
||||
PowerSwitchIF *powerSwitcher = nullptr;
|
||||
|
||||
/**
|
||||
* Pointer to the IPCStore.
|
||||
*
|
||||
* This caches the pointer received from the objectManager in the constructor.
|
||||
*/
|
||||
StorageManagerIF *IPCStore;
|
||||
StorageManagerIF *IPCStore = nullptr;
|
||||
|
||||
/**
|
||||
* cached for init
|
||||
@ -505,7 +509,7 @@ protected:
|
||||
/**
|
||||
* Communication object used for device communication
|
||||
*/
|
||||
DeviceCommunicationIF *communicationInterface;
|
||||
DeviceCommunicationIF *communicationInterface = nullptr;
|
||||
|
||||
/**
|
||||
* Cookie used for communication. This is passed to the communication
|
||||
@ -516,7 +520,7 @@ protected:
|
||||
/**
|
||||
* The MessageQueue used to receive device handler commands and to send replies.
|
||||
*/
|
||||
MessageQueueIF* commandQueue;
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
/**
|
||||
* this is the datapool variable with the thermal state of the device
|
||||
@ -545,9 +549,9 @@ protected:
|
||||
* Optional Error code
|
||||
* Can be set in doStartUp(), doShutDown() and doTransition() to signal cause for Transition failure.
|
||||
*/
|
||||
ReturnValue_t childTransitionFailure;
|
||||
ReturnValue_t childTransitionFailure = RETURN_OK;
|
||||
|
||||
uint32_t ignoreMissedRepliesCount; //!< Counts if communication channel lost a reply, so some missed replys can be ignored.
|
||||
uint32_t ignoreMissedRepliesCount = 0; //!< Counts if communication channel lost a reply, so some missed replys can be ignored.
|
||||
|
||||
FailureIsolationBase* fdirInstance; //!< Pointer to the used FDIR instance. If not provided by child, default class is instantiated.
|
||||
|
||||
@ -962,7 +966,7 @@ private:
|
||||
*
|
||||
* Set when setMode() is called.
|
||||
*/
|
||||
uint32_t timeoutStart;
|
||||
uint32_t timeoutStart = 0;
|
||||
|
||||
/**
|
||||
* Delay for the current mode transition, used for time out
|
||||
@ -1084,8 +1088,8 @@ private:
|
||||
* - @c RETURN_FAILED IPCStore is NULL
|
||||
* - the return value from the IPCStore if it was not @c RETURN_OK
|
||||
*/
|
||||
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data,
|
||||
uint32_t *len);
|
||||
ReturnValue_t getStorageData(store_address_t storageAddress,
|
||||
uint8_t ** data, size_t * len);
|
||||
|
||||
/**
|
||||
* set all switches returned by getSwitches()
|
||||
@ -1114,7 +1118,7 @@ private:
|
||||
* - @c RETURN_FAILED when cookies could not be changed, eg because the newChannel is not enabled
|
||||
* - @c returnvalues of RMAPChannelIF::isActive()
|
||||
*/
|
||||
ReturnValue_t switchCookieChannel(object_id_t newChannelId);
|
||||
//ReturnValue_t switchCookieChannel(object_id_t newChannelId);
|
||||
|
||||
/**
|
||||
* Handle device handler messages (e.g. commands sent by PUS Service 2)
|
||||
|
@ -47,7 +47,7 @@ void DeviceHandlerMessage::setDeviceHandlerWiretappingMessage(
|
||||
|
||||
void DeviceHandlerMessage::setDeviceHandlerSwitchIoBoardMessage(
|
||||
CommandMessage* message, uint32_t ioBoardIdentifier) {
|
||||
message->setCommand(CMD_SWITCH_IOBOARD);
|
||||
message->setCommand(CMD_SWITCH_ADDRESS);
|
||||
message->setParameter(ioBoardIdentifier);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void DeviceHandlerMessage::clear(CommandMessage* message) {
|
||||
}
|
||||
}
|
||||
/* NO BREAK falls through*/
|
||||
case CMD_SWITCH_IOBOARD:
|
||||
case CMD_SWITCH_ADDRESS:
|
||||
case CMD_WIRETAPPING:
|
||||
message->setCommand(CommandMessage::CMD_NONE);
|
||||
message->setParameter(0);
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::DEVICE_HANDLER_COMMAND;
|
||||
static const Command_t CMD_RAW = MAKE_COMMAND_ID( 1 ); //!< Sends a raw command, setParameter is a ::store_id_t containing the raw packet to send
|
||||
// static const Command_t CMD_DIRECT = MAKE_COMMAND_ID( 2 ); //!< Sends a direct command, setParameter is a ::DeviceCommandId_t, setParameter2 is a ::store_id_t containing the data needed for the command
|
||||
static const Command_t CMD_SWITCH_IOBOARD = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier
|
||||
static const Command_t CMD_SWITCH_ADDRESS = MAKE_COMMAND_ID( 3 ); //!< Requests a IO-Board switch, setParameter() is the IO-Board identifier
|
||||
static const Command_t CMD_WIRETAPPING = MAKE_COMMAND_ID( 4 ); //!< (De)Activates the monitoring of all raw traffic in DeviceHandlers, setParameter is 0 to deactivate, 1 to activate
|
||||
|
||||
/*static const Command_t REPLY_SWITCHED_IOBOARD = MAKE_COMMAND_ID(1 );//!< Reply to a @c CMD_SWITCH_IOBOARD, indicates switch was successful, getParameter() contains the board switched to (0: nominal, 1: redundant)
|
||||
|
Reference in New Issue
Block a user