-
first of all thanks for your efforts for this lib and all other contributions however in new lib. I can't find out how to implement same logic on stream here is the code used in old lib void streamCallback(FirebaseStream data)
{
#ifdef ENABLE_DEBUG_MODE
Serial.printf("sream path, %s\nevent path, %s\ndata type, %s\nevent type, %s\n\n",
data.streamPath().c_str(),
data.dataPath().c_str(),
data.dataType().c_str(),
data.eventType().c_str());
printResult(data); // see addons/RTDBHelper.h
Serial.println();
// This is the size of stream payload received (current and max value)
// Max payload size is the payload size under the stream path since the stream connected
// and read once and will not update until stream reconnection takes place.
// This max value will be zero as no payload received in case of ESP8266 which
// BearSSL reserved Rx buffer size is less than the actual stream payload.
Serial.printf("Received stream payload size: %d (Max. %d)\n\n", data.payloadLength(), data.maxPayloadLength());
Serial.println();
#endif
FirebaseJson *json = data.to<FirebaseJson *>();
// Print all object data
#ifdef ENABLE_DEBUG_MODE
Serial.println((const char *)FPSTR("Pretty printed JSON data:"));
json->toString(Serial, true);
Serial.println();
Serial.println((const char *)FPSTR("Iterate JSON data:"));
Serial.println();
#endif
size_t len = json->iteratorBegin();
FirebaseJson::IteratorValue value;
for (size_t i = 0; i < len; i++)
{
value = json->valueAt(i);
#ifdef ENABLE_DEBUG_MODE
Serial_Printf((const char *)FPSTR("%d, Type: %s, Name: %s, Value: %s\n"), i, value.type == FirebaseJson::JSON_OBJECT ? (const char *)FPSTR("object") : (const char *)FPSTR("array"), value.key.c_str(), value.value.c_str());
#endif
StreamHolder(value.key, value.value); // this is my logic handler (too speed there is nothing take much memory here)
}
json->iteratorEnd();
json->clear();
dataChanged = true;
} i found this discussion talk about same thing but it's too old, are you updated this part or something or just use arduino Json lib and again thanks for your efforts it's insane . |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
As stated in documentation, the APIs and concept of this library and old libraries are different, and you cannot migrate from the old code. You can learn how to use it from provided examples and read the documentation thoroughly for the details. |
Beta Was this translation helpful? Give feedback.
As stated in documentation, the APIs and concept of this library and old libraries are different, and you cannot migrate from the old code. You can learn how to use it from provided examples and read the documentation thoroughly for the details.