Skip to content

Commit

Permalink
Allows other Firebase calls inside the stream and multipath stream ca…
Browse files Browse the repository at this point in the history
…llback function.
  • Loading branch information
mobizt committed Apr 3, 2021
1 parent a602918 commit 57e26a2
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 25 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 v 2.0.13
Google's Firebase Arduino Client Library for ESP8266 and ESP32 v 2.0.14


This library supports ESP8266 and ESP32 MCU from Espressif. The following are platforms in which the libraries are also available (RTDB only).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
Expand Down
6 changes: 3 additions & 3 deletions examples/Authentications/Custom_Token/Custom_Token.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
Expand Down Expand Up @@ -189,7 +189,7 @@ void setup()
* To modify the database rules in this exanple, we need the full access rights then
* using the database secret in prepareDatabaseRules function to sign in.
*
* If you database rules has been modified, plesse comment this code out.
* If you database rules has been modified, please comment this code out.
*
* The character $ is to make a wildcard variable (can be any name) represents any node key
* which located at some level in the rule structure and use as reference variable
Expand Down Expand Up @@ -307,7 +307,7 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal
Firebase.begin(&config, &auth);

Serial.println("------------------------------------");
Serial.println("Read database ruless...");
Serial.println("Read database rules...");
if (Firebase.RTDB.getRules(&fbdo))
{
FirebaseJsonData result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
Expand Down Expand Up @@ -155,7 +155,7 @@ void setup()
* To modify the database rules in this exanple, we need the full access rights then
* using the database secret in prepareDatabaseRules function to sign in.
*
* If you database rules has been modified, plesse comment this code out.
* If you database rules has been modified, please comment this code out.
*
* The character $ is to make a wildcard variable (can be any name) represents any node key
* which located at some level in the rule structure and use as reference variable
Expand Down Expand Up @@ -271,7 +271,7 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal
Firebase.begin(&config, &auth);

Serial.println("------------------------------------");
Serial.println("Read database ruless...");
Serial.println("Read database rules...");
if (Firebase.RTDB.getRules(&fbdo))
{
FirebaseJsonData result;
Expand Down
8 changes: 4 additions & 4 deletions examples/Authentications/Email_Password/Email_Password.ino
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/** 3. Define the API key
*
* The API key (required) can be obtained since you created the project and set up
* the Authentication in Firebase conssole. Then you will get the API key from
* the Authentication in Firebase console. Then you will get the API key from
* Firebase project Web API key in Project settings, on General tab should show the
* Web API Key.
*
Expand All @@ -51,7 +51,7 @@
*/
#define API_KEY "API_KEY"

/* 4. Define the user Email and password that alreadey registerd or added in your project */
/* 4. Define the user Email and password that already registerd or added in your project */
#define USER_EMAIL "USER_EMAIL"
#define USER_PASSWORD "USER_PASSWORD"

Expand Down Expand Up @@ -138,7 +138,7 @@ void setup()
* which located at some level in the rule structure and use as reference variable
* in .read, .write and .validate rules
*
* If you database rules has been modified, plesse comment this code out
* If you database rules has been modified, please comment this code out
*/
String var = "$user";
String val = "(auth.uid === $user)";
Expand Down Expand Up @@ -228,7 +228,7 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal
Firebase.begin(&config, &auth);

Serial.println("------------------------------------");
Serial.println("Read database ruless...");
Serial.println("Read database rules...");
if (Firebase.RTDB.getRules(&fbdo))
{
FirebaseJsonData result;
Expand Down
2 changes: 1 addition & 1 deletion examples/Authentications/Reset_Password/Reset_Password.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
Expand All @@ -45,7 +45,7 @@
*/
#define API_KEY "API_KEY"

/* 4. Define the user Email and password that alreadey registerd or added in your project */
/* 4. Define the user Email and password that already registerd or added in your project */
#define USER_EMAIL "USER_EMAIL"
#define USER_PASSWORD "USER_PASSWORD"

Expand Down
2 changes: 1 addition & 1 deletion examples/Authentications/Signup/Signup.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/** 3. Define the API key
*
* The API key can be obtained since you created the project and set up
* the Authentication in Firebase conssole.
* the Authentication in Firebase console.
*
* You may need to enable the Identity provider at https://console.cloud.google.com/customer-identity/providers
* Select your project, click at ENABLE IDENTITY PLATFORM button.
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.0.13",
"version": "2.0.14",
"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.0.13
version=2.0.14

author=Mobizt

Expand Down
2 changes: 1 addition & 1 deletion src/Firebase_ESP_Client.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 2.0.13
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 2.0.14
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down
2 changes: 1 addition & 1 deletion src/Firebase_ESP_Client.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 2.0.13
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 2.0.14
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down
2 changes: 1 addition & 1 deletion 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 v 2.0.13
Google's Firebase Arduino Client Library for ESP8266 and ESP32 v 2.0.14


The default filessystem used in the library is flash and SD.
Expand Down
11 changes: 9 additions & 2 deletions src/rtdb/FB_RTDB.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Realtime Database class, FB_RTDB.cpp version 1.0.8
* Google's Firebase Realtime Database class, FB_RTDB.cpp version 1.0.9
*
* This library supports Espressif ESP8266 and ESP32
*
* Created March 30, 2021
* Created April 3, 2021
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -3625,11 +3625,15 @@ int FB_RTDB::sendRequest(FirebaseData *fbdo, struct fb_esp_rtdb_request_info_t *
bool FB_RTDB::waitResponse(FirebaseData *fbdo)
{
#if defined(ESP32)

//if currently perform stream payload handling process, skip it.
if (Signer.getCfg()->_int.fb_processing && fbdo->_ss.con_mode == fb_esp_con_mode_rtdb_stream)
return true;

//set the blocking flag
Signer.getCfg()->_int.fb_processing = true;
bool ret = handleResponse(fbdo);
//reset the blocking flag
Signer.getCfg()->_int.fb_processing = false;

return ret;
Expand Down Expand Up @@ -4343,6 +4347,9 @@ void FB_RTDB::parseStreamPayload(FirebaseData *fbdo, const char *payload)

void FB_RTDB::sendCB(FirebaseData *fbdo)
{
//to allow other subsequence request which can be occurred in the user stream callback
Signer.getCfg()->_int.fb_processing = false;

if (fbdo->_dataAvailableCallback)
{
FirebaseStream s;
Expand Down
4 changes: 2 additions & 2 deletions src/rtdb/FB_RTDB.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Realtime Database class, FB_RTDB.h version 1.0.8
* Google's Firebase Realtime Database class, FB_RTDB.h version 1.0.9
*
* This library supports Espressif ESP8266 and ESP32
*
* Created March 30, 2021
* Created April 3, 2021
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2021 K. Suwatchai (Mobizt)
Expand Down

0 comments on commit 57e26a2

Please sign in to comment.