Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit26a87d4

Browse files
authored
Merge pull requestFirebaseExtended#356 from kotl/master
Update suggested versions and manually merge connection error check
2 parents0c1b046 +9dcf205 commit26a87d4

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

‎README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ The Arduino library is [under heavy development](https://github.com/googlesample
2020
-[FirebaseArduino API Reference](http://firebase-arduino.readthedocs.io/)
2121

2222
##Dependencies
23-
- FirebaseArduino now depends on[ArduinoJson library](https://github.com/bblanchon/ArduinoJson) instead of containing it's own version of it. Please either use Library Manager or download specific version of the library from github.
23+
- FirebaseArduino now depends on[ArduinoJson library](https://github.com/bblanchon/ArduinoJson) instead of containing it's own version of it. Please either use Library Manager or download specific version of the library from github. We recommend that ArduinoJson is at least version[5.13.1](https://github.com/bblanchon/ArduinoJson/tree/v5.13.1)
24+
25+
- ESP8266 Core SDK. We recommend using officially tagged releases and it should be at least[2.4.1](https://github.com/esp8266/Arduino/tree/2.4.1)
2426

2527
##Disclaimer
2628

‎contrib/test/dummies/FirebaseHttpClient_dummy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class FirebaseHttpClientDummy : public FirebaseHttpClient {
2323
voidaddHeader(const std::string&UNUSED_ARG(name),const std::string& UNUSED_ARG(value))override {
2424
}
2525

26+
boolconnected()override {
27+
returntrue;
28+
}
29+
2630
voidcollectHeaders(constchar*UNUSED_ARG(header_keys[]),const int UNUSED_ARG(count))override {
2731
}
2832

‎src/FirebaseArduino.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ void FirebaseArduino::stream(const String& path) {
156156

157157
boolFirebaseArduino::available() {
158158
if (stream_http_.get() ==nullptr) {
159+
error_ =FirebaseError(FIREBASE_ERROR_CODES::STREAM_NOT_INITIALIZED,"HTTP stream is not initialized");
160+
return0;
161+
}
162+
if (!stream_http_.get()->connected()) {
163+
error_ =FirebaseError(FIREBASE_ERROR_CODES::HTTP_CONNECTION_LOST,"Connection Lost");
159164
return0;
160165
}
161166
auto client = stream_http_.get()->getStreamPtr();

‎src/FirebaseError.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#ifndef firebase_error_h
22
#definefirebase_error_h
33

4+
5+
// These error codes are used in addition to regular HTTP error codes.
6+
// Same error space is shared between HTTP errors and these values.
7+
enum FIREBASE_ERROR_CODES {
8+
HTTP_CONNECTION_LOST = -5,
9+
STREAM_NOT_INITIALIZED = -6
10+
};
11+
412
classFirebaseError {
513
public:
614
// Make it explicit that the empty constructor mean no error.

‎src/FirebaseHttpClient.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class FirebaseHttpClient {
3333

3434
virtual std::stringerrorToString(int error_code) = 0;
3535

36+
virtualboolconnected() = 0;
37+
3638
protected:
3739
staticconstuint16_tkFirebasePort =443;
3840
};

‎src/FirebaseHttpClient_Esp8266.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ class FirebaseHttpClientEsp8266 : public FirebaseHttpClient {
8383
returnHTTPClient::errorToString(error_code).c_str();
8484
}
8585

86+
boolconnected()override {
87+
return http_.connected();
88+
}
89+
8690
private:
8791
ForceReuseHTTPClient http_;
8892
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp