ioBoardAddress protected instead of private to allow custom initialize

This commit is contained in:
Robin Müller 2019-10-22 00:06:11 +02:00
parent 907664cea9
commit cbc8012198
5 changed files with 16 additions and 13 deletions

View File

@ -21,7 +21,7 @@ DeviceHandlerBase::DeviceHandlerBase(uint32_t ioBoardAddress,
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),
SystemObject(setObjectId),ioBoardAddress(ioBoardAddress), 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),
@ -31,7 +31,7 @@ DeviceHandlerBase::DeviceHandlerBase(uint32_t ioBoardAddress,
modeHelper(this), parameterHelper(this), childTransitionFailure(RETURN_OK),
ignoreMissedRepliesCount(0), fdirInstance(fdirInstance), hkSwitcher(this),
defaultFDIRUsed(fdirInstance == NULL), switchOffWasReported(false),
executingTask(NULL), actionHelper(this, NULL), cookieInfo(), ioBoardAddress(ioBoardAddress),
executingTask(NULL), actionHelper(this, NULL), cookieInfo(),
timeoutStart(0), childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,

View File

@ -141,6 +141,11 @@ public:
*/
virtual void setTaskIF(PeriodicTaskIF* task_);
protected:
/**
* cached from ctor for initialize()
*/
const uint32_t ioBoardAddress;
/**
* The Returnvalues id of this class, required by HasReturnvaluesIF
*/
@ -163,6 +168,8 @@ protected:
static const DeviceCommandId_t NO_COMMAND_ID = -2;
static const MessageQueueId_t NO_COMMANDER = 0;
/**
* Pointer to the raw packet that will be sent.
*/
@ -833,6 +840,9 @@ protected:
DeviceCommandMap deviceCommandMap;
ActionHelper actionHelper;
private:
/**
@ -865,10 +875,6 @@ private:
*/
CookieInfo cookieInfo;
/**
* cached from ctor for initialize()
*/
const uint32_t ioBoardAddress;
/**
* Used for timing out mode transitions.

View File

@ -22,11 +22,9 @@ public:
*
* @details The mode of the device handler must not be confused with the mode the device is in.
* The mode of the device itself is transparent to the user but related to the mode of the handler.
* MODE_ON and MODE_OFF are included in hasModesIF.h
*/
// Robin: The first two modes (MODE_ON, MODE_OFF) are specified in hasModesIF.
// We could mention in a comment where those modes are located.
// The comments for _MODE_TO_ON have been taken from the comments in DeviceHandlerBase.cpp file.
// Is the same explanation valid for _MODE_TO_RAW and MODE_TO_NORMAL?
// MODE_ON = 0, //!< The device is powered and ready to perform operations. In this mode, no commands are sent by the device handler itself, but direct commands van be commanded and will be interpreted
// MODE_OFF = 1, //!< The device is powered off. The only command accepted in this mode is a mode change to on.

View File

@ -27,8 +27,8 @@ public:
/**
* ctor
*
* @param owner
* @param objectId the object Id to use when communication with the HealthTable
* @param useAsFrom id to use as from id when sending replies, can be set to 0
*/
HealthHelper(HasHealthIF* owner, object_id_t objectId);

View File

@ -19,8 +19,7 @@ FixedTimeslotTask::~FixedTimeslotTask() {
void FixedTimeslotTask::taskEntryPoint(void* argument) {
//The argument is re-interpreted as FixedTimeslotTask. The Task object is global, so it is found from any place.
FixedTimeslotTask *originalTask(
reinterpret_cast<FixedTimeslotTask*>(argument));
FixedTimeslotTask *originalTask(reinterpret_cast<FixedTimeslotTask*>(argument));
// Task should not start until explicitly requested
// in FreeRTOS, tasks start as soon as they are created if the scheduler is running
// but not if the scheduler is not running.