Skip to content

Commit

Permalink
Add payload and dataTypeEnum functions for the FirebaseStream object.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jun 10, 2021
1 parent 30adc8a commit 5cb9047
Show file tree
Hide file tree
Showing 17 changed files with 311 additions and 121 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firebase Arduino Client Library for ESP8266 and ESP32


Google's Firebase Arduino Client Library for ESP8266 and ESP32 v2.2.4
Google's Firebase Arduino Client Library for ESP8266 and ESP32 v2.2.5


This library supports ESP8266 and ESP32 MCU from Espressif. The following are platforms in which the libraries are also available (RTDB only).
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ getBackupFileSize KEYWORD2
clear KEYWORD2
fileTransferError KEYWORD2
payload KEYWORD2
dataTypeEnum KEYWORD2
queryFilter KEYWORD2
empty KEYWORD2
stopWiFiClient KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Firebase Arduino Client Library for ESP8266 and ESP32",
"version": "2.2.4",
"version": "2.2.5",
"keywords": "communication, REST, esp32, esp8266, arduino",
"description": "This client library provides the functions to work with Firebase Realtime database, Firestore, Storage and Cloud messaging.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=Firebase Arduino Client Library for ESP8266 and ESP32

version=2.2.4
version=2.2.5

author=Mobizt

Expand Down
4 changes: 2 additions & 2 deletions src/Firebase_ESP_Client.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.cpp v2.2.4
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.cpp v2.2.5
*
* This library supports Espressif ESP8266 and ESP32
*
* Created May 23, 2021
* Created June 10, 2021
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down
6 changes: 3 additions & 3 deletions src/Firebase_ESP_Client.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#ifndef FIREBASE_CLIENT_VERSION
#define FIREBASE_CLIENT_VERSION "2.2.4"
#define FIREBASE_CLIENT_VERSION "2.2.5"
#endif

/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v2.2.4
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v2.2.5
*
* This library supports Espressif ESP8266 and ESP32
*
* Created May 23, 2021
* Created June 10, 2021
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down
78 changes: 55 additions & 23 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firebase Arduino Client Library for ESP8266 and ESP32


Google's Firebase Arduino Client Library for ESP8266 and ESP32 v2.2.4
Google's Firebase Arduino Client Library for ESP8266 and ESP32 v2.2.5


The default filessystem used in the library is flash and SD.
Expand Down Expand Up @@ -442,7 +442,7 @@ bool removeQueryIndex(FirebaseData *fbdo, const char *path, const char *database



#### Determine the existent of the defined node.
#### Get the existent of the defined node.

param **`fbdo`** The pointer to Firebase Data Object.

Expand All @@ -458,7 +458,7 @@ bool pathExisted(FirebaseData *fbdo, const String &path);



#### Determine the unique identifier (ETag) of current data at the defined node.
#### Get the unique identifier (ETag) of current data at the defined node.

param **`fbdo`** The pointer to Firebase Data Object.

Expand Down Expand Up @@ -2982,7 +2982,7 @@ bool restoreErrorQueue(FirebaseData *fbdo, const char *filename, fb_esp_mem_stor



#### Determine the number of Firebase Error Queues stored in a defined file (flash memory).
#### Get the number of Firebase Error Queues stored in a defined file (flash memory).

param **`fbdo`** The pointer to Firebase Data Object.

Expand All @@ -3003,7 +3003,7 @@ uint8_t errorQueueCount(FirebaseData *fbdo, const char *filename, fb_esp_mem_sto



#### Determine number of queues in Firebase Data object's Error Queues collection.
#### Get number of queues in Firebase Data object's Error Queues collection.

param **`fbdo`** The pointer to Firebase Data Object.

Expand All @@ -3020,7 +3020,7 @@ uint8_t errorQueueCount(FirebaseData *fbdo);



#### Determine whether the Firebase Error Queues collection was full or not.
#### Get whether the Firebase Error Queues collection was full or not.

param **`fbdo`** The pointer to Firebase Data Object.

Expand Down Expand Up @@ -3070,7 +3070,7 @@ uint32_t getErrorQueueID(FirebaseData *fbdo);



#### Determine whether the Firebase Error Queue currently exists in the Error Queue collection or not.
#### Get whether the Firebase Error Queue currently exists in the Error Queue collection or not.

param **`fbdo`** The pointer to Firebase Data Object.

Expand Down Expand Up @@ -4487,7 +4487,7 @@ bool pauseFirebase(bool pause);



#### Determine the data type of payload returned from the server
#### Get the data type of payload returned from the server (RTDB only)

return **`The one of these data type e.g. integer, float, string, JSON and blob.`**

Expand All @@ -4499,8 +4499,40 @@ String dataType();



#### Get the data type of payload returned from the server (RTDB only)

#### Determine the event type of stream
return **`The enumeration value of fb_esp_rtdb_data_type.`**

fb_esp_rtdb_data_type_null or 1,

fb_esp_rtdb_data_type_integer or 2,

fb_esp_rtdb_data_type_float or 3,

fb_esp_rtdb_data_type_double or 4,

fb_esp_rtdb_data_type_boolean or 5,

fb_esp_rtdb_data_type_string or 6,

fb_esp_rtdb_data_type_json or 7,

fb_esp_rtdb_data_type_array or 8,

fb_esp_rtdb_data_type_blob or 9,

fb_esp_rtdb_data_type_file or 10

```cpp
uint8_t dataTypeEnum();
```






#### Get the event type of stream

return **`The one of these event type String e.g. put, patch, cancel, and auth_revoked.`**

Expand All @@ -4521,7 +4553,7 @@ String eventType();



#### Determine the unique identifier (ETag) of current data
#### Get the unique identifier (ETag) of current data

return **`String.`** of unique identifier.

Expand All @@ -4534,7 +4566,7 @@ String ETag();



#### Determine the current stream path
#### Get the current stream path

return **`The database streaming path.`**

Expand All @@ -4548,7 +4580,7 @@ String streamPath();



#### Determine the current data path
#### Get the current data path

return **`The node which belongs to server' s returned payload.`**

Expand All @@ -4565,7 +4597,7 @@ String dataPath();



#### Determine the error reason String from the process
#### Get the error reason String from the process

return **`The error description string (String object).`**

Expand Down Expand Up @@ -4756,7 +4788,7 @@ String pushName();



#### Determine the stream connection status
#### Get the stream connection status

return **`Boolean`** type status indicates whether the Firebase Data object is working with the stream or not.

Expand All @@ -4769,7 +4801,7 @@ bool isStream();



#### Determine the server connection status
#### Get the server connection status

return **`Boolean`** type status indicates whether the Firebase Data object is connected to the server or not.

Expand All @@ -4781,7 +4813,7 @@ bool httpConnected();



#### Determine the timeout event of server's stream (30 sec is the default)
#### Get the timeout event of server's stream (30 sec is the default)

Nothing to do when stream connection timeout, the stream connection will be automatically resumed.

Expand All @@ -4795,7 +4827,7 @@ bool streamTimeout();



#### Determine the availability of data or payload returned from the server
#### Get the availability of data or payload returned from the server

return **`Boolean`** type status indicates whether the server returns the new payload or not.

Expand All @@ -4807,7 +4839,7 @@ bool dataAvailable();



#### Determine the availability of stream event-data payload returned from the server
#### Get the availability of stream event-data payload returned from the server

return **`Boolean`** type status indicates whether the server returns the stream event-data
payload or not.
Expand All @@ -4820,7 +4852,7 @@ bool streamAvailable();



#### Determine the matching between data type that intend to get from/store to database and the server's return payload data type
#### Get 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 the server's returned payload is matched or not.
Expand All @@ -4833,7 +4865,7 @@ bool mismatchDataType();



#### Determine the HTTP status code return from the server
#### Get the HTTP status code return from the server

return **`Integer`** number of HTTP status.

Expand Down Expand Up @@ -4861,7 +4893,7 @@ bool bufferOverflow();



#### Determine the name (full path) of backup file in SD card/flash memory
#### Get the name (full path) of backup file in SD card/flash memory

return **`String`** (String object) of a file name that stores on SD card/flash memory after backup operation.

Expand All @@ -4874,7 +4906,7 @@ String getBackupFilename();



#### Determine the size of the backup file
#### Get the size of the backup file

return **`Number of byte`** of backup file in byte after backup operation.

Expand All @@ -4896,7 +4928,7 @@ void clear();



#### Determine the error description for file transferring (pushFile, setFile, backup and restore)
#### Get the error description for file transferring (pushFile, setFile, backup and restore)

return **`Error description string* (String object).`**

Expand Down
19 changes: 14 additions & 5 deletions src/addons/FireSense/FireSense.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* FireSense v1.0.3
* FireSense v1.0.4
*
* The Programmable Data Logging and IO Control library.
*
* This library required FirebaseESP32 or FirebaseESP8266 or Firebase ESP Client to be installed.
*
* This library supports Espressif ESP8266 and ESP32
*
* Created May 27, 2021
* Created June 10, 2021
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -59,6 +59,15 @@
#include <Firebase_ESP_Client.h>
#endif

#ifndef FIREBASE_STREAM_CLASS
#if defined(FIREBASE_ESP_CLIENT)
#define FIREBASE_STREAM_CLASS FirebaseStream
#elif defined(FIREBASE_ESP32_CLIENT) || defined(FIREBASE_ESP8266_CLIENT)
#define FIREBASE_STREAM_CLASS StreamData
#endif
#endif


class MillisTimer
{
public:
Expand Down Expand Up @@ -379,7 +388,7 @@ class FireSenseClass
*/
String getDeviceId();

void readStream(FirebaseStream *data);
void readStream(FIREBASE_STREAM_CLASS *data);
void readStream(FirebaseData *fbdo);
bool configExisted();

Expand Down Expand Up @@ -802,7 +811,7 @@ bool FireSenseClass::configExisted()
return config_existed;
}

static void FiresenseStreamCB(FirebaseStream data)
static void FiresenseStreamCB(FIREBASE_STREAM_CLASS data)
{
FireSense.readStream(&data);
}
Expand Down Expand Up @@ -2930,7 +2939,7 @@ void FireSenseClass::loadStatus()
loadingStatus = false;
}

void FireSenseClass::readStream(FirebaseStream *data)
void FireSenseClass::readStream(FIREBASE_STREAM_CLASS *data)
{
if (!configReady())
return;
Expand Down
Loading

0 comments on commit 5cb9047

Please sign in to comment.