API change introduced, using new device comIF

also changed child handler base.
This commit is contained in:
Robin Müller 2020-04-19 15:48:17 +02:00
parent c8983650f7
commit 1820ad14b7
4 changed files with 32 additions and 31 deletions

View File

@ -2,15 +2,16 @@
#include <framework/devicehandlers/ChildHandlerBase.h> #include <framework/devicehandlers/ChildHandlerBase.h>
#include <framework/subsystem/SubsystemBase.h> #include <framework/subsystem/SubsystemBase.h>
ChildHandlerBase::ChildHandlerBase(uint32_t ioBoardAddress, ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
object_id_t setObjectId, object_id_t deviceCommunication, object_id_t deviceCommunication, CookieIF * comCookie,
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch, uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalRequestPoolId, uint32_t parent,
uint32_t parent, FailureIsolationBase* customFdir, uint32_t cmdQueueSize) : FailureIsolationBase* customFdir, size_t cmdQueueSize) :
DeviceHandlerBase(ioBoardAddress, setObjectId, maxDeviceReplyLen, DeviceHandlerBase(setObjectId, deviceCommunication, comCookie,
setDeviceSwitch, deviceCommunication, thermalStatePoolId, setDeviceSwitch, thermalStatePoolId,thermalRequestPoolId,
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir), cmdQueueSize), parentId( (customFdir == nullptr? &childHandlerFdir : customFdir),
parent), childHandlerFdir(setObjectId) { cmdQueueSize),
parentId(parent), childHandlerFdir(setObjectId) {
} }
ChildHandlerBase::~ChildHandlerBase() { ChildHandlerBase::~ChildHandlerBase() {

View File

@ -6,12 +6,12 @@
class ChildHandlerBase: public DeviceHandlerBase { class ChildHandlerBase: public DeviceHandlerBase {
public: public:
ChildHandlerBase(uint32_t ioBoardAddress, object_id_t setObjectId, ChildHandlerBase(object_id_t setObjectId,
object_id_t deviceCommunication, uint32_t maxDeviceReplyLen, object_id_t deviceCommunication, CookieIF * comCookie,
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId, uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
uint32_t thermalRequestPoolId, uint32_t parent, uint32_t thermalRequestPoolId, uint32_t parent,
FailureIsolationBase* customFdir = NULL, FailureIsolationBase* customFdir = nullptr,
uint32_t cmdQueueSize = 20); size_t cmdQueueSize = 20);
virtual ~ChildHandlerBase(); virtual ~ChildHandlerBase();
virtual ReturnValue_t initialize(); virtual ReturnValue_t initialize();

View File

@ -16,17 +16,17 @@ 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(uint32_t ioBoardAddress, DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
object_id_t setObjectId, uint32_t maxDeviceReplyLen, object_id_t deviceCommunication, CookieIF * comCookie,
uint8_t setDeviceSwitch, object_id_t deviceCommunication, uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalRequestPoolId, FailureIsolationBase* fdirInstance,
FailureIsolationBase* fdirInstance, uint32_t cmdQueueSize) : size_t cmdQueueSize) :
SystemObject(setObjectId), rawPacket(0), rawPacketLen(0), mode(MODE_OFF), SystemObject(setObjectId), rawPacket(0), rawPacketLen(0), mode(MODE_OFF),
submode(SUBMODE_NONE), pstStep(0), maxDeviceReplyLen(maxDeviceReplyLen), submode(SUBMODE_NONE), pstStep(0), maxDeviceReplyLen(maxDeviceReplyLen),
wiretappingMode(OFF), defaultRawReceiver(0), storedRawData(StorageManagerIF::INVALID_ADDRESS), wiretappingMode(OFF), defaultRawReceiver(0), storedRawData(StorageManagerIF::INVALID_ADDRESS),
requestedRawTraffic(0), powerSwitcher(NULL), IPCStore(NULL), requestedRawTraffic(0), powerSwitcher(NULL), IPCStore(NULL),
deviceCommunicationId(deviceCommunication), communicationInterface(NULL), deviceCommunicationId(deviceCommunication), communicationInterface(NULL),
cookie(NULL), commandQueue(NULL), deviceThermalStatePoolId(thermalStatePoolId), comCookie(comCookie), commandQueue(NULL), deviceThermalStatePoolId(thermalStatePoolId),
deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this, setObjectId), deviceThermalRequestPoolId(thermalRequestPoolId), healthHelper(this, setObjectId),
modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK), modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK),
ignoreMissedRepliesCount(0), fdirInstance(fdirInstance), hkSwitcher(this), ignoreMissedRepliesCount(0), fdirInstance(fdirInstance), hkSwitcher(this),
@ -102,7 +102,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
return RETURN_FAILED; return RETURN_FAILED;
} }
result = communicationInterface->initializeInterface(cookie); result = communicationInterface->initializeInterface(comCookie);
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
@ -503,7 +503,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) {
@ -524,7 +524,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);
@ -556,7 +556,7 @@ void DeviceHandlerBase::doSendRead() {
requestLen = 0; requestLen = 0;
} }
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;
@ -584,8 +584,8 @@ void DeviceHandlerBase::doGetRead() {
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
result = communicationInterface->readReceivedMessage(cookie, &receivedData, result = communicationInterface->readReceivedMessage(comCookie,
&receivedDataLen); &receivedData, &receivedDataLen);
if (result != RETURN_OK) { if (result != RETURN_OK) {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result); triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);

View File

@ -27,7 +27,7 @@ void setStaticFrameworkObjectIds();
class StorageManagerIF; class StorageManagerIF;
/** /**
* \defgroup devices Devices * @defgroup devices Devices
* Contains all devices and the DeviceHandlerBase class. * Contains all devices and the DeviceHandlerBase class.
*/ */
@ -99,12 +99,12 @@ public:
* @param fdirInstance * @param fdirInstance
* @param cmdQueueSize * @param cmdQueueSize
*/ */
DeviceHandlerBase(uint32_t ioBoardAddress, object_id_t setObjectId, DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
uint32_t maxDeviceReplyLen, uint8_t setDeviceSwitch, CookieIF * comCookie, uint8_t setDeviceSwitch,
object_id_t deviceCommunication,
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 = NULL, uint32_t cmdQueueSize = 20); FailureIsolationBase* fdirInstance = nullptr,
size_t cmdQueueSize = 20);
/** /**
* @brief This function is the device handler base core component and is * @brief This function is the device handler base core component and is
@ -555,7 +555,7 @@ protected:
/** /**
* Cookie used for communication * Cookie used for communication
*/ */
CookieIF *cookie; CookieIF * comCookie;
struct DeviceCommandInfo { struct DeviceCommandInfo {
bool isExecuting; //!< Indicates if the command is already executing. bool isExecuting; //!< Indicates if the command is already executing.