From b2b6b8ee23bc1ed05a4b1e1fc583a9c3f1f71cef Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 24 Mar 2020 15:33:18 +0100 Subject: [PATCH] added initializeInterface for comIF/cookie --- devicehandlers/DeviceCommunicationIF.h | 12 ++++++++++++ devicehandlers/DeviceHandlerBase.cpp | 9 ++++----- devicehandlers/DeviceHandlerBase.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/devicehandlers/DeviceCommunicationIF.h b/devicehandlers/DeviceCommunicationIF.h index 6f2715041..931fc8b5e 100644 --- a/devicehandlers/DeviceCommunicationIF.h +++ b/devicehandlers/DeviceCommunicationIF.h @@ -46,6 +46,18 @@ public: virtual ~DeviceCommunicationIF() {} + /** + * @brief Device specific initialization, using the cookie. + * @details + * The cookie is already prepared in the factory. If the communication + * interface needs to be set up in some way and requires cookie information, + * this can be performed in this function, which is called on device handler + * initialization. + * @param cookie + * @return + */ + virtual ReturnValue_t initializeInterface(CookieIF * cookie) = 0; + /** * Called by DHB in the SEND_WRITE doSendWrite(). * This function is used to send data to the physical device diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index ebb361d97..ad699508f 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -102,11 +102,10 @@ ReturnValue_t DeviceHandlerBase::initialize() { return RETURN_FAILED; } -// result = communicationInterface->open(&cookie, logicalAddress, -// maxDeviceReplyLen, comParameter1, comParameter2); -// if (result != RETURN_OK) { -// return result; -// } + result = communicationInterface->initializeInterface(comCookie); + if (result != RETURN_OK) { + return result; + } IPCStore = objectManager->get(objects::IPC_STORE); if (IPCStore == NULL) { diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 5faaa8e01..dcca2cc4b 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -464,7 +464,7 @@ protected: * indicates either that all raw messages to and from the device should be sent to #theOneWhoWantsToReadRawTraffic * or that all device TM should be downlinked to #theOneWhoWantsToReadRawTraffic */ - enum WiretappingMode { + enum WiretappingMode: uint8_t { OFF = 0, RAW = 1, TM = 2 } wiretappingMode;