Skip to content

Commit c53810d

Browse files
committed
Fix stream bugs
1 parent 689dd72 commit c53810d

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Firebase RTDB Arduino Client for ARM/AVR WIFI Dev Boards
22

33

4-
Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Development Boards based on WiFiNINA library, v 1.1.1
4+
Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Development Boards based on WiFiNINA library, v 1.1.2
55

66
This client library provides the most reliable operations for read, store, update Firebase RTDB through REST API.
77

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name=Firebase Arduino based on WiFiNINA
22

3-
version=1.1.1
3+
version=1.1.2
44

55
author=Mobizt
66

src/Firebase_Arduino_WiFiNINA.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/*
2-
* Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Dev Boards based on WiFiNINA library, version 1.1.1
2+
* Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Dev Boards based on WiFiNINA library, version 1.1.2
33
*
44
*
55
* This library required WiFiNINA Library to be installed.
66
* https://github.com/arduino-libraries/WiFiNINA
77
*
8-
* March 5, 2020
8+
* March 8, 2020
99
*
1010
* Feature Added:
1111
*
1212
* Feature Fixed:
13-
* - Use dynamic memory and code optimization.
13+
* - No stream event triggering bug when the child node value of parent node changes.
14+
* - FirebaseJson and FirebaseJsonArray data are not assigned when reading from the stream.
1415
*
1516
*
1617
* This library provides ARM/AVR WIFI Development Boards to perform REST API by GET PUT, POST, PATCH, DELETE data from/to with Google's Firebase database using get, set, update
@@ -808,6 +809,7 @@ bool Firebase_Arduino_WiFiNINA::getServerResponse(FirebaseData &dataObj)
808809
if (m)
809810
{
810811
dataObj._eventType = eventType;
812+
bool samePath = true;
811813

812814
//Parses json response for path
813815
tmp = getPGMString(C_STR_17);
@@ -822,7 +824,8 @@ bool Firebase_Arduino_WiFiNINA::getServerResponse(FirebaseData &dataObj)
822824
{
823825
tmp = newPtr(p2 - p1 - strlen_P(C_STR_17));
824826
strncpy(tmp, lineBuf + p1 + strlen_P(C_STR_17), p2 - p1 - strlen_P(C_STR_17));
825-
dataObj._path=tmp;
827+
samePath = strcmp(tmp, dataObj._path.c_str()) == 0;
828+
dataObj._path = tmp;
826829
delPtr(tmp);
827830
}
828831
}
@@ -839,18 +842,13 @@ bool Firebase_Arduino_WiFiNINA::getServerResponse(FirebaseData &dataObj)
839842
delPtr(tmp);
840843

841844
setDataType(dataObj, dataObj._data.c_str());
842-
843-
bool samePath = dataObj._path == dataObj._path2;
844-
bool rootPath = dataObj._path= "/";
845-
bool emptyPath = dataObj._path2== "";
846845
bool sameData = dataObj._data == dataObj._data2;
847846

848847
//Any stream update?
849-
if ((!samePath && (!rootPath || emptyPath)) || (samePath && !sameData && !dataObj._streamPathChanged))
848+
if (!samePath || (samePath && !sameData && !dataObj._streamPathChanged))
850849
{
851850
dataObj._streamDataChanged = true;
852851
dataObj._data2 = dataObj._data;
853-
dataObj._path2 =dataObj._path;
854852
}
855853
else
856854
dataObj._streamDataChanged = false;
@@ -1317,7 +1315,6 @@ bool Firebase_Arduino_WiFiNINA::cancelCurrentResponse(FirebaseData &dataObj)
13171315
dataObj._streamDataChanged = false;
13181316
dataObj._dataMillis = millis();
13191317
dataObj._data2 = "";
1320-
dataObj._path2 ="";
13211318
dataObj._dataAvailable = false;
13221319
dataObj._isStreamTimeout = false;
13231320
dataObj._httpCode = HTTPC_ERROR_CONNECTION_REFUSED;
@@ -1601,7 +1598,6 @@ FirebaseData ::~FirebaseData()
16011598
void FirebaseData::end()
16021599
{
16031600
_path="";
1604-
_path2 ="";
16051601
_data="";
16061602
_data2="";
16071603
_streamPath="";

src/Firebase_Arduino_WiFiNINA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/*
2-
* Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Dev Boards based on WiFiNINA library, version 1.1.1
2+
* Google's Firebase Realtime Database Arduino Library for ARM/AVR WIFI Dev Boards based on WiFiNINA library, version 1.1.2
33
*
44
*
55
* This library required WiFiNINA Library to be installed.
66
* https://github.com/arduino-libraries/WiFiNINA
77
*
8-
* March 5, 2020
8+
* March 8, 2020
99
*
1010
* Feature Added:
1111
*
1212
* Feature Fixed:
13-
* - Use dynamic memory and code optimization.
13+
* - No stream event triggering bug when the child node value of parent node changes.
14+
* - FirebaseJson and FirebaseJsonArray data are not assigned when reading from the stream.
1415
*
1516
*
1617
* This library provides ARM/AVR WIFI Development Boards to perform REST API by GET PUT, POST, PATCH, DELETE data from/to with Google's Firebase database using get, set, update
@@ -970,7 +971,6 @@ class FirebaseData
970971
uint8_t _r_dataType;
971972

972973
String _path = "";
973-
String _path2 = "";
974974
String _data = "";
975975
String _data2 = "";
976976
String _streamPath = "";

0 commit comments

Comments
 (0)