Skip to main content

wlan_telemetry/
config.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::collections::HashSet;
6
7#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
8pub enum DeviceMobility {
9    #[default]
10    Mobile,
11    Stationary,
12}
13
14#[derive(Clone, Debug, Default, PartialEq, Eq)]
15pub struct TelemetryConfig {
16    pub enable_connect_disconnect: bool,
17    pub enable_iface_logger: bool,
18    pub enable_power_logger: bool,
19    pub enable_recovery_logger: bool,
20    pub enable_scan_logger: bool,
21    pub enable_pno_scan_logger: bool,
22    pub enable_sme_timeout_logger: bool,
23    pub enable_toggle_logger: bool,
24    pub enable_tx_power_scenario_logger: bool,
25    pub enable_client_iface_counters_logger: bool,
26    pub device_mobility: DeviceMobility,
27}
28
29#[derive(Clone, Debug, PartialEq, Eq)]
30pub enum CobaltAllowlist {
31    All,
32    Only(HashSet<u32>),
33}
34
35impl CobaltAllowlist {
36    pub fn contains(&self, metric_id: u32) -> bool {
37        match self {
38            CobaltAllowlist::All => true,
39            CobaltAllowlist::Only(set) => set.contains(&metric_id),
40        }
41    }
42}
43
44#[cfg(test)]
45mod tests {
46    use super::*;
47
48    #[fuchsia::test]
49    fn test_telemetry_config_default() {
50        let config = TelemetryConfig::default();
51        assert_eq!(config.device_mobility, DeviceMobility::Mobile);
52    }
53}