DHB/Cookie refactoring

This commit is contained in:
Robin Müller 2020-04-01 12:41:54 +02:00
parent 5218a0d84f
commit 996dbc9e4b
14 changed files with 142 additions and 213 deletions

View File

@ -8,7 +8,7 @@ ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
uint32_t parent, FailureIsolationBase* customFdir, size_t cmdQueueSize) : uint32_t parent, FailureIsolationBase* customFdir, size_t cmdQueueSize) :
DeviceHandlerBase(setObjectId, deviceCommunication, cookie, DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
maxDeviceReplyLen, setDeviceSwitch, thermalStatePoolId, setDeviceSwitch, thermalStatePoolId,
thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir), thermalRequestPoolId, (customFdir == NULL? &childHandlerFdir : customFdir),
cmdQueueSize), cmdQueueSize),
parentId(parent), childHandlerFdir(setObjectId) { parentId(parent), childHandlerFdir(setObjectId) {

View File

@ -1,26 +0,0 @@
/**
* @file Cookie.cpp
*
* @date 23.03.2020
*/
#include <framework/devicehandlers/Cookie.h>
Cookie::Cookie(address_t logicalAddress_): logicalAddress(logicalAddress_) {
}
void Cookie::setAddress(address_t logicalAddress_) {
logicalAddress = logicalAddress_;
}
void Cookie::setMaxReplyLen(size_t maxReplyLen_) {
maxReplyLen = maxReplyLen_;
}
address_t Cookie::getAddress() const {
return logicalAddress;
}
size_t Cookie::getMaxReplyLen() const {
return maxReplyLen;
}

View File

@ -1,38 +0,0 @@
#ifndef COOKIE_H_
#define COOKIE_H_
#include <framework/devicehandlers/CookieIF.h>
/**
* @brief This datatype is used to identify different connection over a single interface
* (like RMAP or I2C)
* @details
* To use this class, implement a communication specific child cookie which
* inherits Cookie. Cookie instances are created in config/ Factory.cpp by calling
* CookieIF* childCookie = new ChildCookie(...).´
*
* This cookie is then passed to the child device handlers, which stores the
* pointer and passes it to the communication interface functions.
*
* The cookie can be used to store all kinds of information
* about the communication, like slave addresses, communication status,
* communication parameters etc.
*
* @ingroup comm
*/
class Cookie: public CookieIF {
public:
Cookie();
Cookie(address_t logicalAddress_);
virtual ~Cookie() {};
virtual void setAddress(address_t logicalAddres_);
virtual void setMaxReplyLen(size_t maxReplyLen_);
virtual address_t getAddress() const;
virtual size_t getMaxReplyLen() const;
private:
address_t logicalAddress = 0;
size_t maxReplyLen = 0;
};
#endif /* COOKIE_H_ */

View File

@ -1,30 +1,33 @@
/** #ifndef COOKIE_H_
* @file CookieIF.h #define COOKIE_H_
* #include <framework/devicehandlers/CookieIF.h>
* @date 23.03.2020 #include <stdint.h>
*/
/**
#ifndef FRAMEWORK_DEVICEHANDLERS_COOKIEIF_H_ * @brief Physical address type
#define FRAMEWORK_DEVICEHANDLERS_COOKIEIF_H_ */
#include <framework/devicehandlers/DeviceHandlerIF.h> typedef uint32_t address_t;
/** /**
* @brief Physical address type * @brief This datatype is used to identify different connection over a single interface
*/ * (like RMAP or I2C)
typedef uint32_t address_t; * @details
* To use this class, implement a communication specific child cookie which
class CookieIF { * inherits Cookie. Cookie instances are created in config/ Factory.cpp by calling
public: * CookieIF* childCookie = new ChildCookie(...).
/** *
* Default empty virtual destructor. * This cookie is then passed to the child device handlers, which stores the
*/ * pointer and passes it to the communication interface functions.
virtual ~CookieIF() {}; *
* The cookie can be used to store all kinds of information
virtual void setAddress(address_t logicalAddress_) = 0; * about the communication, like slave addresses, communication status,
virtual address_t getAddress() const = 0; * communication parameters etc.
*
virtual void setMaxReplyLen(size_t maxReplyLen_) = 0; * @ingroup comm
virtual size_t getMaxReplyLen() const = 0; */
}; class CookieIF {
public:
#endif /* FRAMEWORK_DEVICEHANDLERS_COOKIEIF_H_ */ virtual ~CookieIF() {};
};
#endif /* COOKIE_H_ */

View File

@ -1,7 +1,7 @@
#ifndef DEVICECOMMUNICATIONIF_H_ #ifndef DEVICECOMMUNICATIONIF_H_
#define DEVICECOMMUNICATIONIF_H_ #define DEVICECOMMUNICATIONIF_H_
#include <framework/devicehandlers/Cookie.h> #include <framework/devicehandlers/CookieIF.h>
#include <framework/devicehandlers/DeviceHandlerIF.h> #include <framework/devicehandlers/DeviceHandlerIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h> #include <framework/returnvalues/HasReturnvaluesIF.h>
/** /**
@ -88,11 +88,14 @@ public:
/** /**
* Called by DHB in the SEND_WRITE doSendRead(). * Called by DHB in the SEND_WRITE doSendRead().
* Request a reply. * It is assumed that it is always possible to request a reply
* from a device. If a requestLen of 0 is supplied, no reply was enabled
* and communication specific action should be taken (e.g. read nothing
* or read everything).
*
* @param cookie * @param cookie
* @param requestLen Size of data to read
* @return -@c RETURN_OK to confirm the request for data has been sent. * @return -@c RETURN_OK to confirm the request for data has been sent.
* -@c NO_READ_REQUEST if no request shall be made. readReceivedMessage()
* will not be called in the respective communication cycle.
* - Everything else triggers failure event with returnvalue as parameter 1 * - Everything else triggers failure event with returnvalue as parameter 1
*/ */
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) = 0; virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) = 0;

View File

@ -17,7 +17,7 @@ object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0; object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
CookieIF * comCookie_, size_t maxReplyLen, uint8_t setDeviceSwitch, CookieIF * comCookie_, uint8_t setDeviceSwitch,
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId, uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) : FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE), SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
@ -31,7 +31,6 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN), childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch) transitionSourceSubMode(SUBMODE_NONE), deviceSwitch(setDeviceSwitch)
{ {
this->comCookie->setMaxReplyLen(maxReplyLen);
commandQueue = QueueFactory::instance()-> commandQueue = QueueFactory::instance()->
createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE); createMessageQueue(cmdQueueSize, CommandMessage::MAX_MESSAGE_SIZE);
cookieInfo.state = COOKIE_UNUSED; cookieInfo.state = COOKIE_UNUSED;
@ -540,23 +539,27 @@ void DeviceHandlerBase::doGetWrite() {
} }
void DeviceHandlerBase::doSendRead() { void DeviceHandlerBase::doSendRead() {
ReturnValue_t result; ReturnValue_t result = RETURN_FAILED;
size_t requestLen = 0;
DeviceReplyIter iter = deviceReplyMap.find(cookieInfo.pendingCommand->first); // If the device handler can only request replies after a command
if(iter != deviceReplyMap.end()) { // has been sent, there should be only one reply enabled and the
requestLen = iter->second.replyLen; // correct reply length will be mapped.
} for(DeviceReplyIter iter = deviceReplyMap.begin();
else { iter != deviceReplyMap.end();iter++)
requestLen = comCookie->getMaxReplyLen(); {
if(iter->second.delayCycles != 0) {
requestLen = iter->second.replyLen;
break;
}
} }
result = communicationInterface->requestReceiveMessage(comCookie, requestLen); result = communicationInterface->requestReceiveMessage(comCookie, requestLen);
if (result == RETURN_OK) { if (result == RETURN_OK) {
cookieInfo.state = COOKIE_READ_SENT; cookieInfo.state = COOKIE_READ_SENT;
} }
else if(result == DeviceCommunicationIF::NO_READ_REQUEST) { /* else if(result == DeviceCommunicationIF::NO_READ_REQUEST) {
return; return;
} }*/
else { else {
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result); triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
//We can't inform anyone, because we don't know which command was sent last. //We can't inform anyone, because we don't know which command was sent last.
@ -1288,9 +1291,5 @@ void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_){
void DeviceHandlerBase::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) { void DeviceHandlerBase::debugInterface(uint8_t positionTracker, object_id_t objectId, uint32_t parameter) {
} }
uint32_t DeviceHandlerBase::getLogicalAddress() {
return this->comCookie->getAddress();
}
void DeviceHandlerBase::performOperationHook() { void DeviceHandlerBase::performOperationHook() {
} }

View File

@ -101,7 +101,7 @@ public:
* @param cmdQueueSize * @param cmdQueueSize
*/ */
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
CookieIF * comCookie_, size_t maxReplyLen, uint8_t setDeviceSwitch, CookieIF * comCookie_, uint8_t setDeviceSwitch,
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER, uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER, uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
FailureIsolationBase* fdirInstance = nullptr, size_t cmdQueueSize = 20); FailureIsolationBase* fdirInstance = nullptr, size_t cmdQueueSize = 20);
@ -439,11 +439,6 @@ protected:
*/ */
size_t rawPacketLen = 0; size_t rawPacketLen = 0;
/**
* Size of data to request.
*/
size_t requestLen = 0;
/** /**
* The mode the device handler is currently in. * The mode the device handler is currently in.
* *
@ -463,11 +458,6 @@ protected:
*/ */
uint8_t pstStep = 0; uint8_t pstStep = 0;
/**
* This will be used in the RMAP getRead command as expected length, is set by the constructor, can be modiefied at will.
*/
const uint32_t maxDeviceReplyLen = 0;
/** /**
* wiretapping flag: * wiretapping flag:
* *
@ -526,7 +516,6 @@ protected:
struct DeviceCommandInfo { struct DeviceCommandInfo {
bool isExecuting; //!< Indicates if the command is already executing. bool isExecuting; //!< Indicates if the command is already executing.
uint8_t expectedReplies; //!< Dynamic value to indicate how many replies are expected. Inititated with 0. uint8_t expectedReplies; //!< Dynamic value to indicate how many replies are expected. Inititated with 0.
uint8_t expectedRepliesWhenEnablingReplyMap; //!< Constant value which specifies expected replies when enabling reply map. Inititated in insertInCommandAndReplyMap()
MessageQueueId_t sendReplyTo; //!< if this is != NO_COMMANDER, DHB was commanded externally and shall report everything to commander. MessageQueueId_t sendReplyTo; //!< if this is != NO_COMMANDER, DHB was commanded externally and shall report everything to commander.
}; };
typedef std::map<DeviceCommandId_t, DeviceCommandInfo> DeviceCommandMap; typedef std::map<DeviceCommandId_t, DeviceCommandInfo> DeviceCommandMap;
@ -847,11 +836,6 @@ protected:
*/ */
virtual bool dontCheckQueue(); virtual bool dontCheckQueue();
/**
* Used to retrieve logical address
* @return logicalAddress
*/
virtual uint32_t getLogicalAddress();
Mode_t getBaseMode(Mode_t transitionMode); Mode_t getBaseMode(Mode_t transitionMode);
bool isAwaitingReply(); bool isAwaitingReply();
@ -962,11 +946,6 @@ private:
*/ */
CookieInfo cookieInfo; CookieInfo cookieInfo;
/**
* cached from ctor for initialize()
*/
//const uint32_t logicalAddress = 0;
/** /**
* Used for timing out mode transitions. * Used for timing out mode transitions.
* *

View File

@ -12,8 +12,8 @@ RMAP::RMAP(){
} }
ReturnValue_t RMAP::sendWriteCommand(RMAPCookie *cookie, uint8_t* buffer, ReturnValue_t RMAP::sendWriteCommand(RMAPCookie *cookie, const uint8_t* buffer,
uint32_t length) { size_t length) {
uint8_t instruction; uint8_t instruction;
if ((buffer == NULL) && (length != 0)) { if ((buffer == NULL) && (length != 0)) {
@ -61,7 +61,7 @@ ReturnValue_t RMAP::sendReadCommand(RMAPCookie *cookie, uint32_t expLength) {
} }
ReturnValue_t RMAP::getReadReply(RMAPCookie *cookie, uint8_t **buffer, ReturnValue_t RMAP::getReadReply(RMAPCookie *cookie, uint8_t **buffer,
uint32_t *size) { size_t *size) {
if (cookie->getChannel() == NULL) { if (cookie->getChannel() == NULL) {
return COMMAND_NO_CHANNEL; return COMMAND_NO_CHANNEL;
} }

View File

@ -153,8 +153,8 @@ public:
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write command * - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write command
* - return codes of RMAPChannelIF::sendCommand() * - return codes of RMAPChannelIF::sendCommand()
*/ */
static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, uint8_t* buffer, static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, const uint8_t* buffer,
uint32_t length); size_t length);
/** /**
* get the reply to a write command * get the reply to a write command
@ -204,7 +204,7 @@ public:
* - return codes of RMAPChannelIF::getReply() * - return codes of RMAPChannelIF::getReply()
*/ */
static ReturnValue_t getReadReply(RMAPCookie *cookie, uint8_t **buffer, static ReturnValue_t getReadReply(RMAPCookie *cookie, uint8_t **buffer,
uint32_t *size); size_t *size);
/** /**
* @see sendReadCommand() * @see sendReadCommand()

View File

@ -3,6 +3,7 @@
#include <framework/rmap/RMAPCookie.h> #include <framework/rmap/RMAPCookie.h>
#include <framework/returnvalues/HasReturnvaluesIF.h> #include <framework/returnvalues/HasReturnvaluesIF.h>
#include <cstddef>
class RMAPChannelIF { class RMAPChannelIF {
public: public:
@ -73,7 +74,7 @@ public:
* - @c NOT_SUPPORTED if you dont feel like implementing something... * - @c NOT_SUPPORTED if you dont feel like implementing something...
*/ */
virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction, virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction,
uint8_t *data, uint32_t datalen)=0; const uint8_t *data, size_t datalen)=0;
/** /**
* get the reply to an rmap command * get the reply to an rmap command
@ -92,7 +93,7 @@ public:
* - all RMAP standard replies * - all RMAP standard replies
*/ */
virtual ReturnValue_t getReply(RMAPCookie *cookie, uint8_t **databuffer, virtual ReturnValue_t getReply(RMAPCookie *cookie, uint8_t **databuffer,
uint32_t *len)=0; size_t *len)=0;
/** /**
* *

View File

@ -93,11 +93,11 @@ RMAPCookie::~RMAPCookie() {
} }
//uint32_t RMAPCookie::getMaxReplyLen() const { size_t RMAPCookie::getMaxReplyLen() const {
// return maxReplyLen; return maxReplyLen;
//} }
//
void RMAPCookie::setMaxReplyLen(uint32_t maxReplyLen) { void RMAPCookie::setMaxReplyLen(size_t maxReplyLen) {
this->maxReplyLen = maxReplyLen; this->maxReplyLen = maxReplyLen;
} }

View File

@ -1,12 +1,13 @@
#ifndef RMAPCOOKIE_H_ #ifndef RMAPCOOKIE_H_
#define RMAPCOOKIE_H_ #define RMAPCOOKIE_H_
#include <framework/devicehandlers/Cookie.h> #include <framework/devicehandlers/CookieIF.h>
#include <framework/rmap/rmapStructs.h> #include <framework/rmap/rmapStructs.h>
#include <cstddef>
class RMAPChannelIF; class RMAPChannelIF;
class RMAPCookie : public Cookie { class RMAPCookie : public CookieIF {
public: public:
//To Uli: Sorry, I need an empty ctor to initialize an array of cookies. //To Uli: Sorry, I need an empty ctor to initialize an array of cookies.
RMAPCookie(); RMAPCookie();
@ -28,8 +29,8 @@ public:
void setCommandMask(uint8_t commandMask); void setCommandMask(uint8_t commandMask);
uint8_t getCommandMask(); uint8_t getCommandMask();
//size_t getMaxReplyLen() const; size_t getMaxReplyLen() const;
void setMaxReplyLen(uint32_t maxReplyLen); void setMaxReplyLen(size_t maxReplyLen);
uint16_t getTransactionIdentifier() const; uint16_t getTransactionIdentifier() const;
void setTransactionIdentifier(uint16_t id_); void setTransactionIdentifier(uint16_t id_);

View File

@ -5,43 +5,43 @@
RmapDeviceCommunicationIF::~RmapDeviceCommunicationIF() { RmapDeviceCommunicationIF::~RmapDeviceCommunicationIF() {
} }
ReturnValue_t RmapDeviceCommunicationIF::sendMessage(Cookie* cookie, ReturnValue_t RmapDeviceCommunicationIF::sendMessage(CookieIF *cookie,
uint8_t* data, uint32_t len) { const uint8_t * sendData, size_t sendLen) {
return RMAP::sendWriteCommand((RMAPCookie *) cookie, data, len); return RMAP::sendWriteCommand((RMAPCookie *) cookie, sendData, sendLen);
} }
ReturnValue_t RmapDeviceCommunicationIF::getSendSuccess(Cookie* cookie) { ReturnValue_t RmapDeviceCommunicationIF::getSendSuccess(CookieIF* cookie) {
return RMAP::getWriteReply((RMAPCookie *) cookie); return RMAP::getWriteReply((RMAPCookie *) cookie);
} }
ReturnValue_t RmapDeviceCommunicationIF::requestReceiveMessage( ReturnValue_t RmapDeviceCommunicationIF::requestReceiveMessage(
Cookie* cookie) { CookieIF *cookie, size_t requestLen) {
return RMAP::sendReadCommand((RMAPCookie *) cookie, return RMAP::sendReadCommand((RMAPCookie *) cookie,
((RMAPCookie *) cookie)->getMaxReplyLen()); ((RMAPCookie *) cookie)->getMaxReplyLen());
} }
ReturnValue_t RmapDeviceCommunicationIF::readReceivedMessage(Cookie* cookie, ReturnValue_t RmapDeviceCommunicationIF::readReceivedMessage(CookieIF* cookie,
uint8_t** buffer, uint32_t* size) { uint8_t** buffer, size_t * size) {
return RMAP::getReadReply((RMAPCookie *) cookie, buffer, size); return RMAP::getReadReply((RMAPCookie *) cookie, buffer, size);
} }
ReturnValue_t RmapDeviceCommunicationIF::setAddress(Cookie* cookie, ReturnValue_t RmapDeviceCommunicationIF::setAddress(CookieIF* cookie,
uint32_t address) { uint32_t address) {
((RMAPCookie *) cookie)->setAddress(address); ((RMAPCookie *) cookie)->setAddress(address);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
uint32_t RmapDeviceCommunicationIF::getAddress(Cookie* cookie) { uint32_t RmapDeviceCommunicationIF::getAddress(CookieIF* cookie) {
return ((RMAPCookie *) cookie)->getAddress(); return ((RMAPCookie *) cookie)->getAddress();
} }
ReturnValue_t RmapDeviceCommunicationIF::setParameter(Cookie* cookie, ReturnValue_t RmapDeviceCommunicationIF::setParameter(CookieIF* cookie,
uint32_t parameter) { uint32_t parameter) {
//TODO Empty? //TODO Empty?
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
uint32_t RmapDeviceCommunicationIF::getParameter(Cookie* cookie) { uint32_t RmapDeviceCommunicationIF::getParameter(CookieIF* cookie) {
return 0; return 0;
} }

View File

@ -17,66 +17,73 @@ class RmapDeviceCommunicationIF: public DeviceCommunicationIF {
public: public:
virtual ~RmapDeviceCommunicationIF(); virtual ~RmapDeviceCommunicationIF();
/** /**
* This method is mission specific as the open call will return a mission specific cookie * @brief Device specific initialization, using the cookie.
* * @details
* @param cookie A cookie, can be mission specific subclass of RMAP Cookie * The cookie is already prepared in the factory. If the communication
* @param address The address of the RMAP Cookie * interface needs to be set up in some way and requires cookie information,
* @param maxReplyLen Maximum length of expected reply * this can be performed in this function, which is called on device handler
* @return * initialization.
* @param cookie
* @return -@c RETURN_OK if initialization was successfull
* - Everything else triggers failure event with returnvalue as parameter 1
*/ */
virtual ReturnValue_t open(Cookie **cookie, uint32_t address, virtual ReturnValue_t initializeInterface(CookieIF * cookie) = 0;
uint32_t maxReplyLen) = 0;
/** /**
* Use an existing cookie to open a connection to a new DeviceCommunication. * Called by DHB in the SEND_WRITE doSendWrite().
* The previous connection must not be closed. * This function is used to send data to the physical device
* If the returnvalue is not RETURN_OK, the cookie is unchanged and * by implementing and calling related drivers or wrapper functions.
* can be used with the previous connection. * @param cookie
* @param data
* @param len
* @return -@c RETURN_OK for successfull send
* - Everything else triggers failure event with returnvalue as parameter 1
*/
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
size_t sendLen);
/**
* Called by DHB in the GET_WRITE doGetWrite().
* Get send confirmation that the data in sendMessage() was sent successfully.
* @param cookie
* @return -@c RETURN_OK if data was sent successfull
* - Everything else triggers falure event with returnvalue as parameter 1
*/
virtual ReturnValue_t getSendSuccess(CookieIF *cookie);
/**
* Called by DHB in the SEND_WRITE doSendRead().
* It is assumed that it is always possible to request a reply
* from a device.
* *
* @param cookie * @param cookie
* @param address * @return -@c RETURN_OK to confirm the request for data has been sent.
* @param maxReplyLen * -@c NO_READ_REQUEST if no request shall be made. readReceivedMessage()
* @return * will not be called in the respective communication cycle.
* - Everything else triggers failure event with returnvalue as parameter 1
*/ */
virtual ReturnValue_t reOpen(Cookie *cookie, uint32_t address, virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen);
uint32_t maxReplyLen) = 0;
/** /**
* Closing call of connection and free memory of cookie. * Called by DHB in the GET_WRITE doGetRead().
* Mission dependent call * This function is used to receive data from the physical device
* by implementing and calling related drivers or wrapper functions.
* @param cookie * @param cookie
* @param data
* @param len
* @return @c RETURN_OK for successfull receive
* - Everything else triggers failure event with returnvalue as parameter 1
*/ */
virtual void close(Cookie *cookie) = 0; virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
size_t *size);
//SHOULDDO can data be const? ReturnValue_t setAddress(CookieIF* cookie,
/** uint32_t address);
* uint32_t getAddress(CookieIF* cookie);
* ReturnValue_t setParameter(CookieIF* cookie,
* @param cookie Expects an RMAPCookie or derived from RMAPCookie Class uint32_t parameter);
* @param data Data to be send uint32_t getParameter(CookieIF* cookie);
* @param len Length of the data to be send
* @return - Return codes of RMAP::sendWriteCommand()
*/
virtual ReturnValue_t sendMessage(Cookie *cookie, uint8_t *data,
uint32_t len);
virtual ReturnValue_t getSendSuccess(Cookie *cookie);
virtual ReturnValue_t requestReceiveMessage(Cookie *cookie);
virtual ReturnValue_t readReceivedMessage(Cookie *cookie, uint8_t **buffer,
uint32_t *size);
virtual ReturnValue_t setAddress(Cookie *cookie, uint32_t address);
virtual uint32_t getAddress(Cookie *cookie);
virtual ReturnValue_t setParameter(Cookie *cookie, uint32_t parameter);
virtual uint32_t getParameter(Cookie *cookie);
}; };
#endif /* MISSION_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ */ #endif /* MISSION_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ */