mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-21 22:50:55 +00:00
Added a client transfer context for use by the control marshaling function
This commit is contained in:
parent
de09ddbe09
commit
fae30398b2
@ -307,7 +307,7 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
|
|
||||||
JsonObject item = items.createNestedObject();
|
JsonObject item = items.createNestedObject();
|
||||||
elementcount++;
|
elementcount++;
|
||||||
control->MarshalControl(item, InUpdateMode);
|
control->MarshalControl(item, InUpdateMode, ClientTransferContext);
|
||||||
|
|
||||||
if (rootDoc.overflowed())
|
if (rootDoc.overflowed())
|
||||||
{
|
{
|
||||||
@ -315,6 +315,7 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
if (1 == elementcount)
|
if (1 == elementcount)
|
||||||
{
|
{
|
||||||
Serial.println(String(F("ERROR: prepareJSONChunk: Control ")) + String(control->id) + F(" is too large to be sent to the browser."));
|
Serial.println(String(F("ERROR: prepareJSONChunk: Control ")) + String(control->id) + F(" is too large to be sent to the browser."));
|
||||||
|
// Serial.println(String(F("ERROR: prepareJSONChunk: value: ")) + control->value);
|
||||||
rootDoc.clear();
|
rootDoc.clear();
|
||||||
item = items.createNestedObject();
|
item = items.createNestedObject();
|
||||||
control->MarshalErrorMessage(item);
|
control->MarshalErrorMessage(item);
|
||||||
@ -330,7 +331,6 @@ uint32_t ESPUIclient::prepareJSONChunk(uint16_t startindex,
|
|||||||
}
|
}
|
||||||
// exit the loop
|
// exit the loop
|
||||||
control = nullptr;
|
control = nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,12 @@ public:
|
|||||||
ReloadNeeded = 3,
|
ReloadNeeded = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ClientTransferContext_t
|
||||||
|
{
|
||||||
|
void *control = nullptr;
|
||||||
|
uint16_t Offset = 0;
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// bool HasBeenNotified = false; // Set when a notification has been sent and we are waiting for a reply
|
// bool HasBeenNotified = false; // Set when a notification has been sent and we are waiting for a reply
|
||||||
// bool DelayedNotification = false; // set if a delayed notification is needed
|
// bool DelayedNotification = false; // set if a delayed notification is needed
|
||||||
@ -39,7 +45,8 @@ protected:
|
|||||||
fsm_EspuiClient_state* pCurrentFsmState = &fsm_EspuiClient_state_Idle_imp;
|
fsm_EspuiClient_state* pCurrentFsmState = &fsm_EspuiClient_state_Idle_imp;
|
||||||
|
|
||||||
time_t EspuiClientEndTime = 0;
|
time_t EspuiClientEndTime = 0;
|
||||||
|
ClientTransferContext_t ClientTransferContext;
|
||||||
|
|
||||||
// bool NeedsNotification() { return pCurrentFsmState != &fsm_EspuiClient_state_Idle_imp; }
|
// bool NeedsNotification() { return pCurrentFsmState != &fsm_EspuiClient_state_Idle_imp; }
|
||||||
|
|
||||||
bool CanSend();
|
bool CanSend();
|
||||||
|
Loading…
Reference in New Issue
Block a user