From 1829d9cf0a04b4ee9a01c3740db87a95e7568898 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 4 Feb 2021 01:31:46 +0100 Subject: [PATCH] lpid replaced by gpid --- controller/ExtendedControllerBase.h | 10 +++---- datapoollocal/HasLocalDataPoolIF.h | 2 +- datapoollocal/LocalDataPoolManager.cpp | 12 ++++---- .../ProvidesDataPoolSubscriptionIF.h | 4 +-- housekeeping/HousekeepingMessage.cpp | 30 ++++++++++++------- housekeeping/HousekeepingMessage.h | 10 ++++--- 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/controller/ExtendedControllerBase.h b/controller/ExtendedControllerBase.h index ae59b758..f069819b 100644 --- a/controller/ExtendedControllerBase.h +++ b/controller/ExtendedControllerBase.h @@ -24,12 +24,12 @@ public: size_t commandQueueDepth = 3); virtual ~ExtendedControllerBase(); - /** SystemObjectIF overrides */ + /* SystemObjectIF overrides */ virtual ReturnValue_t initialize() override; virtual MessageQueueId_t getCommandQueue() const override; - /** ExecutableObjectIF overrides */ + /* ExecutableObjectIF overrides */ virtual ReturnValue_t performOperation(uint8_t opCode) override; virtual ReturnValue_t initializeAfterTaskCreation() override; @@ -50,15 +50,15 @@ protected: */ virtual void performControlOperation() = 0; - /** Handle the four messages mentioned above */ + /* Handle the four messages mentioned above */ void handleQueue() override; - /** HasActionsIF overrides */ + /* HasActionsIF overrides */ virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) override; - /** HasLocalDatapoolIF overrides */ + /* HasLocalDatapoolIF overrides */ virtual LocalDataPoolManager* getHkManagerHandle() override; virtual object_id_t getObjectId() const override; virtual ReturnValue_t initializeLocalDataPool( diff --git a/datapoollocal/HasLocalDataPoolIF.h b/datapoollocal/HasLocalDataPoolIF.h index 1d87d47c..05570175 100644 --- a/datapoollocal/HasLocalDataPoolIF.h +++ b/datapoollocal/HasLocalDataPoolIF.h @@ -80,7 +80,7 @@ public: * @param storeId If a snapshot was requested, data will be located inside * the IPC store with this store ID. */ - virtual void handleChangedPoolVariable(lp_id_t poolId, + virtual void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId = storeId::INVALID_STORE_ADDRESS) { return; } diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 48b4a038..dd009684 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -166,7 +166,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receive // prepare and send update notification. CommandMessage notification; HousekeepingMessage::setUpdateNotificationVariableCommand(¬ification, - receiver.dataId.localPoolId); + gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId)); ReturnValue_t result = hkQueue->sendMessage( receiver.destinationQueue, ¬ification); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -238,7 +238,7 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot( CommandMessage notification; HousekeepingMessage::setUpdateSnapshotVariableCommand(¬ification, - receiver.dataId.localPoolId, storeId); + gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId); result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -563,9 +563,9 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage( return HasReturnvaluesIF::RETURN_OK; } case(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): { - lp_id_t locPoolId = HousekeepingMessage:: + gp_id_t globPoolId = HousekeepingMessage:: getUpdateNotificationVariableCommand(message); - owner->handleChangedPoolVariable(locPoolId); + owner->handleChangedPoolVariable(globPoolId); return HasReturnvaluesIF::RETURN_OK; } case(HousekeepingMessage::UPDATE_SNAPSHOT_SET): { @@ -576,9 +576,9 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage( } case(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): { store_address_t storeId; - lp_id_t localPoolId = HousekeepingMessage:: + gp_id_t globPoolId = HousekeepingMessage:: getUpdateSnapshotVariableCommand(message, &storeId); - owner->handleChangedPoolVariable(localPoolId, storeId); + owner->handleChangedPoolVariable(globPoolId, storeId); return HasReturnvaluesIF::RETURN_OK; } diff --git a/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/datapoollocal/ProvidesDataPoolSubscriptionIF.h index a0d73b93..4a6cdb9f 100644 --- a/datapoollocal/ProvidesDataPoolSubscriptionIF.h +++ b/datapoollocal/ProvidesDataPoolSubscriptionIF.h @@ -38,7 +38,6 @@ public: bool isDiagnostics, object_id_t packetDestination) = 0; - /** * @brief Subscribe for a notification message which will be sent * if a dataset has changed. @@ -54,8 +53,7 @@ public: * @return */ virtual ReturnValue_t subscribeForSetUpdateMessages(const uint32_t setId, - object_id_t destinationObject, - MessageQueueId_t targetQueueId, + object_id_t destinationObject, MessageQueueId_t targetQueueId, bool generateSnapshot) = 0; /** diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index 5d732961..d9803ef6 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -125,8 +125,10 @@ sid_t HousekeepingMessage::getSid(const CommandMessage* message) { return sid; } -void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) { - std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); +gp_id_t HousekeepingMessage::getGpid(const CommandMessage* message) { + gp_id_t globalPoolId; + std::memcpy(&globalPoolId.raw, message->getData(), sizeof(globalPoolId.raw)); + return globalPoolId; } void HousekeepingMessage::setHkStuctureReportReply(CommandMessage *reply, @@ -169,9 +171,9 @@ void HousekeepingMessage::setUpdateNotificationSetCommand( } void HousekeepingMessage::setUpdateNotificationVariableCommand( - CommandMessage *command, lp_id_t localPoolId) { + CommandMessage *command, gp_id_t globalPoolId) { command->setCommand(UPDATE_NOTIFICATION_VARIABLE); - command->setParameter(localPoolId); + setGpid(command, globalPoolId); } void HousekeepingMessage::setUpdateSnapshotSetCommand(CommandMessage *command, @@ -182,9 +184,9 @@ void HousekeepingMessage::setUpdateSnapshotSetCommand(CommandMessage *command, } void HousekeepingMessage::setUpdateSnapshotVariableCommand( - CommandMessage *command, lp_id_t localPoolId, store_address_t storeId) { + CommandMessage *command, gp_id_t globalPoolId, store_address_t storeId) { command->setCommand(UPDATE_SNAPSHOT_VARIABLE); - command->setParameter(localPoolId); + setGpid(command, globalPoolId); command->setParameter3(storeId.raw); } @@ -193,9 +195,9 @@ sid_t HousekeepingMessage::getUpdateNotificationSetCommand( return getSid(command); } -lp_id_t HousekeepingMessage::getUpdateNotificationVariableCommand( +gp_id_t HousekeepingMessage::getUpdateNotificationVariableCommand( const CommandMessage *command) { - return command->getParameter(); + return getGpid(command); } sid_t HousekeepingMessage::getUpdateSnapshotSetCommand( @@ -206,10 +208,18 @@ sid_t HousekeepingMessage::getUpdateSnapshotSetCommand( return getSid(command); } -lp_id_t HousekeepingMessage::getUpdateSnapshotVariableCommand( +gp_id_t HousekeepingMessage::getUpdateSnapshotVariableCommand( const CommandMessage *command, store_address_t *storeId) { if(storeId != nullptr) { *storeId = command->getParameter3(); } - return command->getParameter(); + return getGpid(command); +} + +void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) { + std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); +} + +void HousekeepingMessage::setGpid(CommandMessage *message, gp_id_t globalPoolId) { + std::memcpy(message->getData(), &globalPoolId.raw, sizeof(globalPoolId.raw)); } diff --git a/housekeeping/HousekeepingMessage.h b/housekeeping/HousekeepingMessage.h index 0c7680dc..a38ff73f 100644 --- a/housekeeping/HousekeepingMessage.h +++ b/housekeeping/HousekeepingMessage.h @@ -75,6 +75,7 @@ public: //static constexpr Command_t UPDATE_HK_REPORT = MAKE_COMMAND_ID(134); static sid_t getSid(const CommandMessage* message); + static gp_id_t getGpid(const CommandMessage* message); /* Housekeeping Interface Messages */ @@ -123,26 +124,27 @@ public: static void setUpdateNotificationSetCommand(CommandMessage* command, sid_t sid); static void setUpdateNotificationVariableCommand(CommandMessage* command, - lp_id_t localPoolId); + gp_id_t globalPoolId); static void setUpdateSnapshotSetCommand(CommandMessage* command, sid_t sid, store_address_t storeId); static void setUpdateSnapshotVariableCommand(CommandMessage* command, - lp_id_t localPoolId, store_address_t storeId); + gp_id_t globalPoolId, store_address_t storeId); static sid_t getUpdateNotificationSetCommand(const CommandMessage* command); - static lp_id_t getUpdateNotificationVariableCommand( + static gp_id_t getUpdateNotificationVariableCommand( const CommandMessage* command); static sid_t getUpdateSnapshotSetCommand(const CommandMessage* command, store_address_t* storeId); - static lp_id_t getUpdateSnapshotVariableCommand(const CommandMessage* command, + static gp_id_t getUpdateSnapshotVariableCommand(const CommandMessage* command, store_address_t* storeId); /** Utility */ static void clear(CommandMessage* message); private: static void setSid(CommandMessage* message, sid_t sid); + static void setGpid(CommandMessage* message, gp_id_t globalPoolId); };