Google's Firebase Realtime Database Arduino Library for ESP32
param config The pointer to FirebaseConfig data.
param auth The pointer to FirebaseAuth data.
note: For FirebaseConfig and FirebaseAuth data usage, see the examples.
void begin(FirebaseConfig *config, FirebaseAuth *auth);param param config The pointer to FirebaseConfig data.
param idToken The ID Token.
param expire The expired interval in seeconds (max.3600 sec).
param refreshToken The refresh token for token refreshment.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setIdToken(FirebaseConfig *config, <string> idToken, size_t expire = 3600, <string> refreshToken = "");param config The pointer to FirebaseConfig data.
param accessToken The access Token.
param expire The expired interval in seeconds (max.3600 sec).
param refreshToken The refresh token for token refreshment.
param clientId The The client identifier issued to the client during the registration process.
param clientSecret The client secret.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setAccessToken(FirebaseConfig *config, <string> accessToken, size_t expire = 3600, <string> refreshToken = "", <string> clientId = "", <string> clientSecret = "");param config The pointer to FirebaseConfig data.
param customToken The Identity Platform custom token.
If the refresh token from Custom token verification or sign in, was assigned here instead of custom token (signed JWT token), the token refresh process will be performed immediately.
Any token that is not in the form header.payload.signature i.e., xxxxx.yyyyy.zzzzz will be treated as refresh token.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setCustomToken(FirebaseConfig *config, <string> customToken);return bool of expiry status.
bool isTokenExpired();param config The pointer to FirebaseConfig data.
void refreshToken(FirebaseConfig *config);param config The pointer to FirebaseConfig data.
void reset(FirebaseConfig *config);return token_info_t The token_info_t structured data that indicates the status.
note: Use type property to get the type enum value.
token_type_undefined or 0,
token_type_legacy_token or 1,
token_type_id_token or 2,
token_type_custom_token or 3,
token_type_oauth2_access_token or 4
Use status property to get the status enum value.
token_status_uninitialized or 0,
token_status_on_signing or 1,
token_status_on_request or 2,
token_status_on_refresh or 3,
token_status_ready or 4
In case of token generation and refreshment errors, use error.code property to get the error code number.
Use error.message property to get the error message string.
struct token_info_t authTokenInfo();return Boolean type status indicates the token generation is completed.
This function should be called repeatedly to handle authentication tasks.
bool ready();return Boolean type status indicates the device can access to the services.
This returns false if ready() returns false (token generation is not ready).
bool authenticated();param databaseURL Your RTDB URL e.g. <databaseName>.firebaseio.com or <databaseName>.<region>.firebasedatabase.app
param databaseSecret Your database secret.
param caCert Root CA certificate base64 string (PEM file).
param caCertFile Root CA certificate DER file (binary).
param StorageType Type of storage, StorageType::SD and StorageType::FLASH.
param GMTOffset GMT time offset in hour is required to set time in order to make BearSSL
data decryption/encryption to work.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
void begin(<string> databaseURL, <string> databaseSecret);
void begin(<string> databaseURL, <string> databaseSecret, <char array> caCert, float GMTOffset = 0.0);
void begin(<string> databaseURL, <string> databaseSecret, <string> caCertFile, uint8_t storageType, float GMTOffset = 0.0);param fbdo Firebase Data Object to hold data and instance.
void end(FirebaseData &fbdo);param config The pointer to FirebaseConfig data.
param auth The pointer to FirebaseAuth data.
param email The user Email.
param password The user password.
return Boolean type status indicates the success of the operation.
note: By calling Firebase.begin with config and auth after sign up will be signed in.
This required Email/Password provider to be enabled,
From Firebase console, select Authentication, select Sign-in method tab, under the Sign-in providers list, enable Email/Password provider.
If the assigned email and passowrd are empty, the anonymous user will be created if Anonymous provider is enabled.
To enable Anonymous provider, from Firebase console, select Authentication, select Sign-in method tab, under the Sign-in providers list, enable Anonymous provider.
bool signUp(FirebaseConfig *config, FirebaseAuth *auth, <string> email, <string> password);param config The pointer to FirebaseConfig data.
param auth The pointer to FirebaseAuth data.
param idToken (optional) The id token of user, leave blank to delete the current sign in user.
return Boolean type status indicates the success of the operation.
bool deleteUser(FirebaseConfig *config, FirebaseAuth *auth, const char* idToken = "");param config The pointer to FirebaseConfig data.
param idToken The id token of user that was already signed in with Email and password (optional).
return Boolean type status indicates the success of the operation.
note: The id token can be obtained from config.signer.tokens.id_token after begin with config and auth data
If the idToken is not assigned, the internal config.signer.tokens.id_token will be used.
See the Templates of Email address verification in the Firebase console, Authentication.
bool sendEmailVerification(FirebaseConfig *config,<string> idToken);param config The pointer to FirebaseConfig data.
param email The user Email to send the password resset link.
return Boolean type status indicates the success of the operation.
bool sendResetPassword(FirebaseConfig *config, <string> email);param reconnect The boolean to set/unset WiFi AP reconnection.
void reconnectWiFi(bool reconnect);return constant char* of currently used auth token.
const char *getToken();return constant char* of refresh token.
const char *getRefreshToken();return int * of free Heap memory size.
int getFreeHeap();return time_t * of current timestamp.
time_t getCurrentTime();param digits The decimal places.
void setFloatDigits(uint8_t digits);param digits The decimal places.
void setDoubleDigits(uint8_t digits);return the response code of reading JSON data from WiFi/Ethernet Client
int responseCode();param enable The boolean value to enable/disable.
The multiple HTTP requessts at a time is disable by default to prevent the large memory used in multiple requests.
void allowMultipleRequests(bool enable);param fbdo Firebase Data Object to hold data and instances.
param millisec The milliseconds to limit the request (0 - 900,000 ms or 15 min).
void setReadTimeout(FirebaseData &fbdo, int millisec);param fbdo Firebase Data Object to hold data and instances.
param size The size identified string e.g. tiny, small, medium, large and unlimited.
Size string and its write timeout in seconds e.g. tiny (1s), small (10s), medium (30s) and large (60s).
void setwriteSizeLimit(FirebaseData &fbdo, <string> size);param fbdo Firebase Data Object to hold data and instances.
return Boolean type status indicates the success of the operation.
bool getRules(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file data, StorageType::FLASH or StorageType::SD.
param filename Filename to save rules.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean type status indicates the success of the operation.
getRules(FirebaseData &fbdo, uint8_t storageType, <string> filename, RTDB_DownloadProgressCallback callback = NULL)param fbdo Firebase Data Object to hold data and instances.
param rules Database rules in jSON String format.
return Boolean type status indicates the success of the operation.
bool setRules(FirebaseData &fbdo, <string> rules);param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file data, StorageType::FLASH or StorageType::SD.
param filename Filename to read the rules from.
param callback Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean type status indicates the success of the operation.
bool setRules(FirebaseData &fbdo, uint8_t storageType, <string> filename, RTDB_UploadProgressCallback callback = NULL)param fbdo The pointer to Firebase Data Object.
param path The parent path of child's node that the .read and .write rules are being set.
param var The child node key that the .read and .write rules are being set.
param readVal The child node key .read value.
param writeVal The child node key .write value.
param databaseSecret The database secret.
return Boolean value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool setReadWriteRules(FirebaseData &fbdo, <string> path, <string> var, <string> readVal, <string> writeVal, <string> databaseSecret);param fbdo The pointer to Firebase Data Object.
param path The parent path of child's node that being query.
param node The child node key that being query.
param databaseSecret The database secret.
return Boolean value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool setQueryIndex(FirebaseData &fbdo, <string> path, <string> node, <string> databaseSecret);param fbdo The pointer to Firebase Data Object.
param path The parent path of child's node that the index is being removed.
param databaseSecret The database secret.
return Boolean value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool removeQueryIndex(FirebaseData &fbdo, <string> path, <string> databaseSecret);param fbdo Firebase Data Object to hold data and instances.
param path Database path to be checked.
return Boolean type result indicates whether the defined database path has existed or not.
bool pathExisted(FirebaseData &dataObj, <string> path);return String of unique identifier.
String getETag(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path being read the data.
return Boolean type status indicates the success of the operation.
Return the child data with its value or JSON object (its values will be truncated to true).
The data can be read from FirebaseData object.
bool getShallowData(FirebaseData &fbdo, <string> path); param fbdo Firebase Data Object to hold data and instances.
param flag Boolean value to enable.
This option used to escape the Firewall restriction (if device is connected through Firewall) that allows only HTTP GET and POST
HTTP PATCH request was sent as PATCH which not affected by this option.
void enableClassicRequest(FirebaseData &fbdo, bool flag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which to set the priority value.
param priority The priority value.
return Boolean type status indicates the success of the operation.
This allows us to set priority to any node other than a priority that set through setJSON, pushJSON, updateNode, and updateNodeSilent functions.
The returned priority value from server can read from function <FirebaseData>.priority().
bool setPriority(FirebaseData &fbdo, <string> path, float priority);
bool setPriorityAsync(FirebaseData &fbdo, <string> path, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which to set the priority value.
return Boolean type status indicates the success of the operation.
The priority value from server can read from function <FirebaseData>.priority().
bool getPriority(FirebaseData &fbdo, <string> path);param fbdo The pointer to Firebase Data Object.
param path The path to the node.
param value The appended value of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob Byte array of data (blob).
param size Size of the byte array (blob).
param storageType The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param fileName The file path includes its name.
return Boolean value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName() to get the key.
bool push(FirebaseData &fbdo, <string> path, <type> value);
bool pushAsync(FirebaseData &fbdo, <string> path, <type> value);
bool push(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool pushAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool push(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName);
bool pushAsync(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName);param fbdo The pointer to Firebase Data Object.
param path The path to the node.
param value The appended value of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority The priority value.
return Boolean value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName() to get the key.
bool push(FirebaseData &fbdo, <string> path, <type> value, float priority);
bool pushAsync(FirebaseData &fbdo, <string> path, <type> value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which integer value will be appended.
param value The appended value.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushInt(FirebaseData &fbdo, <string> path, <integer> value);
bool pushIntAsync(FirebaseData &fbdo, <string> path, <integer> value);bool pushInt(FirebaseData &fbdo, <string> path, <integer> value, float priority);
bool pushIntAsync(FirebaseData &fbdo, <string> path, <integer> value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which float value will be appended.
param value The appended value.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushFloat(FirebaseData &fbdo, <string> path, float value);
bool pushFloatAsync(FirebaseData &fbdo, <string> path, float value);bool pushFloat(FirebaseData &fbdo, <string> path, float value, float priority);
bool pushFloatAsync(FirebaseData &fbdo, <string> path, float value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which float value will be appended.
param value The appended value.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushDouble(FirebaseData &fbdo, <string> path, double value);
bool pushDoubleAsync(FirebaseData &fbdo, <string> path, double value);bool pushDouble(FirebaseData &fbdo, <string> path, double value, float priority);
bool pushDoubleAsync(FirebaseData &fbdo, <string> path, double value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which Boolean value will be appended.
param value The appended value.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushBool(FirebaseData &fbdo, <string> path, bool value);
bool pushBoolAsync(FirebaseData &fbdo, <string> path, bool value);bool pushBool(FirebaseData &fbdo, <string> path, bool value, float priority);
bool pushBoolAsync(FirebaseData &fbdo, <string> path, bool value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which string will be appended.
param value The appended value.
return Boolean type status indicates the success of the operation.
The new appended node's key stored in Firebase Data object,
which can be accessed via function <FirebaseData>.pushName().
bool pushString(FirebaseData &fbdo, <string> path, <string> value);
bool pushStringAsync(FirebaseData &fbdo, <string> path, <string> value);bool pushString(FirebaseData &fbdo, <string> path, <string> value, float priority);
bool pushStringAsync(FirebaseData &fbdo, <string> path, <string> value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJson object will be appended.
param json The appended FirebaseJson object.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json);
bool pushJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json);Append new child node key and value (using JSON data or FirebaseJson object) and the virtual child ".priority" to the defined database path.
bool pushJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);
bool pushJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);This will replace any child nodes inside the defined path with array defined in FirebaseJsonArray object.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJsonArray object will be appended.
param arr The appended FirebaseJsonArray object.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr);
bool pushArrayAsync(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr);bool pushArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority);
bool pushArrayAsync(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which binary data will be appended.
param blob Byte array of data.
param size Size of array in byte.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushBlob(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool pushBlobAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file data, StorageType::FLASH or StorageType::SD.
param path Target database path in which binary data from the file will be appended.
param fileName File name included its path in SD card/Flash memory.
param **callback**callback Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool pushFile(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, RTDB_UploadProgressCallback callback = NULL);
bool pushFileAsync(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, RTDB_UploadProgressCallback callback = NULL);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which timestamp will be appended.
return Boolean type status indicates the success of the operation.
The new appended node's key will be stored in Firebase Data object,
which its value can be accessed via function <FirebaseData>.pushName().
bool pushTimestampAsync(FirebaseData &fbdo, <string> path);
bool pushTimestampAsync(FirebaseData &fbdo, <string> path);param fbdo The pointer to Firebase Data Object.
param path The path to the node which integer value will be set.
param value the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob Byte array of data (blob).
param size Size of the byte array (blob).
param fileName The file path includes its name.
return Boolean value, indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<type>() to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>() to get the String value.
bool set(FirebaseData &fbdo, <string> path, <type> value);
bool setAsync(FirebaseData &fbdo, <string> path, <type> value);
bool set(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool setAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool set(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName);
bool setAsync(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName);param fbdo The pointer to Firebase Data Object.
param path The path to the node which integer value will be set.
param value the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority The priority value.
return Boolean value, indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<type>() to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>() to get the String value.
bool set(FirebaseData &fbdo, <string> path, <type> value, float priority);
bool setAsync(FirebaseData &fbdo, <string> path, <type> value, float priority);param fbdo The pointer to Firebase Data Object.
param path The path to the node which integer value will be set.
param value the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob Byte array of data (blob).
param size Size of the byte array (blob).
param fileName The file path includes its name.
param ETag Known unique identifier string (ETag) of defined node.
return Boolean value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to get the type of data that successfully stored in the database.
And <FirebaseData>.to<type>() to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>() to get the String value.
bool set(FirebaseData &fbdo, <string> path, <type> value, <string> ETag);
bool setAsync(FirebaseData &fbdo, <string> path, <type> value, <string> ETag);
bool set(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool setAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool set(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag);
bool setAsync(FirebaseData &fbdo, firebase_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag);Set the generic value and the virtual child ".priority" if defined ETag matches at the defined node.
param fbdo The pointer to Firebase Data Object.
param path The path to the node which integer value will be set.
param value the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority The priority value.
param ETag Known unique identifier string (ETag) of defined node.
return Boolean value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to get the type of data that successfully stored in the database.
And <FirebaseData>.to<type>() to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>() to get the String value.
bool set(FirebaseData &fbdo, <string> path, <type> value, float priority, <string> ETag);
bool setAsync(FirebaseData &fbdo, <string> path, <type> value, float priority, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which integer data will be set.
param value Integer value to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully
stores in the database.
Call <FirebaseData>.to<int>() will return the integer value of
the payload returned from the server.
bool setInt(FirebaseData &fbdo, <string> path, <integer> value);
bool setIntAsync(FirebaseData &fbdo, <string> path, <integer> value);bool setInt(FirebaseData &fbdo, <string> path, <integer> value, float priority);
bool setIntAsync(FirebaseData &fbdo, <string> path, <integer> value, float priority);Set integer data at the defined database path if defined database path's ETag matched the ETag value.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which integer data will be set.
param value Integer value to set.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.to<int>() to get the current integer value.
bool setInt(FirebaseData &fbdo, <string> path, <integer> value, <string> ETag);
bool setIntAsync(FirebaseData &fbdo, <string> path, <integer> value, <string> ETag);Set integer data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setInt(FirebaseData &fbdo, <string> path, <integer> value, float priority, <string> ETag);
bool setIntAsync(FirebaseData &fbdo, <string> path, <integer> value, float priority, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Float value to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<float>() will return the float value of
the payload returned from the server.
bool setFloat(FirebaseData &fbdo, <string> path, float value);
bool setFloatAsync(FirebaseData &fbdo, <string> path, float value);bool setFloat(FirebaseData &fbdo, <string> path, float value, float priority);
bool setFloatAsync(FirebaseData &fbdo, <string> path, float value, float priority);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Float value to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<float>() will return the float value of
the payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.to<float>() to get the current float value.
bool setFloat(FirebaseData &fbdo, <string> path, float value, <string> ETag);
bool setFloatAsync(FirebaseData &fbdo, <string> path, float value, <string> ETag);Set float data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setFloat(FirebaseData &fbdo, <string> path, float value, float priority, <string> ETag);
bool setFloatAsync(FirebaseData &fbdo, <string> path, float value, float priority, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Double value to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data that successfully
stores in the database.
Call <FirebaseData>.to<double>() will return the double value of
the payload returned from the server.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.9lf\n", firebaseData.to<double>()); for print the returned double value up to 9 decimal places.
bool setDouble(FirebaseData &fbdo, <string> path, double value);
bool setDoubleAsync(FirebaseData &fbdo, <string> path, double value);bool setDouble(FirebaseData &fbdo, <string> path, double value, float priority);
bool setDoubleAsync(FirebaseData &fbdo, <string> path, double value, float priority);Set double data at the defined database path if defined database path's ETag matched the ETag value.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Double value to set.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<double>() will return the double value of payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.doubeData to get the current double value.
bool setDouble(FirebaseData &fbdo, <string> path, double value, <string> ETag);
bool setDoubleAsync(FirebaseData &fbdo, <string> path, double value, <string> ETag);Set double data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setDouble(FirebaseData &fbdo, <string> path, double value, float priority, <string> ETag);
bool setDoubleAsync(FirebaseData &fbdo, <string> path, double value, float priority, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Boolean value to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<bool>() will return the Boolean value of
the payload returned from the server.
bool setBool(FirebaseData &fbdo, <string> path, bool value);
bool setBoolAsync(FirebaseData &fbdo, <string> path, bool value);bool setBool(FirebaseData &fbdo, <string> path, bool value, float priority);
bool setBoolAsync(FirebaseData &fbdo, <string> path, bool value, float priority);Set Boolean data at the defined database path if defined database path's ETag matched the ETag value
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which float data will be set.
param value Boolean value to set.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data that successfully stores in the database.
Call <FirebaseData>.to<bool>() will return the Boolean value of
the payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.doubeData to get the current boolean value.
bool setBool(FirebaseData &fbdo, <string> path, bool value, <string> ETag);
bool setBoolAsync(FirebaseData &fbdo, <string> path, bool value, <string> ETag);Set boolean data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setBool(FirebaseData &fbdo, <string> path, bool value, float priority, <string> ETag);
bool setBoolAsync(FirebaseData &fbdo, <string> path, bool value, float priority, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which string data will be set.
param value String or text to set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<String>() will return the string value of
the payload returned from the server.
bool setString(FirebaseData &fbdo, <string> path, <string> value);
bool setStringAsync(FirebaseData &fbdo, <string> path, <string> value);bool setString(FirebaseData &fbdo, <string> path, <string> value, float priority);
bool setStringAsync(FirebaseData &fbdo, <string> path, <string> value, float priority);Set string (text) at the defined database path if defined database path's ETag matched the ETag value
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which string data will be set.
param value String or text to set.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<String>() will return the string value of
the payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also, call <FirebaseData>.to<String>() to get the current string value.
bool setString(FirebaseData &fbdo, <string> path, <string> value, <string> ETag);
bool setStringAsync(FirebaseData &fbdo, <string> path, <string> value, <string> ETag);Set string data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setString(FirebaseData &fbdo, <string> path, <string> value, float priority, <string> ETag);
bool setStringAsync(FirebaseData &fbdo, <string> path, <string> value, float priority, <string> ETag);This will replace any child nodes inside the defined path with node' s key and value defined in FirebaseJson object.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJson object will be replaced or set.
param json The FirebaseJson object.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>() and <FirebaseData>.to<FirebaseJson *>() will return reference to object and pointer to FirebaseJson object from payload.
bool setJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json);
bool setJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json);bool setJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);
bool setJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);Set child nodes key and value (using JSON data or FirebaseJson object) to the defined database path if defined database path's ETag matched the ETag value
This will replace any child nodes inside the defined path with node' s key and value defined in JSON data or FirebaseJson object.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in JSON data or FirebaseJson object will be replaced or set.
param jsonString The JSON string to set (should be valid JSON data).
param json The FirebaseJson object.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>() and <FirebaseData>.to<FirebaseJson *>() will return reference to object and pointer to FirebaseJson object from payload.
bool setJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json, <string> ETag);
bool setJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, <string> ETag);Set JSON data or FirebaseJson object and the virtual child ".priority" if defined ETag matches at the defined database path
bool setJSON(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority, <string> ETag);
bool setJSONAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority, <string> ETag);This will replace any child nodes inside the defined path with array defined in FirebaseJsonArray object.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJsonArray object will be replaced or set.
param arr The FirebaseJsonArray object.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data that successfully
stores in the database.
Call <FirebaseData>.to<FirebaseJsonArray>() and <FirebaseData>.to<FirebaseJsonArray *>() will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
bool setArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr);
bool setArrayAsync(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr);bool setArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority);
bool setArrayAsync(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority);Set array (using JSON data or FirebaseJson object) to the defined database path if defined database path's ETag matched the ETag value.
This will replace any child nodes inside the defined path with array defined in FirebaseJsonArray object.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in JSON data will be replaced or set.
param arr The FirebaseJsonArray object.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag() to get the current ETag value.
Also call <FirebaseData>.dataType to determine what type of data that successfully
stores in the database.
And <FirebaseData>.to<FirebaseJsonArray>() and <FirebaseData>.to<FirebaseJsonArray *>() will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
bool setArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, <string> ETag);
bool setArray(AsyncFirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, <string> ETag);Set FirebaseJsonArray object and the virtual child ".priority" if defined ETag matches at the defined database path
bool setArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority, <string> ETag);
bool setArrayAsync(FirebaseData &fbdo, <string> path, FirebaseJsonArray &arr, float priority, <string> ETag);This will replace any child nodes inside the defined path with a blob of binary data.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which binary data will be set.
param blob Byte array of data.
param size Size of the byte array.
return Boolean type status indicates the success of the operation.
No payload returned from the server.
bool setBlob(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);
bool setBlobAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size);Set blob (binary data) at the defined database path if defined database path's ETag matched the ETag value
This will replace any child nodes inside the defined path with a blob of binary data.
param fbdo Firebase Data Object to hold data and instances.
param path Target database path in which binary data will be set.
param blob Byte array of data.
param size Size of the byte array.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.
No payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
bool setBlob(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool setBlobAsync(FirebaseData &fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file data, StorageType::FLASH or StorageType::SD.
param path Target database path in which binary data from the file will be set.
param fileName File name included its path in SD card/Flash memory.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean type status indicates the success of the operation.
No payload returned from the server.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool setFile(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);
bool setFileAsync(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);Set binary data from a file stored on SD card/Flash memory to the defined database path if defined database path's ETag matched the ETag value
param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file data, StorageType::FLASH or StorageType::SD.
param path Target database path in which binary data from the file will be set.
param fileName File name included its path in SD card/Flash memory.
param ETag Known unique identifier string (ETag) of defined database path.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean type status indicates the success of the operation.
No payload returned from the server.
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool setFile(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, <string> ETag, RTDB_UploadProgressCallback callback = NULL);
bool setFileAsync(FirebaseData &fbdo, uint8_t storageType, <string> path, <string> fileName, <string> ETag, RTDB_UploadProgressCallback callback = NULL);param fbdo Firebase Data Object to hold data and instances.
param path Target database path which timestamp will be set.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.to<int>() will return the integer value of timestamp in seconds
or <FirebaseData>.to<double>() to get millisecond timestamp.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.0lf\n", firebaseData.to<double>());.
bool setTimestamp(FirebaseData &fbdo, <string> path);
bool setTimestampAsync(FirebaseData &fbdo, <string> path);Update child node key or existing key's value (using FirebaseJson object) under the defined database path
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJson object will be updated.
param json The FirebaseJson object used for update.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>() and <FirebaseData>.to<FirebaseJson *>() will return reference to object and pointer to FirebaseJson object from payload.
To reduce network data usage, use updateNodeSilent instead.
bool updateNode(FirebaseData &fbdo, <string> path, FirebaseJson &json);
bool updateNodeAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json);Update child node key or existing key's value and virtual child ".priority" (using JSON data or FirebaseJson object) under the defined database path.
bool updateNode(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);
bool updateNodeAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);Update child node key or existing key's value (using FirebaseJson object) under the defined database path
param fbdo Firebase Data Object to hold data and instances.
param path Target database path which key and value in FirebaseJson object will be updated.
param json The FirebaseJson object used for update.
return Boolean type status indicates the success of the operation.
Owing to the objective of this function to reduce network data usage, no payload will be returned from the server.
bool updateNodeSilent(FirebaseData &fbdo, <string> path, FirebaseJson &json);
bool updateNodeSilentAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json);Update child node key and virtual child ".priority" (using JSON data or FirebaseJson object) under the defined database path.
bool updateNodeSilent(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);
bool updateNodeSilentAsync(FirebaseData &fbdo, <string> path, FirebaseJson &json, float priority);param fbdo The pointer to Firebase Data Object.
param path The path to the node.
return Boolean value, indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<int>(), <FirebaseData>.to<float>, <FirebaseData>.to<double>,
<FirebaseData>.to<bool>, <FirebaseData>.to<String>, <FirebaseData>.to<FirebaseJson>(),
<FirebaseData>.to<FirebaseJson *>(), <FirebaseData>.to<FirebaseJsonArray>(),
<FirebaseData>.to<FirebaseJsonArray *>(), <FirebaseData>.to<std::vector<uint8_t> *> and <FirebaseData>.to<File>() corresponded to its type that get from <FirebaseData>.dataType.
bool get(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the integer value is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<int>() will return the integer value of
payload returned from the server.
If the payload returned from server is not integer or float type,
the function <FirebaseData>.to<int>() will return zero (0).
If the payload returned from server is float type,
the function <FirebaseData>.to<int>() will return rounded integer value.
bool getInt(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the integer value is being read.
param target The integer type variable to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getInt(FirebaseData &fbdo, <string> path,<integer> &target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the float value is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<float>() will return the float value of
the payload returned from the server.
If the payload returned from server is not integer or float type,
the function <FirebaseData>.to<int>() will return zero (0).
bool getFloat(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the float value is being read.
param target The float type variable to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getFloat(FirebaseData &fbdo, <string> path, float &target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the float value is being rea.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<double>() will return the double value of
the payload returned from the server.
If the payload returned from server is not integer, float and double,
the function <FirebaseData>.to<double>() will return zero (0).
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.9lf\n", firebaseData.to<double>()); for print the returned double value up to 9 decimal places.
bool getDouble(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the float value is being read.
param target The double type variable to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getDouble(FirebaseData &fbdo, <string> path, double &target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the Boolean value is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<bool>() will return the Boolean value of
the payload returned from the server.
If the payload returned from server is not boolean type,
the function <FirebaseData>.to<bool>() will return false.
bool getBool(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the Boolean value is being read.
param target The boolean type variable to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not Boolean, the target variable's value will be false.
bool getBool(FirebaseData &fbdo, <string> path, bool &target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the string value is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<String>() will return the string value of
the payload returned from the server.
If the payload returned from the server is not string type,
the function <FirebaseData>.to<String>() will return empty string (String object).
bool getString(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the string value is being read.
param target The String object to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not a string, the target String object's value will be empty.
bool getString(FirebaseData &fbdo, <string> path, String &target);The returned payload JSON string represents the child nodes and their value.
param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the JSON string value is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>() and <FirebaseData>.to<FirebaseJson *>() will return reference to object and pointer to FirebaseJson object from payload.
If the type of payload returned from server is not json,
the function <FirebaseData>.to<FirebaseJson>() will contain empty object.
bool getJSON(FirebaseData &fbdo, <string> path);The returned payload JSON string represents the child nodes and their value.
param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the JSON string value is being read.
param target The FirebaseJson object pointer to get json data
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not JSON, the target FirebaseJson object will contain an empty object.
bool getJSON(FirebaseData &fbdo, <string> path, FirebaseJson *target);The returned payload JSON string represents the child nodes and their value.
param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the JSON string value is being read.
param query QueryFilter class to set query parameters to filter data.
return Boolean type status indicates the success of the operation.
Available query parameters for filtering the data are the following.
query filter.orderBy` A required parameter to specify which data used for data filtering included child key, key, and value.
Use "$key" for filtering data by keys of all nodes at the defined database path.
Use "$value" for filtering data by value of all nodes at the defined database path.
Use "$priority" for filtering data by "virtual child" named .priority of all nodes.
Use any child key to filter by that key.
QueryFilter.limitToFirst The total children (number) to filter from the first 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
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>() and <FirebaseData>.to<FirebaseJson *>() will return reference to object and pointer to FirebaseJson object from payload.
If the type of payload returned from server is not json,
the function <FirebaseData>.to<FirebaseJson>() will contain empty object.
bool getJSON(FirebaseData &fbdo, <string> path, QueryFilter &quer);The returned payload JSON string represents the child nodes and their value.
param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the JSON string value is being read.
param target The FirebaseJson object pointer to get json data.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not JSON, the target FirebaseJson object will contain an empty object.
bool getJSON(FirebaseData &fbdo, <string> path, QueryFilter &query, FirebaseJson *target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the array is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJsonArray>() and <FirebaseData>.to<FirebaseJsonArray*>() will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
If the type of payload returned from the server is not an array,
the array element in <FirebaseData>.to<FirebaseJsonArray>() will be empty.
bool getArray(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the array is being read.
param **`target - The FirebaseJsonArray object pointer to get array value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not an array, the target FirebaseJsonArray object will contain an empty array.
bool getArray(FirebaseData &fbdo, <string> path, FirebaseJsonArray *target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the array is being read.
param query QueryFilter class to set query parameters to filter data.
return Boolean type status indicates the success of the operation.
Available query parameters for filtering the data are the following.
QueryFilter.orderBy - Required parameter to specify which data used for data filtering included child key, key, and value. Use "$key" for filtering data by keys of all nodes at the defined database path. Use "$value" for filtering data by value of all nodes at the defined database path. Use "$priority" for filtering data by "virtual child" named .priority of all nodes. Use any child key to filter by that key.
QueryFilter.limitToFirst - The total children (number) to filter from the first 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
Call <FirebaseData>.dataType or <FirebaseData>.dataTypeNum to determine what type of data that successfully
stores in the database.
Call <FirebaseData>.to<FirebaseJsonArray>() and <FirebaseData>.to<FirebaseJsonArray *>() will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
If the type of payload returned from the server is not an array,
the function <FirebaseData>.to<FirebaseJsonArray>() will contain empty array.
bool getArray(FirebaseData &fbdo, <string> path, QueryFilter &query);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the array is being read.
param target The FirebaseJsonArray object to get array value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not an array, the target FirebaseJsonArray object will contain an empty array.
bool getArray(FirebaseData &fbdo, <string> path, QueryFilter &query, FirebaseJsonArray *target);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the binary data is being read.
return Boolean type status indicates the success of the operation.
Call <FirebaseData>.dataType() to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<std::vector<uint8_t> *>() will return the dynamic array of unsigned 8-bit data of
payload returned from server.
If the payload returned from the server is not blob type,
the function <FirebaseData>.to<std::vector<uint8_t> *>() will return empty array.
bool getBlob(FirebaseData &fbdo, <string> path);param fbdo Firebase Data Object to hold data and instances.
param path Database path in which the binary data is being read.
param target Dynamic array of unsigned 8-bit data (i.e. std::vector<uint8_t>) to store value.
return Boolean type status indicates the success of the operation.
If the type of payload returned from the server is not a blob, the target variable value will be an empty array.
bool getBlob(FirebaseData &fbdo, <string> path, std::vector<uint8_t> &target);The downloaded data will be decoded to binary and save to SD card/Flash memory, then
please make sure that data at the defined database path is the file type.
param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to write file data, StorageType::FLASH or StorageType::SD.
param nodePath Database path that file data will be downloaded.
param fileName File name included its path in SD card/Flash memory.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean type status indicates the success of the operation.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool getFile(FirebaseData &fbdo, uint8_t storageType, <string> nodePath, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);param fbdo The pointer to Firebase Data Object.
param fwPath The firmware data path.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean value, indicates the success of the operation.
Note: In ESP8266, this function will allocate 16k+ memory for internal SSL client.
Firmware data is the bin file that stored on datanbase using pushFile or setFile function.
bool downloadOTA(FirebaseData *fbdo, <string> fwPath, RTDB_DownloadProgressCallback callback = NULL);param fbdo Firebase Data Object to hold data and instances.
param path Database path to be deleted.
return Boolean type status indicates the success of the operation.*
bool deleteNode(FirebaseData &fbdo, <string> path);Delete all child nodes at the defined database path if defined database path's ETag matched the ETag value
param fbdo Firebase Data Object to hold data and instances.
param path Database path to be deleted.
param ETag Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of the operation.*
If ETag at the defined database path does not match the provided ETag parameter, the operation will fail with HTTP code 412, Precondition Failed (ETag is not matched).
bool deleteNode(FirebaseData &fbdo, <string> path, <string> ETag);param fbdo The pointer to Firebase Data Object.
param path The parent path of children nodes that being delete.
param timestampNode The sub-child node that keep the timestamp.
param limit The maximum number of children nodes to delete at once, 30 is maximum.
param dataRetentionPeriod The period in seconds of data in the past which will be retained.
return Boolean value, indicates the success of the operation.*
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool deleteNodesByTimestamp(FirebaseData &fbdo, <string> path, <string> timestampNode, size_t limit, unsigned long dataRetentionPeriod);param fbdo Firebase Data Object to hold data and instances.
param path Database path to monitor.
return Boolean type status indicates the success of the operation.*
bool beginStream(FirebaseData &fbdo, <string> path);Start subscribe to the value changes at the defined parent node path with multiple nodes paths parsing.
param fbdo Firebase Data Object to hold data and instances.
param parentPath Database parent node path to subscribe.
return Boolean type status indicates the success of the operation.*
bool beginMultiPathStream(FirebaseData &fbdo, <string> parentPath,);Once beginStream was called e.g. in setup(), the readStream function should call inside the loop function.
param fbdo Firebase Data Object to hold data and instances.
return Boolean type status indicates the success of the operation.
Using the same Firebase Data object for stream read/monitoring associated with read, store, update, delete will break or quit the current stream connection.
The stream will be resumed or reconnected automatically when calling readStream.
bool readStream(FirebaseData &fbdo);It can be restart again by calling beginStream.
param fbdo Firebase Data Object to hold data and instances.
return Boolean type status indicates the success of the operation.
bool endStream(FirebaseData &fbdo);setStreamCallback should be called before Firebase.beginStream.
param fbdo Firebase Data Object to hold data and instances.
param dataAvailablecallback The Callback function that accepts streamData parameter.
param timeoutCallback The Callback function will be called when stream connection was timeout (optional).
param streamTaskStackSize The stream task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
dataAvailablecallback will be called When data in the defined path changed or the stream path changed or stream connection was resumed from read, store, update, and deleteNode.
The payload returned from the server will be one of these integer, float, string, JSON and blob types.
Call [streamData object].dataType to determine what type of data that successfully store in the database.
Call [streamData object].xxxData will return the appropriate data type of the payload returned from the server.
void setStreamCallback(FirebaseData &fbdo, StreamEventCallback dataAvailablecallback, StreamTimeoutCallback timeoutCallback = NULL, size_t streamTaskStackSize = 8192);setMultiPathStreamCallback should be called before Firebase.beginMultiPathStream.
param fbdo Firebase Data Object to hold data and instances.
param multiPathDataCallback The Callback function that accepts MultiPathStreamData parameter.
param timeoutCallback The Callback function will be called when stream connection was timeout (optional).
param streamTaskStackSize The stream task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
multiPathDataCallback will be called When data in the defined path changed or the stream path changed or stream connection was resumed from getXXX, setXXX, pushXXX, updateNode, deleteNode.
The payload returned from the server will be one of these integer, float, string and JSON.
Call [MultiPathStreamData object].get to get the child node value, type and data path.
The properties [MultiPathStreamData object].value, [MultiPathStreamData object].dataPath, and [MultiPathStreamData object].type will return the value, path of data, and type of data respectively.
These properties will store the result from calling the function [MultiPathStreamData object].get.
void setMultiPathStreamCallback(FirebaseData &fbdo, MultiPathStreamEventCallback multiPathDataCallback, StreamTimeoutCallback timeoutCallback = NULL, size_t streamTaskStackSize = 8192);param fbdo Firebase Data Object to hold data and instances.
void removeStreamCallback(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
void removeMultiPathStreamCallback(FirebaseData &fbdo);To manually triggering the stream callback function, this should call repeatedly in loop().
void runStream();param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to save file, StorageType::FLASH or StorageType::SD.
param nodePath Database path to be back up.
param fileName File name to save.
param callback Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean type status indicates the success of the operation.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool backup(FirebaseData &fbdo, uint8_t storageType, <string> nodePath, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);param fbdo Firebase Data Object to hold data and instances.
param storageType Type of storage to read file, StorageType::FLASH or StorageType::SD.
param nodePath Database path to be restored.
param fileName File name to read.
param callback Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean type status indicates the success of the operation.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool restore(FirebaseData &fbdo, uint8_t storageType <string> nodePath, <string> fileName, RTDB_UploadProgressCallback callback = NULL);Set maximum Firebase's read/store retry operation (0 - 255) in case of network problems and buffer overflow
param fbdo Firebase Data Object to hold data and instances.
param num The maximum retry.
void setMaxRetry(FirebaseData &fbdo, uint8_t num);Firebase read/store operation causes by network problems and buffer overflow will be added to Firebase Error Queues collection.
param fbdo Firebase Data Object to hold data and instances.
param num The maximum Firebase Error Queues.
void setMaxErrorQueue(FirebaseData &fbdo, uint8_t num);Firebase read (get) operation will not be saved.
param fbdo Firebase Data Object to hold data and instances.
param filename File name to be saved.
param storageType Type of storage to save file, StorageType::FLASH or StorageType::SD.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool saveErrorQueue(FirebaseData &fbdo, <string> filename, uint8_t storageType);param filename File name to delete.
param storageType Type of storage to save file, StorageType::FLASH or StorageType::SD.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool deleteStorageFile(<string> filename, uint8_t storageType);param fbdo Firebase Data Object to hold data and instances.
param filename Filename to be read and restore queues.
param storageType Type of storage to read file, StorageType::FLASH or StorageType::SD.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
bool restoreErrorQueue(FirebaseData &fbdo, <string> filename, uint8_t storageType);param fbdo Firebase Data Object to hold data and instances.
param filename Filename to be read and count for queues.
param storageType Type of storage to read file, StorageType::FLASH or StorageType::SD.
return Number (0-255) of queues store in defined FLASH file.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
uint8_t errorQueueCount(FirebaseData &fbdo, <string> filename, uint8_t storageType);param fbdo Firebase Data Object to hold data and instances.
return Number (0-255) of queues in Firebase Data object queue collection.
uint8_t errorQueueCount(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
return Boolean type status indicates whether the Firebase Error Queues collection was full or not.
bool isErrorQueueFull(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
param callback Callback function that accepts QueueInfo parameter.
void processErrorQueue(FirebaseData &fbdo, QueueInfoCallback callback = NULL);Return 0 if there is no Firebase Error from the last operation.
param fbdo Firebase Data Object to hold data and instances.
return Number of Queue ID.
uint32_t getErrorQueueID(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
param errorQueueID The Firebase Error Queue ID get from getErrorQueueID.
return Boolean type status indicates the queue existence.
bool isErrorQueueExisted(FirebaseData &fbdo, uint32_t errorQueueID);param fbdo Firebase Data Object to hold data and instances.
param callback Callback function that accepts QueueInfo Object as parameter, optional.
param queueTaskStackSize The queue error recovery task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
The following functions are available from QueueInfo Object accepted by callback.
queueInfo.totalQueues(), get the total Error Queues in Error Queue Collection.
queueInfo.currentQueueID(), get current Error Queue ID that being process.
queueInfo.isQueueFull(), determine whether Error Queue Collection is full or not.
queueInfo.dataType(), get a string of the Firebase call data type that being process of current Error Queue.
queueInfo.method(), get a string of the Firebase call method that being process of current Error Queue.
queueInfo.path(), get a string of the Firebase call path that being process of current Error Queue.
void beginAutoRunErrorQueue(FirebaseData &fbdo, QueueInfoCallback callback = NULL, size_t queueTaskStackSize = 8192);param fbdo Firebase Data Object to hold data and instances.
void endAutoRunErrorQueue(FirebaseData &fbdo);param fbdo Firebase Data Object to hold data and instances.
void clearErrorQueue(FirebaseData &fbdo);param ss The SPI Chip/Slave Select pin.
param sck The SPI Clock pin.
param miso The SPI MISO pin.
param mosi The SPI MOSI pin.
aram frequency The SPI frequency.
return boolean The boolean value indicates the success of operation.
bool sdBegin(int8_t ss = -1, int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1, uint32_t frequency = 4000000);param ss The SPI Chip/Slave Select pin.
param spiConfig The pointer to SPIClass object for SPI configuartion.
param frequency The SPI frequency.
return boolean The boolean value indicates the success of operation.
bool sdBegin(int8_t ss, SPIClass *spiConfig = nullptr, uint32_t frequency = 4000000);param sdFatSPIConfig The pointer to SdSpiConfig object for SdFat SPI configuration.
param ss The SPI Chip/Slave Select pin.
param sck The SPI Clock pin.
param miso The SPI MISO pin.
param mosi The SPI MOSI pin.
return boolean The boolean value indicates the success of operation.
bool sdBegin(SdSpiConfig *sdFatSPIConfig, int8_t ss = -1, int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1);param sdFatSDIOConfig The pointer to SdioConfig object for SdFat SDIO configuration.
return boolean The boolean value indicates the success of operation.
bool sdBegin(SdioConfig *sdFatSDIOConfig);param mountpoint The mounting point.
param mode1bit Allow 1 bit data line (SPI mode).
param format_if_mount_failed Format SD_MMC card if mount failed.
return Boolean type status indicates the success of the operation.
bool sdMMCBegin(const char *mountpoint = "/sdcard", bool mode1bit = false, bool format_if_mount_failed = false);param ts timestamp in seconds from midnight Jan 1, 1970.
return Boolean type status indicates the success of the operation.
This function allows the internal time setting by timestamp i.e. timestamp from external RTC.
bool setSystemTime(time_t ts);param httpCode The http code.
param buff The C++ string buffer out.
void errorToString(int httpCode, std::string &buff);These functions can be called directly from FCM object in the Firebase object e.g. Firebase.FCM.<function name>
param serverKey Server key found on Console: Project settings > Cloud Messaging
param spi_ethernet_module SPI_ETH_Module struct data, optional for ESP8266 use with Ethernet module.
note: This server key required for sending message via legacy HTTP API.
SPI_ETH_Module struct data is for ESP8266 Ethernet supported module lwip interface.
The usage example for Ethernet.
#include <ENC28J60lwIP.h>
#define ETH_CS_PIN 16 //GPIO 16 connected to Ethernet module (ENC28J60) CS pin
ENC28J60lwIP eth(ETH_CS_PIN);
FirebaseData fbdo;
SPI_ETH_Module spi_ethernet_module;
//in setup()
spi_ethernet_module.enc28j60 = ð
Firebase.FCM.setServerKey(FIREBASE_FCM_SERVER_KEY, &spi_ethernet_module);
The API key created in the Google Cloud console, cannot be used for authorizing FCM requests.
void setServerKey(<string> serverKey, SPI_ETH_Module *spi_ethernet_module = NUL);param fbdo The pointer to Firebase Data Object.
param msg The pointer to the message to send which is the FCM_Legacy_JSON_Message type data.
return Boolean value, indicates the success of the operation.
The FCM_Legacy_JSON_Message properties are
targets - The targets of messages e.g. to, registration_ids, condition.
options - The options of message contained the sub-properties e.g, collapse_key, priority, content_available, mutable_content,time_to_live, restricted_package_name, and dry_run.
The sub-properties value of the options should be assigned in string.
payloads - The two payloads i.e. notification and data.
The payloads.notification properties are available e.g.
| Name | Type | Platform |
|---|---|---|
| title | string | all |
| body | string | all |
| icon | string | Andoid, web |
| click_action | string | all |
| sound | string | iOS, Android |
| badge | number | iOS |
| subtitle | string | iOS |
| body_loc_key | string | iOS, Android |
| body_loc_args | JSON array of string | iOS, Android |
| title_loc_key | string iOS, Android | |
| title_loc_args | JSON array of string | iOS, Android |
| android_channel_id | string | Android |
| tag | string | Android |
| color | string | Android |
The payloads.data is the JSON object.
Read more details about legacy HTTP API here https://firebase.google.com/docs/cloud-messaging/http-server-ref
bool send(FirebaseData *fbdo, FCM_Legacy_HTTP_Message *msg);param fbdo The pointer to Firebase Data Object.
param msg The pointer to the message to send which is the FCM_HTTPv1_JSON_Message type data.
return Boolean value, indicates the success of the operation.
Read more details about HTTP v1 API here https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
bool send(FirebaseData *fbdo, FCM_HTTPv1_JSON_Message *msg);param fbdo The pointer to Firebase Data Object.
param topic The topic to subscribe.
param IID The instance ID tokens or registration tokens array.
param numToken The size of instance ID tokens array.
return Boolean value, indicates the success of the operation.
bool subscribeTopic(FirebaseData *fbdo, <string> topic, <string> IID[], size_t numToken);param fbdo The pointer to Firebase Data Object.
param topic The topic to romove the subscription.
param IID The instance ID tokens or registration tokens array.
param numToken The size of instance ID tokens array.
return Boolean value, indicates the success of the operation.
bool unsubscribeTopic(FirebaseData *fbdo, <string> topic, <string> IID[], size_t numToken);param fbdo The pointer to Firebase Data Object.
param IID The instance ID token of device.
return Boolean value, indicates the success of the operation.
bool appInstanceInfo(FirebaseData *fbdo, <string> IID);param fbdo The pointer to Firebase Data Object.
param application The Bundle id of the app.
param sandbox The Boolean to indicate sandbox environment (TRUE) or production (FALSE).
param APNs The iOS APNs tokens array.
param numToken The size of instance ID tokens array.
return Boolean value, indicates the success of the operation.
bool regisAPNsTokens(FirebaseData *fbdo, <string> application, bool sandbox, <string> APNs[], size_t numToken);param client The pointer to Arduino Client.
param networkConnectionCB The function that handles the network connection.
param networkStatusCB The function that handle the network connection status acknowledgement.
void setGenericClient(Client *client, FB_NetworkConnectionRequestCallback networkConnectionCB,
FB_NetworkStatusRequestCallback networkStatusCB);param client The pointer to TinyGsmClient.
param modem The pointer to TinyGsm modem object. Modem should be initialized and/or set mode before transfering data.
param pin The SIM pin.
param apn The GPRS APN (Access Point Name).
param user The GPRS user.
param password The GPRS password.
void setGSMClient(Client *client, void *modem, const char *pin, const char *apn, const char *user, const char *password);param client The pointer to Ethernet client object.
param macAddress The Ethernet MAC address.
param csPin The Ethernet module SPI chip select pin.
param resetPin The Ethernet module reset pin.
param staticIP (Optional) The pointer to Firebase_StaticIP object which included these IPAddress properties ipAddress, netMask, defaultGateway and dnsServer.
void setEthernetClient(Client *client, uint8_t macAddress[6], int csPin, int resetPin, Firebase_StaticIP *staticIP = nullptr);param status The network status.
void setNetworkStatus(bool status);param rx The number of bytes for receive buffer memory for secured mode BearSSL (512 is minimum, 16384 is maximum).
param tx The number of bytes for transmit buffer memory for secured mode BearSSL (512 is minimum, 16384 is maximum).
Set this option to false to support get large Blob and File operations.
void void setBSSLBufferSize(uint16_t rx, uint16_t tx);param len The server response buffer size limit.
void setResponseSize(uint16_t len);return WiFi client instance.
ESP_SSLClient *getWiFiClient();note: This will release the memory used by internal SSL client.
void stopWiFiClient();void closeFile();param ca PEM format certificate string.
void setCert(const char* ca);param pause True for pause and False for unpause.
return Boolean type status indicates the success of the operation.
bool pauseFirebase(bool pause);return Boolean type value of pause status.
bool isPause();return Internal WiFiClientSecure pointer.
WiFiClientSecure *getWiFiClient();This will release the memory used by internal WiFi client.
The next server connection will take time (a second) due to SSL/TLS handshaking
void stopWiFiClient();return The one of these data type e.g. string, boolean, int, float, double, json, array, blob, file and null.
String dataType();return The enumeration value of firebase_rtdb_data_type.
firebase_rtdb_data_type_null or 1,
firebase_rtdb_data_type_integer or 2,
firebase_rtdb_data_type_float or 3,
firebase_rtdb_data_type_double or 4,
firebase_rtdb_data_type_boolean or 5,
firebase_rtdb_data_type_string or 6,
firebase_rtdb_data_type_json or 7,
firebase_rtdb_data_type_array or 8,
firebase_rtdb_data_type_blob or 9,
firebase_rtdb_data_type_file or 10
uint8_t dataTypeEnum();return The one of these event type String e.g. put, patch, cancel, and auth_revoked.
The event type "put" indicated that data at the event path relative to the stream path was completely changed.
The event path can be determined by dataPath().
The event type "patch" indicated that data at the event path relative to stream path was updated.
The event path can be determined by dataPath().
The event type "cancel" indicated something wrong and cancel by the server.
The event type "auth_revoked" indicated the provided Firebase Authentication Data (Database secret) is no longer valid.
String eventType();return String. of unique identifier.
String ETag();return The database streaming path.
String streamPath();return The database path which belongs to server' s returned payload.
The database path returned from this function in case of stream, also changed upon the child or parent's stream value changes.
String dataPath();return The error description string (String object).
String errorReason();return The error code (int).
See src/FB_Error.h
String errorCode();return Integer value.
int intData();return Float value.
float floatData();return Double value.
float doubleData();return Boolean value.
float boolData();return String (String object).
String stringData();return String (String object).
String jsonString();return FirebaseJson object.
FirebaseJson &jsonObject();return **FirebaseJson object **pointer.
FirebaseJson *jsonObjectPtr();return FirebaseJsonArray object.
FirebaseJsonArray &jsonArray();return FirebaseJsonArray object pointer.
FirebaseJsonArray *jsonArrayPtr();return FirebaseJsonData object.
FirebaseJsonData &jsonData();return FirebaseJsonData object pointer.
FirebaseJsonData *jsonDataPtr();return Dynamic array of 8-bit unsigned integer i.e. std::vector<uint8_t>.
std::vector<uint8_t> blobData();return the file stream.
File fileStream();return the The object or primitive type variable.
to<type>();
e.g. to<String>(), to<int>(), to<bool>()Return the new appended node's name or key of server returned payload when calling pushXXX function (RTDB only).
return String (String object).
String pushName();return Boolean type status indicates whether the Firebase Data object is working with a stream or not.
bool isStream();return Boolean type status indicates whether the Firebase Data object is connected to the server or not.
bool httpConnected();Nothing to do when stream connection timeout, the stream connection will be automatically resumed.
return Boolean type status indicates whether the stream was a timeout or not.
bool streamTimeout();return Boolean type status indicates whether the server returns the new payload or not.
bool dataAvailable();return Boolean type status indicates whether the server returns the stream event-data
payload or not.
bool streamAvailable();Get the matching between data type that intend to get from/store to database and the server's return payload data type (RTDB only.
return Boolean type status indicates whether the type of data being get from/store to database
and the server's returned payload is matched or not.
Data type checking was disable by default, which can be enabled via the Firebase Config e.g. config.rtdb.data_type_stricted = true
bool mismatchDataType();return Integer number of HTTP status.
int httpCode();return Integer number of payload length.
int payloadLength();return Integer number of max payload length.
int maxPayloadLength();return Boolean of the overflow status.
Total default HTTP response buffer size is 400 bytes which can be set through Firebase.setResponseSize.
bool bufferOverflow();return String (String object) of the file name that stores on SD card after backup operation.
String getBackupFilename();return Number of byte of backup file in byte after backup operation.
size_t getBackupFileSize();void clear();Get the error description for file transferring (pushFile, setFile, backup and restore) (RTDB only).
return Error description string* (String object).
String fileTransferError();return Payload string* (String object).
String payload();param tcpKeepIdleSeconds lwIP TCP Keepalive idle in seconds.
param tcpKeepIntervalSeconds lwIP TCP Keepalive interval in seconds.
param tcpKeepCount lwIP TCP Keepalive count.
For the TCP (KeepAlive) options, see this doc.
If value of one of these parameters is zero, the TCP KeepAlive will be disabled.
You can check the server connecting status, by exexuting <FirebaseData>.httpConnected() which will return true when connection to the server is still alive.
void keepAlive(int tcpKeepIdleSeconds, int tcpKeepIntervalSeconds, int tcpKeepCount);return Boolean status of TCP Keepalive.
bool isKeepAlive();param serverKey Server key found on Console: Project settings > Cloud Messaging
param spi_ethernet_module SPI_ETH_Module struct data, optional for ESP8266 use with Ethernet module.
SPI_ETH_Module struct data is for ESP8266 Ethernet supported module lwip interface.
The usage example for Ethernet.
#include <ENC28J60lwIP.h>
#define ETH_CS_PIN 16 //GPIO 16 connected to Ethernet module (ENC28J60) CS pin
ENC28J60lwIP eth(ETH_CS_PIN);
FirebaseData fbdo;
SPI_ETH_Module spi_ethernet_module;
//in setup()
spi_ethernet_module.enc28j60 = ð
fbdo.fcm.begin(FIREBASE_FCM_SERVER_KEY, &spi_ethernet_module);
void begin(<string> serverKey, SPI_ETH_Module *spi_ethernet_module = NULL);param deviceToken Recipient's device registration token to add that message will be sent to.
void addDeviceToken(<string> deviceToken);param index Index (start from zero) of recipient's device registration token that added to FCM Data Object of Firebase Data object.
void removeDeviceToken(uint16_t index); void clearDeviceToken();param title The title text of notification message.
param body The body text of notification message.
void setNotifyMessage(<string> title, <string> body);param title The title text of notification message.
param body The body text of notification message.
param icon The name and/or included URI/URL of the icon to show on notifying the message.
void setNotifyMessage(<string> title, <string> body, <string> icon);param title The title text of notification message.
param body The body text of notification message.
param icon The name and/or included URI/URL of the icon to show on notifying the message.
param click_action The URL or intent to accept click event on the notification message.
void setNotifyMessage(<string> title, <string> body, <string> icon, <string> click_action);param key The key field in notification message.
param value The value field in the notification message.
void addCustomNotifyMessage(<string> key, <string> value);void clearNotifyMessage();param jsonString The JSON structured data string.
void setDataMessage(<string> jsonString);param json The FirebaseJson object.
void setDataMessage(FirebaseJson &json);void clearDataMessage();param priority The priority string i.e. normal and high.
void setPriority(<string> priority);param key String of collapse key.
void setCollapseKey(<string> key);param seconds Number of seconds from 0 to 2,419,200 (4 weeks).
void setTimeToLive(uint32_t seconds);param **`topic - Topic string.
void setTopic(<string> topic);return const char* of payload returned from the server.
const char* getSendResult();param data The JSON object literal string to set or deserialize.
return bool value represents the successful operation.
Call FirebaseJson.errorPosition to get the error.
bool setJsonData(<string> data);return instance of an object.
FirebaseJson &clear();param client The pointer to or instance of Client object.
return instance of an object.
bool readFrom(Client *client);
bool readFrom(Client &client);param client The pointer to or instance of WiFiClient object.
return instance of an object.
bool readFrom(WiFiClient *client);
bool readFrom(WiFiClient &client);param client The pointer to or instance of WiFiClientSecure object.
return instance of an object.
bool readFrom(WiFiClientSecure *client);
bool readFrom(WiFiClientSecure &client);param ser The HW or SW Serial object.
param timeoutMS The timeout in millisecond to wait for Serial data to be completed.
return instance of an object.
bool readFrom(HardwareSerial &ser, uint32_t timeoutMS = 5000);
bool readFrom(SoftwareSerial &ser, uint32_t timeoutMS = 5000);param file The File object.
return instance of an object.
bool readFrom(fs::File &file);param key The new key string that null to be added.
return instance of an object.
FirebaseJson &add(<string> key);param key The new key string that string value to be added.
param value The value for the new specified key.
return instance of an object.
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
FirebaseJson &add(<string> key, <type> value);param out The writable object e.g. String, std::string, char array, Stream e.g ile, WiFi/Ethernet Client and LWMQTT, that accepts the returning string.
param topic The MQTT topic (LWMQTT).
param prettify Boolean flag for return the pretty format string i.e. with text indentation and newline.
void toString(<type> out, bool prettify = false);
void toString(<type> out, <string> topic, bool prettify = false);param result The reference of FirebaseJsonData that holds the result.
param path Relative path to the specific node in FirebaseJson object.
param prettify The text indentation and new line serialization option.
return boolean status of the operation.
The FirebaseJsonData object holds the returned data which can be read from the following properties.
jsonData.stringValue - contains the returned string.
jsonData.intValue - contains the returned integer value.
jsonData.floatValue - contains the returned float value.
jsonData.doubleValue - contains the returned double value.
jsonData.boolValue - contains the returned boolean value.
jsonData.success - used to determine the result of the get operation.
jsonData.type - used to determine the type of returned value in string represents the types of value e.g. string, int, double, boolean, array, object, null and undefined.
jsonData.typeNum used to determine the type of returned value is an integer as represented by the following value.
FirebaseJson::UNDEFINED = 0
FirebaseJson::OBJECT = 1
FirebaseJson::ARRAY = 2
FirebaseJson::STRING = 3
FirebaseJson::INT = 4
FirebaseJson::FLOAT = 5
FirebaseJson::DOUBLE = 6
FirebaseJson::BOOL = 7 and
FirebaseJson::NULL = 8
bool get(FirebaseJsonData &result, <string> path, bool prettify = false);param result The reference of FirebaseJsonData that holds the result.
param criteria The FirebaseJson::SearchCriteria data.
param prettify The text indentation and new line serialization option.
return number of elements found from search.
The SearchCriteria data has the properties e.g.
path - The key of path to search.
Path can be wildcard with * in search path and * should use as key in part and do not mix with any character.
value - The value string to search.
depth - The begin depth (int) of element to search, default is 0.
endDepth - The end depth (int) of element to search, default is -1.
searchAll - The boolean option to search all occurrences of elements.
size_t search(SearchCriteria &criteria);
size_t search(FirebaseJsonData &result, SearchCriteria &criteria, bool prettify = false);param path The key or path to search in to.
param searchAll Search all occurrences.
return full path string in case of found.
String getPath(<string> path, bool searchAll = false);param path The key or path of child element check.
return boolean status indicated the existence of element.
bool isMember(<string> path);return number of child/array elements in FirebaseJson object.
size_t iteratorBegin();param index The element index to get.
param type The integer which holds the type of data i.e. FirebaseJson::OBJECT and FirebaseJson::ARRAY
param key The string which holds the key/name of the object, can return empty String if the data type is an array.
param value The string which holds the value for the element key or array.
void iteratorGet(size_t index, int &type, String &key, String &value);param index The element index to get.
return IteratorValue struct
This should call after iteratorBegin.
The IteratorValue struct contains the following members: int type String key String value
IteratorValue valueAt(size_t index);void iteratorEnd();param path The relative path that null to be set.
The relative path can be mixed with array index (number placed inside square brackets) and node names e.g. /myRoot/[2]/Sensor1/myData/[3].
void set(<string> path);param path The relative path that string value to be set.
param value The value to set.
The relative path can be mixed with array index (number placed inside square brackets) and node names e.g. /myRoot/[2]/Sensor1/myData/[3].
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
void set(<string> path, <type> value);param path The relative path to remove its contents/children.
return bool value represents the successful operation.
bool remove(<string> path);return raw JSON string
const char *raw();return the position of error in JSON object literal
Return -1 when for no parsing error.
int errorPosition();param prettify The text indentation and new line serialization option.
return size in byte of buffer
size_t serializedBufferLength(bool prettify = false);param digits The number of decimal places.
void setFloatDigits(uint8_t digits);param digits The number of decimal places.
void setDoubleDigits(uint8_t digits);return the response code of reading JSON data from WiFi/Ethernet Client
int responseCode();param data The JSON array literal string to set or deserialize.
return bool value represents the successful operation.
Call FirebaseJsonArray.errorPosition to get the error.
bool setJsonArrayData(<string> data);return instance of an object.
FirebaseJsonArray &add();param value The value to add.
return instance of an object.
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
FirebaseJsonArray &add(<type> value);param v The value of any type to add.
param n The consecutive values of any type to add.
return instance of an object.
e.g. add("a","b",1,2)
FirebaseJsonArray &add(First v, Next... n);param client The pointer to or instance of Client object.
return instance of an object.
bool readFrom(Client *client);
bool readFrom(Client &client);param client The pointer to or instance of WiFiClient object.
return instance of an object.
bool readFrom(WiFiClient *client);
bool readFrom(WiFiClient &client);param client The pointer to or instance of WiFiClientSecure object.
return instance of an object.
bool readFrom(WiFiClientSecure *client);
bool readFrom(WiFiClientSecure &client);param ser The HW or SW Serial object.
param timeoutMS The timeout in millisecond to wait for Serial data to be completed.
return instance of an object.
bool readFrom(HardwareSerial &ser, uint32_t timeoutMS = 5000);
bool readFrom(SoftwareSerial &ser, uint32_t timeoutMS = 5000);param file The File object.
return instance of an object.
bool readFrom(fs::File &file);param result The reference of FirebaseJsonData object that holds data at the specified index.
param index_or_path Index of data or relative path to data in FirebaseJsonArray object.
return boolean status of the operation.
The relative path must begin with array index (number placed inside square brackets) followed by other array indexes or node names e.g. /[2]/myData would get the data from myData key inside the array indexes 2
bool get(FirebaseJsonData &result, <int or string> index_or_path);param result The reference of FirebaseJsonData that holds the result.
param criteria The FirebaseJson::SearchCriteria data.
param prettify The text indentation and new line serialization option.
return number of elements found from search.
The SearchCriteria data has the properties e.g.
path - The key of path to search.
Path can be wildcard with * in search path and * should use as key in part and do not mix with any character.
value - The value string to search.
depth - The begin depth (int) of element to search, default is 0.
endDepth - The end depth (int) of element to search, default is -1.
searchAll - The boolean option to search all occurrences of elements.
size_t search(SearchCriteria &criteria);
size_t search(FirebaseJsonData &result, SearchCriteria &criteria, bool prettify = false);param path The key or path to search in to.
param searchAll Search all occurrences.
return full path string in case of found.
String getPath(<string> path, bool searchAll = false);param path The key or path of child element check.
return boolean status indicated the existence of element.
bool isMember(<string> path);return number of child/array elements in FirebaseJsonArray object.
size_t iteratorBegin();param index The element index to get.
param type The integer which holds the type of data i.e. FirebaseJson::OBJECT and FirebaseJson::ARRAY
param key The string which holds the key/name of the object, can return empty String if the data type is an array.
param value The string which holds the value for the element key or array.
void iteratorGet(size_t index, int &type, String &key, String &value);param index The element index to get.
return IteratorValue struct
This should call after iteratorBegin.
The IteratorValue struct contains the following members: int type String key String value
IteratorValue valueAt(size_t index);void iteratorEnd();return length of the array.
size_t size();param out The writable object e.g. String, std::string, char array, Stream e.g ile, WiFi/Ethernet Client and LWMQTT, that accepts the returning string.
param prettify Boolean flag for return the pretty format string i.e. with text indentation and newline.
void toString(<type> out, bool prettify = false);return raw JSON Array string
const char *raw();param prettify The text indentation and new line serialization option.
return size in byte of buffer
size_t serializedBufferLength(bool prettify = false);return instance of an object.
FirebaseJsonArray &clear();param index_or_path The array index or path that null to be set.
void set(<int or string> index_or_path);param index_or_path The array index or path that value to be set.
param value The value to set.
void set(<int or string> index_or_path, <type> value);param index_or_path The array index or relative path to array to be removed.
return bool value represents the successful operation.
bool remove(<int or string> index_or_path);return the position of error in JSON array literal
Return -1 when for no parsing error.
int errorPosition();param digits The number of decimal places.
void setFloatDigits(uint8_t digits);param digits The number of decimal places.
void setDoubleDigits(uint8_t digits);param jsonArray The returning FirebaseJsonArray object.
return bool status for successful operation.
This should call after pares or get functions.
bool getArray(FirebaseJsonArray &jsonArray);param source The JSON array string.
param jsonArray The returning FirebaseJsonArray object.
return bool status for successful operation.
This should call after pares or get functions.
bool getArray(<string> source, FirebaseJsonArray &jsonArray);param jsonArray The returning FirebaseJson object.
return bool status for successful operation.
This should call after pares or get functions.
bool getJSON(FirebaseJson &json);param source The JSON string.
param json The returning FirebaseJsonArray object.
return bool status for successful operation.
This should call after pares or get functions.
bool getJSON(<string> source, FirebaseJson &json);return the The object or primitive type variable.
to<type>();
e.g. to<String>(), to<int>(), to<bool>()stringValue The String value of parses data.
intValue The int value of parses data.
doubleValue The double value of parses data.
floatValue The float value of parses data.
boolVlue The bool value of parses data.
success used to determine the result of the deserialize operation.
type The type String of parses data e.g. string, int, double, boolean, array, object, null and undefined.
typeNum The type (number) of parses data in form of the following jsonDataType value.
FirebaseJson::UNDEFINED = 0
FirebaseJson::OBJECT = 1
FirebaseJson::ARRAY = 2
FirebaseJson::STRING = 3
FirebaseJson::INT = 4
FirebaseJson::FLOAT = 5
FirebaseJson::DOUBLE = 6
FirebaseJson::BOOL = 7 and
FirebaseJson::NULL = 8
The MIT License (MIT)
Copyright (c) 2024 K. Suwatchai (Mobizt)
Permission is hereby granted, free of charge, to any person returning a copy 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 so, subject to the following conditions:
The above 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 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.