device handler base update

This commit is contained in:
Robin Müller 2020-12-30 22:01:11 +01:00
parent b2c98f0ae4
commit 44dcd3104e
2 changed files with 13 additions and 10 deletions

View File

@ -16,8 +16,8 @@
#include <iomanip> #include <iomanip>
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::defaultPowerSwitcherId = objects::NO_OBJECT;
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::defaultRawDataReceiverId = objects::NO_OBJECT;
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
@ -151,9 +151,9 @@ ReturnValue_t DeviceHandlerBase::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
if(rawDataReceiverId != objects::NO_OBJECT) { if(defaultRawDataReceiverId != objects::NO_OBJECT) {
AcceptsDeviceResponsesIF *rawReceiver = objectManager->get< AcceptsDeviceResponsesIF *rawReceiver = objectManager->get<
AcceptsDeviceResponsesIF>(rawDataReceiverId); AcceptsDeviceResponsesIF>(defaultRawDataReceiverId);
if (rawReceiver == nullptr) { if (rawReceiver == nullptr) {
sif::error << "DeviceHandlerBase::initialize: Raw receiver object " sif::error << "DeviceHandlerBase::initialize: Raw receiver object "
@ -165,8 +165,9 @@ ReturnValue_t DeviceHandlerBase::initialize() {
defaultRawReceiver = rawReceiver->getDeviceQueue(); defaultRawReceiver = rawReceiver->getDeviceQueue();
} }
if(powerSwitcherId != objects::NO_OBJECT) { if(defaultPowerSwitcherId != objects::NO_OBJECT) {
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId); powerSwitcher = objectManager->get<PowerSwitchIF>(
defaultPowerSwitcherId);
if (powerSwitcher == nullptr) { if (powerSwitcher == nullptr) {
sif::error << "DeviceHandlerBase::initialize: Power switcher " sif::error << "DeviceHandlerBase::initialize: Power switcher "
<< "object ID set but no valid object found." << std::endl; << "object ID set but no valid object found." << std::endl;
@ -682,9 +683,11 @@ void DeviceHandlerBase::doGetRead() {
replyRawData(receivedData, receivedDataLen, requestedRawTraffic); replyRawData(receivedData, receivedDataLen, requestedRawTraffic);
} }
if (mode == MODE_RAW and defaultRawReceiver != MessageQueueIF::NO_QUEUE) { if (mode == MODE_RAW) {
if(defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
replyRawReplyIfnotWiretapped(receivedData, receivedDataLen); replyRawReplyIfnotWiretapped(receivedData, receivedDataLen);
} }
}
else { else {
parseReply(receivedData, receivedDataLen); parseReply(receivedData, receivedDataLen);
} }

View File

@ -739,10 +739,10 @@ protected:
PeriodicTaskIF* executingTask = nullptr; PeriodicTaskIF* executingTask = nullptr;
//!< Object which switches power on and off. //!< Object which switches power on and off.
static object_id_t powerSwitcherId; static object_id_t defaultPowerSwitcherId;
//!< Object which receives RAW data by default. //!< Object which receives RAW data by default.
static object_id_t rawDataReceiverId; static object_id_t defaultRawDataReceiverId;
//!< Object which may be the root cause of an identified fault. //!< Object which may be the root cause of an identified fault.
static object_id_t defaultFdirParentId; static object_id_t defaultFdirParentId;