diff --git a/lib/session/StreamingMsgPackEncoder.h b/lib/session/StreamingMsgPackEncoder.h index efef8cd..9b42421 100644 --- a/lib/session/StreamingMsgPackEncoder.h +++ b/lib/session/StreamingMsgPackEncoder.h @@ -15,7 +15,6 @@ const char TypeToMsgPackCode::CODE = '\xd0'; const char TypeToMsgPackCode::CODE = '\xd1'; const char TypeToMsgPackCode::CODE = '\xd2'; - template class StreamingMsgPackEncoder { @@ -125,3 +124,36 @@ private: uint32_t contentLength; bool sizeCountMode; }; + + + +template +class ChunkedStreamingMsgPackEncoder +{ +public: + ChunkedStreamingMsgPackEncoder(Writer * writer_, uint32_t offset, uint32_t maxSize) + : encoder_(writer_), offset_(offset), maxSize_(maxSize), sent_(0) + {} + + void sendMap16(byte size) { + // check if it fits, using separate object + encoder_.setSizeCountMode(true); + } + + void sendString255(PGM_P s) { + + } + + template + void sendInt(T value) { + + } + + + +private: + StreamingMsgPackEncoder encoder_; + uint32_t offset_; + uint32_t maxSize_; + uint32_t sent_; +}; diff --git a/src/firmware_main.cpp b/src/firmware_main.cpp index a6a5922..46a50ba 100644 --- a/src/firmware_main.cpp +++ b/src/firmware_main.cpp @@ -54,7 +54,10 @@ void httpSetup(SessionManager * sessionManager) sessionManager->stopMeasurements(); }); server.on("/api/session/data", HTTP_GET, [sessionManager](AsyncWebServerRequest * req) { - //TODO + StreamingMsgPackEncoder encoder(&adaptor); + + req->send_P(200, "application/x-msgpack", const uint8_t * content, size_t len) + });