wled_json_api_library/structures/cfg/cfg_ap.rs
1use serde;
2use serde::{Serialize, Deserialize};
3use serde_repr::{Deserialize_repr, Serialize_repr};
4use crate::structures::none_function;
5
6
7
8
9/// Information about the access point that the ESP hosts when enabled, or when connecting to other AP fails
10#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
11#[serde(rename_all = "camelCase")]
12pub struct Ap {
13 /// SSID of local AP
14 #[serde(skip_serializing_if = "Option::is_none")]
15 #[serde(default = "none_function")]
16 pub ssid: Option<String>,
17
18 /// Length of AP password (password is wled1234 by default if I remember correctly)
19 #[serde(skip_serializing_if = "Option::is_none")]
20 #[serde(default = "none_function")]
21 pub pskl: Option<usize>,
22
23 /// 2.4GHz WiFi AP channel (1-13)
24 #[serde(skip_serializing_if = "Option::is_none")]
25 #[serde(default = "none_function")]
26 pub chan: Option<u8>,
27
28 /// hidden AP SSID, no idea why this is a byte but it is
29 #[serde(skip_serializing_if = "Option::is_none")]
30 #[serde(default = "none_function")]
31 pub hide: Option<u8>,
32
33 /// access point opens when no connection after boot by default
34 #[serde(skip_serializing_if = "Option::is_none")]
35 #[serde(default = "none_function")]
36 pub behav: Option<ApBehaviourEnum>,
37
38 /// IP to host the website when on AP (default 4.3.2.1)
39 #[serde(skip_serializing_if = "Option::is_none")]
40 #[serde(default = "none_function")]
41 pub ip: Option<[u8; 4]>,
42}
43
44
45
46#[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug, Clone)]
47#[repr(u8)]
48pub enum ApBehaviourEnum {
49 /// Open AP when no connection after boot
50 ApBehaviorBootNoConn,
51 /// Open when no connection (either after boot or if connection is lost)
52 ApBehaviorNoConn,
53 /// Always open
54 ApBehaviorAlways,
55 /// Only when button pressed for 6 sec
56 ApBehaviorButtonOnly,
57 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
58 RSVD1,
59 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
60 RSVD2,
61 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
62 RSVD3,
63 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
64 RSVD4,
65 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
66 RSVD5,
67 /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more AP behaviours
68 RSVD6,
69
70}