New firmware WIP
This commit is contained in:
parent
6a724b284f
commit
ce4fa96771
|
@ -15,7 +15,6 @@ const char TypeToMsgPackCode<int8_t>::CODE = '\xd0';
|
|||
const char TypeToMsgPackCode<int16_t>::CODE = '\xd1';
|
||||
const char TypeToMsgPackCode<int32_t>::CODE = '\xd2';
|
||||
|
||||
|
||||
template<typename Writer>
|
||||
class StreamingMsgPackEncoder
|
||||
{
|
||||
|
@ -125,3 +124,36 @@ private:
|
|||
uint32_t contentLength;
|
||||
bool sizeCountMode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename Writer>
|
||||
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<typename T>
|
||||
void sendInt(T value) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
StreamingMsgPackEncoder<Writer> encoder_;
|
||||
uint32_t offset_;
|
||||
uint32_t maxSize_;
|
||||
uint32_t sent_;
|
||||
};
|
||||
|
|
|
@ -54,7 +54,10 @@ void httpSetup(SessionManager<Session_T> * sessionManager)
|
|||
sessionManager->stopMeasurements();
|
||||
});
|
||||
server.on("/api/session/data", HTTP_GET, [sessionManager](AsyncWebServerRequest * req) {
|
||||
//TODO
|
||||
StreamingMsgPackEncoder<HttpWriterAdaptor> encoder(&adaptor);
|
||||
|
||||
req->send_P(200, "application/x-msgpack", const uint8_t * content, size_t len)
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue