slight DHB improvements

This commit is contained in:
Robin Müller 2020-05-17 17:53:18 +02:00
parent 9597a0121b
commit 0467b6a1bf

View File

@ -12,6 +12,8 @@
#include <framework/ipc/QueueFactory.h> #include <framework/ipc/QueueFactory.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h> #include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <iomanip>
object_id_t DeviceHandlerBase::powerSwitcherId = 0; 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;
@ -37,6 +39,12 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
CommandMessage::MAX_MESSAGE_SIZE); CommandMessage::MAX_MESSAGE_SIZE);
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
insertInCommandMap(RAW_COMMAND_ID); insertInCommandMap(RAW_COMMAND_ID);
if (comCookie == nullptr) {
sif::error << "DeviceHandlerBase: ObjectID 0x" << std::hex <<
std::setw(8) << std::setfill('0') << this->getObjectId() <<
std::dec << ": Do not pass nullptr as a cookie, consider "
"passing a dummy cookie instead!" << std::endl;
}
if (this->fdirInstance == nullptr) { if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
defaultFDIRParentId); defaultFDIRParentId);
@ -44,7 +52,6 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
} }
DeviceHandlerBase::~DeviceHandlerBase() { DeviceHandlerBase::~DeviceHandlerBase() {
//communicationInterface->close(cookie);
delete comCookie; delete comCookie;
if (defaultFDIRUsed) { if (defaultFDIRUsed) {
delete fdirInstance; delete fdirInstance;
@ -646,8 +653,8 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
uint8_t * *data, uint32_t * len) { uint8_t * *data, uint32_t * len) {
size_t lenTmp; size_t lenTmp;
if (IPCStore == NULL) { if (IPCStore == nullptr) {
*data = NULL; *data = nullptr;
*len = 0; *len = 0;
return RETURN_FAILED; return RETURN_FAILED;
} }
@ -658,7 +665,7 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
} else { } else {
triggerEvent(StorageManagerIF::GET_DATA_FAILED, result, triggerEvent(StorageManagerIF::GET_DATA_FAILED, result,
storageAddress.raw); storageAddress.raw);
*data = NULL; *data = nullptr;
*len = 0; *len = 0;
return result; return result;
} }