MCPcopy Create free account
hub / github.com/SmingHub/Sming / init

Function init

Sming/Libraries/flatbuffers/samples/Basic/app/application.cpp:7–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace MyGame::Sample;
6
7void init()
8{
9 Serial.begin(SERIAL_BAUD_RATE);
10
11 // demonstration how to encode data into a flatbuffer
12 flatbuffers::FlatBufferBuilder builder;
13
14 auto name = builder.CreateString("Sming Monster");
15
16 MonsterBuilder monster_builder(builder);
17 monster_builder.add_name(name);
18
19 auto orc = monster_builder.Finish();
20
21 // Call `Finish()` to instruct the builder that this monster is complete.
22 // Note: Regardless of how you created the `orc`, you still need to call
23 // `Finish()` on the `FlatBufferBuilder`.
24 builder.Finish(orc);
25
26 // and then decode it
27 uint8_t* buffer = builder.GetBufferPointer();
28 auto monster = GetMonster(buffer);
29 Serial.printf("Monster name: %s\n", monster->name()->c_str());
30}

Callers

nothing calls this directly

Calls 7

GetMonsterFunction · 0.85
printfMethod · 0.80
beginMethod · 0.45
add_nameMethod · 0.45
FinishMethod · 0.45
c_strMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected