1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
12pub struct Config {
13 pub back_off_time_between_pull_samples_sec: i64,
14 pub disable_delays: bool,
15 pub early_exit: bool,
16 pub first_sampling_delay_sec: i64,
17 pub has_always_on_counter: bool,
18 pub has_real_time_clock: bool,
19 pub initial_frequency_ppm: u32,
20 pub max_frequency_error_ppm: u32,
21 pub monitor_time_source_url: String,
22 pub monitor_uses_pull: bool,
23 pub oscillator_error_std_dev_ppm: u32,
24 pub power_topology_integration_enabled: bool,
25 pub primary_time_source_url: String,
26 pub primary_uses_pull: bool,
27 pub serve_fuchsia_time_alarms: bool,
28 pub serve_fuchsia_time_external_adjust: bool,
29 pub serve_test_protocols: bool,
30 pub utc_max_allowed_delta_future_sec: i64,
31 pub utc_max_allowed_delta_past_sec: i64,
32 pub utc_start_at_startup: bool,
33 pub utc_start_at_startup_when_invalid_rtc: bool,
34}
35
36impl fidl::Persistable for Config {}
37
38mod internal {
39 use super::*;
40
41 impl fidl::encoding::ValueTypeMarker for Config {
42 type Borrowed<'a> = &'a Self;
43 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
44 value
45 }
46 }
47
48 unsafe impl fidl::encoding::TypeMarker for Config {
49 type Owned = Self;
50
51 #[inline(always)]
52 fn inline_align(_context: fidl::encoding::Context) -> usize {
53 8
54 }
55
56 #[inline(always)]
57 fn inline_size(_context: fidl::encoding::Context) -> usize {
58 120
59 }
60 }
61
62 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
63 #[inline]
64 unsafe fn encode(
65 self,
66 encoder: &mut fidl::encoding::Encoder<'_, D>,
67 offset: usize,
68 _depth: fidl::encoding::Depth,
69 ) -> fidl::Result<()> {
70 encoder.debug_check_bounds::<Config>(offset);
71 fidl::encoding::Encode::<Config, D>::encode(
73 (
74 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.back_off_time_between_pull_samples_sec),
75 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.disable_delays),
76 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.early_exit),
77 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.first_sampling_delay_sec),
78 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_always_on_counter),
79 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_real_time_clock),
80 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_frequency_ppm),
81 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_frequency_error_ppm),
82 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.monitor_time_source_url),
83 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.monitor_uses_pull),
84 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.oscillator_error_std_dev_ppm),
85 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.power_topology_integration_enabled),
86 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_time_source_url),
87 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.primary_uses_pull),
88 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.serve_fuchsia_time_alarms),
89 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.serve_fuchsia_time_external_adjust),
90 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.serve_test_protocols),
91 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.utc_max_allowed_delta_future_sec),
92 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.utc_max_allowed_delta_past_sec),
93 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.utc_start_at_startup),
94 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.utc_start_at_startup_when_invalid_rtc),
95 ),
96 encoder, offset, _depth
97 )
98 }
99 }
100 unsafe impl<
101 D: fidl::encoding::ResourceDialect,
102 T0: fidl::encoding::Encode<i64, D>,
103 T1: fidl::encoding::Encode<bool, D>,
104 T2: fidl::encoding::Encode<bool, D>,
105 T3: fidl::encoding::Encode<i64, D>,
106 T4: fidl::encoding::Encode<bool, D>,
107 T5: fidl::encoding::Encode<bool, D>,
108 T6: fidl::encoding::Encode<u32, D>,
109 T7: fidl::encoding::Encode<u32, D>,
110 T8: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
111 T9: fidl::encoding::Encode<bool, D>,
112 T10: fidl::encoding::Encode<u32, D>,
113 T11: fidl::encoding::Encode<bool, D>,
114 T12: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
115 T13: fidl::encoding::Encode<bool, D>,
116 T14: fidl::encoding::Encode<bool, D>,
117 T15: fidl::encoding::Encode<bool, D>,
118 T16: fidl::encoding::Encode<bool, D>,
119 T17: fidl::encoding::Encode<i64, D>,
120 T18: fidl::encoding::Encode<i64, D>,
121 T19: fidl::encoding::Encode<bool, D>,
122 T20: fidl::encoding::Encode<bool, D>,
123 > fidl::encoding::Encode<Config, D>
124 for (
125 T0,
126 T1,
127 T2,
128 T3,
129 T4,
130 T5,
131 T6,
132 T7,
133 T8,
134 T9,
135 T10,
136 T11,
137 T12,
138 T13,
139 T14,
140 T15,
141 T16,
142 T17,
143 T18,
144 T19,
145 T20,
146 )
147 {
148 #[inline]
149 unsafe fn encode(
150 self,
151 encoder: &mut fidl::encoding::Encoder<'_, D>,
152 offset: usize,
153 depth: fidl::encoding::Depth,
154 ) -> fidl::Result<()> {
155 encoder.debug_check_bounds::<Config>(offset);
156 unsafe {
159 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
160 (ptr as *mut u64).write_unaligned(0);
161 }
162 unsafe {
163 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
164 (ptr as *mut u64).write_unaligned(0);
165 }
166 unsafe {
167 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
168 (ptr as *mut u64).write_unaligned(0);
169 }
170 unsafe {
171 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
172 (ptr as *mut u64).write_unaligned(0);
173 }
174 unsafe {
175 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
176 (ptr as *mut u64).write_unaligned(0);
177 }
178 unsafe {
179 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(88);
180 (ptr as *mut u64).write_unaligned(0);
181 }
182 unsafe {
183 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(112);
184 (ptr as *mut u64).write_unaligned(0);
185 }
186 self.0.encode(encoder, offset + 0, depth)?;
188 self.1.encode(encoder, offset + 8, depth)?;
189 self.2.encode(encoder, offset + 9, depth)?;
190 self.3.encode(encoder, offset + 16, depth)?;
191 self.4.encode(encoder, offset + 24, depth)?;
192 self.5.encode(encoder, offset + 25, depth)?;
193 self.6.encode(encoder, offset + 28, depth)?;
194 self.7.encode(encoder, offset + 32, depth)?;
195 self.8.encode(encoder, offset + 40, depth)?;
196 self.9.encode(encoder, offset + 56, depth)?;
197 self.10.encode(encoder, offset + 60, depth)?;
198 self.11.encode(encoder, offset + 64, depth)?;
199 self.12.encode(encoder, offset + 72, depth)?;
200 self.13.encode(encoder, offset + 88, depth)?;
201 self.14.encode(encoder, offset + 89, depth)?;
202 self.15.encode(encoder, offset + 90, depth)?;
203 self.16.encode(encoder, offset + 91, depth)?;
204 self.17.encode(encoder, offset + 96, depth)?;
205 self.18.encode(encoder, offset + 104, depth)?;
206 self.19.encode(encoder, offset + 112, depth)?;
207 self.20.encode(encoder, offset + 113, depth)?;
208 Ok(())
209 }
210 }
211
212 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
213 #[inline(always)]
214 fn new_empty() -> Self {
215 Self {
216 back_off_time_between_pull_samples_sec: fidl::new_empty!(i64, D),
217 disable_delays: fidl::new_empty!(bool, D),
218 early_exit: fidl::new_empty!(bool, D),
219 first_sampling_delay_sec: fidl::new_empty!(i64, D),
220 has_always_on_counter: fidl::new_empty!(bool, D),
221 has_real_time_clock: fidl::new_empty!(bool, D),
222 initial_frequency_ppm: fidl::new_empty!(u32, D),
223 max_frequency_error_ppm: fidl::new_empty!(u32, D),
224 monitor_time_source_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
225 monitor_uses_pull: fidl::new_empty!(bool, D),
226 oscillator_error_std_dev_ppm: fidl::new_empty!(u32, D),
227 power_topology_integration_enabled: fidl::new_empty!(bool, D),
228 primary_time_source_url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
229 primary_uses_pull: fidl::new_empty!(bool, D),
230 serve_fuchsia_time_alarms: fidl::new_empty!(bool, D),
231 serve_fuchsia_time_external_adjust: fidl::new_empty!(bool, D),
232 serve_test_protocols: fidl::new_empty!(bool, D),
233 utc_max_allowed_delta_future_sec: fidl::new_empty!(i64, D),
234 utc_max_allowed_delta_past_sec: fidl::new_empty!(i64, D),
235 utc_start_at_startup: fidl::new_empty!(bool, D),
236 utc_start_at_startup_when_invalid_rtc: fidl::new_empty!(bool, D),
237 }
238 }
239
240 #[inline]
241 unsafe fn decode(
242 &mut self,
243 decoder: &mut fidl::encoding::Decoder<'_, D>,
244 offset: usize,
245 _depth: fidl::encoding::Depth,
246 ) -> fidl::Result<()> {
247 decoder.debug_check_bounds::<Self>(offset);
248 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
250 let padval = unsafe { (ptr as *const u64).read_unaligned() };
251 let mask = 0xffffffffffff0000u64;
252 let maskedval = padval & mask;
253 if maskedval != 0 {
254 return Err(fidl::Error::NonZeroPadding {
255 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
256 });
257 }
258 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
259 let padval = unsafe { (ptr as *const u64).read_unaligned() };
260 let mask = 0xffff0000u64;
261 let maskedval = padval & mask;
262 if maskedval != 0 {
263 return Err(fidl::Error::NonZeroPadding {
264 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
265 });
266 }
267 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
268 let padval = unsafe { (ptr as *const u64).read_unaligned() };
269 let mask = 0xffffffff00000000u64;
270 let maskedval = padval & mask;
271 if maskedval != 0 {
272 return Err(fidl::Error::NonZeroPadding {
273 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
274 });
275 }
276 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
277 let padval = unsafe { (ptr as *const u64).read_unaligned() };
278 let mask = 0xffffff00u64;
279 let maskedval = padval & mask;
280 if maskedval != 0 {
281 return Err(fidl::Error::NonZeroPadding {
282 padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
283 });
284 }
285 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
286 let padval = unsafe { (ptr as *const u64).read_unaligned() };
287 let mask = 0xffffffffffffff00u64;
288 let maskedval = padval & mask;
289 if maskedval != 0 {
290 return Err(fidl::Error::NonZeroPadding {
291 padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
292 });
293 }
294 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(88) };
295 let padval = unsafe { (ptr as *const u64).read_unaligned() };
296 let mask = 0xffffffff00000000u64;
297 let maskedval = padval & mask;
298 if maskedval != 0 {
299 return Err(fidl::Error::NonZeroPadding {
300 padding_start: offset + 88 + ((mask as u64).trailing_zeros() / 8) as usize,
301 });
302 }
303 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(112) };
304 let padval = unsafe { (ptr as *const u64).read_unaligned() };
305 let mask = 0xffffffffffff0000u64;
306 let maskedval = padval & mask;
307 if maskedval != 0 {
308 return Err(fidl::Error::NonZeroPadding {
309 padding_start: offset + 112 + ((mask as u64).trailing_zeros() / 8) as usize,
310 });
311 }
312 fidl::decode!(
313 i64,
314 D,
315 &mut self.back_off_time_between_pull_samples_sec,
316 decoder,
317 offset + 0,
318 _depth
319 )?;
320 fidl::decode!(bool, D, &mut self.disable_delays, decoder, offset + 8, _depth)?;
321 fidl::decode!(bool, D, &mut self.early_exit, decoder, offset + 9, _depth)?;
322 fidl::decode!(
323 i64,
324 D,
325 &mut self.first_sampling_delay_sec,
326 decoder,
327 offset + 16,
328 _depth
329 )?;
330 fidl::decode!(bool, D, &mut self.has_always_on_counter, decoder, offset + 24, _depth)?;
331 fidl::decode!(bool, D, &mut self.has_real_time_clock, decoder, offset + 25, _depth)?;
332 fidl::decode!(u32, D, &mut self.initial_frequency_ppm, decoder, offset + 28, _depth)?;
333 fidl::decode!(u32, D, &mut self.max_frequency_error_ppm, decoder, offset + 32, _depth)?;
334 fidl::decode!(
335 fidl::encoding::BoundedString<4096>,
336 D,
337 &mut self.monitor_time_source_url,
338 decoder,
339 offset + 40,
340 _depth
341 )?;
342 fidl::decode!(bool, D, &mut self.monitor_uses_pull, decoder, offset + 56, _depth)?;
343 fidl::decode!(
344 u32,
345 D,
346 &mut self.oscillator_error_std_dev_ppm,
347 decoder,
348 offset + 60,
349 _depth
350 )?;
351 fidl::decode!(
352 bool,
353 D,
354 &mut self.power_topology_integration_enabled,
355 decoder,
356 offset + 64,
357 _depth
358 )?;
359 fidl::decode!(
360 fidl::encoding::BoundedString<4096>,
361 D,
362 &mut self.primary_time_source_url,
363 decoder,
364 offset + 72,
365 _depth
366 )?;
367 fidl::decode!(bool, D, &mut self.primary_uses_pull, decoder, offset + 88, _depth)?;
368 fidl::decode!(
369 bool,
370 D,
371 &mut self.serve_fuchsia_time_alarms,
372 decoder,
373 offset + 89,
374 _depth
375 )?;
376 fidl::decode!(
377 bool,
378 D,
379 &mut self.serve_fuchsia_time_external_adjust,
380 decoder,
381 offset + 90,
382 _depth
383 )?;
384 fidl::decode!(bool, D, &mut self.serve_test_protocols, decoder, offset + 91, _depth)?;
385 fidl::decode!(
386 i64,
387 D,
388 &mut self.utc_max_allowed_delta_future_sec,
389 decoder,
390 offset + 96,
391 _depth
392 )?;
393 fidl::decode!(
394 i64,
395 D,
396 &mut self.utc_max_allowed_delta_past_sec,
397 decoder,
398 offset + 104,
399 _depth
400 )?;
401 fidl::decode!(bool, D, &mut self.utc_start_at_startup, decoder, offset + 112, _depth)?;
402 fidl::decode!(
403 bool,
404 D,
405 &mut self.utc_start_at_startup_when_invalid_rtc,
406 decoder,
407 offset + 113,
408 _depth
409 )?;
410 Ok(())
411 }
412 }
413}