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

Commit18092d2

Browse files
committed
Added disconnect error
1 parent74a963a commit18092d2

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

‎src/Firebase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class FirebaseError {
8080
intcode()const {return code_; }
8181
const String&message()const {return message_; }
8282
private:
83-
int code_ =0;
84-
String message_ ="";
83+
constint code_ =0;
84+
constString message_ ="";
8585
};
8686

8787
classFirebaseCall {

‎src/FirebaseArduino.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ void FirebaseArduino::stream(const String& path) {
128128
}
129129

130130
boolFirebaseArduino::available() {
131+
if (!http_->connected()) {
132+
error_ =FirebaseError(HTTP_CONNECTION_LOST,"Connection Lost");
133+
}
131134
return http_->getStreamPtr()->available();
132135
}
133136

‎src/FirebaseArduino.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
*/
3030
classFirebaseArduino {
3131
public:
32+
enum ERROR_CODES {
33+
HTTP_CONNECTION_LOST = -5
34+
};
35+
3236
/**
3337
* Must be called first. This initialize the client with the given
3438
* firebase host and credentials.

‎src/FirebaseHttpClient.h

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

1919
virtualvoidend() = 0;
2020

21+
virtualboolconnected() = 0;
22+
2123
virtualvoidaddHeader(const String& name,const String& value) = 0;
2224
virtualvoidcollectHeaders(constchar* header_keys[],
2325
constint header_key_count) = 0;

‎src/FirebaseHttpClient_Esp8266.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class FirebaseHttpClientEsp8266 : public FirebaseHttpClient {
3333
http_.end();
3434
}
3535

36+
boolconnected()override {
37+
return http_.connected();
38+
}
39+
3640
voidaddHeader(const String& name,const String& value)override {
3741
http_.addHeader(name, value);
3842
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp