forked from mohr/ArduinoIO
27 lines
672 B
C
27 lines
672 B
C
|
#ifndef DLEENCODER_H_
|
||
|
#define DLEENCODER_H_
|
||
|
|
||
|
#include "HasReturnvaluesIF.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
class DleEncoder: public HasReturnvaluesIF {
|
||
|
private:
|
||
|
DleEncoder();
|
||
|
virtual ~DleEncoder();
|
||
|
|
||
|
public:
|
||
|
static const uint8_t STX = 0x02;
|
||
|
static const uint8_t ETX = 0x03;
|
||
|
static const uint8_t DLE = 0x10;
|
||
|
|
||
|
static ReturnValue_t decode(const uint8_t *sourceStream,
|
||
|
size_t sourceStreamLen, size_t *readLen, uint8_t *destStream,
|
||
|
size_t maxDestStreamlen, size_t *decodedLen);
|
||
|
|
||
|
static ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen,
|
||
|
uint8_t *destStream, size_t maxDestLen, size_t *encodedLen,
|
||
|
bool addStxEtx = true);
|
||
|
};
|
||
|
|
||
|
#endif /* DLEENCODER_H_ */
|