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

Commitaa66264

Browse files
committed
Support both string types in FirebaseArduino.h
1 parent3b8ff0f commitaa66264

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎src/FirebaseArduino.cpp‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717
#include"FirebaseArduino.h"
1818

1919
voidFirebaseArduino::begin(constchar* host,constchar* auth) {
20+
begin(String(host),String(auth));
21+
}
22+
23+
voidFirebaseArduino::begin(const String& host,const String& auth) {
2024
http_.reset(FirebaseHttpClient::create());
2125
http_->setReuseConnection(true);
2226
host_ = host;
2327
auth_ = auth;
2428
}
2529

30+
StringFirebaseArduino::FirebaseArduino::push(constchar* path,const JsonVariant& value) {
31+
returnpush(String(path), value);
32+
}
33+
2634
StringFirebaseArduino::FirebaseArduino::push(const String& path,const JsonVariant& value) {
2735
String buf;
2836
value.printTo(buf);
@@ -31,6 +39,10 @@ String FirebaseArduino::FirebaseArduino::push(const String& path, const JsonVari
3139
return push.name();
3240
}
3341

42+
voidFirebaseArduino::set(constchar* path,const JsonVariant& value) {
43+
set(String(path), value);
44+
}
45+
3446
voidFirebaseArduino::set(const String& path,const JsonVariant& value) {
3547
String buf;
3648
value.printTo(buf);
@@ -39,6 +51,10 @@ void FirebaseArduino::set(const String& path, const JsonVariant& value) {
3951
}
4052

4153
FirebaseObjectFirebaseArduino::get(constchar* path) {
54+
returnget(String(path));
55+
}
56+
57+
FirebaseObjectFirebaseArduino::get(const String path) {
4258
auto get =FirebaseGet(host_, auth_, path, http_.get());
4359
error_ = get.error();
4460
if (failed()) {
@@ -48,11 +64,19 @@ FirebaseObject FirebaseArduino::get(const char* path) {
4864
}
4965

5066
voidFirebaseArduino::remove(constchar* path) {
67+
remove(String(path));
68+
}
69+
70+
voidFirebaseArduino::remove(const String& path) {
5171
auto remove =FirebaseRemove(host_, auth_, path, http_.get());
5272
error_ = remove.error();
5373
}
5474

5575
voidFirebaseArduino::stream(constchar* path) {
76+
stream(String(path));
77+
}
78+
79+
voidFirebaseArduino::stream(const String& path) {
5680
auto stream =FirebaseStream(host_, auth_, path, http_.get());
5781
error_ = stream.error();
5882
}

‎src/FirebaseArduino.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class FirebaseArduino {
3636
* \param auth Optional credentials for the db, a secret or token.
3737
*/
3838
voidbegin(constchar* host,constchar* auth ="");
39+
voidbegin(const String& host,const String& auth ="");
3940

4041
/**
4142
* Writes data to a new child location under the parent at path.
@@ -45,6 +46,7 @@ class FirebaseArduino {
4546
* \param value Data that you wish to add under the parent.
4647
* \return The unique child key where the data was written.
4748
*/
49+
Stringpush(constchar* path,const JsonVariant& value);
4850
Stringpush(const String& path,const JsonVariant& value);
4951

5052
/**
@@ -54,6 +56,7 @@ class FirebaseArduino {
5456
* \param path The path inside of your db to the node you wish to update.
5557
* \param value Data that you wish to write.
5658
*/
59+
voidset(constchar* path,const JsonVariant& value);
5760
voidset(const String& path,const JsonVariant& value);
5861

5962

@@ -65,6 +68,7 @@ class FirebaseArduino {
6568
* or it may be a json structure. Will only be populated if success() is true.
6669
*/
6770
FirebaseObjectget(constchar* path);
71+
FirebaseObjectget(const String& path);
6872

6973
/**
7074
* Remove the node, and possibly entire tree, located at path.
@@ -73,6 +77,7 @@ class FirebaseArduino {
7377
* including all of its children.
7478
*/
7579
voidremove(constchar* path);
80+
voidremove(const String& path);
7681

7782
/**
7883
* Starts streaming any changes made to the node located at path, including
@@ -83,6 +88,7 @@ class FirebaseArduino {
8388
* \param path The path inside of your db to the node you wish to monitor.
8489
*/
8590
voidstream(constchar* path);
91+
voidstream(const String& path);
8692

8793
/**
8894
* Checks if there are new events available. This is only meaningful once

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp