Merge remote-tracking branch 'origin/mueller_CookieToCookieIF' into mueller_newDeviceCommunicationIF

This commit is contained in:
2020-04-19 15:30:14 +02:00
7 changed files with 60 additions and 36 deletions

View File

@ -1,10 +0,0 @@
#ifndef COOKIE_H_
#define COOKIE_H_
class Cookie{
public:
virtual ~Cookie(){}
};
#endif /* COOKIE_H_ */

34
devicehandlers/CookieIF.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef COOKIE_H_
#define COOKIE_H_
#include <cstdint>
/**
* @brief Physical address type
*/
typedef std::uint32_t address_t;
/**
* @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 @code{.cpp} CookieIF* childCookie = new ChildCookie(...)
* @endcode .
*
* [not implemented yet]
* 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 CookieIF {
public:
virtual ~CookieIF() {};
};
#endif /* COOKIE_H_ */

View File

@ -2,7 +2,6 @@
#define DEVICECOMMUNICATIONIF_H_
#include <framework/devicehandlers/CookieIF.h>
#include <framework/devicehandlers/DeviceHandlerIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
/**
* @defgroup interfaces Interfaces
@ -78,7 +77,7 @@ public:
* - Everything else triggers failure event with returnvalue as parameter 1
*/
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData,
size_t sendLen) = 0;
uint32_t sendLen) = 0;
/**
* Called by DHB in the GET_WRITE doGetWrite().
@ -103,7 +102,8 @@ public:
* - 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,
uint32_t requestLen) = 0;
/**
* Called by DHB in the GET_WRITE doGetRead().
@ -120,7 +120,7 @@ public:
* returnvalue as parameter 1
*/
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
size_t *size) = 0;
uint32_t *size) = 0;
};
#endif /* DEVICECOMMUNICATIONIF_H_ */

View File

@ -244,7 +244,7 @@ protected:
/**
* Cookie used for communication
*/
Cookie *cookie;
CookieIF *cookie;
/**
* The MessageQueue used to receive device handler commands and to send replies.