Firebase Upload Int but Retreived as Long
Firebase Realtime Database Arduino Library for ESP8266
This library supports ESP8266 MCU from Espressif. The following are platforms in which libraries are also available.
-
ESP32 Firebase Arduino library
-
Arduino MKR WiFi 1010, Arduino MKR VIDOR 4000 and Arduino UNO WiFi Rev.2
-
Arduino WiFi Shield 101 and Arduino MKR1000 WIFI
New library for ESP8266 and ESP32 is available
The unified version for ESP8266 and ESP32 with Deject Storage and new Deject Messaging supported is at present bachelor.
Delight endeavor it here https://github.com/mobizt/Firebase-ESP-Client
Tested Devices
- Wemos D1 Mini
- NodeMCU
- ESP-12F
- LinkNode
Other Arduino Devices supported using external Clients.
Since version 3.8.four, library allows yous to apply external Arduino Clients network interfaces e.m. WiFiClient, EthernetClient and GSMClient, the Arduino supported devices that have enough flash size (> 128k) and memory tin can now use this library.
To use external Client, encounter the ExternalClient examples.
The authentication with OAuth2.0 and custom auth tokens, RTDB mistake queue and downloadFileOTA features are not supported for other Arduino devices using external Clients.
The flash and SD filesystems supports depend on the devices and third party filesystems libraries installed.
Features
-
Complete and secure Firebase RTDB's Residual APIs Client
-
Supports database read, shop, update, delete and value changes listener
-
Supports Test Mode (No Auth)
-
Supports Firmware OTA updates
-
Supports Firebase Deject Messaging.
-
Born JSON editor and deserializer.
-
Supports external Heap via SRAM/PSRAM.
-
Supports ethernet using ENC28J60, W5100 and W5500 Ethernet modules.
Known bugs
From known bugs of BearSSL library in ESP8266 Arduino Core SDK version ii.6.i.
If you lot're using this SDK version, please update the ESP8266 Arduino Cadre SDK to version 2.6.two or newer.
Basic Examples
Don't be confused with other Firebase Arduino libraries, this library has different working functions, the following examples provide the basic usages.
IoT using Firebase and NodeMCU © CC BY-NC-SA
ESP32 | FLUTTER | FIREBASE - Temperature & Humidity Check App <-- *For ESP32 which similar to ESSP8266 unless the include header file, use #include <FirebaseESP8266.h> instead
Serverless IoTs with Firebase Realtime Database and ESP8266 - Function 1
Serverless IoTs with Firebase Realtime Database and ESP8266 - Part 2
Dependencies
This library required ESP8266 Core SDK version two.six.2 and above.
For Arduino IDE, ESP8266 Core SDK can be installed through Boards Manager.
For PlatfoemIO IDE, ESP8266 Core SDK tin be installed through PIO Dwelling > Platforms > Espressif 8266.
Installation
Using Library Manager
At Arduino IDE, get to menu Sketch -> Include Library -> Manage Libraries...
In Library Director Window, search "firebase" in the search form and so select "Firebase ESP8266 Client".
Click "Install" button.
For PlatformIO IDE, using the following command.
pio lib install "Firebase ESP8266 Client""
Or at PIO Home -> Library -> Registry and then search Firebase ESP8266 Client.
If you always installed this library in Global storage in PlatformIO version prior to v2.0.0 and you have updated the PlatformIO to v2.0.0 and later, the global library installation was not available, the sources files of old library version still be able to search by the library dependency finder (LDF), you needed to remove the library from binder C:\Users\<UserName>\.platformio\lib to prevent unexpected behavior when compile and run.
Manual installation
For Arduino IDE, download zippo file from the repository (Github page) by select Code dropdown at the top of repository, select Download Cypher
From Arduino IDE, select bill of fare Sketch -> Include Library -> Add .ZIP Library....
Choose Firebase-ESP8266-primary.cipher that previously downloaded.
Rename Firebase-ESP8266-primary folder to Firebase_ESP8266_Client.
Go to carte du jour Files -> Examples -> Firebase-ESP8266-master and cull one from examples.
For PlatformIO, in binder "lib", create new folder named "Firebase-ESP8266" and add these files in that folder.
Important Note for Transmission Installation in Arduino IDE
Folder renaming to Firebase_ESP8266_Client was required for making the library tin be updated via Library Manager without problems.
Without binder renaming, when yous update the library via Library Manager, library will be updated to the another binder named Firebase_ESP8266_Client which leads to compilation fault when in that location are two different versions of library found in the libraries folder and can cause the conflicts when file structures and functions changed in the newer version.
For example, the library version 3.vii.5 and before were installed manually by downloading Naught file and extracted to Firebase-ESP8266-primary folder. If the library was later updated to v3.8.2 and newer via Library Manager, the compilation error will take place because the newer version files structures and functions changed and compiler is trying to compile these two versions of source files together.
In this case, you demand to delete Firebase-ESP8266-primary folder from libraries binder.
Usages
See all examples for complete usages.
See function description for all bachelor functions.
Initialization
//Include ESP8266WiFi.h #include <ESP8266WiFi.h> //Include Firebase ESP8266 library (this library) #include <FirebaseESP8266.h> //Ascertain the Firebase Information object FirebaseData fbdo; // Define the FirebaseAuth data for authentication information FirebaseAuth auth; // Define the FirebaseConfig data for config data FirebaseConfig config; // Assign the project host and api key (required) config.host = FIREBASE_HOST; config.api_key = API_KEY; // Assign the user sign in credentials auth.user.email = USER_EMAIL; auth.user.password = USER_PASSWORD; //Initialize the library with the Firebase authen and config. Firebase.begin(&config, &auth); //Optional, prepare AP reconnection in setup() Firebase.reconnectWiFi(true); //Optional, set number of error retry Firebase.setMaxRetry(fbdo, 3); //Optional, set number of error resumable queues Firebase.setMaxErrorQueue(fbdo, 30); //Optional, utilise classic HTTP GET and Post requests. //This option allows get and delete functions (PUT and DELETE HTTP requests) works for //device connected behind the Firewall that allows just GET and POST requests. Firebase.enableClassicRequest(fbdo, true); //Optional, set the size of BearSSL WiFi to receive and transmit buffers //Firebase may not support the information transfer fragmentation, you may need to reserve the buffer to match //the data to be transported. fbdo.setBSSLBufferSize(1024, 1024); //minimum size is 512 bytes, maximum size is 16384 bytes //Optional, set the size of HTTP response buffer //Forbid out of retentiveness for large payload simply information may be truncated and can't determine its type. fbdo.setResponseSize(1024); //minimum size is 1024 bytes
Run across other hallmark examples for more sign in methods.
Retention Options for ESP8266
When you update the ESP8266 Arduino Core SDK to v3.0.0, the memory can be configurable from IDE.
You can choose the Heap memory between internal and external memory chip from IDE e.yard. Arduino IDE and PlatformIO on VSCode or Atom IDE.
Arduino IDE
For ESP8266 devices that don't non take external SRAM/PSRAM flake installed, choose the MMU option 3, 16KB cache + 48KB IRAM and 2nd Heap (shared).
For ESP8266 devices that have external 23LC1024 SRAM chip installed, choose the MMU selection 5, 128K External 23LC1024.
For ESP8266 devices that take external ESP-PSRAM64 chip installed, choose the MMU option 6, 1M External 64 MBit PSRAM.
PlatformIO IDE
The MMU options can be selected from build_flags in your project's platformio.ini file
For ESP8266 devices that don't not have external SRAM/PSRAM chip installed, add build flag as below.
[env:d1_mini] platform = espressif8266 build_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED board = d1_mini framework = arduino monitor_speed = 115200
For ESP8266 devices that have external 23LC1024 SRAM chip installed, add build flag as below.
[env:d1_mini] platform = espressif8266 ;128K External 23LC1024 build_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_EXTERNAL_128K board = d1_mini framework = arduino monitor_speed = 115200
For ESP8266 devices that have external ESP-PSRAM64 chip installed, add build flag equally below.
[env:d1_mini] platform = espressif8266 ;1M External 64 MBit PSRAM build_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_EXTERNAL_1024K board = d1_mini framework = arduino monitor_speed = 115200
ESP8266 andd SRAM/PSRAM Chip connectedness
Nearly ESP8266 modules don't have the built-in SRAM/PSRAM on board. External retentivity scrap connection tin can be done via SPI port as below.
23LC1024/ESP-PSRAM64 ESP8266 CS (Pin one) GPIO15 SCK (Pin 6) GPIO14 MOSI (Pin 5) GPIO13 MISO (Pin two) GPIO12 /Concord (Pin seven on 23LC1024 merely) 3V3 Vcc (Pin 8) 3V3 Vcc (Pin 4) GND
Once the external Heap retentivity was selected in IDE, to permit the library to utilize the external retention, you tin set it in FirebaseFS.h by define this macro.
#define FIREBASE_USE_PSRAM
This macro was defined by default when you installed or update the library.
Authentication
This library supports many types of authentications.
See other authentication examples for more hallmark methods.
Some hallmark methods require the token generaion and exchanging process which take more fourth dimension than using the legacy token.
The organisation fourth dimension must be gear up before authenticate using the custom and OAuth2.0 tokens or when the root certificate was fix for data transfer.
The authentication with custom and OAuth2.0 tokens takes the time, several seconds in overall procedure which included the NTP time conquering (system fourth dimension setup), JWT token generation and signing procedure.
By setting the system time prior to calling the Firebase.begin
, the internal NTP time conquering process will be ignored.
Y'all tin gear up the system time using the RTC bit or manually by calling Firebase.setSystemTime
.
While authenticate using Email and password, the procedure volition be perform faster because no token generation and time setup required.
The authenticate using the legacy token (database hole-and-corner) does not have these filibuster time because the token is ready to use.
Speed of data transfer
This library focuses on the user privacy and user data protection which follows Google authentication processes. Setting the security rules to let public access read and write, is not recommended even the data transmision time in this instance was significantly reduced equally it does not crave any auth token so the overall information size was reduced, but anyone can steal, change, or delete information in your database.
Once the auth token is importance and when it was created and ready for authentication procedure, the data transmission time will depend on the fourth dimension used in SSL/TLS handshake process (only for new session opening), the size of http header (included auth token size) and payload to be transmitted and the SSL client buffer reserved size specially in ESP8266.
The legacy token size is relatively pocket-size, only 40 bytes, upshot in smallest header to send, while the size of id token generated using Electronic mail/Password is quite large, approx. 900 bytes. result in larger header to send.
There is a compromise betwixt the speed of data transfer and the Rx/Tx buffer which so reduced the free retentivity available specially in ESP8266.
When the reserved SSL customer Rx/Tx buffer is smaller than the size of data to exist transmitted, the data need to be sent as multiple chunks which required more manual fourth dimension.
This affected especially in ESP8266 which has the limited gratuitous retentiveness.
To speed up the data manual in ESP8266, the larger reserved Rx/Tx buffer size is necessary.
The reserved SSL Rx/Tx buffer size in ESP8266 can be fix through the function <Firebase Data object>.setBSSLBufferSize, e.g. fbdo.setBSSLBufferSize(2048, 2048);
The larger BearSSL buffer reserved for ESP8266, the lower free retentiveness available every bit long as the session opened (server connexion).
Therefore the time for information transfer will be varied from approx. neary 200 ms to 500 ms based on the reserved SSL client Rx/Tx buffer size and the size of data to transmit.
In ESP8266, when the free retentivity and speed are concerned, the legacy token should be used instead of other authentication to reduce the header size and the lower SSL Rx/Tx buffer i.e. 1024 for Rx and 512 for Tx are plenty.
When the session was reused (in this library), the SSL handshake process volition be ignored in the subsequence requests.
The session was close when the host or ip changes or server airtight or the session timed out in 3 minutes.
When the new session need to be opened, the SSL handshake will exist processed over again and used the time approx 1 - two seconds to be washed.
For post (push) or put (set up) request in RTDB, to speed up the data transfer, employ pushAsync or setAsync instead.
With pushAsync and setAsync, the payload response will be ignored and the next data will be candy immediately.
Access in Test Manner (No Auth)
In Test Way, token generation volition be ignored and no hallmark applied to the request.
You can access RTDB database in Test Mode by set the security rules like this.
{ "rules": { ".read": true, ".write": true } }
And set the config.signer.test_mode = true;
, encounter TestMode.ino case.
The authenication credentials and prerequisites
To use Email/Countersign sign-in authentication as in the examples, the Email/Password Sign-in provider must be enabled.
Add Email and password for first user in your projection and so apply this Email and password to sign in.
To use Anonymous sign-in, the Anonymous Sign-in provider must be enabled past follow the below steps.
To go API Cardinal used in Email/Password sign-in
To get the Service accounts key JSON file used in Custom and OAuth2.0 tokens athentications.
For RTDB usages, create new existent-time database (if not setup yet)
Edit the default database rules as following
{ "rules": { ".read": "auth != zero" , ".write": "auth != zippo" } }
To get the database URL and secret (legacy token).
For server SSL hallmark past providing the server root certificate.
Server SSL certificate verification is the process to ensure that the server that client is existence connected is a trusted (valid) server instead of fake server.
The Google's GlobalSign R2 root certificate can be download from https://pki.goog/repository/
Select the .PEM (base-64 encoded string) or .DER (binary) file to download.
From the exam as of July 2021, GlobalSign Root CA was missing from Google server, the certificate chain, GTS Root R1 tin can be used instead of root certificate.
Below is how to assign the certificate data for server verification.
/* In case the certificate data was used */ config.cert.data = rootCACert; //Or custom fix the root certificate for each FirebaseData object fbdo.setCert(rootCACert); /* Or assign the certificate file */ /** From the test every bit of July 2021, GlobalSign Root CA was missing from Google server * as described in a higher place, GTS Root R1 (gsr1.pem or gsr1.der) can be used instead. * ESP32 Arduino SDK supports PEM format but even mBedTLS supports DER format too. * ESP8266 SDK supports both PEM and DER format certificates. */ //config.cert.file = "/gsr1.pem"; //config.cert.file_storage = StorageType::Flash; //or StorageType::SD
Excludes the unused classes to save retention
The internal classes, RTDB and FCM in this library can be excluded or disabled to save memory usage through FirebaseFS.h.
Past annotate the following macros.
ENABLE_RTDB
ENABLE_FCM
To disable OTA update, annotate this macro.
ENABLE_OTA_FIRMWARE_UPDATE
Read Data
Information at a specific node in Firebase RTDB tin be read through these get functions.
The functions included become
, getInt
, getFloat
, getDouble
, getBool
, getString
, getJSON
, getArray
, getBlob
, getFile
.
These functions return boolean value indicates the success of the operation which will be true
if all of the following weather condition were met.
-
Server returns HTTP status code 200
-
The data types matched between request and response.
For generic go, use Firebase.get(fbdo, <path>).
And check its type with fbdo.dataType() or fbdo.dataTypeEnum() and cast the value from it eastward.g. fbdo.to<int>(), fbdo.to<std::cord>().
The data type of returning payload can be determined past fbdo.dataType()
which returns String or fbdo.dataTypeEnum()
returns enum value.
The String of type returns from fbdo.dataType()
can be cord, boolean, int, float, double, json, array, hulk, file and aught.
The enum value blazon, fb_esp_rtdb_data_type returns from fbdo.dataTypeEnum()
tin can be fb_esp_rtdb_data_type_null (1), fb_esp_rtdb_data_type_integer, fb_esp_rtdb_data_type_float, fb_esp_rtdb_data_type_double, fb_esp_rtdb_data_type_boolean, fb_esp_rtdb_data_type_string, fb_esp_rtdb_data_type_json, fb_esp_rtdb_data_type_array, fb_esp_rtdb_data_type_blob, and fb_esp_rtdb_data_type_file (10)
The database data's payload (response) can exist read or access through the casting value from FirebaseData object with to<blazon>() functions (since v2.4.0).
-
String s = fbdo.to<String>();
-
std::string _s = fbdo.to<std::string>();
-
const char *str = fbdo.to<const char *>();
-
bool b = fbdo.to<bool>();
-
int16_t _i = fbdo.to<int16_t>();
-
int i = fbdo.to<int>();
-
double d = fbdo.to<double>();
-
float f = fbdo.to<float>();
-
FirebaseJson *json = fbdo.to<FirebaseJson *>();
or -
FirebaseJson &json = fbdo.to<FirebaseJson>();
-
FirebaseJsonArray *arr = fbdo.to<FirebaseJsonArray *>();
or -
FirebaseJsonArray &arr = fbdo.to<FirebaseJsonArray>();
-
std::vector<uint8_t> *hulk = fbdo.to<std::vector<uint8_t> *>();
-
File file = fbdo.to<File>();
Or through the legacy methods
-
int i = fbdo.intData();
-
bladder f = fbdo.floatData();
-
double d = fbdo.doubleData();
-
bool b = fbdo.boolData();
-
String s = fbdo.stringData();
-
String js = fbdo.jsonString();
-
FirebaseJson &json = fbdo.jsonObject();
-
FirebaseJson *jsonPtr = fbdo.jsonObjectPtr();
-
FirebaseJsonArray &arr = fbdo.jsonArray();
-
FirebaseJsonArray *arrPtr = fbdo.jsonArrayPtr();
-
std::vector<uint8_t> blob = fbdo.blobData();
-
File file = fbdo.fileStream();
Read the data which its type does not friction match the data type in the database from in a higher place functions will return empty (string, object or array).
Hulk and file stream data are stored as special base64 encoded string which are only supported and implemented by this library.
The encoded base64 string will exist prefixed with some header string ("file,base64," and "hulk,base64,") for data type manipulation.
The following example showed how to read integer value from node "/test/int".
if (Firebase.getInt(fbdo, "/examination/int" )) { if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_integer) { Serial.println(fbdo.to<int>()); } } else { Serial.println(fbdo.errorReason()); }
Shop Data
To store data at a specific node in Firebase RTDB, apply these fix functions.
The office included set
, setInt
, setFloat
, setDouble
, setBool
, setString
, setJSON
, setArray
, setBlob
and setFile
.
For faster sending data, non-waits or async style functions are available e.g. setAsync
, setIntAsync
, setFloatAsync
, setDoubleAsync
, setBoolAsync
, setStringAsync
, setJSONAsync
, setArrayAsync
, setBlobAsync
and setFileAsync
.
For generic set, utilize Firebase.set(fbdo, <path>, <any variable or value>).
These async functions will ignore the server responses.
The above functions render boolean value indicates the success of the operation which volition be true
if all of the post-obit conditions matched.
-
Server returns HTTP status code 200
-
The data types matched betwixt request and response.
Only setBlob and setFile functions that make a silent request to Firebase server, thus no payload response returned.
The priority, virtual node ".priority" of each database node tin can be fix through Firebase'due south prepare functions.
The priority value can be used in a query or filtering the children'southward data under a defined node.
Priority option was removed from File and Blob functions since v2.4.0.
ETag (unique identifier value) assigned to Firebase'southward set functions is used as conditional checking.
If defined Etag is not matched the defined path's ETag, the prepare operation will fail with result 412 Precondition Failed.
ETag at whatsoever node tin can be read through Firebase.getETag
. ETag value changed upon the data was set or delete.
The server's Timestamp tin be stored in the database through Firebase.setTimestamp
.
The returned Timestamp value tin get from fbdo.to<int>()
.
The file systems for flash and sd retention can be inverse in FirebaseFS.h.
The following example showed how to store file data to flash memory at node "/test/file_data".
if (Firebase.getFile(fbdo, StorateType::Flash, "/test/file_data" , "/test.txt" )) { //Wink.begin(); //not demand to begin again due to it has been called in function. File file = DEFAULT_FLASH_FS.open( "/test.txt" , "r" ); while (file.available()) { Series.impress(file.read(), HEX); } file.shut(); Serial.println(); } else { Serial.println(fbdo.fileTransferError()); }
Append Data
To append new data to a specific node in Firebase RTDB, use these push button functions.
The role included push
, pushInt
, pushFloat
, pushDouble
, pushBool
, pushString
, pushJSON
, pushArray
, pushBlob
, and pushFile
.
For faster sending data, not-waits or async mode functions are available east.g. pushAsync
, pushIntAsync
, pushFloatAsync
, pushDoubleAsync
, pushBoolAsync
, pushStringAsync
, pushJSONAsync
, pushArrayAsync
, pushBlobAsync
and pushFileAsync
.
These functions return boolean value indicates the success of the operation.
The unique fundamental of a new appended node tin can be adamant from fbdo.pushName()
.
As set functions, the Firebase'south push functions support priority.
ETag was not bachelor after push button unless read the ETag at that new appended unique key later with Firebase.getETag
.
The server's Timestamp tin can exist appended in the database through Firebase.pushTimestamp
.
The unique cardinal of Timestamp can exist determined after Timestamp was appended.
The following example showed how to append new data (using FirebaseJson object) to node "/test/suspend.
FirebaseJson json; FirebaseJson json2; json2.set( "child_of_002" , 123.456); json.gear up( "parent_001" , "parent 001 text" ); json.set( "parent 002" , json2); if (Firebase.pushJSON(fbdo, "/test/suspend" , json)) { Serial.println(fbdo.dataPath()); Serial.println(fbdo.pushName()); Series.println(fbdo.dataPath() + "/" + fbdo.pushName()); } else { Serial.println(fbdo.errorReason()); }
Patch Data
Firebase's update functions used to patch or update new or existing data at the divers node.
These functions, updateNode
and updateNodeSilent
are bachelor and work with JSON object (FirebaseJson object only).
For faster sending information, non-waits or async mode functions are available due east.m. updateNodeAsync
, and updateNodeSilentAsync
.
If whatsoever cardinal name provided at a defined node in JSON object has not existed, a new key will be created.
The server returns JSON data payload which was successfully patched.
Return of large JSON payload will cost the network data, alternative function updateNodeSilent
or updateNodeSilentAsync
should be used to save the network data.
The post-obit instance showed how to patch data at "/test".
FirebaseJson updateData; FirebaseJson json; json.set( "_data2" , "_value2" ); updateData.set( "data1" , "value1" ); updateData.set( "data2" , json); if (Firebase.updateNode(fbdo, "/test/update" , updateData)) { Serial.println(fbdo.dataPath()); Serial.println(fbdo.dataType()); Series.println(fbdo.jsonString()); } else { Serial.println(fbdo.errorReason()); }
Delete Data
The following example showed how to delete data and its children at "/examination/append"
Firebase.deleteNode(fbdo, "/test/append" );
Filtering Data
To filter or query the data, the post-obit query parameters are available through the QueryFilter grade.
These parameters are orderBy
, limitToFirst
, limitToLast
, startAt
, endAt
, and equalTo
.
To filter information, parameter orderBy
should exist assigned.
Use "$primal" as the orderBy
parameter if the key of child nodes was used for the query.
Use "$value" every bit the orderBy
parameter if the value of child nodes was used for the query.
Employ key (or full path) of child nodes as the orderBy
parameter if all values of the specific central were used for the query.
Use "$priority" equally orderBy
parameter if child nodes's "priority" was used for query.
The above orderBy
parameter tin exist combined with the post-obit parameters for limited and ranged the queries.
QueryFilter.limitToFirst
- The total children (number) to filter from the offset child.
QueryFilter.limitToLast
- The total last children (number) to filter.
QueryFilter.startAt
- Starting value of range (number or string) of query upon orderBy param.
QueryFilter.endAt
- Ending value of range (number or string) of query upon orderBy param.
QueryFilter.equalTo
- Value (number or string) matches the orderBy param
The following example showed how to apply queries parameter in QueryFilter class to filter the data at node "/examination/data"
//Assume that children that have primal "sensor" are under "/exam/information" //Instantiate the QueryFilter class QueryFilter query; //Build query using specified child node key "sensor" under "/exam/data" query.orderBy( "sensor" ); //Query any kid that its value begins with 2 (number), assumed that its data type is bladder or integer query.startAt(two); //Query any child that its value ends with 8 (number), causeless that its data type is float or integer query.endAt(8); //Limit the maximum query result to return merely the last 5 nodes query.limitToLast(5); if (Firebase.getJSON(fbdo, "/test/data" , query)) { //Success, then effort to read the JSON payload value Series.println(fbdo.jsonString()); } else { //Failed to get JSON data at defined database path, print out the fault reason Serial.println(fbdo.errorReason()); } //Articulate all query parameters query.clear();
Server Information Changes Listener with Server-Sent Events or HTTP Streaming
This library uses HTTP GET asking with text/event-stream
header to make HTTP streaming connection.
The Firebase's functions that involved the stream operations are beginStream
, beginMultiPathStream
, setStreamCallback
, setMultiPathStreamCallback
and/or readStream
.
Function beginStream
is to subscribe to the data changes at a defined node.
Function beginMultiPathStream
is to subscribe to the data changes at a divers parent node path with multiple child nodes value parsing and works with setMultiPathStreamCallback.
Function setStreamCallback
is to assign the callback function that accepts the FirebaseStream class every bit parameter.
Function setMultiPathStreamCallback
is to assign the callback function that accepts the MultiPathStream grade as parameter.
The FirebaseStream contains stream's event/data payloadd and interface function calls are similar to FirebaseData
object.
The MultiPathStream contains stream's event/data payload for diverse child nodes.
To polling the stream's consequence/information payload manually, utilize readStream
in loop().
Function readStream
used in the loop() task to continuously read the stream's event and information.
Since polling the stream'southward outcome/information payload with readStream
, use fbdo.streamAvailable
to cheque if stream effect/data payoad is available.
Function fbdo.streamAvailable
returned true when new stream's event/data payload was available.
When new stream payload was available, its information and consequence tin be accessed from FirebaseData
object functions.
Function endStream
ends the stream performance.
Notation that, when using the shared FirebaseData
object for stream and CRUD usages(normal operation to create,read, update and delete data), the stream connexion will be interrupted (closed) to connect in other HTTP style, the stream will be resumed (open) afterwards the CRUD usages.
For the above case, you need to provide the idle time for FirebaseData
object to established the streaming connection and received the stream payload. The changes on the server at the streaming node path during the stream interruption volition exist missed.
To avoid this sitation, don't share the usage of stream's FirebaseData
object, another FirebaseData
object should exist used.
In addition, filibuster part used in the same loop of readStream()
will defer the streaming, the server data changes may exist missed.
Go on in mind that FirebaseData
object will create the SSL customer within of HTTPS information transaction and uses large retentivity.
The following case showed how to subscribe to the data changes at node "/exam/data" with a callback function.
//In setup(), set the stream callback office to handle information //streamCallback is the function that called when database information changes or updates occurred //streamTimeoutCallback is the function that chosen when the connection between the server //and client was timeout during HTTP stream Firebase.setStreamCallback(fbdo, streamCallback, streamTimeoutCallback); //In setup(), set the streaming path to "/examination/data" and brainstorm stream connection if (!Firebase.beginStream(fbdo, "/test/information" )) { //Could not brainstorm stream connection, and so print out the error detail Serial.println(fbdo.errorReason()); } //Global role that handles stream data void streamCallback(StreamData data) { //Impress out all information Serial.println( "Stream Data..." ); Serial.println(data.streamPath()); Serial.println(information.dataPath()); Series.println(data.dataType()); //Print out the value //Stream data can be many types which can exist adamant from function dataType if (information.dataTypeEnum() == fb_esp_rtdb_data_type_integer) Serial.println(data.to<int>()); else if (data.dataTypeEnum() == fb_esp_rtdb_data_type_float) Serial.println(data.to<bladder>(), 5); else if (data.dataTypeEnum() == fb_esp_rtdb_data_type_double) printf( "%.9lf\due north " , data.to<double>()); else if (data.dataTypeEnum() == fb_esp_rtdb_data_type_boolean) Series.println(information.to<bool>()? "truthful" : "false" ); else if (data.dataTypeEnum() == fb_esp_rtdb_data_type_string) Series.println(data.to<Cord>()); else if (information.dataTypeEnum() == fb_esp_rtdb_data_type_json) { FirebaseJson *json = data.to<FirebaseJson *>(); Series.println(json->raw()); } else if (data.dataTypeEnum() == fb_esp_rtdb_data_type_array) { FirebaseJsonArray *arr = data.to<FirebaseJsonArray *>(); Serial.println(arr->raw()); } } //Global role that notifies when stream connection lost //The library volition resume the stream connection automatically void streamTimeoutCallback(bool timeout) { if(timeout){ //Stream timeout occurred Serial.println( "Stream timeout, resume streaming..." ); } }
For multiple paths stream, run into the MultiPath_stream example.
The following example showed how to subscribe to the stream changes at "/test/information" and read the stream manually.
//In setup(), gear up the streaming path to "/test/information" and brainstorm stream connection if (!Firebase.beginStream(fbdo, "/test/data" )) { Series.println(fbdo.errorReason()); } //In loop() if (!Firebase.readStream(fbdo)) { Serial.println(fbdo.errorReason()); } if (fbdo.streamTimeout()) { Serial.println( "Stream timeout, resume streaming..." ); Serial.println(); } if (fbdo.streamAvailable()) { if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_integer) Serial.println(fbdo.to<int>()); else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_float) Serial.println(fbdo.to<float>(), 5); else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_double) printf( "%.9lf\north " , fbdo.to<double>()); else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_boolean) Serial.println(fbdo.to<bool>() ? "true" : "false" ); else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_string) Series.println(fbdo.to<String>()); else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_json) { FirebaseJson *json = fbdo.to<FirebaseJson *>(); Serial.println(json->raw()); } else if (fbdo.dataTypeEnum() == fb_esp_rtdb_data_type_array) { FirebaseJsonArray *arr = fbdo.to<FirebaseJsonArray *>(); Serial.println(arr->raw()); } }
Backup and Restore Data
This library allows data backup and restores at a defined path.
The backup file will store in SD/SDMMC menu or flash memory.
The file systems for flash and SD memory can be changed via FirebaseFS.h.
Due to SD library used, only 8.3 DOS format file name supported.
The maximum 8 characters for a file name and three characters for file extension.
The database restoration returned completed status simply when Firebase server successfully updates the data.
Any failed operation will not affect the database (no updates or changes).
The following example showed how to fill-in all database data at "/" and restore.
String backupFileName; if (!Firebase.backup(fbdo, StorateType::SD, "/" , "/backup.txt" )) { Serial.println(fbdo.fileTransferError()); } else { Serial.println(fbdo.getBackupFilename()); Serial.println(fbdo.getBackupFileSize()); backupFileName = fbdo.getBackupFilename(); } //Brainstorm restore backed dup data back to database if (!Firebase.restore(fbdo, StorateType::SD, "/" , backupFileName)) { Serial.println(fbdo.fileTransferError()); } else { Series.println(fbdo.getBackupFilename()); }
Database Error Handling
When read store, append and update operations were failed due to buffer overflow and network problems.
These operations can retry and queued after the retry amount was reached the maximum retry ready in office setMaxRetry
.
//set maximum retry amount to 3 Firebase.setMaxRetry(fbdo, 3);
The function setMaxErrorQueue
limits the maximum queues in Fault Queue collection.
The full of queue collection tin be checked through function isErrorQueueFull
.
//gear up maximum queues to 10 Firebase.setMaxErrorQueue(fbdo, 10); //decide whether Error Queue collection is full or non Firebase.isErrorQueueFull(fbdo);
This library provides ii approaches to run or process Error Queues with two functions.
-
beginAutoRunErrorQueue
-
processErrorQueue
The role beginAutoRunErrorQueue
will run or process queues automatically and can be called one time.
While function processErrorQueue
will run or process queues and should call inside the loop().
With function beginAutoRunErrorQueue
, y'all can assigned callback role that accept QueueInfo object every bit parameter.
Which contains all information virtually existence processed queue, number of remaining queues and Error Queue collection status.
Otherwise, Fault Queues can be tracked manually with the following functions.
Role getErrorQueueID
volition render the unsigned integer presents the id of the queue which will continue using later.
Use getErrorQueueID
and isErrorQueueExisted
to bank check whether this queue id is nonetheless existed or not.
If Error Queue ID does not be in Mistake Queues drove, that queue is already done.
The post-obit instance showed how to run Mistake Queues automatically and track the status with the callback part.
//In setup() //Set the maximum Firebase Error Queues in collection (0 - 255). //Firebase read/shop functioning causes by network issues and buffer overflow volition be //added to Firebase Error Queues collection. Firebase.setMaxErrorQueue(fbdo, 10); //Begin to run Error Queues in Fault Queue collection Firebase.beginAutoRunErrorQueue(fbdo, callback); //Use to cease the car run queues //Firebase.endAutoRunErrorQueue(fbdo); void errorQueueCallback (QueueInfo queueinfo){ if (queueinfo.isQueueFull()) { Series.println( "Queue is total" ); } Serial.print( "Remaining queues: " ); Serial.println(queueinfo.totalQueues()); Series.print( "Being processed queue ID: " ); Serial.println(queueinfo.currentQueueID()); Serial.print( "Data type:" ); Serial.println(queueinfo.dataType()); Serial.print( "Method: " ); Serial.println(queueinfo.firebaseMethod()); Series.impress( "Path: " ); Serial.println(queueinfo.dataType()); Serial.println(); }
The following example showed how to run Mistake Queues and track its status manually.
//In setup() //Ready the maximum Firebase Error Queues in collection (0 - 255). //Firebase read/shop operation causes past network problems and buffer overflow volition be added to //Firebase Fault Queues collection. Firebase.setMaxErrorQueue(fbdo, 10); //All of the post-obit are in loop() Firebase.processErrorQueue(fbdo); //Detrnine the queue condition if (Firebase.isErrorQueueFull(fbdo)) { Serial.println( "Queue is full" ); } //Remaining Error Queues in Error Queue collection Serial.print( "Remaining queues: " ); Serial.println(Firebase.errorQueueCount(fbdo)); //Assumed that queueID is unsigned integer array of queue that added to Error Queue collection //when error and utilize Firebase.getErrorQueueID to get this Mistake Queue id. for (uint8_t i = 0; i < LENGTH_OF_QUEUEID_ARRAY; i++) { Serial.impress( "Fault Queue " ); Serial.print(queueID[i]); if (Firebase.isErrorQueueExisted(fbdo, queueID[i])) Serial.println( " is queuing" ); else Serial.println( " is washed" ); } Serial.println();
Error Queues can exist saved as a file in SD card or Flash memory with function saveErrorQueue
.
Error Queues store as a file can be restored to Fault Queue collection with function restoreErrorQueue
.
Two types of storage can exist assigned with these functions, StorageType::Flash
and StorageType::SD
.
Read data (get) operation is non support queues restore
The following case showed how to restore and save Mistake Queues in /exam.txt file.
//To restore Error Queues if (Firebase.errorQueueCount(fbdo, "/test.txt" , StorageType::Flash) > 0) { Firebase.restoreErrorQueue(fbdo, "/examination.txt" , StorageType::Wink); Firebase.deleteStorageFile( "/test.txt" , StorageType::FLASH); } //To salve Mistake Queues to file Firebase.saveErrorQueue(fbdo, "/test.txt" , StorageType::Wink);
FireSense, The Programmable Information Logging and IO Control (Add together On)
This add on library is for the advance usages and works with Firebase RTDB.
With this add on library, y'all can remotely program your device to control its IOs or do some task or call predefined functions on the fly.
This allows you lot to change your device behaviour and functions without to flash a new firmware via serial or OTA.
See examples/FireSense for the usage.
For FireSense part clarification, see src/addons/FireSense/README.physician.
Firebase Cloud Messaging (FCM)
Two types of FCM message data tin be sent using this library e.k. notification and custom data.
These two types of data tin can transport all together or separately.
Function Firebase.sendMessage
volition transport a message to one recipient.
Function Firebase.broadcastMessage
will broadcast or send a message to multiple recipients.
Function Firebase.sendTopic
will send a message to any recipient who subscribed to the topic.
The FCM bulletin itself offers a broad range of messaging options and capabilities for various recipient device platforms.
For Android, iOS and web platforms, these bones options tin be prepare and piece of work for all platforms.
Office fbdo.fcm.brainstorm
used to assign the server key of your Firebase project.
Function fbdo.fcm.addDeviceToken
used to add recipient registered device token which wants to send message to.
Functions fbdo.fcm.removeDeviceToken
and fbdo.fcm.clearDeviceToken
used to remove or clear recipient device.
For the notification message, title, body, icon (optional), and click_action (optional) can be set up through fbdo.fcm.setNotifyMessage
.
And clear these notify message information with fbdo.fcm.clearNotifyMessage
.
For the information message, provide your custom data as JSON object (FirebaseJson object or string) to fbdo.fcm.setDataMessage
which can be articulate with fbdo.fcm.clearDataMessage
.
The other options are priority
, collapse key
, Time to Alive
of the message and topic
to send messages to, tin exist fix from the following functions.
Call fbdo.fcm.setPriority
for priority ("normal" or "high"), fbdo.fcm.setCollapseKey
for collapse fundamental setup, fbdo.fcm.setTimeToLive
for life span of message setup betwixt 0 sec. to 2,419,200 sec. (or iv weeks), and fbdo.fcm.setTopic
for assigning the topic that bulletin to send to.
The following example showed how to transport FCM message.
//Provide your Firebase projection's server central hither fbdo.fcm.begin(FIREBASE_FCM_SERVER_KEY); //Prvide one or more the recipient registered token or instant ID token fbdo.fcm.addDeviceToken(FIREBASE_FCM_DEVICE_TOKEN); //Provide the priority (optional) fbdo.fcm.setPriority( "normal" ); //Provide the fourth dimension to alive (optional) fbdo.fcm.setTimeToLive(5000); //Gear up the notification message data fbdo.fcm.setNotifyMessage( "Notification" , "Hello World!" , "firebase-logo.png" , "http://www.google.com" ); //Gear up the custom message data fbdo.fcm.setDataMessage( "{\"myData\":\"myValue\"}" ); //Send message to one recipient with inddex 1 (alphabetize starts from 0) if (Firebase.sendMessage(fbdo, ane)) { //Success, print the result returned from server Serial.println(fbdo.fcm.getSendResult()); } else { //Failed, print the error reason Serial.println(fbdo.errorReason()); }
Create, Edit, Serializing and Deserializing the JSON Objects
This library has built-in FirebaseJson Arduino library, the easiest JSON parser, builder and editor.
FirebaseJson usages are and then unproblematic as y'all read, shop and update(edit) the JSON node in Firebase RTDB.
It doesn't use the recursive telephone call to parse or deserialize complex or nested JSON objects and arrays.
This makes the library can use with a express memory device.
Since you declare the FirebaseJson or FirebaseJsonArray object, utilise the functions setJsonData
, setJsonArrayData
, add together
, set
and remove
to build or edit the JSON/Array object and employ get
to parse the node'southward contents.
Divers the relative path of the specific node to add together
, set up
, remove
and get
functions to add, set, remove and get its contents.
Function FirebaseJson.setJsonData
is to deserialize the JSON string to JSON object.
In addition, function FirebaseJson.readFrom
can exist used to read the streaming JSON contents from WiFi/Ethernet Client, File and Harware Serial and serialize it as the streaming content contains valid JSON information.
Function FirebaseJson.add
is used to add together the new node with the contents e.g. String, Number (int and double), Boolean, Assortment and Object to the defined node.
Function FirebaseJson.set
is used for edit, overwrite, create new (if not exist) node with contents e.g. Cord, Number (int and double), Boolean, Array and Object at the defined relative path and node.
Function FirebaseJson.go
is used for parsing or deserializee the JSON object and array. The deserialized or parsed result will continue in FirebaseJsonData object which can be casted to any blazon of value or variable e.g string, bool, int, float, double by using FirebaseJsonData.to<type>
.
The casting from FirebaseJsonData to FirebaseJson and FirebaseJsonArray objects is unlike, by using FirebaseJsonData.getJSON(FirebaseJson)
and FirebaseJsonData.getArray(FirebaseJsonArray)
.
Function FirebaseJson.search
is used for searching the elements in JSON object and array. The search part supports criterias which can exist gear up using FirebaseJson::SearchCriteria data.
The search function returns the number of items or elements found.
The SearchCriteria data consisted of the backdrop e.g. path, value, depth, endDepth, and searchAll.
The path property is the central proper name or path to search which can use the wildcard * for path to be any key or name at that depth and so on.
The value holding can be used with or without path assignment.
The depth belongings is begin depth to search, default value is 0.
The endDepth property is the end depth to search, default value is -1 for unlimited end depth.
The searchAll property, when set to truthful, is to search all occurrences of elements constitute and search outcome stores in FirebaseJsonData object will be assortment of all items found. The actual full path of search can exist obtained by FirebaseJsonData.searchPath
which will be serialized array string of all paths for all elements found from search.
When searchAll holding is faux (default), the showtime occurrence will be fix to the outcome which can exist any value type.
The search path from FirebaseJsonData.searchPath
volition be string of the element or particular full path.
The search result will keep in FirebaseJsonData object which later tin can cast to any type (always be an array in case of searchAll belongings is true) by using FirebaseJsonData.to<blazon>
.
Function FirebaseJson.remove
is used to remove the node and all its children's contents at the defined relative path and node.
Function FirebaseJson.toString
is used for serializeing the JSON object to writable objects e.g. char assortment, Arduino Cord, C/C++ string, WiFi/Ethernet Customer and Hardware/Software Serial.
Office FirebaseJson.serializedBufferLength
is used for calculating the serialized buffer size that required for reserved buffer in serialization.
Office FirebaseJson.responseCode
is used to get the http code response header while read the WiFi/Ethernet Client using FirebaseJson.toString
.
Functions FirebaseJson.iteratorBegin
, FirebaseJson.iteratorGet
and FirebaseJson.iteratorEnd
are used to parse all JSON object contents as a listing which tin can be iterated with index.
Role FirebaseJson.clear
is used to clear JSON object contents.
Function FirebaseJson.setFloatDigits
is for float number precision when serialized to cord.
Part FirebaseJson.setDoubleDigits
is for double number precision when serialized to string.
Function FirebaseJsonArray.add
is used for calculation the new contents e.one thousand. Cord, Number (int and double), Boolean, Array and Object to JSON array.
Function FirebaseJsonArray.ready
is for edit, overwrite, create new (if not exist) contents east.g. String, Number (int and double), Boolean, Array and Object at the defined relative path or divers index of JSON assortment.
Function FirebaseJsonArray.get
and FirebaseJsonArray.search
work in the same mode as FirebaseJson objects
Office FirebaseJsonArray.remove
is used to remove the array's contents at the divers relative path or defined index of JSON assortment.
Part FirebaseJsonArray.toString
is used for serializeing the JSON array object to writable objects east.g. char array, Arduino String, C/C++ cord, WiFi/Ethernet Client and Hardware/Software Series.
Function FirebaseJsonArray.serializedBufferLength
is used for calculating the serialized buffer size that required for reserved buffer in serialization.
Function FirebaseJsonArray.responseCode
is used to get the http code response header while read the WiFi/Ethernet Client using FirebaseJson.toString
.
Function FirebaseJsonArray.clear
is used to clear JSON array object contents.
Function FirebaseJsonArray.setFloatDigits
is for float number precision when serialized to string.
Function FirebaseJsonArray.setDoubleDigits
is for double number precision when serialized to cord.
Run across examples/FirebaseJson for the usage.
For FirebaseJson office description, encounter FirebaseJSON object Functions.
The post-obit example shows how to use FirebaseJson.
//Declare FirebaseJson object (global or local) FirebaseJson json; //Add proper name with value Living Room to JSON object json.add( "name" , "Living Room" ); //Add temp1 with value 120 and temp1 with 40 to JSON object //Note: temp2 is non the kid of temp1 equally in previous version. json.add together( "temp1" , 120).add( "temp2" , 40); //Add nested child contents directly json.set( "unit/temp1" , "Farenheit" ); json.prepare( "unit/temp2" , "Celcius" ); //Deserialize to serial with prettify choice json.toString(Serial, true); Series.println(); Serial.println(); /** This is the upshot of the above code { "name": "Living Room", "temp1": 120, "temp2": 40, "unit": { "temp1": "Farenheit", "temp2": "Celcius" } } */ //To set array to the to a higher place JSON using FirebaseJson straight //Set (add) array indexes 0,1,two,5,7 nether temp1, the original value will be replaced with new one. json.gear up( "temp1/[0]" , 47); json.set( "temp1/[1]" , 28); json.gear up( "temp1/[2]" , 34); json.set( "temp1/[v]" , 23); //null will be created at assortment index 3,4 due to it'south non yet assigned json.set( "temp1/[7]" , 25); //null will be created at assortment alphabetize 6 //Print out as prettify string json.toString(Serial, true); Serial.println(); Series.println(); /** The consequence of the to a higher place code { "proper noun": "Living Room", "temp1": [ 47, 28, 34, null, nil, 23, cypher, 25 ], "temp2": 40, "unit of measurement": { "temp1": "Farenheit", "temp2": "Celcius" } } */ //Try to remove temp1 array at alphabetize ane json.remove( "temp1/[1]" ); //Endeavour to remove temp2 json.remove( "temp2" ); //Print out as prettify string json.toString(Serial, true); Series.println(); Series.println(); /** The result of the above code { "name": "Living Room", "temp1": [ 47, 34, null, goose egg, 23, nothing, 25 ], "unit of measurement": { "temp1": "Farenheit", "temp2": "Celcius" } } */ //Now parse/read the contents from specific node unit/temp2 //FirebaseJsonData is required to keep the parse results which tin exist accessed afterward FirebaseJsonData result; json.become(event, "unit/temp2" ); if (result.success) { //Print type of parsed data e.grand cord, int, double, bool, object, array, null and undefined Serial.println(result.type); //Print its content e.k.string, int, double, bool whereas object, array and zippo besides can admission every bit cord Serial.println(result.to<String>()); //Serial.println(event.to<int>()); //Serial.println(result.to<bool>()); //Series.println(event.to<float>()); //Serial.println(outcome.to<double>()); } //The above lawmaking will show /** string Celcius */ //To become the array temp from FirebaseJson json.become(result, "temp1" ); //Prepare FirebaseJsonArray to take the array from FirebaseJson FirebaseJsonArray arr; //Become array data upshot.go<FirebaseJsonArray>(arr); //Phone call become with FirebaseJsonData to parse the array at defined index i for (size_t i = 0; i < arr.size(); i++) { //event now used every bit temporary object to get the parse results arr.go(consequence, i); //Print its value Serial.impress( "Array alphabetize: " ); Serial.impress(i); Series.print( ", type: " ); Serial.print(result.type); Serial.print( ", value: " ); Series.println(result.to<String>()); } /** The result of to a higher place code Array index: 0, type: int, value: 47 Array index: i, type: int, value: 34 Array index: 2, type: naught, value: cipher Array index: 3, blazon: zilch, value: null Assortment index: 4, type: int, value: 23 Array index: 5, type: null, value: cypher Array index: six, blazon: int, value: 25 */
The following example shows how to employ FirebaseJsonArray.
//Declare FirebaseJsonArray object (global or local) FirebaseJsonArray arr; //Add some data arr.add( "banana" ); arr.add( "mango" ); arr.add together( "coconut" ); //Alter the array contents arr.gear up( "[1]/food" , "salad" ); arr.set( "[1]/sweet" , "cake" ); arr.set( "[1]/appetizer" , "snack" ); arr.ready( "[2]" , "apple" ); // or arr.set(2, "apple"); arr.fix( "[iv]/[0]/[1]/amount" , 20); //Print out array as prettify string arr.toString(Serial, true); Serial.println(); Serial.println(); /** This is the upshot of the above code [ "banana", { "food": "salad", "sweet": "cake", "titbit": "snack" }, "apple tree", nix, [ [ null, { "amount": 20 } ] ] ] */ //Remove array content at /4/0/1/amount arr.remove( "[4]/[0]/[i]/amount" ); //Print out as prettify cord arr.toString(Serial, truthful); Serial.println(); Series.println(); /** The outcome of the above code [ "banana", { "nutrient": "salad", "sweet": "cake", "appetizer": "snack" }, "apple", nix, [ [ null ] ] ] */ //Now parse/read the array contents at some alphabetize FirebaseJsonData result; arr.get(result, "[ane]/food" ); if(event.success) { //Type of parsed data Serial.println(result.type); //Its value Serial.println(event.to<String>()); //Serial.println(outcome.to<int>()); //Series.println(result.to<bool>()); //Serial.println(consequence.to<float>()); //Serial.println(upshot.to<double>()); } //The to a higher place code will testify /** string salad */ //To get the JSON object at array index 1 from FirebaseJsonArray arr.go(outcome, "[1]" ); // or arr.become(outcome, one); //Ready FirebaseJson to have the JSON object from FirebaseJsonArray FirebaseJson json; //Get FirebaseJson data event.get<FirebaseJson>(json); //Parse the JSON object equally list //Get the number of items size_t len = json.iteratorBegin(); FirebaseJson::IteratorValue value; for (size_t i = 0; i < len; i++) { value = json.valueAt(i); Serial.printf( "%d, Type: %s, Name: %s, Value: %due south\n " , i, value.type == FirebaseJson::JSON_OBJECT ? "object" : "array" , value.key.c_str(), value.value.c_str()); } //Clear all list to gratuitous retentivity json.iteratorEnd(); /** The effect of the higher up code 0, Blazon: object, Key: nutrient, Value: salad i, Type: object, Cardinal: sweet, Value: cake two, Type: object, Cardinal: appetizer, Value: snack */
License
The MIT License (MIT)
Copyright (C) 2022 One thousand. Suwatchai (Mobizt)
Permission is hereby granted, free of charge, to any person returning a re-create of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do and then, subject to the following conditions:
The in a higher place copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF Whatever KIND, Express OR Implied, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO Issue SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN Activity OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN Connectedness WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
revelestwomithe1956.blogspot.com
Source: https://github.com/mobizt/Firebase-ESP8266/blob/master/README.md
0 Response to "Firebase Upload Int but Retreived as Long"
Enregistrer un commentaire