Google's Firebase Realtime Database Arduino Library for ESP8266 v 2.4.2
param host - Your Firebase database project host e.g. Your_ProjectID.firebaseio.com.
param auth - Your database secret.
param rootCA - Root CA certificate base64 string (PEM file).
param rootCAFile - Root CA certificate DER file (binary).
param storageType - Type of storage, StorageType::SD and StorageType::SPIFFS.
Root CA certificate DER file is only support in Core SDK v2.5.x
void begin(const String &host, const String &auth);
void begin(const String &host, const String &auth, const char *rootCA);
void begin(const String &host, const String &auth, const String &rootCAFile, uint8_t storageType);param reconnect - The boolean to set/unset WiFi AP reconnection.
void reconnectWiFi(bool reconnect);param dataObj - Firebase Data Object to hold data and instances.
param millisec - The missiseconds to limit the request (0 - 900,000 ms or 15 min).
void setReadTimeout(FirebaseData &dataObj, int millisec);param dataObj - 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 e.g. tiny (1s), small (10s), medium (30s) and large (60s).
void setwriteSizeLimit(FirebaseData &dataObj, const String &size);param dataObj - Firebase Data Object to hold data and instances.
return - Boolean type status indicates the success of operation.
bool getRules(FirebaseData &dataObj);param dataObj - Firebase Data Object to hold data and instances.
param rules - Database rules in jSON String format.
return - Boolean type status indicates the success of operation.
bool setRules(FirebaseData &dataObj, const String &rules);param dataObj - 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 was existed or not.
bool pathExist(FirebaseData &dataObj, const String &path);return String of unique identifier.
String getETag(FirebaseData &dataObj, const String &path);aram dataObj - Firebase Data Object to hold data and instances.
param path - Database path being read the data.
return - Boolean type status indicates the success of operation.
Return the child data with its value or JSON object (its values will be truncated to true).
Call [FirebaseData object].dataType to determine what type of data that returned from database.
Call [FirebaseData object].intData to get integer data.
Call [FirebaseData object].floatData to get float data.
Call [FirebaseData object].doubleData to get double data.
Call [FirebaseData object].boolData to get boolean data.
Call [FirebaseData object].stringData to get string data.
Call [FirebaseData object].jsonData to get JSON string data.
Call [FirebaseData object].jsonObject to get FirebaseJson object.
bool getShallowData(FirebaseData &dataObj, const String &path); param dataObj - 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 &dataObj, bool flag);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which to set the prioity value.
param priority - The priority value.
return - Boolean type status indicates the success of operation.
This allows us to set priority to any node other than priority that set through setJSON, pushJSON, updateNode and updateNodeSilent functions.
The returned priority value from server can read from function [FirebaseData object].priority().
bool setPriority(FirebaseData &dataObj, const String &path, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which to set the prioity value.
return - Boolean type status indicates the success of operation.
The priority value from server can read from function [FirebaseData object].priority().
bool getPriority(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which integer value will be appended.
param intValue - The appended value.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushInt(FirebaseData &dataObj, const String &path, int intValue);bool pushInt(FirebaseData &dataObj, const String &path, int intValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float value will be appended.
param floatValue - The appended value.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushFloat(FirebaseData &dataObj, const String &path, float floatValue);bool pushFloat(FirebaseData &dataObj, const String &path, float floatValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float value will be appended.
param doubleValue - The appended value.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushDouble(FirebaseData &dataObj, const String &path, double doubleValue);bool pushDouble(FirebaseData &dataObj, const String &path, double doubleValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which Boolean value will be appended.
param boolValue - The appended value.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushBool(FirebaseData &dataObj, const String &path, bool boolValue);bool pushBool(FirebaseData &dataObj, const String &path, bool boolValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which string will be appended.
param stringValue - The appended value.
return Boolean type status indicates the success of operation.
The new appended node's key stored in Firebase Data object, which can be accessed via function [FirebaseData object].pushName().
bool pushString(FirebaseData &dataObj, const String &path, const String &stringValue);bool pushString(FirebaseData &dataObj, const String &path, const String &stringValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which key and value in JSON data will be appended.
param jsonString - The appended JSON string (should be valid JSON data).
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushJSON(FirebaseData &dataObj, const String &path, const String &jsonString);param dataObj - 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 operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json);Append new child nodes's key and value (using JSON data or FirebaseJson object) and the virtual child ".priority" to the defined database path.
bool pushJSON(FirebaseData &dataObj, const String &path, const String &jsonString, float priority);
bool pushJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which binary data will be appended.
param blob - Byte array of data.
param size - Size of byte array.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size);bool pushBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size, float priority);param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to read file data, StorageType::SPIFS or StorageType::SD.
param path - Target database path which binary data from file will be appended.
param fileName - File name included its path in SD card/Flash memory.
return Boolean type status indicates the success of operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName);Append new binary data from file store on SD card/Flash memory and the virtual child ".priority" to the defined database path.
bool pushFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName, float priority);param dataObj - 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 operation.
The new appended node's key will be stored in Firebase Data object, which its value can be accessed via function [FirebaseData object].pushName().
bool pushTimestamp(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which integer data will be set.
param intValue - Integer value to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].intData will return the integer value of payload returned from server.
bool setInt(FirebaseData &dataObj, const String &path, int intValue);bool setInt(FirebaseData &dataObj, const String &path, int intValue, float priority);Set integer data at the defined database path if defined database path's ETag matched the ETag value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which integer data will be set.
param intValue - Integer value to set.
param ETag - Known unique identifier string (ETag) of defined database path.
return - Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
If ETag at the defined database path is not match the provided ETag parameter,the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].intData to get the current integer value.
bool setInt(FirebaseData &dataObj, const String &path, int intValue, const String &ETag);Set integer data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setInt(FirebaseData &dataObj, const String &path, int intValue, float priority, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param floatValue - Float value to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].floatData will return the float value of payload returned from server.
bool setFloat(FirebaseData &dataObj, const String &path, float floatValue);bool setFloat(FirebaseData &dataObj, const String &path, float floatValue, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param floatValue - Float value to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].floatData will return the float value of payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter,the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].floatData to get the current float value.
bool setFloat(FirebaseData &dataObj, const String &path, float floatValue, const String &ETag);Set float data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setFloat(FirebaseData &dataObj, const String &path, float floatValue, float priority, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param doubleValue - Double value to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].doubleData will return the double value of payload returned from server.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place, use printf("%.9lf\n", firebaseData.doubleData()); for print the returned double value up to 9 decimal places.
bool setDouble(FirebaseData &dataObj, const String &path, double doubleValue);bool setDouble(FirebaseData &dataObj, const String &path, double doubleValue, float priority);Set double data at the defined database path if defined database path's ETag matched the ETag value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param doubleValue - Double value to set.
param ETag - Known unique identifier string (ETag) of defined database path.
return - Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].doubleData will return the double value of payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].doubeData to get the current double value.
bool setDouble(FirebaseData &dataObj, const String &path, double doubleValue, const String &ETag);Set double data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setDouble(FirebaseData &dataObj, const String &path, double doubleValue, float priority, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param boolValue - Boolean value to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].boolData will return the Boolean value of payload returned from server.
bool setBool(FirebaseData &dataObj, const String &path, bool boolValue);bool setBool(FirebaseData &dataObj, const String &path, bool boolValue, float priority);Set Boolean data at the defined database path if defined database path's ETag matched the ETag value
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which float data will be set.
param boolValue - Boolean value to set.
param ETag - Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].boolData will return the Boolean value of payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].doubeData to get the current boolean value.
bool setBool(FirebaseData &dataObj, const String &path, bool boolValue, const String &ETag);Set boolean data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setBool(FirebaseData &dataObj, const String &path, bool boolValue, float priority, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which string data will be set.
param stringValue - String or text to set.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].stringData will return the string value of payload returned from server.
bool setString(FirebaseData &dataObj, const String &path, const String &stringValue);bool setString(FirebaseData &dataObj, const String &path, const String &stringValue, float priority);Set string (text) at the defined database path if defined database path's ETag matched the ETag value
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which string data will be set.
param stringValue - String or text to set.
param ETag - Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].stringData will return the string value of payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].stringData to get the current string value.
bool setString(FirebaseData &dataObj, const String &path, const String &stringValue, const String &ETag);Set string data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setString(FirebaseData &dataObj, const String &path, const String &stringValue, float priority, const String &ETag);This will replace any child nodes inside the defined path with node' s key and value defined in JSON data.
param dataObj - 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 jsonString - The JSON string to set (should be valid JSON data).
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the JSON string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
bool setJSON(FirebaseData &dataObj, const String &path, const String &jsonString);This will replace any child nodes inside the defined path with node' s key and value defined in FirebaseJson object.
param dataObj - 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 operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the JSON string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
bool setJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json);bool setJSON(FirebaseData &dataObj, const String &path, const String &jsonString, float priority);
bool setJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json, float priority);Set child nodes's 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 dataObj - 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 operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the JSON string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
If operation failed due to ETag is not match, call [FirebaseData object].ETag() to get the current ETag value. Also call [FirebaseData object].jsonData to get the current JSON string value [FirebaseData object].jsonObject to get the FirebaseJson object.
bool setJSON(FirebaseData &dataObj, const String &path, const String &jsonString, const String &ETag);
bool setJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json, const 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 &dataObj, const String &path, const String &jsonString, float priority, const String &ETag);
bool setJSON(FirebaseData &dataObj, const String &path, FirebaseJson &json, float priority, const String &ETag);This will replace any child nodes inside the defined path with blob or binary data.
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which binary data will be set.
param blob - Byte array of data.
param size - Size of byte array.
return Boolean type status indicates the success of operation.
No payload returned from server.
bool setBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size);bool setBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size, float priority);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 blob or binary data.
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which binary data will be set.
param blob - Byte array of data.
param size - Size of byte array.
param ETag - Known unique identifier string (ETag) of defined database path.
return Boolean type status indicates the success of operation.
No payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
bool setBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size, const String &ETag);Set blob data and the virtual child ".priority" if defined ETag matches at the defined database path
bool setBlob(FirebaseData &dataObj, const String &path, uint8_t *blob, size_t size, float priority, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to read file data, StorageType::SPIFS or StorageType::SD.
param path - Target database path which binary data from file will be set.
param fileName - File name included its path in SD card/Flash memory.
return Boolean type status indicates the success of operation.
No payload returned from server.
bool setFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName);bool setFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName, float priority);Set binary data from file stores on SD card/Flash memory to the defined database path if defined database path's ETag matched the ETag value
param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to read file data, StorageType::SPIFS or StorageType::SD.
param path - Target database path which binary data from 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.
return Boolean type status indicates the success of operation.
No payload returned from server.
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
bool setFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName, const String &ETag);Set binary data from file and the virtual child ".priority" if defined ETag matches at the defined database path
bool setFile(FirebaseData &dataObj, uint8_t storageType, const String &path, const String &fileName, float priority, const String &ETag);param dataObj - 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 operation.
Call [FirebaseData object].intData will return the integer value of timestamp in seconds or [FirebaseData object].doubleData to get millisecond timestamp.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place, use printf("%.0lf\n", firebaseData.doubleData());.
bool setTimestamp(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which key and value in JSON data will be update.
param jsonString - The JSON string use for update.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the json string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
To reduce the network data usage, use updateNodeSilent instead.
bool updateNode(FirebaseData &dataObj, const String &path, const String &jsonString);Update child nodes's key or exising key's value (using FirebaseJson object) under the defined database path
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which key and value in FirebaseJson object will be update.
param json - The FirebaseJson object used for update.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the json string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
To reduce the network data usage, use updateNodeSilent instead.
bool updateNode(FirebaseData &dataObj, const String &path, FirebaseJson &json);Update child nodes's key or exising key's value and virtual child ".priority" (using JSON data or FirebaseJson object) under the defined database path.
bool updateNode(FirebaseData &dataObj, const String &path, const String &jsonString, float priority);
bool updateNode(FirebaseData &dataObj, const String &path, FirebaseJson &json, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which key and value in JSON data will be update.
param jsonString - The JSON string use for update.
return Boolean type status indicates the success of operation.
Owing to the objective of this function to reduce the netwok data usage, no payload will be returned from server.
bool updateNodeSilent(FirebaseData &dataObj, const String &path, const String &jsonString);Update child nodes's key or exising key's value (using FirebaseJson object) under the defined database path
param dataObj - Firebase Data Object to hold data and instances.
param path - Target database path which key and value in FirebaseJson object will be update.
param json - The FirebaseJson object used for update.
return Boolean type status indicates the success of operation.
Owing to the objective of this function to reduce the netwok data usage, no payload will be returned from server.
bool updateNodeSilent(FirebaseData &dataObj, const String &path, FirebaseJson &json);Update child nodes's key and virtual child ".priority" (using JSON data or FirebaseJson object) under the defined database path.
bool updateNodeSilent(FirebaseData &dataObj, const String &path, const String &jsonString, float priority);
bool updateNodeSilent(FirebaseData &dataObj, const String &path, FirebaseJson &json, float priority);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the integer value is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].intData will return the integer value of payload returned from server.
If the payload returned from server is not integer or float type, the function [FirebaseData object].intData will return zero (0).
If the payload returned from server is float type, the function [FirebaseData object].intData will return rounded integer value.
bool getInt(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the integer value is being read.
param target - The integer type variable to store value.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not integer, float and double, the target variable's value will be zero (0).
bool getInt(FirebaseData &dataObj, const String &path, int &target);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the float value is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].floatData will return the float value of payload returned from server.
If the payload returned from server is not integer or float type, the function [FirebaseData object].intData will return zero (0).
bool getFloat(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the float value is being read.
param target - The float type variable to store value.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not integer, float and double, the target variable's value will be zero (0).
bool getFloat(FirebaseData &dataObj, const String &path, float &target);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the float value is being rea.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].doubleData will return the double value of payload returned from server.
If the payload returned from server is not integer, float and double, the function [FirebaseData object].doubleData will return zero (0).
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place, use printf("%.9lf\n", firebaseData.doubleData()); for print the returned double value up to 9 decimal places.
bool getDouble(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the float value is being read.
param target - The double type variable to store value.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not integer, float and double, the target variable's value will be zero (0).
bool getDouble(FirebaseData &dataObj, const String &path, double &target);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the Boolean value is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].boolData will return the Boolean value of payload returned from server.
If the payload returned from server is not boolean type, the function [FirebaseData object].boolData will return false.
bool getBool(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the Boolean value is being read.
param target - The boolean type variable to store value.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not Boolean, the target variable's value will be false.
bool getBool(FirebaseData &dataObj, const String &path, bool &target);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the string value is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].stringData will return the string value of payload returned from server.
If the payload returned from server is not string type, the function [FirebaseData object].stringData will return empty string (String object).
bool getString(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the string value is being read.
param target - The String object to store value.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not string, the target String object's value will be empty.
bool getString(FirebaseData &dataObj, const String &path, String &target);The returned payload JSON string represents the child nodes and their value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the JSON string value is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the JSON string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
If the payload returned from server is not json type, the function [FirebaseData object].jsonData will return empty string (String object), the function [FirebaseData object].jsonOject will fail to parse the data.
bool getJSON(FirebaseData &dataObj, const String &path);The returned payload JSON string represents the child nodes and their value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the JSON string value is being read.
param target - The String object to store JSON string.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not string, the target String object's value will be empty.
bool getJSON(FirebaseData &dataObj, const String &path, String &target);The returned payload JSON string represents the child nodes and their value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Database path 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 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 object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].jsonData will return the JSON string value of payload returned from server.
Call [FirebaseData object].jsonObject will return the FirebaseJson object of payload returned from server.
If the payload returned from server is not json type, the function [FirebaseData object].jsonData will return empty string (String object), the function [FirebaseData object].jsonOject will fail to parse the data.
[FirebaseData object].jsonData will return null when the filtered data is empty.
bool getJSON(FirebaseData &dataObj, const String &path, QueryFilter &quer);The returned payload JSON string represents the child nodes and their value.
param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the JSON string value is being read.
param target - The String object to store JSON string.
return Boolean type status indicates the success of operation.
If the type of payload returned from server is not json, the target String object's value will be empty.
bool getJSON(FirebaseData &dataObj, const String &path, QueryFilter &query, String &target);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path which the binary data is being read.
return Boolean type status indicates the success of operation.
Call [FirebaseData object].dataType to determine what type of data that successfully stores in database.
Call [FirebaseData object].blobData will return the dynamic array of unsigned 8-bit data (i.e. std::vector<uint8_t>) of
payload returned from server.
If the payload returned from server is not blob type, the function [FirebaseData object].blobData will return empty array.
bool getBlob(FirebaseData &dataObj, const String &path);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path 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 operation.
If the type of payload returned from server is not blob, the target variable value will be empty array.
bool getBlob(FirebaseData &dataObj, const 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 file type.
param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to write file data, StorageType::SPIFS 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.
return Boolean type status indicates the success of operation.
bool getFile(FirebaseData &dataObj, uint8_t storageType, const String &nodePath, const String &fileName);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path to be deleted.
return Boolean type status indicates the success of operation.*
bool deleteNode(FirebaseData &dataObj, const String &path);Delete all child nodes at the defined database path if defined database path's ETag matched the ETag value
param dataObj - 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 operation.*
If ETag at the defined database path is not match the provided ETag parameter, the operation will failed with HTTP code 412, Precondition Failed (ETag is not match).
bool deleteNode(FirebaseData &dataObj, const String &path, const String &ETag);param dataObj - Firebase Data Object to hold data and instances.
param path - Database path being monitor.
return Boolean type status indicates the success of operation.*
bool beginStream(FirebaseData &dataObj, const String &path);Once beginStream was called e.g. in setup(), the readStream function should call inside the loop function.
param dataObj - Firebase Data Object to hold data and instances.
return Boolean type status indicates the success of 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 &dataObj);Can be restart again by calling beginStream.
param dataObj - Firebase Data Object to hold data and instances.
return Boolean type status indicates the success of operation.
bool endStream(FirebaseData &dataObj);param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to save file, StorageType::SPIFS or StorageType::SD.
param nodePath - Database path to be backuped.
param fileName - File name to save.
Only 8.3 DOS format (max. 8 bytes file name and 3 bytes file extension) can be saved to SD card.
return Boolean type status indicates the success of operation.
bool backup(FirebaseData &dataObj, uint8_t storageType, const String &nodePath, const String &fileName);setStreamCallback should be called before Firebase.beginStream.
param dataObj - Firebase Data Object to hold data and instances.
param dataAvailablecallback - Callback function that accepts streamData parameter.
param timeoutCallback - Callback function will be called when stream connection was timeout (optional).
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 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 stores in database.
Call [streamData object].xxxData will return the appropiated data type of payload returned from server.
void setStreamCallback(FirebaseData &dataObj, StreamEventCallback dataAvailablecallback, StreamTimeoutCallback timeoutCallback = NULL);param dataObj - Firebase Data Object to hold data and instances.
void removeStreamCallback(FirebaseData &dataObj);param dataObj - Firebase Data Object to hold data and instances.
@param storageType - Type of storage to read file, StorageType::SPIFS or StorageType::SD.
param nodePath - Database path to be restored.
param fileName - File name to read.
return Boolean type status indicates the success of operation.
bool restore(FirebaseData &dataObj, uint8_t storageType const String &nodePath, const String &fileName);Set maximum Firebase read/store retry operation (0 - 255) in case of network problems and buffer overflow
param dataObj - Firebase Data Object to hold data and instances.
param num - The maximum retry.
void setMaxRetry(FirebaseData &dataObj, uint8_t num);param dataObj - Firebase Data Object to hold data and instances.
param callback - Callback function that accepts QueueInfo Object as parameter, optional.
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 string of the Frebase call data type that being process of current Error Queue.
queueInfo.method(), get string of the Firebase call method that being process of current Error Queue.
queueInfo.path(), get string of the Firebase call path that being process of current Error Queue.
void beginAutoRunErrorQueue(FirebaseData &dataObj, QueueInfoCallback callback = NULL);param dataObj - Firebase Data Object to hold data and instances.
void endAutoRunErrorQueue(FirebaseData &dataObj);Firebase read/store operation causes by network problems and buffer overflow will be added to Firebase Error Queues collection.
param dataObj - Firebase Data Object to hold data and instances.
param num - The maximum Firebase Error Queues.
void setMaxErrorQueue(FirebaseData &dataObj, uint8_t num);Firebase read (get) operation will not be saved.
param dataObj - Firebase Data Object to hold data and instances.
param filename - File name to be saved.
param storageType - Type of storage to save file, StorageType::SPIFS or StorageType::SD.
bool saveErrorQueue(FirebaseData &dataObj, const String &filename, uint8_t storageType);param filename - File name to delete.
param storageType - Type of storage to save file, StorageType::SPIFS or StorageType::SD.
bool deleteStorageFile(const String &filename, uint8_t storageType);param dataObj - Firebase Data Object to hold data and instances.
param filename - File name to be read and restore queues.
param storageType - Type of storage to read file, StorageType::SPIFS or StorageType::SD.
bool restoreErrorQueue(FirebaseData &dataObj, const String &filename, uint8_t storageType);param dataObj - Firebase Data Object to hold data and instances.
param filename - File name to be read and count for queues.
param storageType - Type of storage to read file, StorageType::SPIFS or StorageType::SD.
return Number (0-255) of queues store in defined SPIFFS file.
uint8_t errorQueueCount(FirebaseData &dataObj, const String &filename, uint8_t storageType);param dataObj - Firebase Data Object to hold data and instances.
return Number (0-255) of queues in Firebase Data object queue collection.
uint8_t errorQueueCount(FirebaseData &dataObj);param dataObj - 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 &dataObj);param dataObj - Firebase Data Object to hold data and instances.
param callback - Callback function that accepts QueueInfo parameter.
void processErrorQueue(FirebaseData &dataObj, QueueInfoCallback callback = NULL);Return 0 if there is no Firebase Error from last operation.
param dataObj - Firebase Data Object to hold data and instances.
return Number of Queue ID.
uint32_t getErrorQueueID(FirebaseData &dataObj);param dataObj - 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 &dataObj, uint32_t errorQueueID);param dataObj - Firebase Data Object to hold data and instances.
void clearErrorQueue(FirebaseData &dataObj);Send Firebase Cloud Messaging to device with first registeration token which added by firebaseData.fcm.addDeviceToken
param dataObj - Firebase Data Object to hold data and instances.
param index - The index (starts from 0) of recipient device token which added by firebaseData.fcm.addDeviceToken
return - Boolean type status indicates the success of operation.
bool sendMessage(FirebaseData &dataObj, uint16_t index);Send Firebase Cloud Messaging to all devices (multicast) which added by firebaseData.fcm.addDeviceToken
param dataObj - Firebase Data Object to hold data and instances.
return - Boolean type status indicates the success of operation.
bool broadcastMessage(FirebaseData &dataObj);param dataObj - Firebase Data Object to hold data and instances.
return - Boolean type status indicates the success of operation.
bool sendTopic(FirebaseData &dataObj);return WiFi client instance.
WiFiClientSecure getWiFiClient();param pause True for pause and False for unpause.
return Boolean type status indicates the success of operation.
bool pauseFirebase(bool pause);return The one of these data type e.g. integer, float, string, json and blob.
String dataType();return The one of these event type String e.g. put, patch, cancel, and auth_revoked.
The event type "put" indicated that data at event path relative to stream path was completely changed. Event path can be determined from dataPath().
The event type "patch" indicated that data at event path relative to stream path was updated. Event path can be determined from dataPath().
The event type "cancel" indeicated something wrong and cancel by 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 belong to server' s returned payload.
The database path returned from this function in case of stream, also changed up on the child or parent's stream value changes.
String dataPath();return The error description string (String object).
String errorReason();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 jsonData();return FirebaseJson object.
FirebaseJson &jsonObject();return Dynamic array of 8-bit unsigned integer i.e. std::vector<uint8_t>.
std::vector<uint8_t> blobData();return String (String object).
String pushName();return Boolean type status indicates whether the Firebase Data object is working with stream or not.
bool isStream();return Boolean type status indicates whether the Firebase Data object is connected to server or not.
bool httpConnected();Nothing to do when stream connection timeout, the stream connection will be automatic resumed.
return Boolean type status indicates whether the stream was timeout or not.
bool streamTimeout();return Boolean type status indicates whether the server return back the new payload or not.
bool dataAvailable();return Boolean type status indicates whether the server return back the stream event-data
payload or not.
bool streamAvailable();Determine the matching between data type that intend to get from/store to database and the server's return payload data type
return Boolean type status indicates whether the type of data being get from/store to database
and server's returned payload are matched or not.
bool mismatchDataType();return Integer number of HTTP status.
int httpCode();return Boolean of the overflow status.
Default buffer size is 400 bytes, assigned via FIREBASE_RESPONSE_SIZE macro in FirebaseESP8266.h
bool bufferOverflow();return String (String object) of file name that store on SD card/Flash memory after backup operation.
String getBackupFilename();return Number of byte of backup file in byte after backup operation.
size_t getBackupFileSize();void clear();return Error description string* (String object).
String fileTransferError();return Payload string* (String object).
String payload();param serverKey - Server key found on Console: Project settings > Cloud Messaging
void begin(const String &serverKey);param deviceToken - Recipient's device registration token to addd that message will be sent to.
void addDeviceToken(const 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(const String &title, const 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 icon to show on notify message.
void setNotifyMessage(const String &title, const String &body, const 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 icon to show on notify message.
param click_action - The URL or intent to accept click event on notification message.
void setNotifyMessage(const String &title, const String &body, const String &icon, const String &click_action);void clearNotifyMessage();param jsonString - The JSON structured data string.
void setDataMessage(const 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(const String &priority);param key - String of collapse key.
void setCollapseKey(const 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(const String &topic);return String of payload returned from server.
String getSendResult();return instance of an object.
FirebaseJson &clear();param data - The JSON object string.
return instance of an object.
The internal buffer will be overwritten by add functions.
FirebaseJson &setJsonData(const String &data);param key - Key string of data.
param value - The String data.
return instance of an object.
FirebaseJson &addString(const String &key, const String &value);param key - Key string of data.
param arr - The FirebaseJsonArray object.
return instance of an object.
FirebaseJson &addArray(const String &key, FirebaseJsonArray *arr);param key - Key string of data.
param value - Integer data.
return instance of an object.
FirebaseJson &addInt(const String &key, int value);param key - Key string of data.
param value - Double data.
return instance of an object.
FirebaseJson &addDouble(const String &key, double value);param key - Key string of data.
param value - Boolean data.
return instance of an object.
FirebaseJson &addBool(const String &key, bool value);param key - Key string of data.
param json - FirebaseJson object that hold the data to be added to this JSON object.
return instance of an object.
FirebaseJson &addJson(const String &key, FirebaseJson *json);return serialized string of JSON object.
String toString();param skipChild - Flag to skip any children nodes under root or array.
param len - Optional. The expected number of JSON tokens (key and value). Should be number of keys and values + 1.
Default value is 50. If object parse failed, increase this value.
return instance of an object.
FirebaseJson &parse(bool skipChild = true, size_t len = 0);param key - Key string of data to get.
return instance of an object.
This should call after parse().
FirebaseJson &get(const String &key);Set the numbers of JSON tokens (keys + values + 1) to be available for read from jsonObjectIterator.
return numbers of tokens.
size_t getJsonObjectIteratorCount();param index - The referenced token index. This will auto increase to the next token index after read.
param key - The referenced key data string. This provided the key data output.
param value - The referenced value string. This provided the value of current key output.
return instance of an object.
FirebaseJson &jsonObjectiterator(size_t &index,String &key, String &value);return FirebaseJsonObject.
The properties available are: stringValue, intValue, doubleValue, boolValue, type, success.
The type property provides the types of value string e.g. string, int, double, boolean, array, object, null and undefined.
The success property provides the success status of get or parse functions.
FirebaseJsonObject parseResult();param value - String data.
return instance of an object.
FirebaseJsonArray &addString(const String &value);param value - Integer data.
return instance of an object.
FirebaseJsonArray &addInt(int value);param value - double data.
return instance of an object.
FirebaseJsonArray &addDouble(double value);param value - Boolean data.
return instance of an object.
FirebaseJsonArray &addBool(bool value);param json - FirebaseJson object that holds data to be added to array.
return instance of an object.
FirebaseJsonArray &addJson(FirebaseJson *json);param arr - JSON array object that holds data to be added to this JSON array.
return instance of an object.
FirebaseJsonArray &addArray(FirebaseJsonArray *arr);return string of an object.
String toString();The MIT License (MIT)
Copyright (c) 2019 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.