#ifndef SRC_SAM_MESSAGE_H_
#define SRC_SAM_MESSAGE_H_
#include <stdint.h>
#include <klog.h>

class SAMmsg
{
	cKlog logger;
	static uint16_t getCRC(uint8_t *buffer, int len);

	static int getDataFromASCII(uint8_t *ascii_in, int ascii_len, uint8_t *data);

public:
	uint8_t source;
	uint8_t destination;
	uint8_t sequenceNumber;
	uint8_t command;
	uint8_t length;
	uint8_t *data;

	SAMmsg();
	SAMmsg(
			uint8_t src,
			uint8_t dest,
			uint8_t seq,
			uint8_t cmd,
			uint8_t len,
			uint8_t *data
	);
	virtual ~SAMmsg();

	static SAMmsg *parse(uint8_t *buffer, int buffer_len);
	int getBytes(uint8_t *buffer, int buffer_len);
	void print();
};

#endif /* SRC_SAM_MESSAGE_H_ */
