2016-06-15 23:48:41 +02:00
|
|
|
#ifndef DEVICECOMMUNICATIONIF_H_
|
|
|
|
#define DEVICECOMMUNICATIONIF_H_
|
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
#include <framework/devicehandlers/CookieIF.h>
|
2016-06-15 23:48:41 +02:00
|
|
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
|
|
|
|
class DeviceCommunicationIF: public HasReturnvaluesIF {
|
|
|
|
public:
|
2018-07-12 16:29:32 +02:00
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_COMMUNICATION_IF;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
static const ReturnValue_t INVALID_COOKIE_TYPE = MAKE_RETURN_CODE(0x01);
|
|
|
|
static const ReturnValue_t NOT_ACTIVE = MAKE_RETURN_CODE(0x02);
|
|
|
|
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0x03);
|
|
|
|
static const ReturnValue_t TOO_MUCH_DATA = MAKE_RETURN_CODE(0x04);
|
|
|
|
static const ReturnValue_t NULLPOINTER = MAKE_RETURN_CODE(0x05);
|
|
|
|
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x06);
|
|
|
|
static const ReturnValue_t CANT_CHANGE_REPLY_LEN = MAKE_RETURN_CODE(0x07);
|
|
|
|
|
|
|
|
virtual ~DeviceCommunicationIF() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t open(CookieIF **cookie, uint32_t address,
|
2016-06-15 23:48:41 +02:00
|
|
|
uint32_t maxReplyLen) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Use an existing cookie to open a connection to a new DeviceCommunication.
|
|
|
|
* The previous connection must not be closed.
|
|
|
|
* If the returnvalue is not RETURN_OK, the cookie is unchanged and
|
|
|
|
* can be used with the previous connection.
|
|
|
|
*
|
|
|
|
* @param cookie
|
|
|
|
* @param address
|
|
|
|
* @param maxReplyLen
|
|
|
|
* @return
|
|
|
|
*/
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t reOpen(CookieIF *cookie, uint32_t address,
|
2016-06-15 23:48:41 +02:00
|
|
|
uint32_t maxReplyLen) = 0;
|
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual void close(CookieIF *cookie) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
//SHOULDDO can data be const?
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t sendMessage(CookieIF *cookie, uint8_t *data,
|
2016-06-15 23:48:41 +02:00
|
|
|
uint32_t len) = 0;
|
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
2016-06-15 23:48:41 +02:00
|
|
|
uint32_t *size) = 0;
|
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t setAddress(CookieIF *cookie, uint32_t address) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual uint32_t getAddress(CookieIF *cookie) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual ReturnValue_t setParameter(CookieIF *cookie, uint32_t parameter) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2020-04-18 14:10:38 +02:00
|
|
|
virtual uint32_t getParameter(CookieIF *cookie) = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* DEVICECOMMUNICATIONIF_H_ */
|