#ifndef COAP_H #define COAP_H #include "Arduino.h" namespace coap { enum Type { CONFIRMABLE = 0, NON_CONFIRMABLE = 1, ACKNOWELEDGMENT = 2, RESET = 3 }; enum Code { EMPTY = 0x00, /* 0.00 */ GET = 0x01, /* 0.01 */ POST = 0x02, /* 0.02 */ PUT = 0x03, /* 0.03 */ DELETE = 0x04, /* 0.04 */ CONTENT = 0x45, /* 2.05 */ NOT_FOUND = 0x84,/*4.04 */ METHOD_NOT_ALLOWED = 0x85 /* 4.05 */ }; class CoapMessage { private: char vertkl; char code; char id[2]; public: uint8_t getVersion(); uint8_t getType(); uint8_t getTKL(); uint8_t getCode(); const char* getMID(); const char* getPayload(); int getOptionDelta(const unsigned char* option); int getOptionLength(const unsigned char* option); const char* getOptionValue(const unsigned char* option); int getOptionValueOffset(const unsigned char* option); const unsigned char* getOptions(); void getUriPath(char* output_buffer, const char* last); }; int coap_server(char* output_buffer, const char* input_buffer, int len); } #endif