MCPcopy Create free account
hub / github.com/OpenStickCommunity/GP2040-CE / do_encode

Function do_encode

lib/nanopb/tests/stackusage/stackusage.c:44–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void do_encode()
45{
46 pb_ostream_t stream = pb_ostream_from_buffer(g_msgbuf, sizeof(g_msgbuf));
47 SettingsGroup msg = SettingsGroup_init_zero;
48 bool status;
49
50 msg.has_settings = true;
51 msg.settings.id = 1;
52 strcpy(msg.settings.name, "abcd");
53 msg.settings.en = true;
54 msg.settings.has_begin = true;
55 msg.settings.begin.label = 1234;
56 msg.settings.begin.properties_count = 1;
57 msg.settings.begin.properties[0].which_field = Property_DeviceA_Mode_tag;
58 msg.settings.begin.properties[0].field.DeviceA_Mode = 2;
59
60 status = pb_encode(&stream, SettingsGroup_fields, &msg);
61 g_msglen = stream.bytes_written;
62 assert(status);
63 assert(g_msglen > 10);
64}
65
66void do_decode()
67{

Callers 1

mainFunction · 0.85

Calls 2

pb_ostream_from_bufferFunction · 0.85
pb_encodeFunction · 0.85

Tested by

no test coverage detected