1 // automatically generated by the FlatBuffers compiler, do not modify
2
3
4 #ifndef FLATBUFFERS_GENERATED_HOSTMESSAGES_CHRE_FBS_H_
5 #define FLATBUFFERS_GENERATED_HOSTMESSAGES_CHRE_FBS_H_
6
7 #include "flatbuffers/flatbuffers.h"
8
9 namespace chre {
10 namespace fbs {
11
12 struct NanoappMessage;
13 struct NanoappMessageT;
14
15 struct HubInfoRequest;
16 struct HubInfoRequestT;
17
18 struct HubInfoResponse;
19 struct HubInfoResponseT;
20
21 struct NanoappListRequest;
22 struct NanoappListRequestT;
23
24 struct NanoappListEntry;
25 struct NanoappListEntryT;
26
27 struct NanoappListResponse;
28 struct NanoappListResponseT;
29
30 struct LoadNanoappRequest;
31 struct LoadNanoappRequestT;
32
33 struct LoadNanoappResponse;
34 struct LoadNanoappResponseT;
35
36 struct HostAddress;
37
38 struct MessageContainer;
39 struct MessageContainerT;
40
41 /// A union that joins together all possible messages. Note that in FlatBuffers,
42 /// unions have an implicit type
43 enum class ChreMessage : uint8_t {
44 NONE = 0,
45 NanoappMessage = 1,
46 HubInfoRequest = 2,
47 HubInfoResponse = 3,
48 NanoappListRequest = 4,
49 NanoappListResponse = 5,
50 LoadNanoappRequest = 6,
51 LoadNanoappResponse = 7,
52 MIN = NONE,
53 MAX = LoadNanoappResponse
54 };
55
EnumNamesChreMessage()56 inline const char **EnumNamesChreMessage() {
57 static const char *names[] = {
58 "NONE",
59 "NanoappMessage",
60 "HubInfoRequest",
61 "HubInfoResponse",
62 "NanoappListRequest",
63 "NanoappListResponse",
64 "LoadNanoappRequest",
65 "LoadNanoappResponse",
66 nullptr
67 };
68 return names;
69 }
70
EnumNameChreMessage(ChreMessage e)71 inline const char *EnumNameChreMessage(ChreMessage e) {
72 const size_t index = static_cast<int>(e);
73 return EnumNamesChreMessage()[index];
74 }
75
76 template<typename T> struct ChreMessageTraits {
77 static const ChreMessage enum_value = ChreMessage::NONE;
78 };
79
80 template<> struct ChreMessageTraits<NanoappMessage> {
81 static const ChreMessage enum_value = ChreMessage::NanoappMessage;
82 };
83
84 template<> struct ChreMessageTraits<HubInfoRequest> {
85 static const ChreMessage enum_value = ChreMessage::HubInfoRequest;
86 };
87
88 template<> struct ChreMessageTraits<HubInfoResponse> {
89 static const ChreMessage enum_value = ChreMessage::HubInfoResponse;
90 };
91
92 template<> struct ChreMessageTraits<NanoappListRequest> {
93 static const ChreMessage enum_value = ChreMessage::NanoappListRequest;
94 };
95
96 template<> struct ChreMessageTraits<NanoappListResponse> {
97 static const ChreMessage enum_value = ChreMessage::NanoappListResponse;
98 };
99
100 template<> struct ChreMessageTraits<LoadNanoappRequest> {
101 static const ChreMessage enum_value = ChreMessage::LoadNanoappRequest;
102 };
103
104 template<> struct ChreMessageTraits<LoadNanoappResponse> {
105 static const ChreMessage enum_value = ChreMessage::LoadNanoappResponse;
106 };
107
108 struct ChreMessageUnion {
109 ChreMessage type;
110 flatbuffers::NativeTable *table;
111
112 ChreMessageUnion() : type(ChreMessage::NONE), table(nullptr) {}
113 ChreMessageUnion(ChreMessageUnion&& u):
114 type(std::move(u.type)), table(std::move(u.table)) {}
115 ChreMessageUnion(const ChreMessageUnion &);
116 ChreMessageUnion &operator=(const ChreMessageUnion &);
117 ~ChreMessageUnion() { Reset(); }
118
119 void Reset();
120
121 template <typename T>
122 void Set(T&& value) {
123 Reset();
124 type = ChreMessageTraits<typename T::TableType>::enum_value;
125 if (type != ChreMessage::NONE) {
126 table = new T(std::forward<T>(value));
127 }
128 }
129
130 static flatbuffers::NativeTable *UnPack(const void *obj, ChreMessage type, const flatbuffers::resolver_function_t *resolver);
131 flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
132
133 NanoappMessageT *AsNanoappMessage() {
134 return type == ChreMessage::NanoappMessage ?
135 reinterpret_cast<NanoappMessageT *>(table) : nullptr;
136 }
137 HubInfoRequestT *AsHubInfoRequest() {
138 return type == ChreMessage::HubInfoRequest ?
139 reinterpret_cast<HubInfoRequestT *>(table) : nullptr;
140 }
141 HubInfoResponseT *AsHubInfoResponse() {
142 return type == ChreMessage::HubInfoResponse ?
143 reinterpret_cast<HubInfoResponseT *>(table) : nullptr;
144 }
145 NanoappListRequestT *AsNanoappListRequest() {
146 return type == ChreMessage::NanoappListRequest ?
147 reinterpret_cast<NanoappListRequestT *>(table) : nullptr;
148 }
149 NanoappListResponseT *AsNanoappListResponse() {
150 return type == ChreMessage::NanoappListResponse ?
151 reinterpret_cast<NanoappListResponseT *>(table) : nullptr;
152 }
153 LoadNanoappRequestT *AsLoadNanoappRequest() {
154 return type == ChreMessage::LoadNanoappRequest ?
155 reinterpret_cast<LoadNanoappRequestT *>(table) : nullptr;
156 }
157 LoadNanoappResponseT *AsLoadNanoappResponse() {
158 return type == ChreMessage::LoadNanoappResponse ?
159 reinterpret_cast<LoadNanoappResponseT *>(table) : nullptr;
160 }
161 };
162
163 bool VerifyChreMessage(flatbuffers::Verifier &verifier, const void *obj, ChreMessage type);
164 bool VerifyChreMessageVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
165
166 MANUALLY_ALIGNED_STRUCT(2) HostAddress FLATBUFFERS_FINAL_CLASS {
167 private:
168 uint16_t client_id_;
169
170 public:
171 HostAddress() {
172 memset(this, 0, sizeof(HostAddress));
173 }
174 HostAddress(const HostAddress &_o) {
175 memcpy(this, &_o, sizeof(HostAddress));
176 }
177 HostAddress(uint16_t _client_id)
178 : client_id_(flatbuffers::EndianScalar(_client_id)) {
179 }
180 uint16_t client_id() const {
181 return flatbuffers::EndianScalar(client_id_);
182 }
183 void mutate_client_id(uint16_t _client_id) {
184 flatbuffers::WriteScalar(&client_id_, _client_id);
185 }
186 };
187 STRUCT_END(HostAddress, 2);
188
189 struct NanoappMessageT : public flatbuffers::NativeTable {
190 typedef NanoappMessage TableType;
191 uint64_t app_id;
192 uint32_t message_type;
193 uint16_t host_endpoint;
194 std::vector<uint8_t> message;
195 NanoappMessageT()
196 : app_id(0),
197 message_type(0),
198 host_endpoint(65534) {
199 }
200 };
201
202 /// Represents a message sent to/from a nanoapp from/to a client on the host
203 struct NanoappMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
204 typedef NanoappMessageT NativeTableType;
205 enum {
206 VT_APP_ID = 4,
207 VT_MESSAGE_TYPE = 6,
208 VT_HOST_ENDPOINT = 8,
209 VT_MESSAGE = 10
210 };
211 uint64_t app_id() const {
212 return GetField<uint64_t>(VT_APP_ID, 0);
213 }
214 bool mutate_app_id(uint64_t _app_id) {
215 return SetField(VT_APP_ID, _app_id);
216 }
217 uint32_t message_type() const {
218 return GetField<uint32_t>(VT_MESSAGE_TYPE, 0);
219 }
220 bool mutate_message_type(uint32_t _message_type) {
221 return SetField(VT_MESSAGE_TYPE, _message_type);
222 }
223 /// Identifies the host-side endpoint on the host that sent or should receive
224 /// this message. The default value is a special value defined in the HAL and
225 /// elsewhere that indicates that the endpoint is unspecified.
226 uint16_t host_endpoint() const {
227 return GetField<uint16_t>(VT_HOST_ENDPOINT, 65534);
228 }
229 bool mutate_host_endpoint(uint16_t _host_endpoint) {
230 return SetField(VT_HOST_ENDPOINT, _host_endpoint);
231 }
232 /// Vector containing arbitrary application-specific message data
233 const flatbuffers::Vector<uint8_t> *message() const {
234 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_MESSAGE);
235 }
236 flatbuffers::Vector<uint8_t> *mutable_message() {
237 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_MESSAGE);
238 }
239 bool Verify(flatbuffers::Verifier &verifier) const {
240 return VerifyTableStart(verifier) &&
241 VerifyField<uint64_t>(verifier, VT_APP_ID) &&
242 VerifyField<uint32_t>(verifier, VT_MESSAGE_TYPE) &&
243 VerifyField<uint16_t>(verifier, VT_HOST_ENDPOINT) &&
244 VerifyFieldRequired<flatbuffers::uoffset_t>(verifier, VT_MESSAGE) &&
245 verifier.Verify(message()) &&
246 verifier.EndTable();
247 }
248 NanoappMessageT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
249 void UnPackTo(NanoappMessageT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
250 static flatbuffers::Offset<NanoappMessage> Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappMessageT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
251 };
252
253 struct NanoappMessageBuilder {
254 flatbuffers::FlatBufferBuilder &fbb_;
255 flatbuffers::uoffset_t start_;
256 void add_app_id(uint64_t app_id) {
257 fbb_.AddElement<uint64_t>(NanoappMessage::VT_APP_ID, app_id, 0);
258 }
259 void add_message_type(uint32_t message_type) {
260 fbb_.AddElement<uint32_t>(NanoappMessage::VT_MESSAGE_TYPE, message_type, 0);
261 }
262 void add_host_endpoint(uint16_t host_endpoint) {
263 fbb_.AddElement<uint16_t>(NanoappMessage::VT_HOST_ENDPOINT, host_endpoint, 65534);
264 }
265 void add_message(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> message) {
266 fbb_.AddOffset(NanoappMessage::VT_MESSAGE, message);
267 }
268 NanoappMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
269 : fbb_(_fbb) {
270 start_ = fbb_.StartTable();
271 }
272 NanoappMessageBuilder &operator=(const NanoappMessageBuilder &);
273 flatbuffers::Offset<NanoappMessage> Finish() {
274 const auto end = fbb_.EndTable(start_, 4);
275 auto o = flatbuffers::Offset<NanoappMessage>(end);
276 fbb_.Required(o, NanoappMessage::VT_MESSAGE);
277 return o;
278 }
279 };
280
281 inline flatbuffers::Offset<NanoappMessage> CreateNanoappMessage(
282 flatbuffers::FlatBufferBuilder &_fbb,
283 uint64_t app_id = 0,
284 uint32_t message_type = 0,
285 uint16_t host_endpoint = 65534,
286 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> message = 0) {
287 NanoappMessageBuilder builder_(_fbb);
288 builder_.add_app_id(app_id);
289 builder_.add_message(message);
290 builder_.add_message_type(message_type);
291 builder_.add_host_endpoint(host_endpoint);
292 return builder_.Finish();
293 }
294
295 inline flatbuffers::Offset<NanoappMessage> CreateNanoappMessageDirect(
296 flatbuffers::FlatBufferBuilder &_fbb,
297 uint64_t app_id = 0,
298 uint32_t message_type = 0,
299 uint16_t host_endpoint = 65534,
300 const std::vector<uint8_t> *message = nullptr) {
301 return chre::fbs::CreateNanoappMessage(
302 _fbb,
303 app_id,
304 message_type,
305 host_endpoint,
306 message ? _fbb.CreateVector<uint8_t>(*message) : 0);
307 }
308
309 flatbuffers::Offset<NanoappMessage> CreateNanoappMessage(flatbuffers::FlatBufferBuilder &_fbb, const NanoappMessageT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
310
311 struct HubInfoRequestT : public flatbuffers::NativeTable {
312 typedef HubInfoRequest TableType;
313 HubInfoRequestT() {
314 }
315 };
316
317 struct HubInfoRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
318 typedef HubInfoRequestT NativeTableType;
319 bool Verify(flatbuffers::Verifier &verifier) const {
320 return VerifyTableStart(verifier) &&
321 verifier.EndTable();
322 }
323 HubInfoRequestT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
324 void UnPackTo(HubInfoRequestT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
325 static flatbuffers::Offset<HubInfoRequest> Pack(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
326 };
327
328 struct HubInfoRequestBuilder {
329 flatbuffers::FlatBufferBuilder &fbb_;
330 flatbuffers::uoffset_t start_;
331 HubInfoRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
332 : fbb_(_fbb) {
333 start_ = fbb_.StartTable();
334 }
335 HubInfoRequestBuilder &operator=(const HubInfoRequestBuilder &);
336 flatbuffers::Offset<HubInfoRequest> Finish() {
337 const auto end = fbb_.EndTable(start_, 0);
338 auto o = flatbuffers::Offset<HubInfoRequest>(end);
339 return o;
340 }
341 };
342
343 inline flatbuffers::Offset<HubInfoRequest> CreateHubInfoRequest(
344 flatbuffers::FlatBufferBuilder &_fbb) {
345 HubInfoRequestBuilder builder_(_fbb);
346 return builder_.Finish();
347 }
348
349 flatbuffers::Offset<HubInfoRequest> CreateHubInfoRequest(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
350
351 struct HubInfoResponseT : public flatbuffers::NativeTable {
352 typedef HubInfoResponse TableType;
353 std::vector<int8_t> name;
354 std::vector<int8_t> vendor;
355 std::vector<int8_t> toolchain;
356 uint32_t platform_version;
357 uint32_t toolchain_version;
358 float peak_mips;
359 float stopped_power;
360 float sleep_power;
361 float peak_power;
362 uint32_t max_msg_len;
363 uint64_t platform_id;
364 uint32_t chre_platform_version;
365 HubInfoResponseT()
366 : platform_version(0),
367 toolchain_version(0),
368 peak_mips(0.0f),
369 stopped_power(0.0f),
370 sleep_power(0.0f),
371 peak_power(0.0f),
372 max_msg_len(0),
373 platform_id(0),
374 chre_platform_version(0) {
375 }
376 };
377
378 struct HubInfoResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
379 typedef HubInfoResponseT NativeTableType;
380 enum {
381 VT_NAME = 4,
382 VT_VENDOR = 6,
383 VT_TOOLCHAIN = 8,
384 VT_PLATFORM_VERSION = 10,
385 VT_TOOLCHAIN_VERSION = 12,
386 VT_PEAK_MIPS = 14,
387 VT_STOPPED_POWER = 16,
388 VT_SLEEP_POWER = 18,
389 VT_PEAK_POWER = 20,
390 VT_MAX_MSG_LEN = 22,
391 VT_PLATFORM_ID = 24,
392 VT_CHRE_PLATFORM_VERSION = 26
393 };
394 /// The name of the hub. Nominally a UTF-8 string, but note that we're not
395 /// using the built-in "string" data type from FlatBuffers here, because the
396 /// generated C++ uses std::string which is not well-supported in CHRE. This
397 /// applies for vendor and toolchain as well.
398 const flatbuffers::Vector<int8_t> *name() const {
399 return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_NAME);
400 }
401 flatbuffers::Vector<int8_t> *mutable_name() {
402 return GetPointer<flatbuffers::Vector<int8_t> *>(VT_NAME);
403 }
404 const flatbuffers::Vector<int8_t> *vendor() const {
405 return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_VENDOR);
406 }
407 flatbuffers::Vector<int8_t> *mutable_vendor() {
408 return GetPointer<flatbuffers::Vector<int8_t> *>(VT_VENDOR);
409 }
410 const flatbuffers::Vector<int8_t> *toolchain() const {
411 return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_TOOLCHAIN);
412 }
413 flatbuffers::Vector<int8_t> *mutable_toolchain() {
414 return GetPointer<flatbuffers::Vector<int8_t> *>(VT_TOOLCHAIN);
415 }
416 /// Legacy platform version reported in the HAL; semantics not strictly
417 /// defined
418 uint32_t platform_version() const {
419 return GetField<uint32_t>(VT_PLATFORM_VERSION, 0);
420 }
421 bool mutate_platform_version(uint32_t _platform_version) {
422 return SetField(VT_PLATFORM_VERSION, _platform_version);
423 }
424 /// Toolchain version reported in the HAL; semantics not strictly defined
425 uint32_t toolchain_version() const {
426 return GetField<uint32_t>(VT_TOOLCHAIN_VERSION, 0);
427 }
428 bool mutate_toolchain_version(uint32_t _toolchain_version) {
429 return SetField(VT_TOOLCHAIN_VERSION, _toolchain_version);
430 }
431 float peak_mips() const {
432 return GetField<float>(VT_PEAK_MIPS, 0.0f);
433 }
434 bool mutate_peak_mips(float _peak_mips) {
435 return SetField(VT_PEAK_MIPS, _peak_mips);
436 }
437 float stopped_power() const {
438 return GetField<float>(VT_STOPPED_POWER, 0.0f);
439 }
440 bool mutate_stopped_power(float _stopped_power) {
441 return SetField(VT_STOPPED_POWER, _stopped_power);
442 }
443 float sleep_power() const {
444 return GetField<float>(VT_SLEEP_POWER, 0.0f);
445 }
446 bool mutate_sleep_power(float _sleep_power) {
447 return SetField(VT_SLEEP_POWER, _sleep_power);
448 }
449 float peak_power() const {
450 return GetField<float>(VT_PEAK_POWER, 0.0f);
451 }
452 bool mutate_peak_power(float _peak_power) {
453 return SetField(VT_PEAK_POWER, _peak_power);
454 }
455 /// Maximum size message that can be sent to a nanoapp
456 uint32_t max_msg_len() const {
457 return GetField<uint32_t>(VT_MAX_MSG_LEN, 0);
458 }
459 bool mutate_max_msg_len(uint32_t _max_msg_len) {
460 return SetField(VT_MAX_MSG_LEN, _max_msg_len);
461 }
462 /// @see chreGetPlatformId()
463 uint64_t platform_id() const {
464 return GetField<uint64_t>(VT_PLATFORM_ID, 0);
465 }
466 bool mutate_platform_id(uint64_t _platform_id) {
467 return SetField(VT_PLATFORM_ID, _platform_id);
468 }
469 /// @see chreGetVersion()
470 uint32_t chre_platform_version() const {
471 return GetField<uint32_t>(VT_CHRE_PLATFORM_VERSION, 0);
472 }
473 bool mutate_chre_platform_version(uint32_t _chre_platform_version) {
474 return SetField(VT_CHRE_PLATFORM_VERSION, _chre_platform_version);
475 }
476 bool Verify(flatbuffers::Verifier &verifier) const {
477 return VerifyTableStart(verifier) &&
478 VerifyField<flatbuffers::uoffset_t>(verifier, VT_NAME) &&
479 verifier.Verify(name()) &&
480 VerifyField<flatbuffers::uoffset_t>(verifier, VT_VENDOR) &&
481 verifier.Verify(vendor()) &&
482 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TOOLCHAIN) &&
483 verifier.Verify(toolchain()) &&
484 VerifyField<uint32_t>(verifier, VT_PLATFORM_VERSION) &&
485 VerifyField<uint32_t>(verifier, VT_TOOLCHAIN_VERSION) &&
486 VerifyField<float>(verifier, VT_PEAK_MIPS) &&
487 VerifyField<float>(verifier, VT_STOPPED_POWER) &&
488 VerifyField<float>(verifier, VT_SLEEP_POWER) &&
489 VerifyField<float>(verifier, VT_PEAK_POWER) &&
490 VerifyField<uint32_t>(verifier, VT_MAX_MSG_LEN) &&
491 VerifyField<uint64_t>(verifier, VT_PLATFORM_ID) &&
492 VerifyField<uint32_t>(verifier, VT_CHRE_PLATFORM_VERSION) &&
493 verifier.EndTable();
494 }
495 HubInfoResponseT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
496 void UnPackTo(HubInfoResponseT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
497 static flatbuffers::Offset<HubInfoResponse> Pack(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
498 };
499
500 struct HubInfoResponseBuilder {
501 flatbuffers::FlatBufferBuilder &fbb_;
502 flatbuffers::uoffset_t start_;
503 void add_name(flatbuffers::Offset<flatbuffers::Vector<int8_t>> name) {
504 fbb_.AddOffset(HubInfoResponse::VT_NAME, name);
505 }
506 void add_vendor(flatbuffers::Offset<flatbuffers::Vector<int8_t>> vendor) {
507 fbb_.AddOffset(HubInfoResponse::VT_VENDOR, vendor);
508 }
509 void add_toolchain(flatbuffers::Offset<flatbuffers::Vector<int8_t>> toolchain) {
510 fbb_.AddOffset(HubInfoResponse::VT_TOOLCHAIN, toolchain);
511 }
512 void add_platform_version(uint32_t platform_version) {
513 fbb_.AddElement<uint32_t>(HubInfoResponse::VT_PLATFORM_VERSION, platform_version, 0);
514 }
515 void add_toolchain_version(uint32_t toolchain_version) {
516 fbb_.AddElement<uint32_t>(HubInfoResponse::VT_TOOLCHAIN_VERSION, toolchain_version, 0);
517 }
518 void add_peak_mips(float peak_mips) {
519 fbb_.AddElement<float>(HubInfoResponse::VT_PEAK_MIPS, peak_mips, 0.0f);
520 }
521 void add_stopped_power(float stopped_power) {
522 fbb_.AddElement<float>(HubInfoResponse::VT_STOPPED_POWER, stopped_power, 0.0f);
523 }
524 void add_sleep_power(float sleep_power) {
525 fbb_.AddElement<float>(HubInfoResponse::VT_SLEEP_POWER, sleep_power, 0.0f);
526 }
527 void add_peak_power(float peak_power) {
528 fbb_.AddElement<float>(HubInfoResponse::VT_PEAK_POWER, peak_power, 0.0f);
529 }
530 void add_max_msg_len(uint32_t max_msg_len) {
531 fbb_.AddElement<uint32_t>(HubInfoResponse::VT_MAX_MSG_LEN, max_msg_len, 0);
532 }
533 void add_platform_id(uint64_t platform_id) {
534 fbb_.AddElement<uint64_t>(HubInfoResponse::VT_PLATFORM_ID, platform_id, 0);
535 }
536 void add_chre_platform_version(uint32_t chre_platform_version) {
537 fbb_.AddElement<uint32_t>(HubInfoResponse::VT_CHRE_PLATFORM_VERSION, chre_platform_version, 0);
538 }
539 HubInfoResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
540 : fbb_(_fbb) {
541 start_ = fbb_.StartTable();
542 }
543 HubInfoResponseBuilder &operator=(const HubInfoResponseBuilder &);
544 flatbuffers::Offset<HubInfoResponse> Finish() {
545 const auto end = fbb_.EndTable(start_, 12);
546 auto o = flatbuffers::Offset<HubInfoResponse>(end);
547 return o;
548 }
549 };
550
551 inline flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponse(
552 flatbuffers::FlatBufferBuilder &_fbb,
553 flatbuffers::Offset<flatbuffers::Vector<int8_t>> name = 0,
554 flatbuffers::Offset<flatbuffers::Vector<int8_t>> vendor = 0,
555 flatbuffers::Offset<flatbuffers::Vector<int8_t>> toolchain = 0,
556 uint32_t platform_version = 0,
557 uint32_t toolchain_version = 0,
558 float peak_mips = 0.0f,
559 float stopped_power = 0.0f,
560 float sleep_power = 0.0f,
561 float peak_power = 0.0f,
562 uint32_t max_msg_len = 0,
563 uint64_t platform_id = 0,
564 uint32_t chre_platform_version = 0) {
565 HubInfoResponseBuilder builder_(_fbb);
566 builder_.add_platform_id(platform_id);
567 builder_.add_chre_platform_version(chre_platform_version);
568 builder_.add_max_msg_len(max_msg_len);
569 builder_.add_peak_power(peak_power);
570 builder_.add_sleep_power(sleep_power);
571 builder_.add_stopped_power(stopped_power);
572 builder_.add_peak_mips(peak_mips);
573 builder_.add_toolchain_version(toolchain_version);
574 builder_.add_platform_version(platform_version);
575 builder_.add_toolchain(toolchain);
576 builder_.add_vendor(vendor);
577 builder_.add_name(name);
578 return builder_.Finish();
579 }
580
581 inline flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponseDirect(
582 flatbuffers::FlatBufferBuilder &_fbb,
583 const std::vector<int8_t> *name = nullptr,
584 const std::vector<int8_t> *vendor = nullptr,
585 const std::vector<int8_t> *toolchain = nullptr,
586 uint32_t platform_version = 0,
587 uint32_t toolchain_version = 0,
588 float peak_mips = 0.0f,
589 float stopped_power = 0.0f,
590 float sleep_power = 0.0f,
591 float peak_power = 0.0f,
592 uint32_t max_msg_len = 0,
593 uint64_t platform_id = 0,
594 uint32_t chre_platform_version = 0) {
595 return chre::fbs::CreateHubInfoResponse(
596 _fbb,
597 name ? _fbb.CreateVector<int8_t>(*name) : 0,
598 vendor ? _fbb.CreateVector<int8_t>(*vendor) : 0,
599 toolchain ? _fbb.CreateVector<int8_t>(*toolchain) : 0,
600 platform_version,
601 toolchain_version,
602 peak_mips,
603 stopped_power,
604 sleep_power,
605 peak_power,
606 max_msg_len,
607 platform_id,
608 chre_platform_version);
609 }
610
611 flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponse(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
612
613 struct NanoappListRequestT : public flatbuffers::NativeTable {
614 typedef NanoappListRequest TableType;
615 NanoappListRequestT() {
616 }
617 };
618
619 struct NanoappListRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
620 typedef NanoappListRequestT NativeTableType;
621 bool Verify(flatbuffers::Verifier &verifier) const {
622 return VerifyTableStart(verifier) &&
623 verifier.EndTable();
624 }
625 NanoappListRequestT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
626 void UnPackTo(NanoappListRequestT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
627 static flatbuffers::Offset<NanoappListRequest> Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
628 };
629
630 struct NanoappListRequestBuilder {
631 flatbuffers::FlatBufferBuilder &fbb_;
632 flatbuffers::uoffset_t start_;
633 NanoappListRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
634 : fbb_(_fbb) {
635 start_ = fbb_.StartTable();
636 }
637 NanoappListRequestBuilder &operator=(const NanoappListRequestBuilder &);
638 flatbuffers::Offset<NanoappListRequest> Finish() {
639 const auto end = fbb_.EndTable(start_, 0);
640 auto o = flatbuffers::Offset<NanoappListRequest>(end);
641 return o;
642 }
643 };
644
645 inline flatbuffers::Offset<NanoappListRequest> CreateNanoappListRequest(
646 flatbuffers::FlatBufferBuilder &_fbb) {
647 NanoappListRequestBuilder builder_(_fbb);
648 return builder_.Finish();
649 }
650
651 flatbuffers::Offset<NanoappListRequest> CreateNanoappListRequest(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
652
653 struct NanoappListEntryT : public flatbuffers::NativeTable {
654 typedef NanoappListEntry TableType;
655 uint64_t app_id;
656 uint32_t version;
657 bool enabled;
658 bool is_system;
659 NanoappListEntryT()
660 : app_id(0),
661 version(0),
662 enabled(true),
663 is_system(false) {
664 }
665 };
666
667 struct NanoappListEntry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
668 typedef NanoappListEntryT NativeTableType;
669 enum {
670 VT_APP_ID = 4,
671 VT_VERSION = 6,
672 VT_ENABLED = 8,
673 VT_IS_SYSTEM = 10
674 };
675 uint64_t app_id() const {
676 return GetField<uint64_t>(VT_APP_ID, 0);
677 }
678 bool mutate_app_id(uint64_t _app_id) {
679 return SetField(VT_APP_ID, _app_id);
680 }
681 uint32_t version() const {
682 return GetField<uint32_t>(VT_VERSION, 0);
683 }
684 bool mutate_version(uint32_t _version) {
685 return SetField(VT_VERSION, _version);
686 }
687 bool enabled() const {
688 return GetField<uint8_t>(VT_ENABLED, 1) != 0;
689 }
690 bool mutate_enabled(bool _enabled) {
691 return SetField(VT_ENABLED, static_cast<uint8_t>(_enabled));
692 }
693 /// Whether the nanoapp is a pre-loaded "system" nanoapp, i.e. one that should
694 /// not show up in the list of nanoapps in the context hub HAL. System
695 /// nanoapps are typically used to leverage CHRE for some device functionality
696 /// and do not interact via the context hub HAL.
697 bool is_system() const {
698 return GetField<uint8_t>(VT_IS_SYSTEM, 0) != 0;
699 }
700 bool mutate_is_system(bool _is_system) {
701 return SetField(VT_IS_SYSTEM, static_cast<uint8_t>(_is_system));
702 }
703 bool Verify(flatbuffers::Verifier &verifier) const {
704 return VerifyTableStart(verifier) &&
705 VerifyField<uint64_t>(verifier, VT_APP_ID) &&
706 VerifyField<uint32_t>(verifier, VT_VERSION) &&
707 VerifyField<uint8_t>(verifier, VT_ENABLED) &&
708 VerifyField<uint8_t>(verifier, VT_IS_SYSTEM) &&
709 verifier.EndTable();
710 }
711 NanoappListEntryT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
712 void UnPackTo(NanoappListEntryT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
713 static flatbuffers::Offset<NanoappListEntry> Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListEntryT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
714 };
715
716 struct NanoappListEntryBuilder {
717 flatbuffers::FlatBufferBuilder &fbb_;
718 flatbuffers::uoffset_t start_;
719 void add_app_id(uint64_t app_id) {
720 fbb_.AddElement<uint64_t>(NanoappListEntry::VT_APP_ID, app_id, 0);
721 }
722 void add_version(uint32_t version) {
723 fbb_.AddElement<uint32_t>(NanoappListEntry::VT_VERSION, version, 0);
724 }
725 void add_enabled(bool enabled) {
726 fbb_.AddElement<uint8_t>(NanoappListEntry::VT_ENABLED, static_cast<uint8_t>(enabled), 1);
727 }
728 void add_is_system(bool is_system) {
729 fbb_.AddElement<uint8_t>(NanoappListEntry::VT_IS_SYSTEM, static_cast<uint8_t>(is_system), 0);
730 }
731 NanoappListEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
732 : fbb_(_fbb) {
733 start_ = fbb_.StartTable();
734 }
735 NanoappListEntryBuilder &operator=(const NanoappListEntryBuilder &);
736 flatbuffers::Offset<NanoappListEntry> Finish() {
737 const auto end = fbb_.EndTable(start_, 4);
738 auto o = flatbuffers::Offset<NanoappListEntry>(end);
739 return o;
740 }
741 };
742
743 inline flatbuffers::Offset<NanoappListEntry> CreateNanoappListEntry(
744 flatbuffers::FlatBufferBuilder &_fbb,
745 uint64_t app_id = 0,
746 uint32_t version = 0,
747 bool enabled = true,
748 bool is_system = false) {
749 NanoappListEntryBuilder builder_(_fbb);
750 builder_.add_app_id(app_id);
751 builder_.add_version(version);
752 builder_.add_is_system(is_system);
753 builder_.add_enabled(enabled);
754 return builder_.Finish();
755 }
756
757 flatbuffers::Offset<NanoappListEntry> CreateNanoappListEntry(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListEntryT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
758
759 struct NanoappListResponseT : public flatbuffers::NativeTable {
760 typedef NanoappListResponse TableType;
761 std::vector<std::unique_ptr<NanoappListEntryT>> nanoapps;
762 NanoappListResponseT() {
763 }
764 };
765
766 struct NanoappListResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
767 typedef NanoappListResponseT NativeTableType;
768 enum {
769 VT_NANOAPPS = 4
770 };
771 const flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>> *nanoapps() const {
772 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>> *>(VT_NANOAPPS);
773 }
774 flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>> *mutable_nanoapps() {
775 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>> *>(VT_NANOAPPS);
776 }
777 bool Verify(flatbuffers::Verifier &verifier) const {
778 return VerifyTableStart(verifier) &&
779 VerifyFieldRequired<flatbuffers::uoffset_t>(verifier, VT_NANOAPPS) &&
780 verifier.Verify(nanoapps()) &&
781 verifier.VerifyVectorOfTables(nanoapps()) &&
782 verifier.EndTable();
783 }
784 NanoappListResponseT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
785 void UnPackTo(NanoappListResponseT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
786 static flatbuffers::Offset<NanoappListResponse> Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
787 };
788
789 struct NanoappListResponseBuilder {
790 flatbuffers::FlatBufferBuilder &fbb_;
791 flatbuffers::uoffset_t start_;
792 void add_nanoapps(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>>> nanoapps) {
793 fbb_.AddOffset(NanoappListResponse::VT_NANOAPPS, nanoapps);
794 }
795 NanoappListResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
796 : fbb_(_fbb) {
797 start_ = fbb_.StartTable();
798 }
799 NanoappListResponseBuilder &operator=(const NanoappListResponseBuilder &);
800 flatbuffers::Offset<NanoappListResponse> Finish() {
801 const auto end = fbb_.EndTable(start_, 1);
802 auto o = flatbuffers::Offset<NanoappListResponse>(end);
803 fbb_.Required(o, NanoappListResponse::VT_NANOAPPS);
804 return o;
805 }
806 };
807
808 inline flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponse(
809 flatbuffers::FlatBufferBuilder &_fbb,
810 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<NanoappListEntry>>> nanoapps = 0) {
811 NanoappListResponseBuilder builder_(_fbb);
812 builder_.add_nanoapps(nanoapps);
813 return builder_.Finish();
814 }
815
816 inline flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponseDirect(
817 flatbuffers::FlatBufferBuilder &_fbb,
818 const std::vector<flatbuffers::Offset<NanoappListEntry>> *nanoapps = nullptr) {
819 return chre::fbs::CreateNanoappListResponse(
820 _fbb,
821 nanoapps ? _fbb.CreateVector<flatbuffers::Offset<NanoappListEntry>>(*nanoapps) : 0);
822 }
823
824 flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponse(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
825
826 struct LoadNanoappRequestT : public flatbuffers::NativeTable {
827 typedef LoadNanoappRequest TableType;
828 uint32_t transaction_id;
829 uint64_t app_id;
830 uint32_t app_version;
831 uint32_t target_api_version;
832 std::vector<uint8_t> app_binary;
833 LoadNanoappRequestT()
834 : transaction_id(0),
835 app_id(0),
836 app_version(0),
837 target_api_version(0) {
838 }
839 };
840
841 struct LoadNanoappRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
842 typedef LoadNanoappRequestT NativeTableType;
843 enum {
844 VT_TRANSACTION_ID = 4,
845 VT_APP_ID = 6,
846 VT_APP_VERSION = 8,
847 VT_TARGET_API_VERSION = 10,
848 VT_APP_BINARY = 12
849 };
850 uint32_t transaction_id() const {
851 return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
852 }
853 bool mutate_transaction_id(uint32_t _transaction_id) {
854 return SetField(VT_TRANSACTION_ID, _transaction_id);
855 }
856 uint64_t app_id() const {
857 return GetField<uint64_t>(VT_APP_ID, 0);
858 }
859 bool mutate_app_id(uint64_t _app_id) {
860 return SetField(VT_APP_ID, _app_id);
861 }
862 uint32_t app_version() const {
863 return GetField<uint32_t>(VT_APP_VERSION, 0);
864 }
865 bool mutate_app_version(uint32_t _app_version) {
866 return SetField(VT_APP_VERSION, _app_version);
867 }
868 uint32_t target_api_version() const {
869 return GetField<uint32_t>(VT_TARGET_API_VERSION, 0);
870 }
871 bool mutate_target_api_version(uint32_t _target_api_version) {
872 return SetField(VT_TARGET_API_VERSION, _target_api_version);
873 }
874 const flatbuffers::Vector<uint8_t> *app_binary() const {
875 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_APP_BINARY);
876 }
877 flatbuffers::Vector<uint8_t> *mutable_app_binary() {
878 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_APP_BINARY);
879 }
880 bool Verify(flatbuffers::Verifier &verifier) const {
881 return VerifyTableStart(verifier) &&
882 VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
883 VerifyField<uint64_t>(verifier, VT_APP_ID) &&
884 VerifyField<uint32_t>(verifier, VT_APP_VERSION) &&
885 VerifyField<uint32_t>(verifier, VT_TARGET_API_VERSION) &&
886 VerifyFieldRequired<flatbuffers::uoffset_t>(verifier, VT_APP_BINARY) &&
887 verifier.Verify(app_binary()) &&
888 verifier.EndTable();
889 }
890 LoadNanoappRequestT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
891 void UnPackTo(LoadNanoappRequestT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
892 static flatbuffers::Offset<LoadNanoappRequest> Pack(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
893 };
894
895 struct LoadNanoappRequestBuilder {
896 flatbuffers::FlatBufferBuilder &fbb_;
897 flatbuffers::uoffset_t start_;
898 void add_transaction_id(uint32_t transaction_id) {
899 fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_TRANSACTION_ID, transaction_id, 0);
900 }
901 void add_app_id(uint64_t app_id) {
902 fbb_.AddElement<uint64_t>(LoadNanoappRequest::VT_APP_ID, app_id, 0);
903 }
904 void add_app_version(uint32_t app_version) {
905 fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_APP_VERSION, app_version, 0);
906 }
907 void add_target_api_version(uint32_t target_api_version) {
908 fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_TARGET_API_VERSION, target_api_version, 0);
909 }
910 void add_app_binary(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> app_binary) {
911 fbb_.AddOffset(LoadNanoappRequest::VT_APP_BINARY, app_binary);
912 }
913 LoadNanoappRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
914 : fbb_(_fbb) {
915 start_ = fbb_.StartTable();
916 }
917 LoadNanoappRequestBuilder &operator=(const LoadNanoappRequestBuilder &);
918 flatbuffers::Offset<LoadNanoappRequest> Finish() {
919 const auto end = fbb_.EndTable(start_, 5);
920 auto o = flatbuffers::Offset<LoadNanoappRequest>(end);
921 fbb_.Required(o, LoadNanoappRequest::VT_APP_BINARY);
922 return o;
923 }
924 };
925
926 inline flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequest(
927 flatbuffers::FlatBufferBuilder &_fbb,
928 uint32_t transaction_id = 0,
929 uint64_t app_id = 0,
930 uint32_t app_version = 0,
931 uint32_t target_api_version = 0,
932 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> app_binary = 0) {
933 LoadNanoappRequestBuilder builder_(_fbb);
934 builder_.add_app_id(app_id);
935 builder_.add_app_binary(app_binary);
936 builder_.add_target_api_version(target_api_version);
937 builder_.add_app_version(app_version);
938 builder_.add_transaction_id(transaction_id);
939 return builder_.Finish();
940 }
941
942 inline flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequestDirect(
943 flatbuffers::FlatBufferBuilder &_fbb,
944 uint32_t transaction_id = 0,
945 uint64_t app_id = 0,
946 uint32_t app_version = 0,
947 uint32_t target_api_version = 0,
948 const std::vector<uint8_t> *app_binary = nullptr) {
949 return chre::fbs::CreateLoadNanoappRequest(
950 _fbb,
951 transaction_id,
952 app_id,
953 app_version,
954 target_api_version,
955 app_binary ? _fbb.CreateVector<uint8_t>(*app_binary) : 0);
956 }
957
958 flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequest(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
959
960 struct LoadNanoappResponseT : public flatbuffers::NativeTable {
961 typedef LoadNanoappResponse TableType;
962 uint32_t transaction_id;
963 bool success;
964 LoadNanoappResponseT()
965 : transaction_id(0),
966 success(false) {
967 }
968 };
969
970 struct LoadNanoappResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
971 typedef LoadNanoappResponseT NativeTableType;
972 enum {
973 VT_TRANSACTION_ID = 4,
974 VT_SUCCESS = 6
975 };
976 uint32_t transaction_id() const {
977 return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
978 }
979 bool mutate_transaction_id(uint32_t _transaction_id) {
980 return SetField(VT_TRANSACTION_ID, _transaction_id);
981 }
982 bool success() const {
983 return GetField<uint8_t>(VT_SUCCESS, 0) != 0;
984 }
985 bool mutate_success(bool _success) {
986 return SetField(VT_SUCCESS, static_cast<uint8_t>(_success));
987 }
988 bool Verify(flatbuffers::Verifier &verifier) const {
989 return VerifyTableStart(verifier) &&
990 VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
991 VerifyField<uint8_t>(verifier, VT_SUCCESS) &&
992 verifier.EndTable();
993 }
994 LoadNanoappResponseT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
995 void UnPackTo(LoadNanoappResponseT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
996 static flatbuffers::Offset<LoadNanoappResponse> Pack(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
997 };
998
999 struct LoadNanoappResponseBuilder {
1000 flatbuffers::FlatBufferBuilder &fbb_;
1001 flatbuffers::uoffset_t start_;
1002 void add_transaction_id(uint32_t transaction_id) {
1003 fbb_.AddElement<uint32_t>(LoadNanoappResponse::VT_TRANSACTION_ID, transaction_id, 0);
1004 }
1005 void add_success(bool success) {
1006 fbb_.AddElement<uint8_t>(LoadNanoappResponse::VT_SUCCESS, static_cast<uint8_t>(success), 0);
1007 }
1008 LoadNanoappResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1009 : fbb_(_fbb) {
1010 start_ = fbb_.StartTable();
1011 }
1012 LoadNanoappResponseBuilder &operator=(const LoadNanoappResponseBuilder &);
1013 flatbuffers::Offset<LoadNanoappResponse> Finish() {
1014 const auto end = fbb_.EndTable(start_, 2);
1015 auto o = flatbuffers::Offset<LoadNanoappResponse>(end);
1016 return o;
1017 }
1018 };
1019
1020 inline flatbuffers::Offset<LoadNanoappResponse> CreateLoadNanoappResponse(
1021 flatbuffers::FlatBufferBuilder &_fbb,
1022 uint32_t transaction_id = 0,
1023 bool success = false) {
1024 LoadNanoappResponseBuilder builder_(_fbb);
1025 builder_.add_transaction_id(transaction_id);
1026 builder_.add_success(success);
1027 return builder_.Finish();
1028 }
1029
1030 flatbuffers::Offset<LoadNanoappResponse> CreateLoadNanoappResponse(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
1031
1032 struct MessageContainerT : public flatbuffers::NativeTable {
1033 typedef MessageContainer TableType;
1034 ChreMessageUnion message;
1035 std::unique_ptr<HostAddress> host_addr;
1036 MessageContainerT() {
1037 }
1038 };
1039
1040 /// The top-level container that encapsulates all possible messages. Note that
1041 /// per FlatBuffers requirements, we can't use a union as the top-level structure
1042 /// (root type), so we must wrap it in a table.
1043 struct MessageContainer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1044 typedef MessageContainerT NativeTableType;
1045 enum {
1046 VT_MESSAGE_TYPE = 4,
1047 VT_MESSAGE = 6,
1048 VT_HOST_ADDR = 8
1049 };
1050 ChreMessage message_type() const {
1051 return static_cast<ChreMessage>(GetField<uint8_t>(VT_MESSAGE_TYPE, 0));
1052 }
1053 bool mutate_message_type(ChreMessage _message_type) {
1054 return SetField(VT_MESSAGE_TYPE, static_cast<uint8_t>(_message_type));
1055 }
1056 const void *message() const {
1057 return GetPointer<const void *>(VT_MESSAGE);
1058 }
1059 void *mutable_message() {
1060 return GetPointer<void *>(VT_MESSAGE);
1061 }
1062 /// The originating or destination client ID on the host side, used to direct
1063 /// responses only to the client that sent the request. Although initially
1064 /// populated by the requesting client, this is enforced to be the correct
1065 /// value by the entity guarding access to CHRE.
1066 /// This is wrapped in a struct to ensure that it is always included when
1067 /// encoding the message, so it can be mutated by the host daemon.
1068 const HostAddress *host_addr() const {
1069 return GetStruct<const HostAddress *>(VT_HOST_ADDR);
1070 }
1071 HostAddress *mutable_host_addr() {
1072 return GetStruct<HostAddress *>(VT_HOST_ADDR);
1073 }
1074 bool Verify(flatbuffers::Verifier &verifier) const {
1075 return VerifyTableStart(verifier) &&
1076 VerifyField<uint8_t>(verifier, VT_MESSAGE_TYPE) &&
1077 VerifyFieldRequired<flatbuffers::uoffset_t>(verifier, VT_MESSAGE) &&
1078 VerifyChreMessage(verifier, message(), message_type()) &&
1079 VerifyFieldRequired<HostAddress>(verifier, VT_HOST_ADDR) &&
1080 verifier.EndTable();
1081 }
1082 MessageContainerT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
1083 void UnPackTo(MessageContainerT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
1084 static flatbuffers::Offset<MessageContainer> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MessageContainerT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
1085 };
1086
1087 struct MessageContainerBuilder {
1088 flatbuffers::FlatBufferBuilder &fbb_;
1089 flatbuffers::uoffset_t start_;
1090 void add_message_type(ChreMessage message_type) {
1091 fbb_.AddElement<uint8_t>(MessageContainer::VT_MESSAGE_TYPE, static_cast<uint8_t>(message_type), 0);
1092 }
1093 void add_message(flatbuffers::Offset<void> message) {
1094 fbb_.AddOffset(MessageContainer::VT_MESSAGE, message);
1095 }
1096 void add_host_addr(const HostAddress *host_addr) {
1097 fbb_.AddStruct(MessageContainer::VT_HOST_ADDR, host_addr);
1098 }
1099 MessageContainerBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1100 : fbb_(_fbb) {
1101 start_ = fbb_.StartTable();
1102 }
1103 MessageContainerBuilder &operator=(const MessageContainerBuilder &);
1104 flatbuffers::Offset<MessageContainer> Finish() {
1105 const auto end = fbb_.EndTable(start_, 3);
1106 auto o = flatbuffers::Offset<MessageContainer>(end);
1107 fbb_.Required(o, MessageContainer::VT_MESSAGE);
1108 fbb_.Required(o, MessageContainer::VT_HOST_ADDR);
1109 return o;
1110 }
1111 };
1112
1113 inline flatbuffers::Offset<MessageContainer> CreateMessageContainer(
1114 flatbuffers::FlatBufferBuilder &_fbb,
1115 ChreMessage message_type = ChreMessage::NONE,
1116 flatbuffers::Offset<void> message = 0,
1117 const HostAddress *host_addr = 0) {
1118 MessageContainerBuilder builder_(_fbb);
1119 builder_.add_host_addr(host_addr);
1120 builder_.add_message(message);
1121 builder_.add_message_type(message_type);
1122 return builder_.Finish();
1123 }
1124
1125 flatbuffers::Offset<MessageContainer> CreateMessageContainer(flatbuffers::FlatBufferBuilder &_fbb, const MessageContainerT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
1126
1127 inline NanoappMessageT *NanoappMessage::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1128 auto _o = new NanoappMessageT();
1129 UnPackTo(_o, _resolver);
1130 return _o;
1131 }
1132
1133 inline void NanoappMessage::UnPackTo(NanoappMessageT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1134 (void)_o;
1135 (void)_resolver;
1136 { auto _e = app_id(); _o->app_id = _e; };
1137 { auto _e = message_type(); _o->message_type = _e; };
1138 { auto _e = host_endpoint(); _o->host_endpoint = _e; };
1139 { auto _e = message(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->message.push_back(_e->Get(_i)); } };
1140 }
1141
1142 inline flatbuffers::Offset<NanoappMessage> NanoappMessage::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappMessageT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1143 return CreateNanoappMessage(_fbb, _o, _rehasher);
1144 }
1145
1146 inline flatbuffers::Offset<NanoappMessage> CreateNanoappMessage(flatbuffers::FlatBufferBuilder &_fbb, const NanoappMessageT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1147 (void)_rehasher;
1148 (void)_o;
1149 auto _app_id = _o->app_id;
1150 auto _message_type = _o->message_type;
1151 auto _host_endpoint = _o->host_endpoint;
1152 auto _message = _fbb.CreateVector(_o->message);
1153 return chre::fbs::CreateNanoappMessage(
1154 _fbb,
1155 _app_id,
1156 _message_type,
1157 _host_endpoint,
1158 _message);
1159 }
1160
1161 inline HubInfoRequestT *HubInfoRequest::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1162 auto _o = new HubInfoRequestT();
1163 UnPackTo(_o, _resolver);
1164 return _o;
1165 }
1166
1167 inline void HubInfoRequest::UnPackTo(HubInfoRequestT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1168 (void)_o;
1169 (void)_resolver;
1170 }
1171
1172 inline flatbuffers::Offset<HubInfoRequest> HubInfoRequest::Pack(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1173 return CreateHubInfoRequest(_fbb, _o, _rehasher);
1174 }
1175
1176 inline flatbuffers::Offset<HubInfoRequest> CreateHubInfoRequest(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1177 (void)_rehasher;
1178 (void)_o;
1179 return chre::fbs::CreateHubInfoRequest(
1180 _fbb);
1181 }
1182
1183 inline HubInfoResponseT *HubInfoResponse::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1184 auto _o = new HubInfoResponseT();
1185 UnPackTo(_o, _resolver);
1186 return _o;
1187 }
1188
1189 inline void HubInfoResponse::UnPackTo(HubInfoResponseT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1190 (void)_o;
1191 (void)_resolver;
1192 { auto _e = name(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->name.push_back(_e->Get(_i)); } };
1193 { auto _e = vendor(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vendor.push_back(_e->Get(_i)); } };
1194 { auto _e = toolchain(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->toolchain.push_back(_e->Get(_i)); } };
1195 { auto _e = platform_version(); _o->platform_version = _e; };
1196 { auto _e = toolchain_version(); _o->toolchain_version = _e; };
1197 { auto _e = peak_mips(); _o->peak_mips = _e; };
1198 { auto _e = stopped_power(); _o->stopped_power = _e; };
1199 { auto _e = sleep_power(); _o->sleep_power = _e; };
1200 { auto _e = peak_power(); _o->peak_power = _e; };
1201 { auto _e = max_msg_len(); _o->max_msg_len = _e; };
1202 { auto _e = platform_id(); _o->platform_id = _e; };
1203 { auto _e = chre_platform_version(); _o->chre_platform_version = _e; };
1204 }
1205
1206 inline flatbuffers::Offset<HubInfoResponse> HubInfoResponse::Pack(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1207 return CreateHubInfoResponse(_fbb, _o, _rehasher);
1208 }
1209
1210 inline flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponse(flatbuffers::FlatBufferBuilder &_fbb, const HubInfoResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1211 (void)_rehasher;
1212 (void)_o;
1213 auto _name = _o->name.size() ? _fbb.CreateVector(_o->name) : 0;
1214 auto _vendor = _o->vendor.size() ? _fbb.CreateVector(_o->vendor) : 0;
1215 auto _toolchain = _o->toolchain.size() ? _fbb.CreateVector(_o->toolchain) : 0;
1216 auto _platform_version = _o->platform_version;
1217 auto _toolchain_version = _o->toolchain_version;
1218 auto _peak_mips = _o->peak_mips;
1219 auto _stopped_power = _o->stopped_power;
1220 auto _sleep_power = _o->sleep_power;
1221 auto _peak_power = _o->peak_power;
1222 auto _max_msg_len = _o->max_msg_len;
1223 auto _platform_id = _o->platform_id;
1224 auto _chre_platform_version = _o->chre_platform_version;
1225 return chre::fbs::CreateHubInfoResponse(
1226 _fbb,
1227 _name,
1228 _vendor,
1229 _toolchain,
1230 _platform_version,
1231 _toolchain_version,
1232 _peak_mips,
1233 _stopped_power,
1234 _sleep_power,
1235 _peak_power,
1236 _max_msg_len,
1237 _platform_id,
1238 _chre_platform_version);
1239 }
1240
1241 inline NanoappListRequestT *NanoappListRequest::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1242 auto _o = new NanoappListRequestT();
1243 UnPackTo(_o, _resolver);
1244 return _o;
1245 }
1246
1247 inline void NanoappListRequest::UnPackTo(NanoappListRequestT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1248 (void)_o;
1249 (void)_resolver;
1250 }
1251
1252 inline flatbuffers::Offset<NanoappListRequest> NanoappListRequest::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1253 return CreateNanoappListRequest(_fbb, _o, _rehasher);
1254 }
1255
1256 inline flatbuffers::Offset<NanoappListRequest> CreateNanoappListRequest(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1257 (void)_rehasher;
1258 (void)_o;
1259 return chre::fbs::CreateNanoappListRequest(
1260 _fbb);
1261 }
1262
1263 inline NanoappListEntryT *NanoappListEntry::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1264 auto _o = new NanoappListEntryT();
1265 UnPackTo(_o, _resolver);
1266 return _o;
1267 }
1268
1269 inline void NanoappListEntry::UnPackTo(NanoappListEntryT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1270 (void)_o;
1271 (void)_resolver;
1272 { auto _e = app_id(); _o->app_id = _e; };
1273 { auto _e = version(); _o->version = _e; };
1274 { auto _e = enabled(); _o->enabled = _e; };
1275 { auto _e = is_system(); _o->is_system = _e; };
1276 }
1277
1278 inline flatbuffers::Offset<NanoappListEntry> NanoappListEntry::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListEntryT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1279 return CreateNanoappListEntry(_fbb, _o, _rehasher);
1280 }
1281
1282 inline flatbuffers::Offset<NanoappListEntry> CreateNanoappListEntry(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListEntryT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1283 (void)_rehasher;
1284 (void)_o;
1285 auto _app_id = _o->app_id;
1286 auto _version = _o->version;
1287 auto _enabled = _o->enabled;
1288 auto _is_system = _o->is_system;
1289 return chre::fbs::CreateNanoappListEntry(
1290 _fbb,
1291 _app_id,
1292 _version,
1293 _enabled,
1294 _is_system);
1295 }
1296
1297 inline NanoappListResponseT *NanoappListResponse::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1298 auto _o = new NanoappListResponseT();
1299 UnPackTo(_o, _resolver);
1300 return _o;
1301 }
1302
1303 inline void NanoappListResponse::UnPackTo(NanoappListResponseT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1304 (void)_o;
1305 (void)_resolver;
1306 { auto _e = nanoapps(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->nanoapps.push_back(std::unique_ptr<NanoappListEntryT>(_e->Get(_i)->UnPack(_resolver))); } };
1307 }
1308
1309 inline flatbuffers::Offset<NanoappListResponse> NanoappListResponse::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1310 return CreateNanoappListResponse(_fbb, _o, _rehasher);
1311 }
1312
1313 inline flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponse(flatbuffers::FlatBufferBuilder &_fbb, const NanoappListResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1314 (void)_rehasher;
1315 (void)_o;
1316 auto _nanoapps = _fbb.CreateVector<flatbuffers::Offset<NanoappListEntry>>(_o->nanoapps.size(), [&](size_t i) { return CreateNanoappListEntry(_fbb, _o->nanoapps[i].get(), _rehasher); });
1317 return chre::fbs::CreateNanoappListResponse(
1318 _fbb,
1319 _nanoapps);
1320 }
1321
1322 inline LoadNanoappRequestT *LoadNanoappRequest::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1323 auto _o = new LoadNanoappRequestT();
1324 UnPackTo(_o, _resolver);
1325 return _o;
1326 }
1327
1328 inline void LoadNanoappRequest::UnPackTo(LoadNanoappRequestT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1329 (void)_o;
1330 (void)_resolver;
1331 { auto _e = transaction_id(); _o->transaction_id = _e; };
1332 { auto _e = app_id(); _o->app_id = _e; };
1333 { auto _e = app_version(); _o->app_version = _e; };
1334 { auto _e = target_api_version(); _o->target_api_version = _e; };
1335 { auto _e = app_binary(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->app_binary.push_back(_e->Get(_i)); } };
1336 }
1337
1338 inline flatbuffers::Offset<LoadNanoappRequest> LoadNanoappRequest::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappRequestT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1339 return CreateLoadNanoappRequest(_fbb, _o, _rehasher);
1340 }
1341
1342 inline flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequest(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappRequestT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1343 (void)_rehasher;
1344 (void)_o;
1345 auto _transaction_id = _o->transaction_id;
1346 auto _app_id = _o->app_id;
1347 auto _app_version = _o->app_version;
1348 auto _target_api_version = _o->target_api_version;
1349 auto _app_binary = _fbb.CreateVector(_o->app_binary);
1350 return chre::fbs::CreateLoadNanoappRequest(
1351 _fbb,
1352 _transaction_id,
1353 _app_id,
1354 _app_version,
1355 _target_api_version,
1356 _app_binary);
1357 }
1358
1359 inline LoadNanoappResponseT *LoadNanoappResponse::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1360 auto _o = new LoadNanoappResponseT();
1361 UnPackTo(_o, _resolver);
1362 return _o;
1363 }
1364
1365 inline void LoadNanoappResponse::UnPackTo(LoadNanoappResponseT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1366 (void)_o;
1367 (void)_resolver;
1368 { auto _e = transaction_id(); _o->transaction_id = _e; };
1369 { auto _e = success(); _o->success = _e; };
1370 }
1371
1372 inline flatbuffers::Offset<LoadNanoappResponse> LoadNanoappResponse::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappResponseT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1373 return CreateLoadNanoappResponse(_fbb, _o, _rehasher);
1374 }
1375
1376 inline flatbuffers::Offset<LoadNanoappResponse> CreateLoadNanoappResponse(flatbuffers::FlatBufferBuilder &_fbb, const LoadNanoappResponseT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1377 (void)_rehasher;
1378 (void)_o;
1379 auto _transaction_id = _o->transaction_id;
1380 auto _success = _o->success;
1381 return chre::fbs::CreateLoadNanoappResponse(
1382 _fbb,
1383 _transaction_id,
1384 _success);
1385 }
1386
1387 inline MessageContainerT *MessageContainer::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1388 auto _o = new MessageContainerT();
1389 UnPackTo(_o, _resolver);
1390 return _o;
1391 }
1392
1393 inline void MessageContainer::UnPackTo(MessageContainerT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1394 (void)_o;
1395 (void)_resolver;
1396 { auto _e = message_type(); _o->message.type = _e; };
1397 { auto _e = message(); if (_e) _o->message.table = ChreMessageUnion::UnPack(_e, message_type(),_resolver); };
1398 { auto _e = host_addr(); if (_e) _o->host_addr = std::unique_ptr<HostAddress>(new HostAddress(*_e)); };
1399 }
1400
1401 inline flatbuffers::Offset<MessageContainer> MessageContainer::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MessageContainerT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1402 return CreateMessageContainer(_fbb, _o, _rehasher);
1403 }
1404
1405 inline flatbuffers::Offset<MessageContainer> CreateMessageContainer(flatbuffers::FlatBufferBuilder &_fbb, const MessageContainerT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1406 (void)_rehasher;
1407 (void)_o;
1408 auto _message_type = _o->message.type;
1409 auto _message = _o->message.Pack(_fbb);
1410 auto _host_addr = _o->host_addr ? _o->host_addr.get() : 0;
1411 return chre::fbs::CreateMessageContainer(
1412 _fbb,
1413 _message_type,
1414 _message,
1415 _host_addr);
1416 }
1417
1418 inline bool VerifyChreMessage(flatbuffers::Verifier &verifier, const void *obj, ChreMessage type) {
1419 switch (type) {
1420 case ChreMessage::NONE: {
1421 return true;
1422 }
1423 case ChreMessage::NanoappMessage: {
1424 auto ptr = reinterpret_cast<const NanoappMessage *>(obj);
1425 return verifier.VerifyTable(ptr);
1426 }
1427 case ChreMessage::HubInfoRequest: {
1428 auto ptr = reinterpret_cast<const HubInfoRequest *>(obj);
1429 return verifier.VerifyTable(ptr);
1430 }
1431 case ChreMessage::HubInfoResponse: {
1432 auto ptr = reinterpret_cast<const HubInfoResponse *>(obj);
1433 return verifier.VerifyTable(ptr);
1434 }
1435 case ChreMessage::NanoappListRequest: {
1436 auto ptr = reinterpret_cast<const NanoappListRequest *>(obj);
1437 return verifier.VerifyTable(ptr);
1438 }
1439 case ChreMessage::NanoappListResponse: {
1440 auto ptr = reinterpret_cast<const NanoappListResponse *>(obj);
1441 return verifier.VerifyTable(ptr);
1442 }
1443 case ChreMessage::LoadNanoappRequest: {
1444 auto ptr = reinterpret_cast<const LoadNanoappRequest *>(obj);
1445 return verifier.VerifyTable(ptr);
1446 }
1447 case ChreMessage::LoadNanoappResponse: {
1448 auto ptr = reinterpret_cast<const LoadNanoappResponse *>(obj);
1449 return verifier.VerifyTable(ptr);
1450 }
1451 default: return false;
1452 }
1453 }
1454
1455 inline bool VerifyChreMessageVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
1456 if (values->size() != types->size()) return false;
1457 for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
1458 if (!VerifyChreMessage(
1459 verifier, values->Get(i), types->GetEnum<ChreMessage>(i))) {
1460 return false;
1461 }
1462 }
1463 return true;
1464 }
1465
1466 inline flatbuffers::NativeTable *ChreMessageUnion::UnPack(const void *obj, ChreMessage type, const flatbuffers::resolver_function_t *resolver) {
1467 switch (type) {
1468 case ChreMessage::NanoappMessage: {
1469 auto ptr = reinterpret_cast<const NanoappMessage *>(obj);
1470 return ptr->UnPack(resolver);
1471 }
1472 case ChreMessage::HubInfoRequest: {
1473 auto ptr = reinterpret_cast<const HubInfoRequest *>(obj);
1474 return ptr->UnPack(resolver);
1475 }
1476 case ChreMessage::HubInfoResponse: {
1477 auto ptr = reinterpret_cast<const HubInfoResponse *>(obj);
1478 return ptr->UnPack(resolver);
1479 }
1480 case ChreMessage::NanoappListRequest: {
1481 auto ptr = reinterpret_cast<const NanoappListRequest *>(obj);
1482 return ptr->UnPack(resolver);
1483 }
1484 case ChreMessage::NanoappListResponse: {
1485 auto ptr = reinterpret_cast<const NanoappListResponse *>(obj);
1486 return ptr->UnPack(resolver);
1487 }
1488 case ChreMessage::LoadNanoappRequest: {
1489 auto ptr = reinterpret_cast<const LoadNanoappRequest *>(obj);
1490 return ptr->UnPack(resolver);
1491 }
1492 case ChreMessage::LoadNanoappResponse: {
1493 auto ptr = reinterpret_cast<const LoadNanoappResponse *>(obj);
1494 return ptr->UnPack(resolver);
1495 }
1496 default: return nullptr;
1497 }
1498 }
1499
1500 inline flatbuffers::Offset<void> ChreMessageUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
1501 switch (type) {
1502 case ChreMessage::NanoappMessage: {
1503 auto ptr = reinterpret_cast<const NanoappMessageT *>(table);
1504 return CreateNanoappMessage(_fbb, ptr, _rehasher).Union();
1505 }
1506 case ChreMessage::HubInfoRequest: {
1507 auto ptr = reinterpret_cast<const HubInfoRequestT *>(table);
1508 return CreateHubInfoRequest(_fbb, ptr, _rehasher).Union();
1509 }
1510 case ChreMessage::HubInfoResponse: {
1511 auto ptr = reinterpret_cast<const HubInfoResponseT *>(table);
1512 return CreateHubInfoResponse(_fbb, ptr, _rehasher).Union();
1513 }
1514 case ChreMessage::NanoappListRequest: {
1515 auto ptr = reinterpret_cast<const NanoappListRequestT *>(table);
1516 return CreateNanoappListRequest(_fbb, ptr, _rehasher).Union();
1517 }
1518 case ChreMessage::NanoappListResponse: {
1519 auto ptr = reinterpret_cast<const NanoappListResponseT *>(table);
1520 return CreateNanoappListResponse(_fbb, ptr, _rehasher).Union();
1521 }
1522 case ChreMessage::LoadNanoappRequest: {
1523 auto ptr = reinterpret_cast<const LoadNanoappRequestT *>(table);
1524 return CreateLoadNanoappRequest(_fbb, ptr, _rehasher).Union();
1525 }
1526 case ChreMessage::LoadNanoappResponse: {
1527 auto ptr = reinterpret_cast<const LoadNanoappResponseT *>(table);
1528 return CreateLoadNanoappResponse(_fbb, ptr, _rehasher).Union();
1529 }
1530 default: return 0;
1531 }
1532 }
1533
1534 inline void ChreMessageUnion::Reset() {
1535 switch (type) {
1536 case ChreMessage::NanoappMessage: {
1537 auto ptr = reinterpret_cast<NanoappMessageT *>(table);
1538 delete ptr;
1539 break;
1540 }
1541 case ChreMessage::HubInfoRequest: {
1542 auto ptr = reinterpret_cast<HubInfoRequestT *>(table);
1543 delete ptr;
1544 break;
1545 }
1546 case ChreMessage::HubInfoResponse: {
1547 auto ptr = reinterpret_cast<HubInfoResponseT *>(table);
1548 delete ptr;
1549 break;
1550 }
1551 case ChreMessage::NanoappListRequest: {
1552 auto ptr = reinterpret_cast<NanoappListRequestT *>(table);
1553 delete ptr;
1554 break;
1555 }
1556 case ChreMessage::NanoappListResponse: {
1557 auto ptr = reinterpret_cast<NanoappListResponseT *>(table);
1558 delete ptr;
1559 break;
1560 }
1561 case ChreMessage::LoadNanoappRequest: {
1562 auto ptr = reinterpret_cast<LoadNanoappRequestT *>(table);
1563 delete ptr;
1564 break;
1565 }
1566 case ChreMessage::LoadNanoappResponse: {
1567 auto ptr = reinterpret_cast<LoadNanoappResponseT *>(table);
1568 delete ptr;
1569 break;
1570 }
1571 default: break;
1572 }
1573 table = nullptr;
1574 type = ChreMessage::NONE;
1575 }
1576
1577 inline const chre::fbs::MessageContainer *GetMessageContainer(const void *buf) {
1578 return flatbuffers::GetRoot<chre::fbs::MessageContainer>(buf);
1579 }
1580
1581 inline MessageContainer *GetMutableMessageContainer(void *buf) {
1582 return flatbuffers::GetMutableRoot<MessageContainer>(buf);
1583 }
1584
1585 inline bool VerifyMessageContainerBuffer(
1586 flatbuffers::Verifier &verifier) {
1587 return verifier.VerifyBuffer<chre::fbs::MessageContainer>(nullptr);
1588 }
1589
1590 inline void FinishMessageContainerBuffer(
1591 flatbuffers::FlatBufferBuilder &fbb,
1592 flatbuffers::Offset<chre::fbs::MessageContainer> root) {
1593 fbb.Finish(root);
1594 }
1595
1596 inline std::unique_ptr<MessageContainerT> UnPackMessageContainer(
1597 const void *buf,
1598 const flatbuffers::resolver_function_t *res = nullptr) {
1599 return std::unique_ptr<MessageContainerT>(GetMessageContainer(buf)->UnPack(res));
1600 }
1601
1602 } // namespace fbs
1603 } // namespace chre
1604
1605 #endif // FLATBUFFERS_GENERATED_HOSTMESSAGES_CHRE_FBS_H_
1606