DHB: performOperation Hook + polling counter
polling counter to specify how often communication opertions are performed, however this still needs to be changed..
This commit is contained in:
parent
22e4dabd1b
commit
68cda479d6
@ -9,7 +9,7 @@
|
||||
* @brief Map implementation for maps with a pre-defined size.
|
||||
* @details Can be initialized with desired maximum size.
|
||||
* Iterator is used to access <key,value> pair and
|
||||
* iterate through map entries.
|
||||
* iterate through map entries. Complexity O(n).
|
||||
* @ingroup container
|
||||
*/
|
||||
template<typename key_t, typename T>
|
||||
|
@ -4,11 +4,9 @@
|
||||
/**
|
||||
* @defgroup container Container
|
||||
*
|
||||
* General Purpose Container to store various elements.
|
||||
*
|
||||
* Also contains Adapter classes to print elements to a
|
||||
* bytestream and to read them from a bytestream, as well
|
||||
* as an Adapter to swap the endianness.
|
||||
* General Purpose Containers to store various elements.
|
||||
* As opposed to the STL library implementation, these implementations
|
||||
* don't allocate memory dynamically.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -32,8 +32,9 @@ DeviceHandlerBase::DeviceHandlerBase(uint32_t logicalAddress_,
|
||||
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)
|
||||
pollingFrequency(1), pollingCounter(1), timeoutStart(0), childTransitionDelay(5000),
|
||||
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(SUBMODE_NONE),
|
||||
deviceSwitch(setDeviceSwitch)
|
||||
{
|
||||
commandQueue = QueueFactory::instance()->
|
||||
createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE);
|
||||
@ -63,10 +64,20 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
||||
decrementDeviceReplyMap();
|
||||
fdirInstance->checkForFailures();
|
||||
hkSwitcher.performOperation();
|
||||
performOperationHook();
|
||||
}
|
||||
if (mode == MODE_OFF) {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
if (pollingCounter != pollingFrequency) {
|
||||
pollingCounter ++;
|
||||
return RETURN_OK;
|
||||
}
|
||||
else {
|
||||
pollingCounter = 1;
|
||||
}
|
||||
|
||||
switch (getRmapAction()) {
|
||||
case SEND_WRITE:
|
||||
if ((cookieInfo.state == COOKIE_UNUSED)) {
|
||||
@ -87,6 +98,7 @@ ReturnValue_t DeviceHandlerBase::performOperation(uint8_t counter) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
@ -166,7 +178,6 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
mySet.commit(PoolVariableIF::VALID);
|
||||
|
||||
return RETURN_OK;
|
||||
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::decrementDeviceReplyMap() {
|
||||
@ -1278,3 +1289,6 @@ void DeviceHandlerBase::debugInterface(uint8_t positionTracker, object_id_t obje
|
||||
uint32_t DeviceHandlerBase::getLogicalAddress() {
|
||||
return logicalAddress;
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::performOperationHook() {
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
#include <framework/devicehandlers/DeviceHandlerFailureIsolation.h>
|
||||
#include <framework/datapool/HkSwitchHelper.h>
|
||||
#include <framework/serialize/SerialFixedArrayListAdapter.h>
|
||||
#include <map>
|
||||
#include <framework/ipc/MessageQueueIF.h>
|
||||
#include <framework/tasks/PeriodicTaskIF.h>
|
||||
#include <map>
|
||||
|
||||
namespace Factory{
|
||||
void setStaticFrameworkObjectIds();
|
||||
@ -88,7 +88,7 @@ public:
|
||||
* The constructor passes the objectId to the SystemObject().
|
||||
*
|
||||
* @param setObjectId the ObjectId to pass to the SystemObject() Constructor
|
||||
* @param maxDeviceReplyLen the length the RMAP getRead call will be sent with
|
||||
* @param maxDeviceReplyLen the largest allowed reply size
|
||||
* @param setDeviceSwitch the switch the device is connected to, for devices using two switches, overwrite getSwitches()
|
||||
* @param deviceCommuncation Communcation Interface object which is used to implement communication functions
|
||||
* @param thermalStatePoolId
|
||||
@ -349,6 +349,12 @@ protected:
|
||||
virtual ReturnValue_t getSwitches(const uint8_t **switches,
|
||||
uint8_t *numberOfSwitches);
|
||||
|
||||
/**
|
||||
* Can be used to perform device specific periodic operations.
|
||||
* This is called on the SEND_READ step of the performOperation() call
|
||||
*/
|
||||
virtual void performOperationHook();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param parentQueueId
|
||||
@ -934,6 +940,19 @@ private:
|
||||
*/
|
||||
const uint32_t logicalAddress;
|
||||
|
||||
/**
|
||||
* Polling Frequency which specifies how often the communication functions
|
||||
* and functionalities are called.
|
||||
*
|
||||
* This is not a time value. The time value depends on the
|
||||
* respective period time of the polling sequence table.
|
||||
* The actual time frequency can be calculated by multiplying that period
|
||||
* with the polling frequency value. Defaults to 1 (communication operations called
|
||||
* in each performOperation()).
|
||||
*/
|
||||
uint32_t pollingFrequency;
|
||||
uint32_t pollingCounter;
|
||||
|
||||
/**
|
||||
* Used for timing out mode transitions.
|
||||
*
|
||||
@ -981,6 +1000,8 @@ private:
|
||||
* - checks whether commanded mode transitions are required and calls handleCommandedModeTransition()
|
||||
* - does the necessary action for the current mode or calls doChildStateMachine in modes @c MODE_TO_ON and @c MODE_TO_OFF
|
||||
* - actions that happen in transitions (eg setting a timeout) are handled in setMode()
|
||||
* - Maybe export this into own class to increase modularity of software
|
||||
* and reduce the massive class size ?
|
||||
*/
|
||||
void doStateMachine(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user