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

Commit14eda96

Browse files
committed
Add json parsing to modem streaming
1 parentdf8372a commit14eda96

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/modem/stream-command.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ bool StreamCommand::execute(const String& command,
2323
}
2424

2525
bool running =true;
26+
DynamicJsonBuffer buffer;
2627
while(running) {
2728
if (stream->available()) {
2829
std::string json;
2930
FirebaseStream::Event event = stream->read(json);
3031
out->print("+");
3132
out->print(FirebaseStream::EventToName(event).c_str());
3233
out->print("");
33-
// TODO(edcoyne): add json parsing and get real path.
34-
out->println("/dummy/path");
35-
out->println(json.length());
36-
out->println(json.c_str());
34+
constauto& object = buffer.parseObject(json.c_str());
35+
String data = object["data"];
36+
out->println(object["path"].asString());
37+
out->println(data.length());
38+
out->println(data);
3739
}elseif (in->available()) {
3840
String command = in->readLine();
3941
if (command =="END_STREAM") {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp