settings/setup/
types.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use bitflags::bitflags;
use serde::{Deserialize, Serialize};

#[derive(PartialEq, Default, Debug, Clone, Copy, Deserialize, Serialize)]
pub struct SetupInfo {
    pub configuration_interfaces: ConfigurationInterfaceFlags,
}

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct ConfigurationInterfaceFlags: u32 {
        const ETHERNET = 1 << 0;
        const WIFI = 1 << 1;
        const DEFAULT = Self::WIFI.bits();
    }
}

impl Default for ConfigurationInterfaceFlags {
    fn default() -> Self {
        Self::DEFAULT
    }
}

bitflags_serde_legacy::impl_traits!(ConfigurationInterfaceFlags);

#[derive(Debug, PartialEq, Copy, Clone)]
pub struct SetConfigurationInterfacesParams {
    pub config_interfaces_flags: ConfigurationInterfaceFlags,
    // Set true to reboot the device, otherwise, set it as false.
    pub should_reboot: bool,
}