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 NanoappMessageBuilder;
14 
15 struct HubInfoRequest;
16 struct HubInfoRequestBuilder;
17 
18 struct HubInfoResponse;
19 struct HubInfoResponseBuilder;
20 
21 struct NanoappListRequest;
22 struct NanoappListRequestBuilder;
23 
24 struct NanoappListEntry;
25 struct NanoappListEntryBuilder;
26 
27 struct NanoappListResponse;
28 struct NanoappListResponseBuilder;
29 
30 struct LoadNanoappRequest;
31 struct LoadNanoappRequestBuilder;
32 
33 struct LoadNanoappResponse;
34 struct LoadNanoappResponseBuilder;
35 
36 struct UnloadNanoappRequest;
37 struct UnloadNanoappRequestBuilder;
38 
39 struct UnloadNanoappResponse;
40 struct UnloadNanoappResponseBuilder;
41 
42 struct LogMessage;
43 struct LogMessageBuilder;
44 
45 struct TimeSyncMessage;
46 struct TimeSyncMessageBuilder;
47 
48 struct DebugDumpRequest;
49 struct DebugDumpRequestBuilder;
50 
51 struct DebugDumpData;
52 struct DebugDumpDataBuilder;
53 
54 struct DebugDumpResponse;
55 struct DebugDumpResponseBuilder;
56 
57 struct TimeSyncRequest;
58 struct TimeSyncRequestBuilder;
59 
60 struct LowPowerMicAccessRequest;
61 struct LowPowerMicAccessRequestBuilder;
62 
63 struct LowPowerMicAccessRelease;
64 struct LowPowerMicAccessReleaseBuilder;
65 
66 struct SettingChangeMessage;
67 struct SettingChangeMessageBuilder;
68 
69 struct LogMessageV2;
70 struct LogMessageV2Builder;
71 
72 struct SelfTestRequest;
73 struct SelfTestRequestBuilder;
74 
75 struct SelfTestResponse;
76 struct SelfTestResponseBuilder;
77 
78 struct HostAddress;
79 
80 struct MessageContainer;
81 struct MessageContainerBuilder;
82 
83 /// An enum describing the setting type.
84 enum class Setting : int8_t {
85   LOCATION = 0,
86   WIFI_AVAILABLE = 1,
87   AIRPLANE_MODE = 2,
88   MICROPHONE = 3,
89   MIN = LOCATION,
90   MAX = MICROPHONE
91 };
92 
EnumValuesSetting()93 inline const Setting (&EnumValuesSetting())[4] {
94   static const Setting values[] = {
95     Setting::LOCATION,
96     Setting::WIFI_AVAILABLE,
97     Setting::AIRPLANE_MODE,
98     Setting::MICROPHONE
99   };
100   return values;
101 }
102 
EnumNamesSetting()103 inline const char * const *EnumNamesSetting() {
104   static const char * const names[5] = {
105     "LOCATION",
106     "WIFI_AVAILABLE",
107     "AIRPLANE_MODE",
108     "MICROPHONE",
109     nullptr
110   };
111   return names;
112 }
113 
EnumNameSetting(Setting e)114 inline const char *EnumNameSetting(Setting e) {
115   if (flatbuffers::IsOutRange(e, Setting::LOCATION, Setting::MICROPHONE)) return "";
116   const size_t index = static_cast<size_t>(e);
117   return EnumNamesSetting()[index];
118 }
119 
120 /// An enum describing the state of a setting.
121 enum class SettingState : int8_t {
122   DISABLED = 0,
123   ENABLED = 1,
124   MIN = DISABLED,
125   MAX = ENABLED
126 };
127 
EnumValuesSettingState()128 inline const SettingState (&EnumValuesSettingState())[2] {
129   static const SettingState values[] = {
130     SettingState::DISABLED,
131     SettingState::ENABLED
132   };
133   return values;
134 }
135 
EnumNamesSettingState()136 inline const char * const *EnumNamesSettingState() {
137   static const char * const names[3] = {
138     "DISABLED",
139     "ENABLED",
140     nullptr
141   };
142   return names;
143 }
144 
EnumNameSettingState(SettingState e)145 inline const char *EnumNameSettingState(SettingState e) {
146   if (flatbuffers::IsOutRange(e, SettingState::DISABLED, SettingState::ENABLED)) return "";
147   const size_t index = static_cast<size_t>(e);
148   return EnumNamesSettingState()[index];
149 }
150 
151 /// A union that joins together all possible messages. Note that in FlatBuffers,
152 /// unions have an implicit type
153 enum class ChreMessage : uint8_t {
154   NONE = 0,
155   NanoappMessage = 1,
156   HubInfoRequest = 2,
157   HubInfoResponse = 3,
158   NanoappListRequest = 4,
159   NanoappListResponse = 5,
160   LoadNanoappRequest = 6,
161   LoadNanoappResponse = 7,
162   UnloadNanoappRequest = 8,
163   UnloadNanoappResponse = 9,
164   LogMessage = 10,
165   TimeSyncMessage = 11,
166   DebugDumpRequest = 12,
167   DebugDumpData = 13,
168   DebugDumpResponse = 14,
169   TimeSyncRequest = 15,
170   LowPowerMicAccessRequest = 16,
171   LowPowerMicAccessRelease = 17,
172   SettingChangeMessage = 18,
173   LogMessageV2 = 19,
174   SelfTestRequest = 20,
175   SelfTestResponse = 21,
176   MIN = NONE,
177   MAX = SelfTestResponse
178 };
179 
EnumValuesChreMessage()180 inline const ChreMessage (&EnumValuesChreMessage())[22] {
181   static const ChreMessage values[] = {
182     ChreMessage::NONE,
183     ChreMessage::NanoappMessage,
184     ChreMessage::HubInfoRequest,
185     ChreMessage::HubInfoResponse,
186     ChreMessage::NanoappListRequest,
187     ChreMessage::NanoappListResponse,
188     ChreMessage::LoadNanoappRequest,
189     ChreMessage::LoadNanoappResponse,
190     ChreMessage::UnloadNanoappRequest,
191     ChreMessage::UnloadNanoappResponse,
192     ChreMessage::LogMessage,
193     ChreMessage::TimeSyncMessage,
194     ChreMessage::DebugDumpRequest,
195     ChreMessage::DebugDumpData,
196     ChreMessage::DebugDumpResponse,
197     ChreMessage::TimeSyncRequest,
198     ChreMessage::LowPowerMicAccessRequest,
199     ChreMessage::LowPowerMicAccessRelease,
200     ChreMessage::SettingChangeMessage,
201     ChreMessage::LogMessageV2,
202     ChreMessage::SelfTestRequest,
203     ChreMessage::SelfTestResponse
204   };
205   return values;
206 }
207 
EnumNamesChreMessage()208 inline const char * const *EnumNamesChreMessage() {
209   static const char * const names[23] = {
210     "NONE",
211     "NanoappMessage",
212     "HubInfoRequest",
213     "HubInfoResponse",
214     "NanoappListRequest",
215     "NanoappListResponse",
216     "LoadNanoappRequest",
217     "LoadNanoappResponse",
218     "UnloadNanoappRequest",
219     "UnloadNanoappResponse",
220     "LogMessage",
221     "TimeSyncMessage",
222     "DebugDumpRequest",
223     "DebugDumpData",
224     "DebugDumpResponse",
225     "TimeSyncRequest",
226     "LowPowerMicAccessRequest",
227     "LowPowerMicAccessRelease",
228     "SettingChangeMessage",
229     "LogMessageV2",
230     "SelfTestRequest",
231     "SelfTestResponse",
232     nullptr
233   };
234   return names;
235 }
236 
EnumNameChreMessage(ChreMessage e)237 inline const char *EnumNameChreMessage(ChreMessage e) {
238   if (flatbuffers::IsOutRange(e, ChreMessage::NONE, ChreMessage::SelfTestResponse)) return "";
239   const size_t index = static_cast<size_t>(e);
240   return EnumNamesChreMessage()[index];
241 }
242 
243 template<typename T> struct ChreMessageTraits {
244   static const ChreMessage enum_value = ChreMessage::NONE;
245 };
246 
247 template<> struct ChreMessageTraits<chre::fbs::NanoappMessage> {
248   static const ChreMessage enum_value = ChreMessage::NanoappMessage;
249 };
250 
251 template<> struct ChreMessageTraits<chre::fbs::HubInfoRequest> {
252   static const ChreMessage enum_value = ChreMessage::HubInfoRequest;
253 };
254 
255 template<> struct ChreMessageTraits<chre::fbs::HubInfoResponse> {
256   static const ChreMessage enum_value = ChreMessage::HubInfoResponse;
257 };
258 
259 template<> struct ChreMessageTraits<chre::fbs::NanoappListRequest> {
260   static const ChreMessage enum_value = ChreMessage::NanoappListRequest;
261 };
262 
263 template<> struct ChreMessageTraits<chre::fbs::NanoappListResponse> {
264   static const ChreMessage enum_value = ChreMessage::NanoappListResponse;
265 };
266 
267 template<> struct ChreMessageTraits<chre::fbs::LoadNanoappRequest> {
268   static const ChreMessage enum_value = ChreMessage::LoadNanoappRequest;
269 };
270 
271 template<> struct ChreMessageTraits<chre::fbs::LoadNanoappResponse> {
272   static const ChreMessage enum_value = ChreMessage::LoadNanoappResponse;
273 };
274 
275 template<> struct ChreMessageTraits<chre::fbs::UnloadNanoappRequest> {
276   static const ChreMessage enum_value = ChreMessage::UnloadNanoappRequest;
277 };
278 
279 template<> struct ChreMessageTraits<chre::fbs::UnloadNanoappResponse> {
280   static const ChreMessage enum_value = ChreMessage::UnloadNanoappResponse;
281 };
282 
283 template<> struct ChreMessageTraits<chre::fbs::LogMessage> {
284   static const ChreMessage enum_value = ChreMessage::LogMessage;
285 };
286 
287 template<> struct ChreMessageTraits<chre::fbs::TimeSyncMessage> {
288   static const ChreMessage enum_value = ChreMessage::TimeSyncMessage;
289 };
290 
291 template<> struct ChreMessageTraits<chre::fbs::DebugDumpRequest> {
292   static const ChreMessage enum_value = ChreMessage::DebugDumpRequest;
293 };
294 
295 template<> struct ChreMessageTraits<chre::fbs::DebugDumpData> {
296   static const ChreMessage enum_value = ChreMessage::DebugDumpData;
297 };
298 
299 template<> struct ChreMessageTraits<chre::fbs::DebugDumpResponse> {
300   static const ChreMessage enum_value = ChreMessage::DebugDumpResponse;
301 };
302 
303 template<> struct ChreMessageTraits<chre::fbs::TimeSyncRequest> {
304   static const ChreMessage enum_value = ChreMessage::TimeSyncRequest;
305 };
306 
307 template<> struct ChreMessageTraits<chre::fbs::LowPowerMicAccessRequest> {
308   static const ChreMessage enum_value = ChreMessage::LowPowerMicAccessRequest;
309 };
310 
311 template<> struct ChreMessageTraits<chre::fbs::LowPowerMicAccessRelease> {
312   static const ChreMessage enum_value = ChreMessage::LowPowerMicAccessRelease;
313 };
314 
315 template<> struct ChreMessageTraits<chre::fbs::SettingChangeMessage> {
316   static const ChreMessage enum_value = ChreMessage::SettingChangeMessage;
317 };
318 
319 template<> struct ChreMessageTraits<chre::fbs::LogMessageV2> {
320   static const ChreMessage enum_value = ChreMessage::LogMessageV2;
321 };
322 
323 template<> struct ChreMessageTraits<chre::fbs::SelfTestRequest> {
324   static const ChreMessage enum_value = ChreMessage::SelfTestRequest;
325 };
326 
327 template<> struct ChreMessageTraits<chre::fbs::SelfTestResponse> {
328   static const ChreMessage enum_value = ChreMessage::SelfTestResponse;
329 };
330 
331 bool VerifyChreMessage(flatbuffers::Verifier &verifier, const void *obj, ChreMessage type);
332 bool VerifyChreMessageVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
333 
334 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) HostAddress FLATBUFFERS_FINAL_CLASS {
335  private:
336   uint16_t client_id_;
337 
338  public:
339   HostAddress() {
340     memset(static_cast<void *>(this), 0, sizeof(HostAddress));
341   }
342   HostAddress(uint16_t _client_id)
343       : client_id_(flatbuffers::EndianScalar(_client_id)) {
344   }
345   uint16_t client_id() const {
346     return flatbuffers::EndianScalar(client_id_);
347   }
348 };
349 FLATBUFFERS_STRUCT_END(HostAddress, 2);
350 
351 /// Represents a message sent to/from a nanoapp from/to a client on the host
352 struct NanoappMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
353   typedef NanoappMessageBuilder Builder;
354   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
355     VT_APP_ID = 4,
356     VT_MESSAGE_TYPE = 6,
357     VT_HOST_ENDPOINT = 8,
358     VT_MESSAGE = 10,
359     VT_MESSAGE_PERMISSIONS = 12,
360     VT_PERMISSIONS = 14
361   };
362   uint64_t app_id() const {
363     return GetField<uint64_t>(VT_APP_ID, 0);
364   }
365   uint32_t message_type() const {
366     return GetField<uint32_t>(VT_MESSAGE_TYPE, 0);
367   }
368   /// Identifies the host-side endpoint on the host that sent or should receive
369   /// this message. The default value is a special value defined in the HAL and
370   /// elsewhere that indicates that the endpoint is unspecified.
371   uint16_t host_endpoint() const {
372     return GetField<uint16_t>(VT_HOST_ENDPOINT, 65534);
373   }
374   /// Vector containing arbitrary application-specific message data
375   const flatbuffers::Vector<uint8_t> *message() const {
376     return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_MESSAGE);
377   }
378   /// List of Android permissions that cover the contents of a message from a
379   /// nanoapp to the host.
380   /// These permissions are used to record and attribute access to
381   /// permissions-controlled resources.
382   uint32_t message_permissions() const {
383     return GetField<uint32_t>(VT_MESSAGE_PERMISSIONS, 0);
384   }
385   /// List of Android permissions declared by the nanoapp / granted to the host.
386   /// For messages from a nanoaapp to the host, this must be a superset of
387   /// message_permissions.
388   uint32_t permissions() const {
389     return GetField<uint32_t>(VT_PERMISSIONS, 0);
390   }
391   bool Verify(flatbuffers::Verifier &verifier) const {
392     return VerifyTableStart(verifier) &&
393            VerifyField<uint64_t>(verifier, VT_APP_ID) &&
394            VerifyField<uint32_t>(verifier, VT_MESSAGE_TYPE) &&
395            VerifyField<uint16_t>(verifier, VT_HOST_ENDPOINT) &&
396            VerifyOffsetRequired(verifier, VT_MESSAGE) &&
397            verifier.VerifyVector(message()) &&
398            VerifyField<uint32_t>(verifier, VT_MESSAGE_PERMISSIONS) &&
399            VerifyField<uint32_t>(verifier, VT_PERMISSIONS) &&
400            verifier.EndTable();
401   }
402 };
403 
404 struct NanoappMessageBuilder {
405   typedef NanoappMessage Table;
406   flatbuffers::FlatBufferBuilder &fbb_;
407   flatbuffers::uoffset_t start_;
408   void add_app_id(uint64_t app_id) {
409     fbb_.AddElement<uint64_t>(NanoappMessage::VT_APP_ID, app_id, 0);
410   }
411   void add_message_type(uint32_t message_type) {
412     fbb_.AddElement<uint32_t>(NanoappMessage::VT_MESSAGE_TYPE, message_type, 0);
413   }
414   void add_host_endpoint(uint16_t host_endpoint) {
415     fbb_.AddElement<uint16_t>(NanoappMessage::VT_HOST_ENDPOINT, host_endpoint, 65534);
416   }
417   void add_message(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> message) {
418     fbb_.AddOffset(NanoappMessage::VT_MESSAGE, message);
419   }
420   void add_message_permissions(uint32_t message_permissions) {
421     fbb_.AddElement<uint32_t>(NanoappMessage::VT_MESSAGE_PERMISSIONS, message_permissions, 0);
422   }
423   void add_permissions(uint32_t permissions) {
424     fbb_.AddElement<uint32_t>(NanoappMessage::VT_PERMISSIONS, permissions, 0);
425   }
426   explicit NanoappMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
427         : fbb_(_fbb) {
428     start_ = fbb_.StartTable();
429   }
430   NanoappMessageBuilder &operator=(const NanoappMessageBuilder &);
431   flatbuffers::Offset<NanoappMessage> Finish() {
432     const auto end = fbb_.EndTable(start_);
433     auto o = flatbuffers::Offset<NanoappMessage>(end);
434     fbb_.Required(o, NanoappMessage::VT_MESSAGE);
435     return o;
436   }
437 };
438 
439 inline flatbuffers::Offset<NanoappMessage> CreateNanoappMessage(
440     flatbuffers::FlatBufferBuilder &_fbb,
441     uint64_t app_id = 0,
442     uint32_t message_type = 0,
443     uint16_t host_endpoint = 65534,
444     flatbuffers::Offset<flatbuffers::Vector<uint8_t>> message = 0,
445     uint32_t message_permissions = 0,
446     uint32_t permissions = 0) {
447   NanoappMessageBuilder builder_(_fbb);
448   builder_.add_app_id(app_id);
449   builder_.add_permissions(permissions);
450   builder_.add_message_permissions(message_permissions);
451   builder_.add_message(message);
452   builder_.add_message_type(message_type);
453   builder_.add_host_endpoint(host_endpoint);
454   return builder_.Finish();
455 }
456 
457 inline flatbuffers::Offset<NanoappMessage> CreateNanoappMessageDirect(
458     flatbuffers::FlatBufferBuilder &_fbb,
459     uint64_t app_id = 0,
460     uint32_t message_type = 0,
461     uint16_t host_endpoint = 65534,
462     const std::vector<uint8_t> *message = nullptr,
463     uint32_t message_permissions = 0,
464     uint32_t permissions = 0) {
465   auto message__ = message ? _fbb.CreateVector<uint8_t>(*message) : 0;
466   return chre::fbs::CreateNanoappMessage(
467       _fbb,
468       app_id,
469       message_type,
470       host_endpoint,
471       message__,
472       message_permissions,
473       permissions);
474 }
475 
476 struct HubInfoRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
477   typedef HubInfoRequestBuilder Builder;
478   bool Verify(flatbuffers::Verifier &verifier) const {
479     return VerifyTableStart(verifier) &&
480            verifier.EndTable();
481   }
482 };
483 
484 struct HubInfoRequestBuilder {
485   typedef HubInfoRequest Table;
486   flatbuffers::FlatBufferBuilder &fbb_;
487   flatbuffers::uoffset_t start_;
488   explicit HubInfoRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
489         : fbb_(_fbb) {
490     start_ = fbb_.StartTable();
491   }
492   HubInfoRequestBuilder &operator=(const HubInfoRequestBuilder &);
493   flatbuffers::Offset<HubInfoRequest> Finish() {
494     const auto end = fbb_.EndTable(start_);
495     auto o = flatbuffers::Offset<HubInfoRequest>(end);
496     return o;
497   }
498 };
499 
500 inline flatbuffers::Offset<HubInfoRequest> CreateHubInfoRequest(
501     flatbuffers::FlatBufferBuilder &_fbb) {
502   HubInfoRequestBuilder builder_(_fbb);
503   return builder_.Finish();
504 }
505 
506 struct HubInfoResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
507   typedef HubInfoResponseBuilder Builder;
508   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
509     VT_NAME = 4,
510     VT_VENDOR = 6,
511     VT_TOOLCHAIN = 8,
512     VT_PLATFORM_VERSION = 10,
513     VT_TOOLCHAIN_VERSION = 12,
514     VT_PEAK_MIPS = 14,
515     VT_STOPPED_POWER = 16,
516     VT_SLEEP_POWER = 18,
517     VT_PEAK_POWER = 20,
518     VT_MAX_MSG_LEN = 22,
519     VT_PLATFORM_ID = 24,
520     VT_CHRE_PLATFORM_VERSION = 26
521   };
522   /// The name of the hub. Nominally a UTF-8 string, but note that we're not
523   /// using the built-in "string" data type from FlatBuffers here, because the
524   /// generated C++ uses std::string which is not well-supported in CHRE. This
525   /// applies for vendor and toolchain as well.
526   const flatbuffers::Vector<int8_t> *name() const {
527     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_NAME);
528   }
529   const flatbuffers::Vector<int8_t> *vendor() const {
530     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_VENDOR);
531   }
532   const flatbuffers::Vector<int8_t> *toolchain() const {
533     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_TOOLCHAIN);
534   }
535   /// Legacy platform version reported in the HAL; semantics not strictly
536   /// defined
537   uint32_t platform_version() const {
538     return GetField<uint32_t>(VT_PLATFORM_VERSION, 0);
539   }
540   /// Toolchain version reported in the HAL; semantics not strictly defined
541   uint32_t toolchain_version() const {
542     return GetField<uint32_t>(VT_TOOLCHAIN_VERSION, 0);
543   }
544   float peak_mips() const {
545     return GetField<float>(VT_PEAK_MIPS, 0.0f);
546   }
547   float stopped_power() const {
548     return GetField<float>(VT_STOPPED_POWER, 0.0f);
549   }
550   float sleep_power() const {
551     return GetField<float>(VT_SLEEP_POWER, 0.0f);
552   }
553   float peak_power() const {
554     return GetField<float>(VT_PEAK_POWER, 0.0f);
555   }
556   /// Maximum size message that can be sent to a nanoapp
557   uint32_t max_msg_len() const {
558     return GetField<uint32_t>(VT_MAX_MSG_LEN, 0);
559   }
560   /// @see chreGetPlatformId()
561   uint64_t platform_id() const {
562     return GetField<uint64_t>(VT_PLATFORM_ID, 0);
563   }
564   /// @see chreGetVersion()
565   uint32_t chre_platform_version() const {
566     return GetField<uint32_t>(VT_CHRE_PLATFORM_VERSION, 0);
567   }
568   bool Verify(flatbuffers::Verifier &verifier) const {
569     return VerifyTableStart(verifier) &&
570            VerifyOffset(verifier, VT_NAME) &&
571            verifier.VerifyVector(name()) &&
572            VerifyOffset(verifier, VT_VENDOR) &&
573            verifier.VerifyVector(vendor()) &&
574            VerifyOffset(verifier, VT_TOOLCHAIN) &&
575            verifier.VerifyVector(toolchain()) &&
576            VerifyField<uint32_t>(verifier, VT_PLATFORM_VERSION) &&
577            VerifyField<uint32_t>(verifier, VT_TOOLCHAIN_VERSION) &&
578            VerifyField<float>(verifier, VT_PEAK_MIPS) &&
579            VerifyField<float>(verifier, VT_STOPPED_POWER) &&
580            VerifyField<float>(verifier, VT_SLEEP_POWER) &&
581            VerifyField<float>(verifier, VT_PEAK_POWER) &&
582            VerifyField<uint32_t>(verifier, VT_MAX_MSG_LEN) &&
583            VerifyField<uint64_t>(verifier, VT_PLATFORM_ID) &&
584            VerifyField<uint32_t>(verifier, VT_CHRE_PLATFORM_VERSION) &&
585            verifier.EndTable();
586   }
587 };
588 
589 struct HubInfoResponseBuilder {
590   typedef HubInfoResponse Table;
591   flatbuffers::FlatBufferBuilder &fbb_;
592   flatbuffers::uoffset_t start_;
593   void add_name(flatbuffers::Offset<flatbuffers::Vector<int8_t>> name) {
594     fbb_.AddOffset(HubInfoResponse::VT_NAME, name);
595   }
596   void add_vendor(flatbuffers::Offset<flatbuffers::Vector<int8_t>> vendor) {
597     fbb_.AddOffset(HubInfoResponse::VT_VENDOR, vendor);
598   }
599   void add_toolchain(flatbuffers::Offset<flatbuffers::Vector<int8_t>> toolchain) {
600     fbb_.AddOffset(HubInfoResponse::VT_TOOLCHAIN, toolchain);
601   }
602   void add_platform_version(uint32_t platform_version) {
603     fbb_.AddElement<uint32_t>(HubInfoResponse::VT_PLATFORM_VERSION, platform_version, 0);
604   }
605   void add_toolchain_version(uint32_t toolchain_version) {
606     fbb_.AddElement<uint32_t>(HubInfoResponse::VT_TOOLCHAIN_VERSION, toolchain_version, 0);
607   }
608   void add_peak_mips(float peak_mips) {
609     fbb_.AddElement<float>(HubInfoResponse::VT_PEAK_MIPS, peak_mips, 0.0f);
610   }
611   void add_stopped_power(float stopped_power) {
612     fbb_.AddElement<float>(HubInfoResponse::VT_STOPPED_POWER, stopped_power, 0.0f);
613   }
614   void add_sleep_power(float sleep_power) {
615     fbb_.AddElement<float>(HubInfoResponse::VT_SLEEP_POWER, sleep_power, 0.0f);
616   }
617   void add_peak_power(float peak_power) {
618     fbb_.AddElement<float>(HubInfoResponse::VT_PEAK_POWER, peak_power, 0.0f);
619   }
620   void add_max_msg_len(uint32_t max_msg_len) {
621     fbb_.AddElement<uint32_t>(HubInfoResponse::VT_MAX_MSG_LEN, max_msg_len, 0);
622   }
623   void add_platform_id(uint64_t platform_id) {
624     fbb_.AddElement<uint64_t>(HubInfoResponse::VT_PLATFORM_ID, platform_id, 0);
625   }
626   void add_chre_platform_version(uint32_t chre_platform_version) {
627     fbb_.AddElement<uint32_t>(HubInfoResponse::VT_CHRE_PLATFORM_VERSION, chre_platform_version, 0);
628   }
629   explicit HubInfoResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
630         : fbb_(_fbb) {
631     start_ = fbb_.StartTable();
632   }
633   HubInfoResponseBuilder &operator=(const HubInfoResponseBuilder &);
634   flatbuffers::Offset<HubInfoResponse> Finish() {
635     const auto end = fbb_.EndTable(start_);
636     auto o = flatbuffers::Offset<HubInfoResponse>(end);
637     return o;
638   }
639 };
640 
641 inline flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponse(
642     flatbuffers::FlatBufferBuilder &_fbb,
643     flatbuffers::Offset<flatbuffers::Vector<int8_t>> name = 0,
644     flatbuffers::Offset<flatbuffers::Vector<int8_t>> vendor = 0,
645     flatbuffers::Offset<flatbuffers::Vector<int8_t>> toolchain = 0,
646     uint32_t platform_version = 0,
647     uint32_t toolchain_version = 0,
648     float peak_mips = 0.0f,
649     float stopped_power = 0.0f,
650     float sleep_power = 0.0f,
651     float peak_power = 0.0f,
652     uint32_t max_msg_len = 0,
653     uint64_t platform_id = 0,
654     uint32_t chre_platform_version = 0) {
655   HubInfoResponseBuilder builder_(_fbb);
656   builder_.add_platform_id(platform_id);
657   builder_.add_chre_platform_version(chre_platform_version);
658   builder_.add_max_msg_len(max_msg_len);
659   builder_.add_peak_power(peak_power);
660   builder_.add_sleep_power(sleep_power);
661   builder_.add_stopped_power(stopped_power);
662   builder_.add_peak_mips(peak_mips);
663   builder_.add_toolchain_version(toolchain_version);
664   builder_.add_platform_version(platform_version);
665   builder_.add_toolchain(toolchain);
666   builder_.add_vendor(vendor);
667   builder_.add_name(name);
668   return builder_.Finish();
669 }
670 
671 inline flatbuffers::Offset<HubInfoResponse> CreateHubInfoResponseDirect(
672     flatbuffers::FlatBufferBuilder &_fbb,
673     const std::vector<int8_t> *name = nullptr,
674     const std::vector<int8_t> *vendor = nullptr,
675     const std::vector<int8_t> *toolchain = nullptr,
676     uint32_t platform_version = 0,
677     uint32_t toolchain_version = 0,
678     float peak_mips = 0.0f,
679     float stopped_power = 0.0f,
680     float sleep_power = 0.0f,
681     float peak_power = 0.0f,
682     uint32_t max_msg_len = 0,
683     uint64_t platform_id = 0,
684     uint32_t chre_platform_version = 0) {
685   auto name__ = name ? _fbb.CreateVector<int8_t>(*name) : 0;
686   auto vendor__ = vendor ? _fbb.CreateVector<int8_t>(*vendor) : 0;
687   auto toolchain__ = toolchain ? _fbb.CreateVector<int8_t>(*toolchain) : 0;
688   return chre::fbs::CreateHubInfoResponse(
689       _fbb,
690       name__,
691       vendor__,
692       toolchain__,
693       platform_version,
694       toolchain_version,
695       peak_mips,
696       stopped_power,
697       sleep_power,
698       peak_power,
699       max_msg_len,
700       platform_id,
701       chre_platform_version);
702 }
703 
704 struct NanoappListRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
705   typedef NanoappListRequestBuilder Builder;
706   bool Verify(flatbuffers::Verifier &verifier) const {
707     return VerifyTableStart(verifier) &&
708            verifier.EndTable();
709   }
710 };
711 
712 struct NanoappListRequestBuilder {
713   typedef NanoappListRequest Table;
714   flatbuffers::FlatBufferBuilder &fbb_;
715   flatbuffers::uoffset_t start_;
716   explicit NanoappListRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
717         : fbb_(_fbb) {
718     start_ = fbb_.StartTable();
719   }
720   NanoappListRequestBuilder &operator=(const NanoappListRequestBuilder &);
721   flatbuffers::Offset<NanoappListRequest> Finish() {
722     const auto end = fbb_.EndTable(start_);
723     auto o = flatbuffers::Offset<NanoappListRequest>(end);
724     return o;
725   }
726 };
727 
728 inline flatbuffers::Offset<NanoappListRequest> CreateNanoappListRequest(
729     flatbuffers::FlatBufferBuilder &_fbb) {
730   NanoappListRequestBuilder builder_(_fbb);
731   return builder_.Finish();
732 }
733 
734 struct NanoappListEntry FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
735   typedef NanoappListEntryBuilder Builder;
736   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
737     VT_APP_ID = 4,
738     VT_VERSION = 6,
739     VT_ENABLED = 8,
740     VT_IS_SYSTEM = 10,
741     VT_PERMISSIONS = 12
742   };
743   uint64_t app_id() const {
744     return GetField<uint64_t>(VT_APP_ID, 0);
745   }
746   uint32_t version() const {
747     return GetField<uint32_t>(VT_VERSION, 0);
748   }
749   bool enabled() const {
750     return GetField<uint8_t>(VT_ENABLED, 1) != 0;
751   }
752   /// Whether the nanoapp is a pre-loaded "system" nanoapp, i.e. one that should
753   /// not show up in the list of nanoapps in the context hub HAL. System
754   /// nanoapps are typically used to leverage CHRE for some device functionality
755   /// and do not interact via the context hub HAL.
756   bool is_system() const {
757     return GetField<uint8_t>(VT_IS_SYSTEM, 0) != 0;
758   }
759   /// Nanoapp permissions, if supported. Nanoapp permissions are required on
760   /// CHRE API v1.5+, and are defined in chre/util/system/napp_permissions.h
761   uint32_t permissions() const {
762     return GetField<uint32_t>(VT_PERMISSIONS, 0);
763   }
764   bool Verify(flatbuffers::Verifier &verifier) const {
765     return VerifyTableStart(verifier) &&
766            VerifyField<uint64_t>(verifier, VT_APP_ID) &&
767            VerifyField<uint32_t>(verifier, VT_VERSION) &&
768            VerifyField<uint8_t>(verifier, VT_ENABLED) &&
769            VerifyField<uint8_t>(verifier, VT_IS_SYSTEM) &&
770            VerifyField<uint32_t>(verifier, VT_PERMISSIONS) &&
771            verifier.EndTable();
772   }
773 };
774 
775 struct NanoappListEntryBuilder {
776   typedef NanoappListEntry Table;
777   flatbuffers::FlatBufferBuilder &fbb_;
778   flatbuffers::uoffset_t start_;
779   void add_app_id(uint64_t app_id) {
780     fbb_.AddElement<uint64_t>(NanoappListEntry::VT_APP_ID, app_id, 0);
781   }
782   void add_version(uint32_t version) {
783     fbb_.AddElement<uint32_t>(NanoappListEntry::VT_VERSION, version, 0);
784   }
785   void add_enabled(bool enabled) {
786     fbb_.AddElement<uint8_t>(NanoappListEntry::VT_ENABLED, static_cast<uint8_t>(enabled), 1);
787   }
788   void add_is_system(bool is_system) {
789     fbb_.AddElement<uint8_t>(NanoappListEntry::VT_IS_SYSTEM, static_cast<uint8_t>(is_system), 0);
790   }
791   void add_permissions(uint32_t permissions) {
792     fbb_.AddElement<uint32_t>(NanoappListEntry::VT_PERMISSIONS, permissions, 0);
793   }
794   explicit NanoappListEntryBuilder(flatbuffers::FlatBufferBuilder &_fbb)
795         : fbb_(_fbb) {
796     start_ = fbb_.StartTable();
797   }
798   NanoappListEntryBuilder &operator=(const NanoappListEntryBuilder &);
799   flatbuffers::Offset<NanoappListEntry> Finish() {
800     const auto end = fbb_.EndTable(start_);
801     auto o = flatbuffers::Offset<NanoappListEntry>(end);
802     return o;
803   }
804 };
805 
806 inline flatbuffers::Offset<NanoappListEntry> CreateNanoappListEntry(
807     flatbuffers::FlatBufferBuilder &_fbb,
808     uint64_t app_id = 0,
809     uint32_t version = 0,
810     bool enabled = true,
811     bool is_system = false,
812     uint32_t permissions = 0) {
813   NanoappListEntryBuilder builder_(_fbb);
814   builder_.add_app_id(app_id);
815   builder_.add_permissions(permissions);
816   builder_.add_version(version);
817   builder_.add_is_system(is_system);
818   builder_.add_enabled(enabled);
819   return builder_.Finish();
820 }
821 
822 struct NanoappListResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
823   typedef NanoappListResponseBuilder Builder;
824   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
825     VT_NANOAPPS = 4
826   };
827   const flatbuffers::Vector<flatbuffers::Offset<chre::fbs::NanoappListEntry>> *nanoapps() const {
828     return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<chre::fbs::NanoappListEntry>> *>(VT_NANOAPPS);
829   }
830   bool Verify(flatbuffers::Verifier &verifier) const {
831     return VerifyTableStart(verifier) &&
832            VerifyOffsetRequired(verifier, VT_NANOAPPS) &&
833            verifier.VerifyVector(nanoapps()) &&
834            verifier.VerifyVectorOfTables(nanoapps()) &&
835            verifier.EndTable();
836   }
837 };
838 
839 struct NanoappListResponseBuilder {
840   typedef NanoappListResponse Table;
841   flatbuffers::FlatBufferBuilder &fbb_;
842   flatbuffers::uoffset_t start_;
843   void add_nanoapps(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<chre::fbs::NanoappListEntry>>> nanoapps) {
844     fbb_.AddOffset(NanoappListResponse::VT_NANOAPPS, nanoapps);
845   }
846   explicit NanoappListResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
847         : fbb_(_fbb) {
848     start_ = fbb_.StartTable();
849   }
850   NanoappListResponseBuilder &operator=(const NanoappListResponseBuilder &);
851   flatbuffers::Offset<NanoappListResponse> Finish() {
852     const auto end = fbb_.EndTable(start_);
853     auto o = flatbuffers::Offset<NanoappListResponse>(end);
854     fbb_.Required(o, NanoappListResponse::VT_NANOAPPS);
855     return o;
856   }
857 };
858 
859 inline flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponse(
860     flatbuffers::FlatBufferBuilder &_fbb,
861     flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<chre::fbs::NanoappListEntry>>> nanoapps = 0) {
862   NanoappListResponseBuilder builder_(_fbb);
863   builder_.add_nanoapps(nanoapps);
864   return builder_.Finish();
865 }
866 
867 inline flatbuffers::Offset<NanoappListResponse> CreateNanoappListResponseDirect(
868     flatbuffers::FlatBufferBuilder &_fbb,
869     const std::vector<flatbuffers::Offset<chre::fbs::NanoappListEntry>> *nanoapps = nullptr) {
870   auto nanoapps__ = nanoapps ? _fbb.CreateVector<flatbuffers::Offset<chre::fbs::NanoappListEntry>>(*nanoapps) : 0;
871   return chre::fbs::CreateNanoappListResponse(
872       _fbb,
873       nanoapps__);
874 }
875 
876 /// Represents a request for loading a nanoapp.
877 /// The nanaopp can either be requested to be loaded via a file or via a buffer.
878 /// For loading via a file, the following steps will be taken:
879 /// 1. The loader sends a LoadNanoappRequest message to CHRE. app_binary must
880 ///    be set for legacy purposes, but should be empty. Additionally,
881 ///    fragment_id and total_app_size are unused in this request. The loading
882 ///    that happens as part of this request is serialized, but asynchronous
883 ///    meaning that load requests will be processed in the order they are sent
884 ///    but multiple requests can be outstanding at any given time.
885 /// 2. CHRE stores the filename and waits until its event loop is able to
886 ///    process the request.
887 /// 3. Once ready, the nanoapp will be loaded from the file specified in the
888 ///    original request and will send a callback indicating the
889 ///    completion/failure of the request.
890 /// For loading via a buffer, loading may optionally be fragmented into multiple
891 /// sequential requests, which will follow the following steps:
892 /// 1. The loader sends a LoadNanoappRequest message to CHRE. If the request
893 ///    is fragmented, then the fields fragment_id and total_app_size must
894 ///    be defined. Once the first fragment is sent to CHRE, all subsequent
895 ///    fragments must be delivered before a new LoadNanoappRequest can be
896 ///    issued. If a new request is received while a current request has
897 ///    outstanding fragments, the current request will be overridden with the
898 ///    new one.
899 /// 2. CHRE preallocates the required amount of memory, and loads app_binary,
900 ///    appending to already loaded fragments as appropriate.
901 /// 3. If the request is fragmented, then the requestor must sequentially send
902 ///    multiple LoadNanoappRequest with incremental nanoapp binary fragments.
903 ///    CHRE will respond with LoadNanoappResponse for each request. For
904 ///    requests starting from the second fragment, all fields except
905 ///    fragment_id and app_binary should be ignored by CHRE.
906 ///
907 ///    Once the LoadNanoappRepsonse for the last fragment is received
908 ///    by the HAL, the HAL client will receive a callback indicating the
909 ///    completion/failure of a load request.
910 ///
911 /// If any request fragment is lost, then the entire load request will be
912 /// considered to have failed. If the request times out (e.g. the requestor
913 /// process crashes), then the load request will be cancelled at CHRE and fail.
914 struct LoadNanoappRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
915   typedef LoadNanoappRequestBuilder Builder;
916   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
917     VT_TRANSACTION_ID = 4,
918     VT_APP_ID = 6,
919     VT_APP_VERSION = 8,
920     VT_TARGET_API_VERSION = 10,
921     VT_APP_BINARY = 12,
922     VT_FRAGMENT_ID = 14,
923     VT_TOTAL_APP_SIZE = 16,
924     VT_APP_BINARY_FILE_NAME = 18,
925     VT_APP_FLAGS = 20,
926     VT_RESPOND_BEFORE_START = 22
927   };
928   uint32_t transaction_id() const {
929     return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
930   }
931   uint64_t app_id() const {
932     return GetField<uint64_t>(VT_APP_ID, 0);
933   }
934   uint32_t app_version() const {
935     return GetField<uint32_t>(VT_APP_VERSION, 0);
936   }
937   uint32_t target_api_version() const {
938     return GetField<uint32_t>(VT_TARGET_API_VERSION, 0);
939   }
940   const flatbuffers::Vector<uint8_t> *app_binary() const {
941     return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_APP_BINARY);
942   }
943   /// Fields that are relevant for fragmented loading
944   /// The framgent count starts at 1 and should end at the total number of
945   /// fragments. For clients that do not support fragmented loading, the
946   /// default behavior should be to assume one fragment.
947   uint32_t fragment_id() const {
948     return GetField<uint32_t>(VT_FRAGMENT_ID, 0);
949   }
950   uint32_t total_app_size() const {
951     return GetField<uint32_t>(VT_TOTAL_APP_SIZE, 0);
952   }
953   /// Null-terminated ASCII string containing the file name that contains the
954   /// app binary to be loaded.
955   const flatbuffers::Vector<int8_t> *app_binary_file_name() const {
956     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_APP_BINARY_FILE_NAME);
957   }
958   /// The nanoapp flag values from the nanoapp header defined in
959   /// build/build_template.mk. Refer to that file for more details.
960   uint32_t app_flags() const {
961     return GetField<uint32_t>(VT_APP_FLAGS, 0);
962   }
963   /// If true and fragmented loading is requested, the LoadNanoappResponse
964   /// for the last fragment will be sent after the fragment was confirmed
965   /// to be placed in memory and no additional response will be sent after
966   /// the nanoapp is linked and started in the framework.
967   bool respond_before_start() const {
968     return GetField<uint8_t>(VT_RESPOND_BEFORE_START, 0) != 0;
969   }
970   bool Verify(flatbuffers::Verifier &verifier) const {
971     return VerifyTableStart(verifier) &&
972            VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
973            VerifyField<uint64_t>(verifier, VT_APP_ID) &&
974            VerifyField<uint32_t>(verifier, VT_APP_VERSION) &&
975            VerifyField<uint32_t>(verifier, VT_TARGET_API_VERSION) &&
976            VerifyOffsetRequired(verifier, VT_APP_BINARY) &&
977            verifier.VerifyVector(app_binary()) &&
978            VerifyField<uint32_t>(verifier, VT_FRAGMENT_ID) &&
979            VerifyField<uint32_t>(verifier, VT_TOTAL_APP_SIZE) &&
980            VerifyOffset(verifier, VT_APP_BINARY_FILE_NAME) &&
981            verifier.VerifyVector(app_binary_file_name()) &&
982            VerifyField<uint32_t>(verifier, VT_APP_FLAGS) &&
983            VerifyField<uint8_t>(verifier, VT_RESPOND_BEFORE_START) &&
984            verifier.EndTable();
985   }
986 };
987 
988 struct LoadNanoappRequestBuilder {
989   typedef LoadNanoappRequest Table;
990   flatbuffers::FlatBufferBuilder &fbb_;
991   flatbuffers::uoffset_t start_;
992   void add_transaction_id(uint32_t transaction_id) {
993     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_TRANSACTION_ID, transaction_id, 0);
994   }
995   void add_app_id(uint64_t app_id) {
996     fbb_.AddElement<uint64_t>(LoadNanoappRequest::VT_APP_ID, app_id, 0);
997   }
998   void add_app_version(uint32_t app_version) {
999     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_APP_VERSION, app_version, 0);
1000   }
1001   void add_target_api_version(uint32_t target_api_version) {
1002     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_TARGET_API_VERSION, target_api_version, 0);
1003   }
1004   void add_app_binary(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> app_binary) {
1005     fbb_.AddOffset(LoadNanoappRequest::VT_APP_BINARY, app_binary);
1006   }
1007   void add_fragment_id(uint32_t fragment_id) {
1008     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_FRAGMENT_ID, fragment_id, 0);
1009   }
1010   void add_total_app_size(uint32_t total_app_size) {
1011     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_TOTAL_APP_SIZE, total_app_size, 0);
1012   }
1013   void add_app_binary_file_name(flatbuffers::Offset<flatbuffers::Vector<int8_t>> app_binary_file_name) {
1014     fbb_.AddOffset(LoadNanoappRequest::VT_APP_BINARY_FILE_NAME, app_binary_file_name);
1015   }
1016   void add_app_flags(uint32_t app_flags) {
1017     fbb_.AddElement<uint32_t>(LoadNanoappRequest::VT_APP_FLAGS, app_flags, 0);
1018   }
1019   void add_respond_before_start(bool respond_before_start) {
1020     fbb_.AddElement<uint8_t>(LoadNanoappRequest::VT_RESPOND_BEFORE_START, static_cast<uint8_t>(respond_before_start), 0);
1021   }
1022   explicit LoadNanoappRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1023         : fbb_(_fbb) {
1024     start_ = fbb_.StartTable();
1025   }
1026   LoadNanoappRequestBuilder &operator=(const LoadNanoappRequestBuilder &);
1027   flatbuffers::Offset<LoadNanoappRequest> Finish() {
1028     const auto end = fbb_.EndTable(start_);
1029     auto o = flatbuffers::Offset<LoadNanoappRequest>(end);
1030     fbb_.Required(o, LoadNanoappRequest::VT_APP_BINARY);
1031     return o;
1032   }
1033 };
1034 
1035 inline flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequest(
1036     flatbuffers::FlatBufferBuilder &_fbb,
1037     uint32_t transaction_id = 0,
1038     uint64_t app_id = 0,
1039     uint32_t app_version = 0,
1040     uint32_t target_api_version = 0,
1041     flatbuffers::Offset<flatbuffers::Vector<uint8_t>> app_binary = 0,
1042     uint32_t fragment_id = 0,
1043     uint32_t total_app_size = 0,
1044     flatbuffers::Offset<flatbuffers::Vector<int8_t>> app_binary_file_name = 0,
1045     uint32_t app_flags = 0,
1046     bool respond_before_start = false) {
1047   LoadNanoappRequestBuilder builder_(_fbb);
1048   builder_.add_app_id(app_id);
1049   builder_.add_app_flags(app_flags);
1050   builder_.add_app_binary_file_name(app_binary_file_name);
1051   builder_.add_total_app_size(total_app_size);
1052   builder_.add_fragment_id(fragment_id);
1053   builder_.add_app_binary(app_binary);
1054   builder_.add_target_api_version(target_api_version);
1055   builder_.add_app_version(app_version);
1056   builder_.add_transaction_id(transaction_id);
1057   builder_.add_respond_before_start(respond_before_start);
1058   return builder_.Finish();
1059 }
1060 
1061 inline flatbuffers::Offset<LoadNanoappRequest> CreateLoadNanoappRequestDirect(
1062     flatbuffers::FlatBufferBuilder &_fbb,
1063     uint32_t transaction_id = 0,
1064     uint64_t app_id = 0,
1065     uint32_t app_version = 0,
1066     uint32_t target_api_version = 0,
1067     const std::vector<uint8_t> *app_binary = nullptr,
1068     uint32_t fragment_id = 0,
1069     uint32_t total_app_size = 0,
1070     const std::vector<int8_t> *app_binary_file_name = nullptr,
1071     uint32_t app_flags = 0,
1072     bool respond_before_start = false) {
1073   auto app_binary__ = app_binary ? _fbb.CreateVector<uint8_t>(*app_binary) : 0;
1074   auto app_binary_file_name__ = app_binary_file_name ? _fbb.CreateVector<int8_t>(*app_binary_file_name) : 0;
1075   return chre::fbs::CreateLoadNanoappRequest(
1076       _fbb,
1077       transaction_id,
1078       app_id,
1079       app_version,
1080       target_api_version,
1081       app_binary__,
1082       fragment_id,
1083       total_app_size,
1084       app_binary_file_name__,
1085       app_flags,
1086       respond_before_start);
1087 }
1088 
1089 struct LoadNanoappResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1090   typedef LoadNanoappResponseBuilder Builder;
1091   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1092     VT_TRANSACTION_ID = 4,
1093     VT_SUCCESS = 6,
1094     VT_FRAGMENT_ID = 8
1095   };
1096   uint32_t transaction_id() const {
1097     return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
1098   }
1099   /// Denotes whether a load request succeeded or failed.
1100   /// If any fragment of a load request fails, the entire load request for
1101   /// the same transaction will fail.
1102   bool success() const {
1103     return GetField<uint8_t>(VT_SUCCESS, 0) != 0;
1104   }
1105   /// The fragment count of the load reponse is for.
1106   uint32_t fragment_id() const {
1107     return GetField<uint32_t>(VT_FRAGMENT_ID, 0);
1108   }
1109   bool Verify(flatbuffers::Verifier &verifier) const {
1110     return VerifyTableStart(verifier) &&
1111            VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
1112            VerifyField<uint8_t>(verifier, VT_SUCCESS) &&
1113            VerifyField<uint32_t>(verifier, VT_FRAGMENT_ID) &&
1114            verifier.EndTable();
1115   }
1116 };
1117 
1118 struct LoadNanoappResponseBuilder {
1119   typedef LoadNanoappResponse Table;
1120   flatbuffers::FlatBufferBuilder &fbb_;
1121   flatbuffers::uoffset_t start_;
1122   void add_transaction_id(uint32_t transaction_id) {
1123     fbb_.AddElement<uint32_t>(LoadNanoappResponse::VT_TRANSACTION_ID, transaction_id, 0);
1124   }
1125   void add_success(bool success) {
1126     fbb_.AddElement<uint8_t>(LoadNanoappResponse::VT_SUCCESS, static_cast<uint8_t>(success), 0);
1127   }
1128   void add_fragment_id(uint32_t fragment_id) {
1129     fbb_.AddElement<uint32_t>(LoadNanoappResponse::VT_FRAGMENT_ID, fragment_id, 0);
1130   }
1131   explicit LoadNanoappResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1132         : fbb_(_fbb) {
1133     start_ = fbb_.StartTable();
1134   }
1135   LoadNanoappResponseBuilder &operator=(const LoadNanoappResponseBuilder &);
1136   flatbuffers::Offset<LoadNanoappResponse> Finish() {
1137     const auto end = fbb_.EndTable(start_);
1138     auto o = flatbuffers::Offset<LoadNanoappResponse>(end);
1139     return o;
1140   }
1141 };
1142 
1143 inline flatbuffers::Offset<LoadNanoappResponse> CreateLoadNanoappResponse(
1144     flatbuffers::FlatBufferBuilder &_fbb,
1145     uint32_t transaction_id = 0,
1146     bool success = false,
1147     uint32_t fragment_id = 0) {
1148   LoadNanoappResponseBuilder builder_(_fbb);
1149   builder_.add_fragment_id(fragment_id);
1150   builder_.add_transaction_id(transaction_id);
1151   builder_.add_success(success);
1152   return builder_.Finish();
1153 }
1154 
1155 struct UnloadNanoappRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1156   typedef UnloadNanoappRequestBuilder Builder;
1157   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1158     VT_TRANSACTION_ID = 4,
1159     VT_APP_ID = 6,
1160     VT_ALLOW_SYSTEM_NANOAPP_UNLOAD = 8
1161   };
1162   uint32_t transaction_id() const {
1163     return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
1164   }
1165   uint64_t app_id() const {
1166     return GetField<uint64_t>(VT_APP_ID, 0);
1167   }
1168   /// Set to true to allow this request to unload nanoapps identified as "system
1169   /// nanoapps", i.e. ones with is_system set to true in NanoappListResponse.
1170   bool allow_system_nanoapp_unload() const {
1171     return GetField<uint8_t>(VT_ALLOW_SYSTEM_NANOAPP_UNLOAD, 0) != 0;
1172   }
1173   bool Verify(flatbuffers::Verifier &verifier) const {
1174     return VerifyTableStart(verifier) &&
1175            VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
1176            VerifyField<uint64_t>(verifier, VT_APP_ID) &&
1177            VerifyField<uint8_t>(verifier, VT_ALLOW_SYSTEM_NANOAPP_UNLOAD) &&
1178            verifier.EndTable();
1179   }
1180 };
1181 
1182 struct UnloadNanoappRequestBuilder {
1183   typedef UnloadNanoappRequest Table;
1184   flatbuffers::FlatBufferBuilder &fbb_;
1185   flatbuffers::uoffset_t start_;
1186   void add_transaction_id(uint32_t transaction_id) {
1187     fbb_.AddElement<uint32_t>(UnloadNanoappRequest::VT_TRANSACTION_ID, transaction_id, 0);
1188   }
1189   void add_app_id(uint64_t app_id) {
1190     fbb_.AddElement<uint64_t>(UnloadNanoappRequest::VT_APP_ID, app_id, 0);
1191   }
1192   void add_allow_system_nanoapp_unload(bool allow_system_nanoapp_unload) {
1193     fbb_.AddElement<uint8_t>(UnloadNanoappRequest::VT_ALLOW_SYSTEM_NANOAPP_UNLOAD, static_cast<uint8_t>(allow_system_nanoapp_unload), 0);
1194   }
1195   explicit UnloadNanoappRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1196         : fbb_(_fbb) {
1197     start_ = fbb_.StartTable();
1198   }
1199   UnloadNanoappRequestBuilder &operator=(const UnloadNanoappRequestBuilder &);
1200   flatbuffers::Offset<UnloadNanoappRequest> Finish() {
1201     const auto end = fbb_.EndTable(start_);
1202     auto o = flatbuffers::Offset<UnloadNanoappRequest>(end);
1203     return o;
1204   }
1205 };
1206 
1207 inline flatbuffers::Offset<UnloadNanoappRequest> CreateUnloadNanoappRequest(
1208     flatbuffers::FlatBufferBuilder &_fbb,
1209     uint32_t transaction_id = 0,
1210     uint64_t app_id = 0,
1211     bool allow_system_nanoapp_unload = false) {
1212   UnloadNanoappRequestBuilder builder_(_fbb);
1213   builder_.add_app_id(app_id);
1214   builder_.add_transaction_id(transaction_id);
1215   builder_.add_allow_system_nanoapp_unload(allow_system_nanoapp_unload);
1216   return builder_.Finish();
1217 }
1218 
1219 struct UnloadNanoappResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1220   typedef UnloadNanoappResponseBuilder Builder;
1221   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1222     VT_TRANSACTION_ID = 4,
1223     VT_SUCCESS = 6
1224   };
1225   uint32_t transaction_id() const {
1226     return GetField<uint32_t>(VT_TRANSACTION_ID, 0);
1227   }
1228   bool success() const {
1229     return GetField<uint8_t>(VT_SUCCESS, 0) != 0;
1230   }
1231   bool Verify(flatbuffers::Verifier &verifier) const {
1232     return VerifyTableStart(verifier) &&
1233            VerifyField<uint32_t>(verifier, VT_TRANSACTION_ID) &&
1234            VerifyField<uint8_t>(verifier, VT_SUCCESS) &&
1235            verifier.EndTable();
1236   }
1237 };
1238 
1239 struct UnloadNanoappResponseBuilder {
1240   typedef UnloadNanoappResponse Table;
1241   flatbuffers::FlatBufferBuilder &fbb_;
1242   flatbuffers::uoffset_t start_;
1243   void add_transaction_id(uint32_t transaction_id) {
1244     fbb_.AddElement<uint32_t>(UnloadNanoappResponse::VT_TRANSACTION_ID, transaction_id, 0);
1245   }
1246   void add_success(bool success) {
1247     fbb_.AddElement<uint8_t>(UnloadNanoappResponse::VT_SUCCESS, static_cast<uint8_t>(success), 0);
1248   }
1249   explicit UnloadNanoappResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1250         : fbb_(_fbb) {
1251     start_ = fbb_.StartTable();
1252   }
1253   UnloadNanoappResponseBuilder &operator=(const UnloadNanoappResponseBuilder &);
1254   flatbuffers::Offset<UnloadNanoappResponse> Finish() {
1255     const auto end = fbb_.EndTable(start_);
1256     auto o = flatbuffers::Offset<UnloadNanoappResponse>(end);
1257     return o;
1258   }
1259 };
1260 
1261 inline flatbuffers::Offset<UnloadNanoappResponse> CreateUnloadNanoappResponse(
1262     flatbuffers::FlatBufferBuilder &_fbb,
1263     uint32_t transaction_id = 0,
1264     bool success = false) {
1265   UnloadNanoappResponseBuilder builder_(_fbb);
1266   builder_.add_transaction_id(transaction_id);
1267   builder_.add_success(success);
1268   return builder_.Finish();
1269 }
1270 
1271 /// Represents log messages from CHRE.
1272 struct LogMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1273   typedef LogMessageBuilder Builder;
1274   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1275     VT_BUFFER = 4
1276   };
1277   /// A buffer containing formatted log data. A flat array is used here to avoid
1278   /// overhead in serializing and deserializing. The format is as follows:
1279   ///
1280   /// uint8_t                 - log level (1 = error, 2 = warning,
1281   ///                                      3 = info, 4 = debug)
1282   /// uint64_t, little-endian - timestamp in nanoseconds
1283   /// char[]                  - message to log
1284   /// char, \0                - null-terminator
1285   ///
1286   /// This pattern repeats until the end of the buffer for multiple log
1287   /// messages. The last byte will always be a null-terminator. There are no
1288   /// padding bytes between these fields. Treat this like a packed struct and be
1289   /// cautious with unaligned access when reading/writing this buffer.
1290   const flatbuffers::Vector<int8_t> *buffer() const {
1291     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_BUFFER);
1292   }
1293   bool Verify(flatbuffers::Verifier &verifier) const {
1294     return VerifyTableStart(verifier) &&
1295            VerifyOffset(verifier, VT_BUFFER) &&
1296            verifier.VerifyVector(buffer()) &&
1297            verifier.EndTable();
1298   }
1299 };
1300 
1301 struct LogMessageBuilder {
1302   typedef LogMessage Table;
1303   flatbuffers::FlatBufferBuilder &fbb_;
1304   flatbuffers::uoffset_t start_;
1305   void add_buffer(flatbuffers::Offset<flatbuffers::Vector<int8_t>> buffer) {
1306     fbb_.AddOffset(LogMessage::VT_BUFFER, buffer);
1307   }
1308   explicit LogMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1309         : fbb_(_fbb) {
1310     start_ = fbb_.StartTable();
1311   }
1312   LogMessageBuilder &operator=(const LogMessageBuilder &);
1313   flatbuffers::Offset<LogMessage> Finish() {
1314     const auto end = fbb_.EndTable(start_);
1315     auto o = flatbuffers::Offset<LogMessage>(end);
1316     return o;
1317   }
1318 };
1319 
1320 inline flatbuffers::Offset<LogMessage> CreateLogMessage(
1321     flatbuffers::FlatBufferBuilder &_fbb,
1322     flatbuffers::Offset<flatbuffers::Vector<int8_t>> buffer = 0) {
1323   LogMessageBuilder builder_(_fbb);
1324   builder_.add_buffer(buffer);
1325   return builder_.Finish();
1326 }
1327 
1328 inline flatbuffers::Offset<LogMessage> CreateLogMessageDirect(
1329     flatbuffers::FlatBufferBuilder &_fbb,
1330     const std::vector<int8_t> *buffer = nullptr) {
1331   auto buffer__ = buffer ? _fbb.CreateVector<int8_t>(*buffer) : 0;
1332   return chre::fbs::CreateLogMessage(
1333       _fbb,
1334       buffer__);
1335 }
1336 
1337 /// Represents a message sent to CHRE to indicate AP timestamp for time sync
1338 struct TimeSyncMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1339   typedef TimeSyncMessageBuilder Builder;
1340   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1341     VT_OFFSET = 4
1342   };
1343   /// Offset between AP and CHRE timestamp
1344   int64_t offset() const {
1345     return GetField<int64_t>(VT_OFFSET, 0);
1346   }
1347   bool Verify(flatbuffers::Verifier &verifier) const {
1348     return VerifyTableStart(verifier) &&
1349            VerifyField<int64_t>(verifier, VT_OFFSET) &&
1350            verifier.EndTable();
1351   }
1352 };
1353 
1354 struct TimeSyncMessageBuilder {
1355   typedef TimeSyncMessage Table;
1356   flatbuffers::FlatBufferBuilder &fbb_;
1357   flatbuffers::uoffset_t start_;
1358   void add_offset(int64_t offset) {
1359     fbb_.AddElement<int64_t>(TimeSyncMessage::VT_OFFSET, offset, 0);
1360   }
1361   explicit TimeSyncMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1362         : fbb_(_fbb) {
1363     start_ = fbb_.StartTable();
1364   }
1365   TimeSyncMessageBuilder &operator=(const TimeSyncMessageBuilder &);
1366   flatbuffers::Offset<TimeSyncMessage> Finish() {
1367     const auto end = fbb_.EndTable(start_);
1368     auto o = flatbuffers::Offset<TimeSyncMessage>(end);
1369     return o;
1370   }
1371 };
1372 
1373 inline flatbuffers::Offset<TimeSyncMessage> CreateTimeSyncMessage(
1374     flatbuffers::FlatBufferBuilder &_fbb,
1375     int64_t offset = 0) {
1376   TimeSyncMessageBuilder builder_(_fbb);
1377   builder_.add_offset(offset);
1378   return builder_.Finish();
1379 }
1380 
1381 /// A request to gather and return debugging information. Only one debug dump
1382 /// session can be active at a time. Upon accepting a request, zero or more
1383 /// DebugDumpData messages are generated, followed by a DebugDumpResponse
1384 /// indicating the completion of the operation.
1385 struct DebugDumpRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1386   typedef DebugDumpRequestBuilder Builder;
1387   bool Verify(flatbuffers::Verifier &verifier) const {
1388     return VerifyTableStart(verifier) &&
1389            verifier.EndTable();
1390   }
1391 };
1392 
1393 struct DebugDumpRequestBuilder {
1394   typedef DebugDumpRequest Table;
1395   flatbuffers::FlatBufferBuilder &fbb_;
1396   flatbuffers::uoffset_t start_;
1397   explicit DebugDumpRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1398         : fbb_(_fbb) {
1399     start_ = fbb_.StartTable();
1400   }
1401   DebugDumpRequestBuilder &operator=(const DebugDumpRequestBuilder &);
1402   flatbuffers::Offset<DebugDumpRequest> Finish() {
1403     const auto end = fbb_.EndTable(start_);
1404     auto o = flatbuffers::Offset<DebugDumpRequest>(end);
1405     return o;
1406   }
1407 };
1408 
1409 inline flatbuffers::Offset<DebugDumpRequest> CreateDebugDumpRequest(
1410     flatbuffers::FlatBufferBuilder &_fbb) {
1411   DebugDumpRequestBuilder builder_(_fbb);
1412   return builder_.Finish();
1413 }
1414 
1415 struct DebugDumpData FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1416   typedef DebugDumpDataBuilder Builder;
1417   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1418     VT_DEBUG_STR = 4
1419   };
1420   /// Null-terminated ASCII string containing debugging information
1421   const flatbuffers::Vector<int8_t> *debug_str() const {
1422     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_DEBUG_STR);
1423   }
1424   bool Verify(flatbuffers::Verifier &verifier) const {
1425     return VerifyTableStart(verifier) &&
1426            VerifyOffset(verifier, VT_DEBUG_STR) &&
1427            verifier.VerifyVector(debug_str()) &&
1428            verifier.EndTable();
1429   }
1430 };
1431 
1432 struct DebugDumpDataBuilder {
1433   typedef DebugDumpData Table;
1434   flatbuffers::FlatBufferBuilder &fbb_;
1435   flatbuffers::uoffset_t start_;
1436   void add_debug_str(flatbuffers::Offset<flatbuffers::Vector<int8_t>> debug_str) {
1437     fbb_.AddOffset(DebugDumpData::VT_DEBUG_STR, debug_str);
1438   }
1439   explicit DebugDumpDataBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1440         : fbb_(_fbb) {
1441     start_ = fbb_.StartTable();
1442   }
1443   DebugDumpDataBuilder &operator=(const DebugDumpDataBuilder &);
1444   flatbuffers::Offset<DebugDumpData> Finish() {
1445     const auto end = fbb_.EndTable(start_);
1446     auto o = flatbuffers::Offset<DebugDumpData>(end);
1447     return o;
1448   }
1449 };
1450 
1451 inline flatbuffers::Offset<DebugDumpData> CreateDebugDumpData(
1452     flatbuffers::FlatBufferBuilder &_fbb,
1453     flatbuffers::Offset<flatbuffers::Vector<int8_t>> debug_str = 0) {
1454   DebugDumpDataBuilder builder_(_fbb);
1455   builder_.add_debug_str(debug_str);
1456   return builder_.Finish();
1457 }
1458 
1459 inline flatbuffers::Offset<DebugDumpData> CreateDebugDumpDataDirect(
1460     flatbuffers::FlatBufferBuilder &_fbb,
1461     const std::vector<int8_t> *debug_str = nullptr) {
1462   auto debug_str__ = debug_str ? _fbb.CreateVector<int8_t>(*debug_str) : 0;
1463   return chre::fbs::CreateDebugDumpData(
1464       _fbb,
1465       debug_str__);
1466 }
1467 
1468 struct DebugDumpResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1469   typedef DebugDumpResponseBuilder Builder;
1470   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1471     VT_SUCCESS = 4,
1472     VT_DATA_COUNT = 6
1473   };
1474   /// true if the request was accepted and a dump was performed, false if it was
1475   /// rejected or failed to complete for some reason
1476   bool success() const {
1477     return GetField<uint8_t>(VT_SUCCESS, 0) != 0;
1478   }
1479   /// The number of DebugDumpData messages sent in this session
1480   uint32_t data_count() const {
1481     return GetField<uint32_t>(VT_DATA_COUNT, 0);
1482   }
1483   bool Verify(flatbuffers::Verifier &verifier) const {
1484     return VerifyTableStart(verifier) &&
1485            VerifyField<uint8_t>(verifier, VT_SUCCESS) &&
1486            VerifyField<uint32_t>(verifier, VT_DATA_COUNT) &&
1487            verifier.EndTable();
1488   }
1489 };
1490 
1491 struct DebugDumpResponseBuilder {
1492   typedef DebugDumpResponse Table;
1493   flatbuffers::FlatBufferBuilder &fbb_;
1494   flatbuffers::uoffset_t start_;
1495   void add_success(bool success) {
1496     fbb_.AddElement<uint8_t>(DebugDumpResponse::VT_SUCCESS, static_cast<uint8_t>(success), 0);
1497   }
1498   void add_data_count(uint32_t data_count) {
1499     fbb_.AddElement<uint32_t>(DebugDumpResponse::VT_DATA_COUNT, data_count, 0);
1500   }
1501   explicit DebugDumpResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1502         : fbb_(_fbb) {
1503     start_ = fbb_.StartTable();
1504   }
1505   DebugDumpResponseBuilder &operator=(const DebugDumpResponseBuilder &);
1506   flatbuffers::Offset<DebugDumpResponse> Finish() {
1507     const auto end = fbb_.EndTable(start_);
1508     auto o = flatbuffers::Offset<DebugDumpResponse>(end);
1509     return o;
1510   }
1511 };
1512 
1513 inline flatbuffers::Offset<DebugDumpResponse> CreateDebugDumpResponse(
1514     flatbuffers::FlatBufferBuilder &_fbb,
1515     bool success = false,
1516     uint32_t data_count = 0) {
1517   DebugDumpResponseBuilder builder_(_fbb);
1518   builder_.add_data_count(data_count);
1519   builder_.add_success(success);
1520   return builder_.Finish();
1521 }
1522 
1523 /// A request from CHRE for host to initiate a time sync message
1524 /// (system feature, platform-specific - not all platforms necessarily use this)
1525 struct TimeSyncRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1526   typedef TimeSyncRequestBuilder Builder;
1527   bool Verify(flatbuffers::Verifier &verifier) const {
1528     return VerifyTableStart(verifier) &&
1529            verifier.EndTable();
1530   }
1531 };
1532 
1533 struct TimeSyncRequestBuilder {
1534   typedef TimeSyncRequest Table;
1535   flatbuffers::FlatBufferBuilder &fbb_;
1536   flatbuffers::uoffset_t start_;
1537   explicit TimeSyncRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1538         : fbb_(_fbb) {
1539     start_ = fbb_.StartTable();
1540   }
1541   TimeSyncRequestBuilder &operator=(const TimeSyncRequestBuilder &);
1542   flatbuffers::Offset<TimeSyncRequest> Finish() {
1543     const auto end = fbb_.EndTable(start_);
1544     auto o = flatbuffers::Offset<TimeSyncRequest>(end);
1545     return o;
1546   }
1547 };
1548 
1549 inline flatbuffers::Offset<TimeSyncRequest> CreateTimeSyncRequest(
1550     flatbuffers::FlatBufferBuilder &_fbb) {
1551   TimeSyncRequestBuilder builder_(_fbb);
1552   return builder_.Finish();
1553 }
1554 
1555 /// Request from CHRE to enable direct access to data from the low-power
1556 /// microphone. On some systems, coordination via the AP (e.g. with
1557 /// SoundTrigger HAL) is needed to ensure this capability is powered up when
1558 /// CHRE needs it. The host does not send a response.
1559 struct LowPowerMicAccessRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1560   typedef LowPowerMicAccessRequestBuilder Builder;
1561   bool Verify(flatbuffers::Verifier &verifier) const {
1562     return VerifyTableStart(verifier) &&
1563            verifier.EndTable();
1564   }
1565 };
1566 
1567 struct LowPowerMicAccessRequestBuilder {
1568   typedef LowPowerMicAccessRequest Table;
1569   flatbuffers::FlatBufferBuilder &fbb_;
1570   flatbuffers::uoffset_t start_;
1571   explicit LowPowerMicAccessRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1572         : fbb_(_fbb) {
1573     start_ = fbb_.StartTable();
1574   }
1575   LowPowerMicAccessRequestBuilder &operator=(const LowPowerMicAccessRequestBuilder &);
1576   flatbuffers::Offset<LowPowerMicAccessRequest> Finish() {
1577     const auto end = fbb_.EndTable(start_);
1578     auto o = flatbuffers::Offset<LowPowerMicAccessRequest>(end);
1579     return o;
1580   }
1581 };
1582 
1583 inline flatbuffers::Offset<LowPowerMicAccessRequest> CreateLowPowerMicAccessRequest(
1584     flatbuffers::FlatBufferBuilder &_fbb) {
1585   LowPowerMicAccessRequestBuilder builder_(_fbb);
1586   return builder_.Finish();
1587 }
1588 
1589 /// Notification from CHRE that it no longer needs direct access to low-power
1590 /// microphone data.
1591 struct LowPowerMicAccessRelease FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1592   typedef LowPowerMicAccessReleaseBuilder Builder;
1593   bool Verify(flatbuffers::Verifier &verifier) const {
1594     return VerifyTableStart(verifier) &&
1595            verifier.EndTable();
1596   }
1597 };
1598 
1599 struct LowPowerMicAccessReleaseBuilder {
1600   typedef LowPowerMicAccessRelease Table;
1601   flatbuffers::FlatBufferBuilder &fbb_;
1602   flatbuffers::uoffset_t start_;
1603   explicit LowPowerMicAccessReleaseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1604         : fbb_(_fbb) {
1605     start_ = fbb_.StartTable();
1606   }
1607   LowPowerMicAccessReleaseBuilder &operator=(const LowPowerMicAccessReleaseBuilder &);
1608   flatbuffers::Offset<LowPowerMicAccessRelease> Finish() {
1609     const auto end = fbb_.EndTable(start_);
1610     auto o = flatbuffers::Offset<LowPowerMicAccessRelease>(end);
1611     return o;
1612   }
1613 };
1614 
1615 inline flatbuffers::Offset<LowPowerMicAccessRelease> CreateLowPowerMicAccessRelease(
1616     flatbuffers::FlatBufferBuilder &_fbb) {
1617   LowPowerMicAccessReleaseBuilder builder_(_fbb);
1618   return builder_.Finish();
1619 }
1620 
1621 /// Notification from the host that a system setting has changed
1622 struct SettingChangeMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1623   typedef SettingChangeMessageBuilder Builder;
1624   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1625     VT_SETTING = 4,
1626     VT_STATE = 6
1627   };
1628   /// The setting that has changed
1629   chre::fbs::Setting setting() const {
1630     return static_cast<chre::fbs::Setting>(GetField<int8_t>(VT_SETTING, 0));
1631   }
1632   /// The new setting value
1633   chre::fbs::SettingState state() const {
1634     return static_cast<chre::fbs::SettingState>(GetField<int8_t>(VT_STATE, 0));
1635   }
1636   bool Verify(flatbuffers::Verifier &verifier) const {
1637     return VerifyTableStart(verifier) &&
1638            VerifyField<int8_t>(verifier, VT_SETTING) &&
1639            VerifyField<int8_t>(verifier, VT_STATE) &&
1640            verifier.EndTable();
1641   }
1642 };
1643 
1644 struct SettingChangeMessageBuilder {
1645   typedef SettingChangeMessage Table;
1646   flatbuffers::FlatBufferBuilder &fbb_;
1647   flatbuffers::uoffset_t start_;
1648   void add_setting(chre::fbs::Setting setting) {
1649     fbb_.AddElement<int8_t>(SettingChangeMessage::VT_SETTING, static_cast<int8_t>(setting), 0);
1650   }
1651   void add_state(chre::fbs::SettingState state) {
1652     fbb_.AddElement<int8_t>(SettingChangeMessage::VT_STATE, static_cast<int8_t>(state), 0);
1653   }
1654   explicit SettingChangeMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1655         : fbb_(_fbb) {
1656     start_ = fbb_.StartTable();
1657   }
1658   SettingChangeMessageBuilder &operator=(const SettingChangeMessageBuilder &);
1659   flatbuffers::Offset<SettingChangeMessage> Finish() {
1660     const auto end = fbb_.EndTable(start_);
1661     auto o = flatbuffers::Offset<SettingChangeMessage>(end);
1662     return o;
1663   }
1664 };
1665 
1666 inline flatbuffers::Offset<SettingChangeMessage> CreateSettingChangeMessage(
1667     flatbuffers::FlatBufferBuilder &_fbb,
1668     chre::fbs::Setting setting = chre::fbs::Setting::LOCATION,
1669     chre::fbs::SettingState state = chre::fbs::SettingState::DISABLED) {
1670   SettingChangeMessageBuilder builder_(_fbb);
1671   builder_.add_state(state);
1672   builder_.add_setting(setting);
1673   return builder_.Finish();
1674 }
1675 
1676 /// Represents V2 log messages from CHRE.
1677 struct LogMessageV2 FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1678   typedef LogMessageV2Builder Builder;
1679   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1680     VT_BUFFER = 4,
1681     VT_NUM_LOGS_DROPPED = 6
1682   };
1683   /// A buffer containing formatted log data. A flat array is used here to avoid
1684   /// overhead in serializing and deserializing. The format is as follows:
1685   ///
1686   /// uint8_t                 - LogBuffer log level (1 = error, 2 = warn,
1687   ///                                                3 = info,  4 = debug,
1688   ///                                                5 = verbose)
1689   /// uint32_t, little-endian - timestamp in milliseconds
1690   /// char[]                  - message to log
1691   /// char, \0                - null-terminator
1692   ///
1693   /// This pattern repeats until the end of the buffer for multiple log
1694   /// messages. The last byte will always be a null-terminator. There are no
1695   /// padding bytes between these fields. Treat this like a packed struct and be
1696   /// cautious with unaligned access when reading/writing this buffer.
1697   const flatbuffers::Vector<int8_t> *buffer() const {
1698     return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_BUFFER);
1699   }
1700   /// The number of logs dropped since CHRE started
1701   uint32_t num_logs_dropped() const {
1702     return GetField<uint32_t>(VT_NUM_LOGS_DROPPED, 0);
1703   }
1704   bool Verify(flatbuffers::Verifier &verifier) const {
1705     return VerifyTableStart(verifier) &&
1706            VerifyOffset(verifier, VT_BUFFER) &&
1707            verifier.VerifyVector(buffer()) &&
1708            VerifyField<uint32_t>(verifier, VT_NUM_LOGS_DROPPED) &&
1709            verifier.EndTable();
1710   }
1711 };
1712 
1713 struct LogMessageV2Builder {
1714   typedef LogMessageV2 Table;
1715   flatbuffers::FlatBufferBuilder &fbb_;
1716   flatbuffers::uoffset_t start_;
1717   void add_buffer(flatbuffers::Offset<flatbuffers::Vector<int8_t>> buffer) {
1718     fbb_.AddOffset(LogMessageV2::VT_BUFFER, buffer);
1719   }
1720   void add_num_logs_dropped(uint32_t num_logs_dropped) {
1721     fbb_.AddElement<uint32_t>(LogMessageV2::VT_NUM_LOGS_DROPPED, num_logs_dropped, 0);
1722   }
1723   explicit LogMessageV2Builder(flatbuffers::FlatBufferBuilder &_fbb)
1724         : fbb_(_fbb) {
1725     start_ = fbb_.StartTable();
1726   }
1727   LogMessageV2Builder &operator=(const LogMessageV2Builder &);
1728   flatbuffers::Offset<LogMessageV2> Finish() {
1729     const auto end = fbb_.EndTable(start_);
1730     auto o = flatbuffers::Offset<LogMessageV2>(end);
1731     return o;
1732   }
1733 };
1734 
1735 inline flatbuffers::Offset<LogMessageV2> CreateLogMessageV2(
1736     flatbuffers::FlatBufferBuilder &_fbb,
1737     flatbuffers::Offset<flatbuffers::Vector<int8_t>> buffer = 0,
1738     uint32_t num_logs_dropped = 0) {
1739   LogMessageV2Builder builder_(_fbb);
1740   builder_.add_num_logs_dropped(num_logs_dropped);
1741   builder_.add_buffer(buffer);
1742   return builder_.Finish();
1743 }
1744 
1745 inline flatbuffers::Offset<LogMessageV2> CreateLogMessageV2Direct(
1746     flatbuffers::FlatBufferBuilder &_fbb,
1747     const std::vector<int8_t> *buffer = nullptr,
1748     uint32_t num_logs_dropped = 0) {
1749   auto buffer__ = buffer ? _fbb.CreateVector<int8_t>(*buffer) : 0;
1750   return chre::fbs::CreateLogMessageV2(
1751       _fbb,
1752       buffer__,
1753       num_logs_dropped);
1754 }
1755 
1756 struct SelfTestRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1757   typedef SelfTestRequestBuilder Builder;
1758   bool Verify(flatbuffers::Verifier &verifier) const {
1759     return VerifyTableStart(verifier) &&
1760            verifier.EndTable();
1761   }
1762 };
1763 
1764 struct SelfTestRequestBuilder {
1765   typedef SelfTestRequest Table;
1766   flatbuffers::FlatBufferBuilder &fbb_;
1767   flatbuffers::uoffset_t start_;
1768   explicit SelfTestRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1769         : fbb_(_fbb) {
1770     start_ = fbb_.StartTable();
1771   }
1772   SelfTestRequestBuilder &operator=(const SelfTestRequestBuilder &);
1773   flatbuffers::Offset<SelfTestRequest> Finish() {
1774     const auto end = fbb_.EndTable(start_);
1775     auto o = flatbuffers::Offset<SelfTestRequest>(end);
1776     return o;
1777   }
1778 };
1779 
1780 inline flatbuffers::Offset<SelfTestRequest> CreateSelfTestRequest(
1781     flatbuffers::FlatBufferBuilder &_fbb) {
1782   SelfTestRequestBuilder builder_(_fbb);
1783   return builder_.Finish();
1784 }
1785 
1786 struct SelfTestResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1787   typedef SelfTestResponseBuilder Builder;
1788   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1789     VT_SUCCESS = 4
1790   };
1791   bool success() const {
1792     return GetField<uint8_t>(VT_SUCCESS, 0) != 0;
1793   }
1794   bool Verify(flatbuffers::Verifier &verifier) const {
1795     return VerifyTableStart(verifier) &&
1796            VerifyField<uint8_t>(verifier, VT_SUCCESS) &&
1797            verifier.EndTable();
1798   }
1799 };
1800 
1801 struct SelfTestResponseBuilder {
1802   typedef SelfTestResponse Table;
1803   flatbuffers::FlatBufferBuilder &fbb_;
1804   flatbuffers::uoffset_t start_;
1805   void add_success(bool success) {
1806     fbb_.AddElement<uint8_t>(SelfTestResponse::VT_SUCCESS, static_cast<uint8_t>(success), 0);
1807   }
1808   explicit SelfTestResponseBuilder(flatbuffers::FlatBufferBuilder &_fbb)
1809         : fbb_(_fbb) {
1810     start_ = fbb_.StartTable();
1811   }
1812   SelfTestResponseBuilder &operator=(const SelfTestResponseBuilder &);
1813   flatbuffers::Offset<SelfTestResponse> Finish() {
1814     const auto end = fbb_.EndTable(start_);
1815     auto o = flatbuffers::Offset<SelfTestResponse>(end);
1816     return o;
1817   }
1818 };
1819 
1820 inline flatbuffers::Offset<SelfTestResponse> CreateSelfTestResponse(
1821     flatbuffers::FlatBufferBuilder &_fbb,
1822     bool success = false) {
1823   SelfTestResponseBuilder builder_(_fbb);
1824   builder_.add_success(success);
1825   return builder_.Finish();
1826 }
1827 
1828 /// The top-level container that encapsulates all possible messages. Note that
1829 /// per FlatBuffers requirements, we can't use a union as the top-level
1830 /// structure (root type), so we must wrap it in a table.
1831 struct MessageContainer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
1832   typedef MessageContainerBuilder Builder;
1833   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
1834     VT_MESSAGE_TYPE = 4,
1835     VT_MESSAGE = 6,
1836     VT_HOST_ADDR = 8
1837   };
1838   chre::fbs::ChreMessage message_type() const {
1839     return static_cast<chre::fbs::ChreMessage>(GetField<uint8_t>(VT_MESSAGE_TYPE, 0));
1840   }
1841   const void *message() const {
1842     return GetPointer<const void *>(VT_MESSAGE);
1843   }
1844   template<typename T> const T *message_as() const;
1845   const chre::fbs::NanoappMessage *message_as_NanoappMessage() const {
1846     return message_type() == chre::fbs::ChreMessage::NanoappMessage ? static_cast<const chre::fbs::NanoappMessage *>(message()) : nullptr;
1847   }
1848   const chre::fbs::HubInfoRequest *message_as_HubInfoRequest() const {
1849     return message_type() == chre::fbs::ChreMessage::HubInfoRequest ? static_cast<const chre::fbs::HubInfoRequest *>(message()) : nullptr;
1850   }
1851   const chre::fbs::HubInfoResponse *message_as_HubInfoResponse() const {
1852     return message_type() == chre::fbs::ChreMessage::HubInfoResponse ? static_cast<const chre::fbs::HubInfoResponse *>(message()) : nullptr;
1853   }
1854   const chre::fbs::NanoappListRequest *message_as_NanoappListRequest() const {
1855     return message_type() == chre::fbs::ChreMessage::NanoappListRequest ? static_cast<const chre::fbs::NanoappListRequest *>(message()) : nullptr;
1856   }
1857   const chre::fbs::NanoappListResponse *message_as_NanoappListResponse() const {
1858     return message_type() == chre::fbs::ChreMessage::NanoappListResponse ? static_cast<const chre::fbs::NanoappListResponse *>(message()) : nullptr;
1859   }
1860   const chre::fbs::LoadNanoappRequest *message_as_LoadNanoappRequest() const {
1861     return message_type() == chre::fbs::ChreMessage::LoadNanoappRequest ? static_cast<const chre::fbs::LoadNanoappRequest *>(message()) : nullptr;
1862   }
1863   const chre::fbs::LoadNanoappResponse *message_as_LoadNanoappResponse() const {
1864     return message_type() == chre::fbs::ChreMessage::LoadNanoappResponse ? static_cast<const chre::fbs::LoadNanoappResponse *>(message()) : nullptr;
1865   }
1866   const chre::fbs::UnloadNanoappRequest *message_as_UnloadNanoappRequest() const {
1867     return message_type() == chre::fbs::ChreMessage::UnloadNanoappRequest ? static_cast<const chre::fbs::UnloadNanoappRequest *>(message()) : nullptr;
1868   }
1869   const chre::fbs::UnloadNanoappResponse *message_as_UnloadNanoappResponse() const {
1870     return message_type() == chre::fbs::ChreMessage::UnloadNanoappResponse ? static_cast<const chre::fbs::UnloadNanoappResponse *>(message()) : nullptr;
1871   }
1872   const chre::fbs::LogMessage *message_as_LogMessage() const {
1873     return message_type() == chre::fbs::ChreMessage::LogMessage ? static_cast<const chre::fbs::LogMessage *>(message()) : nullptr;
1874   }
1875   const chre::fbs::TimeSyncMessage *message_as_TimeSyncMessage() const {
1876     return message_type() == chre::fbs::ChreMessage::TimeSyncMessage ? static_cast<const chre::fbs::TimeSyncMessage *>(message()) : nullptr;
1877   }
1878   const chre::fbs::DebugDumpRequest *message_as_DebugDumpRequest() const {
1879     return message_type() == chre::fbs::ChreMessage::DebugDumpRequest ? static_cast<const chre::fbs::DebugDumpRequest *>(message()) : nullptr;
1880   }
1881   const chre::fbs::DebugDumpData *message_as_DebugDumpData() const {
1882     return message_type() == chre::fbs::ChreMessage::DebugDumpData ? static_cast<const chre::fbs::DebugDumpData *>(message()) : nullptr;
1883   }
1884   const chre::fbs::DebugDumpResponse *message_as_DebugDumpResponse() const {
1885     return message_type() == chre::fbs::ChreMessage::DebugDumpResponse ? static_cast<const chre::fbs::DebugDumpResponse *>(message()) : nullptr;
1886   }
1887   const chre::fbs::TimeSyncRequest *message_as_TimeSyncRequest() const {
1888     return message_type() == chre::fbs::ChreMessage::TimeSyncRequest ? static_cast<const chre::fbs::TimeSyncRequest *>(message()) : nullptr;
1889   }
1890   const chre::fbs::LowPowerMicAccessRequest *message_as_LowPowerMicAccessRequest() const {
1891     return message_type() == chre::fbs::ChreMessage::LowPowerMicAccessRequest ? static_cast<const chre::fbs::LowPowerMicAccessRequest *>(message()) : nullptr;
1892   }
1893   const chre::fbs::LowPowerMicAccessRelease *message_as_LowPowerMicAccessRelease() const {
1894     return message_type() == chre::fbs::ChreMessage::LowPowerMicAccessRelease ? static_cast<const chre::fbs::LowPowerMicAccessRelease *>(message()) : nullptr;
1895   }
1896   const chre::fbs::SettingChangeMessage *message_as_SettingChangeMessage() const {
1897     return message_type() == chre::fbs::ChreMessage::SettingChangeMessage ? static_cast<const chre::fbs::SettingChangeMessage *>(message()) : nullptr;
1898   }
1899   const chre::fbs::LogMessageV2 *message_as_LogMessageV2() const {
1900     return message_type() == chre::fbs::ChreMessage::LogMessageV2 ? static_cast<const chre::fbs::LogMessageV2 *>(message()) : nullptr;
1901   }
1902   const chre::fbs::SelfTestRequest *message_as_SelfTestRequest() const {
1903     return message_type() == chre::fbs::ChreMessage::SelfTestRequest ? static_cast<const chre::fbs::SelfTestRequest *>(message()) : nullptr;
1904   }
1905   const chre::fbs::SelfTestResponse *message_as_SelfTestResponse() const {
1906     return message_type() == chre::fbs::ChreMessage::SelfTestResponse ? static_cast<const chre::fbs::SelfTestResponse *>(message()) : nullptr;
1907   }
1908   /// The originating or destination client ID on the host side, used to direct
1909   /// responses only to the client that sent the request. Although initially
1910   /// populated by the requesting client, this is enforced to be the correct
1911   /// value by the entity guarding access to CHRE.
1912   /// This is wrapped in a struct to ensure that it is always included when
1913   /// encoding the message, so it can be mutated by the host daemon.
1914   const chre::fbs::HostAddress *host_addr() const {
1915     return GetStruct<const chre::fbs::HostAddress *>(VT_HOST_ADDR);
1916   }
1917   bool Verify(flatbuffers::Verifier &verifier) const {
1918     return VerifyTableStart(verifier) &&
1919            VerifyField<uint8_t>(verifier, VT_MESSAGE_TYPE) &&
1920            VerifyOffsetRequired(verifier, VT_MESSAGE) &&
1921            VerifyChreMessage(verifier, message(), message_type()) &&
1922            VerifyFieldRequired<chre::fbs::HostAddress>(verifier, VT_HOST_ADDR) &&
1923            verifier.EndTable();
1924   }
1925 };
1926 
1927 template<> inline const chre::fbs::NanoappMessage *MessageContainer::message_as<chre::fbs::NanoappMessage>() const {
1928   return message_as_NanoappMessage();
1929 }
1930 
1931 template<> inline const chre::fbs::HubInfoRequest *MessageContainer::message_as<chre::fbs::HubInfoRequest>() const {
1932   return message_as_HubInfoRequest();
1933 }
1934 
1935 template<> inline const chre::fbs::HubInfoResponse *MessageContainer::message_as<chre::fbs::HubInfoResponse>() const {
1936   return message_as_HubInfoResponse();
1937 }
1938 
1939 template<> inline const chre::fbs::NanoappListRequest *MessageContainer::message_as<chre::fbs::NanoappListRequest>() const {
1940   return message_as_NanoappListRequest();
1941 }
1942 
1943 template<> inline const chre::fbs::NanoappListResponse *MessageContainer::message_as<chre::fbs::NanoappListResponse>() const {
1944   return message_as_NanoappListResponse();
1945 }
1946 
1947 template<> inline const chre::fbs::LoadNanoappRequest *MessageContainer::message_as<chre::fbs::LoadNanoappRequest>() const {
1948   return message_as_LoadNanoappRequest();
1949 }
1950 
1951 template<> inline const chre::fbs::LoadNanoappResponse *MessageContainer::message_as<chre::fbs::LoadNanoappResponse>() const {
1952   return message_as_LoadNanoappResponse();
1953 }
1954 
1955 template<> inline const chre::fbs::UnloadNanoappRequest *MessageContainer::message_as<chre::fbs::UnloadNanoappRequest>() const {
1956   return message_as_UnloadNanoappRequest();
1957 }
1958 
1959 template<> inline const chre::fbs::UnloadNanoappResponse *MessageContainer::message_as<chre::fbs::UnloadNanoappResponse>() const {
1960   return message_as_UnloadNanoappResponse();
1961 }
1962 
1963 template<> inline const chre::fbs::LogMessage *MessageContainer::message_as<chre::fbs::LogMessage>() const {
1964   return message_as_LogMessage();
1965 }
1966 
1967 template<> inline const chre::fbs::TimeSyncMessage *MessageContainer::message_as<chre::fbs::TimeSyncMessage>() const {
1968   return message_as_TimeSyncMessage();
1969 }
1970 
1971 template<> inline const chre::fbs::DebugDumpRequest *MessageContainer::message_as<chre::fbs::DebugDumpRequest>() const {
1972   return message_as_DebugDumpRequest();
1973 }
1974 
1975 template<> inline const chre::fbs::DebugDumpData *MessageContainer::message_as<chre::fbs::DebugDumpData>() const {
1976   return message_as_DebugDumpData();
1977 }
1978 
1979 template<> inline const chre::fbs::DebugDumpResponse *MessageContainer::message_as<chre::fbs::DebugDumpResponse>() const {
1980   return message_as_DebugDumpResponse();
1981 }
1982 
1983 template<> inline const chre::fbs::TimeSyncRequest *MessageContainer::message_as<chre::fbs::TimeSyncRequest>() const {
1984   return message_as_TimeSyncRequest();
1985 }
1986 
1987 template<> inline const chre::fbs::LowPowerMicAccessRequest *MessageContainer::message_as<chre::fbs::LowPowerMicAccessRequest>() const {
1988   return message_as_LowPowerMicAccessRequest();
1989 }
1990 
1991 template<> inline const chre::fbs::LowPowerMicAccessRelease *MessageContainer::message_as<chre::fbs::LowPowerMicAccessRelease>() const {
1992   return message_as_LowPowerMicAccessRelease();
1993 }
1994 
1995 template<> inline const chre::fbs::SettingChangeMessage *MessageContainer::message_as<chre::fbs::SettingChangeMessage>() const {
1996   return message_as_SettingChangeMessage();
1997 }
1998 
1999 template<> inline const chre::fbs::LogMessageV2 *MessageContainer::message_as<chre::fbs::LogMessageV2>() const {
2000   return message_as_LogMessageV2();
2001 }
2002 
2003 template<> inline const chre::fbs::SelfTestRequest *MessageContainer::message_as<chre::fbs::SelfTestRequest>() const {
2004   return message_as_SelfTestRequest();
2005 }
2006 
2007 template<> inline const chre::fbs::SelfTestResponse *MessageContainer::message_as<chre::fbs::SelfTestResponse>() const {
2008   return message_as_SelfTestResponse();
2009 }
2010 
2011 struct MessageContainerBuilder {
2012   typedef MessageContainer Table;
2013   flatbuffers::FlatBufferBuilder &fbb_;
2014   flatbuffers::uoffset_t start_;
2015   void add_message_type(chre::fbs::ChreMessage message_type) {
2016     fbb_.AddElement<uint8_t>(MessageContainer::VT_MESSAGE_TYPE, static_cast<uint8_t>(message_type), 0);
2017   }
2018   void add_message(flatbuffers::Offset<void> message) {
2019     fbb_.AddOffset(MessageContainer::VT_MESSAGE, message);
2020   }
2021   void add_host_addr(const chre::fbs::HostAddress *host_addr) {
2022     fbb_.AddStruct(MessageContainer::VT_HOST_ADDR, host_addr);
2023   }
2024   explicit MessageContainerBuilder(flatbuffers::FlatBufferBuilder &_fbb)
2025         : fbb_(_fbb) {
2026     start_ = fbb_.StartTable();
2027   }
2028   MessageContainerBuilder &operator=(const MessageContainerBuilder &);
2029   flatbuffers::Offset<MessageContainer> Finish() {
2030     const auto end = fbb_.EndTable(start_);
2031     auto o = flatbuffers::Offset<MessageContainer>(end);
2032     fbb_.Required(o, MessageContainer::VT_MESSAGE);
2033     fbb_.Required(o, MessageContainer::VT_HOST_ADDR);
2034     return o;
2035   }
2036 };
2037 
2038 inline flatbuffers::Offset<MessageContainer> CreateMessageContainer(
2039     flatbuffers::FlatBufferBuilder &_fbb,
2040     chre::fbs::ChreMessage message_type = chre::fbs::ChreMessage::NONE,
2041     flatbuffers::Offset<void> message = 0,
2042     const chre::fbs::HostAddress *host_addr = 0) {
2043   MessageContainerBuilder builder_(_fbb);
2044   builder_.add_host_addr(host_addr);
2045   builder_.add_message(message);
2046   builder_.add_message_type(message_type);
2047   return builder_.Finish();
2048 }
2049 
2050 inline bool VerifyChreMessage(flatbuffers::Verifier &verifier, const void *obj, ChreMessage type) {
2051   switch (type) {
2052     case ChreMessage::NONE: {
2053       return true;
2054     }
2055     case ChreMessage::NanoappMessage: {
2056       auto ptr = reinterpret_cast<const chre::fbs::NanoappMessage *>(obj);
2057       return verifier.VerifyTable(ptr);
2058     }
2059     case ChreMessage::HubInfoRequest: {
2060       auto ptr = reinterpret_cast<const chre::fbs::HubInfoRequest *>(obj);
2061       return verifier.VerifyTable(ptr);
2062     }
2063     case ChreMessage::HubInfoResponse: {
2064       auto ptr = reinterpret_cast<const chre::fbs::HubInfoResponse *>(obj);
2065       return verifier.VerifyTable(ptr);
2066     }
2067     case ChreMessage::NanoappListRequest: {
2068       auto ptr = reinterpret_cast<const chre::fbs::NanoappListRequest *>(obj);
2069       return verifier.VerifyTable(ptr);
2070     }
2071     case ChreMessage::NanoappListResponse: {
2072       auto ptr = reinterpret_cast<const chre::fbs::NanoappListResponse *>(obj);
2073       return verifier.VerifyTable(ptr);
2074     }
2075     case ChreMessage::LoadNanoappRequest: {
2076       auto ptr = reinterpret_cast<const chre::fbs::LoadNanoappRequest *>(obj);
2077       return verifier.VerifyTable(ptr);
2078     }
2079     case ChreMessage::LoadNanoappResponse: {
2080       auto ptr = reinterpret_cast<const chre::fbs::LoadNanoappResponse *>(obj);
2081       return verifier.VerifyTable(ptr);
2082     }
2083     case ChreMessage::UnloadNanoappRequest: {
2084       auto ptr = reinterpret_cast<const chre::fbs::UnloadNanoappRequest *>(obj);
2085       return verifier.VerifyTable(ptr);
2086     }
2087     case ChreMessage::UnloadNanoappResponse: {
2088       auto ptr = reinterpret_cast<const chre::fbs::UnloadNanoappResponse *>(obj);
2089       return verifier.VerifyTable(ptr);
2090     }
2091     case ChreMessage::LogMessage: {
2092       auto ptr = reinterpret_cast<const chre::fbs::LogMessage *>(obj);
2093       return verifier.VerifyTable(ptr);
2094     }
2095     case ChreMessage::TimeSyncMessage: {
2096       auto ptr = reinterpret_cast<const chre::fbs::TimeSyncMessage *>(obj);
2097       return verifier.VerifyTable(ptr);
2098     }
2099     case ChreMessage::DebugDumpRequest: {
2100       auto ptr = reinterpret_cast<const chre::fbs::DebugDumpRequest *>(obj);
2101       return verifier.VerifyTable(ptr);
2102     }
2103     case ChreMessage::DebugDumpData: {
2104       auto ptr = reinterpret_cast<const chre::fbs::DebugDumpData *>(obj);
2105       return verifier.VerifyTable(ptr);
2106     }
2107     case ChreMessage::DebugDumpResponse: {
2108       auto ptr = reinterpret_cast<const chre::fbs::DebugDumpResponse *>(obj);
2109       return verifier.VerifyTable(ptr);
2110     }
2111     case ChreMessage::TimeSyncRequest: {
2112       auto ptr = reinterpret_cast<const chre::fbs::TimeSyncRequest *>(obj);
2113       return verifier.VerifyTable(ptr);
2114     }
2115     case ChreMessage::LowPowerMicAccessRequest: {
2116       auto ptr = reinterpret_cast<const chre::fbs::LowPowerMicAccessRequest *>(obj);
2117       return verifier.VerifyTable(ptr);
2118     }
2119     case ChreMessage::LowPowerMicAccessRelease: {
2120       auto ptr = reinterpret_cast<const chre::fbs::LowPowerMicAccessRelease *>(obj);
2121       return verifier.VerifyTable(ptr);
2122     }
2123     case ChreMessage::SettingChangeMessage: {
2124       auto ptr = reinterpret_cast<const chre::fbs::SettingChangeMessage *>(obj);
2125       return verifier.VerifyTable(ptr);
2126     }
2127     case ChreMessage::LogMessageV2: {
2128       auto ptr = reinterpret_cast<const chre::fbs::LogMessageV2 *>(obj);
2129       return verifier.VerifyTable(ptr);
2130     }
2131     case ChreMessage::SelfTestRequest: {
2132       auto ptr = reinterpret_cast<const chre::fbs::SelfTestRequest *>(obj);
2133       return verifier.VerifyTable(ptr);
2134     }
2135     case ChreMessage::SelfTestResponse: {
2136       auto ptr = reinterpret_cast<const chre::fbs::SelfTestResponse *>(obj);
2137       return verifier.VerifyTable(ptr);
2138     }
2139     default: return true;
2140   }
2141 }
2142 
2143 inline bool VerifyChreMessageVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
2144   if (!values || !types) return !values && !types;
2145   if (values->size() != types->size()) return false;
2146   for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
2147     if (!VerifyChreMessage(
2148         verifier,  values->Get(i), types->GetEnum<ChreMessage>(i))) {
2149       return false;
2150     }
2151   }
2152   return true;
2153 }
2154 
2155 inline const chre::fbs::MessageContainer *GetMessageContainer(const void *buf) {
2156   return flatbuffers::GetRoot<chre::fbs::MessageContainer>(buf);
2157 }
2158 
2159 inline const chre::fbs::MessageContainer *GetSizePrefixedMessageContainer(const void *buf) {
2160   return flatbuffers::GetSizePrefixedRoot<chre::fbs::MessageContainer>(buf);
2161 }
2162 
2163 inline bool VerifyMessageContainerBuffer(
2164     flatbuffers::Verifier &verifier) {
2165   return verifier.VerifyBuffer<chre::fbs::MessageContainer>(nullptr);
2166 }
2167 
2168 inline bool VerifySizePrefixedMessageContainerBuffer(
2169     flatbuffers::Verifier &verifier) {
2170   return verifier.VerifySizePrefixedBuffer<chre::fbs::MessageContainer>(nullptr);
2171 }
2172 
2173 inline void FinishMessageContainerBuffer(
2174     flatbuffers::FlatBufferBuilder &fbb,
2175     flatbuffers::Offset<chre::fbs::MessageContainer> root) {
2176   fbb.Finish(root);
2177 }
2178 
2179 inline void FinishSizePrefixedMessageContainerBuffer(
2180     flatbuffers::FlatBufferBuilder &fbb,
2181     flatbuffers::Offset<chre::fbs::MessageContainer> root) {
2182   fbb.FinishSizePrefixed(root);
2183 }
2184 
2185 }  // namespace fbs
2186 }  // namespace chre
2187 
2188 #endif  // FLATBUFFERS_GENERATED_HOSTMESSAGES_CHRE_FBS_H_
2189