diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-10-29 19:17:14 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-10-29 19:33:41 +0100 |
| commit | 3681c782765408685d14d7c80c88d4d18dee783d (patch) | |
| tree | cfcb924291340feb833c6933d489f17898c1906d /embassy-net-esp-hosted | |
| parent | 252664c1b0b4d81c34953c92bdcec84f7b5d3986 (diff) | |
net-esp-hosted: update proto definitions to latest esp-hosted-fg.
Diffstat (limited to 'embassy-net-esp-hosted')
| -rw-r--r-- | embassy-net-esp-hosted/src/control.rs | 33 | ||||
| -rw-r--r-- | embassy-net-esp-hosted/src/esp_hosted_config.proto | 205 | ||||
| -rw-r--r-- | embassy-net-esp-hosted/src/lib.rs | 4 |
3 files changed, 225 insertions, 17 deletions
diff --git a/embassy-net-esp-hosted/src/control.rs b/embassy-net-esp-hosted/src/control.rs index a7f5168c2..38ec648b4 100644 --- a/embassy-net-esp-hosted/src/control.rs +++ b/embassy-net-esp-hosted/src/control.rs | |||
| @@ -60,9 +60,11 @@ pub struct Status { | |||
| 60 | macro_rules! ioctl { | 60 | macro_rules! ioctl { |
| 61 | ($self:ident, $req_variant:ident, $resp_variant:ident, $req:ident, $resp:ident) => { | 61 | ($self:ident, $req_variant:ident, $resp_variant:ident, $req:ident, $resp:ident) => { |
| 62 | let mut msg = proto::CtrlMsg { | 62 | let mut msg = proto::CtrlMsg { |
| 63 | r#msg_id: proto::CtrlMsgId::$req_variant, | 63 | msg_id: proto::CtrlMsgId::$req_variant, |
| 64 | r#msg_type: proto::CtrlMsgType::Req, | 64 | msg_type: proto::CtrlMsgType::Req, |
| 65 | r#payload: Some(proto::CtrlMsg_::Payload::$req_variant($req)), | 65 | payload: Some(proto::CtrlMsg_::Payload::$req_variant($req)), |
| 66 | req_resp_type: 0, | ||
| 67 | uid: 0, | ||
| 66 | }; | 68 | }; |
| 67 | $self.ioctl(&mut msg).await?; | 69 | $self.ioctl(&mut msg).await?; |
| 68 | #[allow(unused_mut)] | 70 | #[allow(unused_mut)] |
| @@ -117,15 +119,22 @@ impl<'a> Control<'a> { | |||
| 117 | 119 | ||
| 118 | /// Connect to the network identified by ssid using the provided password. | 120 | /// Connect to the network identified by ssid using the provided password. |
| 119 | pub async fn connect(&mut self, ssid: &str, password: &str) -> Result<(), Error> { | 121 | pub async fn connect(&mut self, ssid: &str, password: &str) -> Result<(), Error> { |
| 122 | const WIFI_BAND_MODE_AUTO: i32 = 3; // 2.4GHz + 5GHz | ||
| 123 | |||
| 120 | let req = proto::CtrlMsg_Req_ConnectAP { | 124 | let req = proto::CtrlMsg_Req_ConnectAP { |
| 121 | r#ssid: unwrap!(String::try_from(ssid)), | 125 | ssid: unwrap!(String::try_from(ssid)), |
| 122 | r#pwd: unwrap!(String::try_from(password)), | 126 | pwd: unwrap!(String::try_from(password)), |
| 123 | r#bssid: String::new(), | 127 | bssid: String::new(), |
| 124 | r#listen_interval: 3, | 128 | listen_interval: 3, |
| 125 | r#is_wpa3_supported: true, | 129 | is_wpa3_supported: true, |
| 130 | band_mode: WIFI_BAND_MODE_AUTO, | ||
| 126 | }; | 131 | }; |
| 127 | ioctl!(self, ReqConnectAp, RespConnectAp, req, resp); | 132 | ioctl!(self, ReqConnectAp, RespConnectAp, req, resp); |
| 133 | |||
| 134 | // TODO: in newer esp-hosted firmwares that added EventStationConnectedToAp | ||
| 135 | // the connect ioctl seems to be async, so we shouldn't immediately set LinkState::Up here. | ||
| 128 | self.state_ch.set_link_state(LinkState::Up); | 136 | self.state_ch.set_link_state(LinkState::Up); |
| 137 | |||
| 129 | Ok(()) | 138 | Ok(()) |
| 130 | } | 139 | } |
| 131 | 140 | ||
| @@ -140,8 +149,8 @@ impl<'a> Control<'a> { | |||
| 140 | /// duration in seconds, clamped to [10, 3600] | 149 | /// duration in seconds, clamped to [10, 3600] |
| 141 | async fn set_heartbeat(&mut self, duration: u32) -> Result<(), Error> { | 150 | async fn set_heartbeat(&mut self, duration: u32) -> Result<(), Error> { |
| 142 | let req = proto::CtrlMsg_Req_ConfigHeartbeat { | 151 | let req = proto::CtrlMsg_Req_ConfigHeartbeat { |
| 143 | r#enable: true, | 152 | enable: true, |
| 144 | r#duration: duration as i32, | 153 | duration: duration as i32, |
| 145 | }; | 154 | }; |
| 146 | ioctl!(self, ReqConfigHeartbeat, RespConfigHeartbeat, req, resp); | 155 | ioctl!(self, ReqConfigHeartbeat, RespConfigHeartbeat, req, resp); |
| 147 | Ok(()) | 156 | Ok(()) |
| @@ -149,7 +158,7 @@ impl<'a> Control<'a> { | |||
| 149 | 158 | ||
| 150 | async fn get_mac_addr(&mut self) -> Result<[u8; 6], Error> { | 159 | async fn get_mac_addr(&mut self) -> Result<[u8; 6], Error> { |
| 151 | let req = proto::CtrlMsg_Req_GetMacAddress { | 160 | let req = proto::CtrlMsg_Req_GetMacAddress { |
| 152 | r#mode: WifiMode::Sta as _, | 161 | mode: WifiMode::Sta as _, |
| 153 | }; | 162 | }; |
| 154 | ioctl!(self, ReqGetMacAddress, RespGetMacAddress, req, resp); | 163 | ioctl!(self, ReqGetMacAddress, RespGetMacAddress, req, resp); |
| 155 | let mac_str = core::str::from_utf8(&resp.mac).map_err(|_| Error::Internal)?; | 164 | let mac_str = core::str::from_utf8(&resp.mac).map_err(|_| Error::Internal)?; |
| @@ -157,7 +166,7 @@ impl<'a> Control<'a> { | |||
| 157 | } | 166 | } |
| 158 | 167 | ||
| 159 | async fn set_wifi_mode(&mut self, mode: u32) -> Result<(), Error> { | 168 | async fn set_wifi_mode(&mut self, mode: u32) -> Result<(), Error> { |
| 160 | let req = proto::CtrlMsg_Req_SetMode { r#mode: mode as i32 }; | 169 | let req = proto::CtrlMsg_Req_SetMode { mode: mode as i32 }; |
| 161 | ioctl!(self, ReqSetWifiMode, RespSetWifiMode, req, resp); | 170 | ioctl!(self, ReqSetWifiMode, RespSetWifiMode, req, resp); |
| 162 | 171 | ||
| 163 | Ok(()) | 172 | Ok(()) |
diff --git a/embassy-net-esp-hosted/src/esp_hosted_config.proto b/embassy-net-esp-hosted/src/esp_hosted_config.proto index aa1bfde64..7d626207e 100644 --- a/embassy-net-esp-hosted/src/esp_hosted_config.proto +++ b/embassy-net-esp-hosted/src/esp_hosted_config.proto | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | /* Copyright (C) 2015-2025 Espressif Systems (Shanghai) PTE LTD */ | ||
| 2 | /* SPDX-License-Identifier: GPL-2.0-only OR Apache-2.0 */ | ||
| 3 | |||
| 1 | syntax = "proto3"; | 4 | syntax = "proto3"; |
| 2 | 5 | ||
| 3 | /* Enums similar to ESP IDF */ | 6 | /* Enums similar to ESP IDF */ |
| @@ -28,9 +31,10 @@ enum Ctrl_WifiBw { | |||
| 28 | } | 31 | } |
| 29 | 32 | ||
| 30 | enum Ctrl_WifiPowerSave { | 33 | enum Ctrl_WifiPowerSave { |
| 31 | PS_Invalid = 0; | 34 | NO_PS = 0; |
| 32 | MIN_MODEM = 1; | 35 | MIN_MODEM = 1; |
| 33 | MAX_MODEM = 2; | 36 | MAX_MODEM = 2; |
| 37 | PS_Invalid = 3; | ||
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | enum Ctrl_WifiSecProt { | 40 | enum Ctrl_WifiSecProt { |
| @@ -96,9 +100,16 @@ enum CtrlMsgId { | |||
| 96 | Req_GetWifiCurrTxPower = 120; | 100 | Req_GetWifiCurrTxPower = 120; |
| 97 | 101 | ||
| 98 | Req_ConfigHeartbeat = 121; | 102 | Req_ConfigHeartbeat = 121; |
| 103 | Req_EnableDisable = 122; | ||
| 104 | Req_GetFwVersion = 123; | ||
| 105 | Req_SetCountryCode = 124; | ||
| 106 | Req_GetCountryCode = 125; | ||
| 107 | Req_SetDhcpDnsStatus = 126; | ||
| 108 | Req_GetDhcpDnsStatus = 127; | ||
| 109 | Req_Custom_RPC_Unserialised_Msg = 128; | ||
| 99 | /* Add new control path command response before Req_Max | 110 | /* Add new control path command response before Req_Max |
| 100 | * and update Req_Max */ | 111 | * and update Req_Max */ |
| 101 | Req_Max = 122; | 112 | Req_Max = 129; |
| 102 | 113 | ||
| 103 | /** Response Msgs **/ | 114 | /** Response Msgs **/ |
| 104 | Resp_Base = 200; | 115 | Resp_Base = 200; |
| @@ -130,9 +141,16 @@ enum CtrlMsgId { | |||
| 130 | Resp_GetWifiCurrTxPower = 220; | 141 | Resp_GetWifiCurrTxPower = 220; |
| 131 | 142 | ||
| 132 | Resp_ConfigHeartbeat = 221; | 143 | Resp_ConfigHeartbeat = 221; |
| 144 | Resp_EnableDisable = 222; | ||
| 145 | Resp_GetFwVersion = 223; | ||
| 146 | Resp_SetCountryCode = 224; | ||
| 147 | Resp_GetCountryCode = 225; | ||
| 148 | Resp_SetDhcpDnsStatus = 226; | ||
| 149 | Resp_GetDhcpDnsStatus = 227; | ||
| 150 | Resp_Custom_RPC_Unserialised_Msg = 228; | ||
| 133 | /* Add new control path command response before Resp_Max | 151 | /* Add new control path command response before Resp_Max |
| 134 | * and update Resp_Max */ | 152 | * and update Resp_Max */ |
| 135 | Resp_Max = 222; | 153 | Resp_Max = 229; |
| 136 | 154 | ||
| 137 | /** Event Msgs **/ | 155 | /** Event Msgs **/ |
| 138 | Event_Base = 300; | 156 | Event_Base = 300; |
| @@ -140,9 +158,22 @@ enum CtrlMsgId { | |||
| 140 | Event_Heartbeat = 302; | 158 | Event_Heartbeat = 302; |
| 141 | Event_StationDisconnectFromAP = 303; | 159 | Event_StationDisconnectFromAP = 303; |
| 142 | Event_StationDisconnectFromESPSoftAP = 304; | 160 | Event_StationDisconnectFromESPSoftAP = 304; |
| 161 | Event_StationConnectedToAP = 305; | ||
| 162 | Event_StationConnectedToESPSoftAP = 306; | ||
| 163 | Event_SetDhcpDnsStatus = 307; | ||
| 164 | Event_Custom_RPC_Unserialised_Msg = 308; | ||
| 143 | /* Add new control path command notification before Event_Max | 165 | /* Add new control path command notification before Event_Max |
| 144 | * and update Event_Max */ | 166 | * and update Event_Max */ |
| 145 | Event_Max = 305; | 167 | Event_Max = 309; |
| 168 | } | ||
| 169 | |||
| 170 | enum HostedFeature { | ||
| 171 | Hosted_InvalidFeature = 0; | ||
| 172 | Hosted_Wifi = 1; | ||
| 173 | Hosted_Bluetooth = 2; | ||
| 174 | Hosted_Is_Network_Split_On = 3; | ||
| 175 | |||
| 176 | /* Add your new features here and re-build prot using build_proto.sh */ | ||
| 146 | } | 177 | } |
| 147 | 178 | ||
| 148 | /* internal supporting structures for CtrlMsg */ | 179 | /* internal supporting structures for CtrlMsg */ |
| @@ -213,6 +244,7 @@ message CtrlMsg_Resp_GetAPConfig { | |||
| 213 | int32 chnl = 4; | 244 | int32 chnl = 4; |
| 214 | Ctrl_WifiSecProt sec_prot = 5; | 245 | Ctrl_WifiSecProt sec_prot = 5; |
| 215 | int32 resp = 6; | 246 | int32 resp = 6; |
| 247 | int32 band_mode = 7; | ||
| 216 | } | 248 | } |
| 217 | 249 | ||
| 218 | message CtrlMsg_Req_ConnectAP { | 250 | message CtrlMsg_Req_ConnectAP { |
| @@ -221,11 +253,13 @@ message CtrlMsg_Req_ConnectAP { | |||
| 221 | string bssid = 3; | 253 | string bssid = 3; |
| 222 | bool is_wpa3_supported = 4; | 254 | bool is_wpa3_supported = 4; |
| 223 | int32 listen_interval = 5; | 255 | int32 listen_interval = 5; |
| 256 | int32 band_mode = 6; | ||
| 224 | } | 257 | } |
| 225 | 258 | ||
| 226 | message CtrlMsg_Resp_ConnectAP { | 259 | message CtrlMsg_Resp_ConnectAP { |
| 227 | int32 resp = 1; | 260 | int32 resp = 1; |
| 228 | bytes mac = 2; | 261 | bytes mac = 2; |
| 262 | int32 band_mode = 3; | ||
| 229 | } | 263 | } |
| 230 | 264 | ||
| 231 | message CtrlMsg_Req_GetSoftAPConfig { | 265 | message CtrlMsg_Req_GetSoftAPConfig { |
| @@ -240,6 +274,7 @@ message CtrlMsg_Resp_GetSoftAPConfig { | |||
| 240 | bool ssid_hidden = 6; | 274 | bool ssid_hidden = 6; |
| 241 | int32 bw = 7; | 275 | int32 bw = 7; |
| 242 | int32 resp = 8; | 276 | int32 resp = 8; |
| 277 | int32 band_mode = 9; | ||
| 243 | } | 278 | } |
| 244 | 279 | ||
| 245 | message CtrlMsg_Req_StartSoftAP { | 280 | message CtrlMsg_Req_StartSoftAP { |
| @@ -250,11 +285,13 @@ message CtrlMsg_Req_StartSoftAP { | |||
| 250 | int32 max_conn = 5; | 285 | int32 max_conn = 5; |
| 251 | bool ssid_hidden = 6; | 286 | bool ssid_hidden = 6; |
| 252 | int32 bw = 7; | 287 | int32 bw = 7; |
| 288 | int32 band_mode = 8; | ||
| 253 | } | 289 | } |
| 254 | 290 | ||
| 255 | message CtrlMsg_Resp_StartSoftAP { | 291 | message CtrlMsg_Resp_StartSoftAP { |
| 256 | int32 resp = 1; | 292 | int32 resp = 1; |
| 257 | bytes mac = 2; | 293 | bytes mac = 2; |
| 294 | int32 band_mode = 3; | ||
| 258 | } | 295 | } |
| 259 | 296 | ||
| 260 | message CtrlMsg_Req_ScanResult { | 297 | message CtrlMsg_Req_ScanResult { |
| @@ -302,7 +339,7 @@ message CtrlMsg_Req_VendorIEData { | |||
| 302 | int32 length = 2; | 339 | int32 length = 2; |
| 303 | bytes vendor_oui = 3; | 340 | bytes vendor_oui = 3; |
| 304 | int32 vendor_oui_type = 4; | 341 | int32 vendor_oui_type = 4; |
| 305 | bytes payload = 5; | 342 | bytes payload = 5; |
| 306 | } | 343 | } |
| 307 | 344 | ||
| 308 | message CtrlMsg_Req_SetSoftAPVendorSpecificIE { | 345 | message CtrlMsg_Req_SetSoftAPVendorSpecificIE { |
| @@ -341,6 +378,81 @@ message CtrlMsg_Resp_ConfigHeartbeat { | |||
| 341 | int32 resp = 1; | 378 | int32 resp = 1; |
| 342 | } | 379 | } |
| 343 | 380 | ||
| 381 | message CtrlMsg_Req_EnableDisable { | ||
| 382 | uint32 feature = 1; | ||
| 383 | bool enable = 2; | ||
| 384 | } | ||
| 385 | |||
| 386 | message CtrlMsg_Resp_EnableDisable { | ||
| 387 | int32 resp = 1; | ||
| 388 | } | ||
| 389 | |||
| 390 | message CtrlMsg_Req_GetFwVersion { | ||
| 391 | } | ||
| 392 | |||
| 393 | message CtrlMsg_Resp_GetFwVersion { | ||
| 394 | int32 resp = 1; | ||
| 395 | string name = 2; | ||
| 396 | uint32 major1 = 3; | ||
| 397 | uint32 major2 = 4; | ||
| 398 | uint32 minor = 5; | ||
| 399 | uint32 rev_patch1 = 6; | ||
| 400 | uint32 rev_patch2 = 7; | ||
| 401 | } | ||
| 402 | |||
| 403 | message CtrlMsg_Req_SetCountryCode { | ||
| 404 | bytes country = 1; | ||
| 405 | bool ieee80211d_enabled = 2; | ||
| 406 | } | ||
| 407 | |||
| 408 | message CtrlMsg_Resp_SetCountryCode { | ||
| 409 | int32 resp = 1; | ||
| 410 | } | ||
| 411 | |||
| 412 | message CtrlMsg_Req_GetCountryCode { | ||
| 413 | } | ||
| 414 | |||
| 415 | message CtrlMsg_Resp_GetCountryCode { | ||
| 416 | int32 resp = 1; | ||
| 417 | bytes country = 2; | ||
| 418 | } | ||
| 419 | |||
| 420 | message CtrlMsg_Req_SetDhcpDnsStatus { | ||
| 421 | int32 iface = 1; | ||
| 422 | int32 net_link_up = 2; | ||
| 423 | |||
| 424 | int32 dhcp_up = 3; | ||
| 425 | bytes dhcp_ip = 4; | ||
| 426 | bytes dhcp_nm = 5; | ||
| 427 | bytes dhcp_gw = 6; | ||
| 428 | |||
| 429 | int32 dns_up = 7; | ||
| 430 | bytes dns_ip = 8; | ||
| 431 | int32 dns_type = 9; | ||
| 432 | } | ||
| 433 | |||
| 434 | message CtrlMsg_Resp_SetDhcpDnsStatus { | ||
| 435 | int32 resp = 1; | ||
| 436 | } | ||
| 437 | |||
| 438 | message CtrlMsg_Req_GetDhcpDnsStatus { | ||
| 439 | } | ||
| 440 | |||
| 441 | message CtrlMsg_Resp_GetDhcpDnsStatus { | ||
| 442 | int32 resp = 1; | ||
| 443 | int32 iface = 2; | ||
| 444 | int32 net_link_up = 3; | ||
| 445 | |||
| 446 | int32 dhcp_up = 4; | ||
| 447 | bytes dhcp_ip = 5; | ||
| 448 | bytes dhcp_nm = 6; | ||
| 449 | bytes dhcp_gw = 7; | ||
| 450 | |||
| 451 | int32 dns_up = 8; | ||
| 452 | bytes dns_ip = 9; | ||
| 453 | int32 dns_type = 10; | ||
| 454 | } | ||
| 455 | |||
| 344 | /** Event structure **/ | 456 | /** Event structure **/ |
| 345 | message CtrlMsg_Event_ESPInit { | 457 | message CtrlMsg_Event_ESPInit { |
| 346 | bytes init_data = 1; | 458 | bytes init_data = 1; |
| @@ -352,11 +464,70 @@ message CtrlMsg_Event_Heartbeat { | |||
| 352 | 464 | ||
| 353 | message CtrlMsg_Event_StationDisconnectFromAP { | 465 | message CtrlMsg_Event_StationDisconnectFromAP { |
| 354 | int32 resp = 1; | 466 | int32 resp = 1; |
| 467 | bytes ssid = 2; | ||
| 468 | uint32 ssid_len = 3; | ||
| 469 | bytes bssid = 4; | ||
| 470 | uint32 reason = 5; | ||
| 471 | int32 rssi = 6; | ||
| 355 | } | 472 | } |
| 356 | 473 | ||
| 474 | message CtrlMsg_Event_StationConnectedToAP { | ||
| 475 | int32 resp = 1; | ||
| 476 | bytes ssid = 2; | ||
| 477 | uint32 ssid_len = 3; | ||
| 478 | bytes bssid = 4; | ||
| 479 | uint32 channel = 5; | ||
| 480 | int32 authmode = 6; | ||
| 481 | int32 aid = 7; | ||
| 482 | } | ||
| 483 | |||
| 484 | |||
| 357 | message CtrlMsg_Event_StationDisconnectFromESPSoftAP { | 485 | message CtrlMsg_Event_StationDisconnectFromESPSoftAP { |
| 358 | int32 resp = 1; | 486 | int32 resp = 1; |
| 359 | bytes mac = 2; | 487 | bytes mac = 2; |
| 488 | uint32 aid = 3; | ||
| 489 | bool is_mesh_child = 4; | ||
| 490 | uint32 reason = 5; | ||
| 491 | } | ||
| 492 | |||
| 493 | message CtrlMsg_Event_StationConnectedToESPSoftAP { | ||
| 494 | int32 resp = 1; | ||
| 495 | bytes mac = 2; | ||
| 496 | uint32 aid = 3; | ||
| 497 | bool is_mesh_child = 4; | ||
| 498 | } | ||
| 499 | |||
| 500 | message CtrlMsg_Event_SetDhcpDnsStatus { | ||
| 501 | int32 iface = 1; | ||
| 502 | int32 net_link_up = 2; | ||
| 503 | |||
| 504 | int32 dhcp_up = 3; | ||
| 505 | bytes dhcp_ip = 4; | ||
| 506 | bytes dhcp_nm = 5; | ||
| 507 | bytes dhcp_gw = 6; | ||
| 508 | |||
| 509 | int32 dns_up = 7; | ||
| 510 | bytes dns_ip = 8; | ||
| 511 | int32 dns_type = 9; | ||
| 512 | int32 resp = 10; | ||
| 513 | } | ||
| 514 | |||
| 515 | /* Add Custom RPC message structures after existing message structures to make it easily notice */ | ||
| 516 | message CtrlMsg_Req_CustomRpcUnserialisedMsg { | ||
| 517 | uint32 custom_msg_id = 1; | ||
| 518 | bytes data = 2; | ||
| 519 | } | ||
| 520 | |||
| 521 | message CtrlMsg_Resp_CustomRpcUnserialisedMsg { | ||
| 522 | int32 resp = 1; | ||
| 523 | uint32 custom_msg_id = 2; | ||
| 524 | bytes data = 3; | ||
| 525 | } | ||
| 526 | |||
| 527 | message CtrlMsg_Event_CustomRpcUnserialisedMsg { | ||
| 528 | int32 resp = 1; | ||
| 529 | uint32 custom_evt_id = 2; | ||
| 530 | bytes data = 3; | ||
| 360 | } | 531 | } |
| 361 | 532 | ||
| 362 | message CtrlMsg { | 533 | message CtrlMsg { |
| @@ -366,6 +537,12 @@ message CtrlMsg { | |||
| 366 | /* msg id */ | 537 | /* msg id */ |
| 367 | CtrlMsgId msg_id = 2; | 538 | CtrlMsgId msg_id = 2; |
| 368 | 539 | ||
| 540 | /* UID of message */ | ||
| 541 | int32 uid = 3; | ||
| 542 | |||
| 543 | /* Request/response type: sync or async */ | ||
| 544 | uint32 req_resp_type = 4; | ||
| 545 | |||
| 369 | /* union of all msg ids */ | 546 | /* union of all msg ids */ |
| 370 | oneof payload { | 547 | oneof payload { |
| 371 | /** Requests **/ | 548 | /** Requests **/ |
| @@ -395,6 +572,13 @@ message CtrlMsg { | |||
| 395 | CtrlMsg_Req_SetWifiMaxTxPower req_set_wifi_max_tx_power = 119; | 572 | CtrlMsg_Req_SetWifiMaxTxPower req_set_wifi_max_tx_power = 119; |
| 396 | CtrlMsg_Req_GetWifiCurrTxPower req_get_wifi_curr_tx_power = 120; | 573 | CtrlMsg_Req_GetWifiCurrTxPower req_get_wifi_curr_tx_power = 120; |
| 397 | CtrlMsg_Req_ConfigHeartbeat req_config_heartbeat = 121; | 574 | CtrlMsg_Req_ConfigHeartbeat req_config_heartbeat = 121; |
| 575 | CtrlMsg_Req_EnableDisable req_enable_disable_feat = 122; | ||
| 576 | CtrlMsg_Req_GetFwVersion req_get_fw_version = 123; | ||
| 577 | CtrlMsg_Req_SetCountryCode req_set_country_code = 124; | ||
| 578 | CtrlMsg_Req_GetCountryCode req_get_country_code = 125; | ||
| 579 | CtrlMsg_Req_SetDhcpDnsStatus req_set_dhcp_dns_status = 126; | ||
| 580 | CtrlMsg_Req_GetDhcpDnsStatus req_get_dhcp_dns_status = 127; | ||
| 581 | CtrlMsg_Req_CustomRpcUnserialisedMsg req_custom_rpc_unserialised_msg = 128; | ||
| 398 | 582 | ||
| 399 | /** Responses **/ | 583 | /** Responses **/ |
| 400 | CtrlMsg_Resp_GetMacAddress resp_get_mac_address = 201; | 584 | CtrlMsg_Resp_GetMacAddress resp_get_mac_address = 201; |
| @@ -422,11 +606,22 @@ message CtrlMsg { | |||
| 422 | CtrlMsg_Resp_SetWifiMaxTxPower resp_set_wifi_max_tx_power = 219; | 606 | CtrlMsg_Resp_SetWifiMaxTxPower resp_set_wifi_max_tx_power = 219; |
| 423 | CtrlMsg_Resp_GetWifiCurrTxPower resp_get_wifi_curr_tx_power = 220; | 607 | CtrlMsg_Resp_GetWifiCurrTxPower resp_get_wifi_curr_tx_power = 220; |
| 424 | CtrlMsg_Resp_ConfigHeartbeat resp_config_heartbeat = 221; | 608 | CtrlMsg_Resp_ConfigHeartbeat resp_config_heartbeat = 221; |
| 609 | CtrlMsg_Resp_EnableDisable resp_enable_disable_feat = 222; | ||
| 610 | CtrlMsg_Resp_GetFwVersion resp_get_fw_version = 223; | ||
| 611 | CtrlMsg_Resp_SetCountryCode resp_set_country_code = 224; | ||
| 612 | CtrlMsg_Resp_GetCountryCode resp_get_country_code = 225; | ||
| 613 | CtrlMsg_Resp_SetDhcpDnsStatus resp_set_dhcp_dns_status = 226; | ||
| 614 | CtrlMsg_Resp_GetDhcpDnsStatus resp_get_dhcp_dns_status = 227; | ||
| 615 | CtrlMsg_Resp_CustomRpcUnserialisedMsg resp_custom_rpc_unserialised_msg = 228; | ||
| 425 | 616 | ||
| 426 | /** Notifications **/ | 617 | /** Notifications **/ |
| 427 | CtrlMsg_Event_ESPInit event_esp_init = 301; | 618 | CtrlMsg_Event_ESPInit event_esp_init = 301; |
| 428 | CtrlMsg_Event_Heartbeat event_heartbeat = 302; | 619 | CtrlMsg_Event_Heartbeat event_heartbeat = 302; |
| 429 | CtrlMsg_Event_StationDisconnectFromAP event_station_disconnect_from_AP = 303; | 620 | CtrlMsg_Event_StationDisconnectFromAP event_station_disconnect_from_AP = 303; |
| 430 | CtrlMsg_Event_StationDisconnectFromESPSoftAP event_station_disconnect_from_ESP_SoftAP = 304; | 621 | CtrlMsg_Event_StationDisconnectFromESPSoftAP event_station_disconnect_from_ESP_SoftAP = 304; |
| 622 | CtrlMsg_Event_StationConnectedToAP event_station_connected_to_AP = 305; | ||
| 623 | CtrlMsg_Event_StationConnectedToESPSoftAP event_station_connected_to_ESP_SoftAP = 306; | ||
| 624 | CtrlMsg_Event_SetDhcpDnsStatus event_set_dhcp_dns_status = 307; | ||
| 625 | CtrlMsg_Event_CustomRpcUnserialisedMsg event_custom_rpc_unserialised_msg = 308; | ||
| 431 | } | 626 | } |
| 432 | } | 627 | } |
diff --git a/embassy-net-esp-hosted/src/lib.rs b/embassy-net-esp-hosted/src/lib.rs index 1fbed3e83..a6c806c46 100644 --- a/embassy-net-esp-hosted/src/lib.rs +++ b/embassy-net-esp-hosted/src/lib.rs | |||
| @@ -340,6 +340,10 @@ where | |||
| 340 | match payload { | 340 | match payload { |
| 341 | CtrlMsg_::Payload::EventEspInit(_) => self.shared.init_done(), | 341 | CtrlMsg_::Payload::EventEspInit(_) => self.shared.init_done(), |
| 342 | CtrlMsg_::Payload::EventHeartbeat(_) => self.heartbeat_deadline = Instant::now() + HEARTBEAT_MAX_GAP, | 342 | CtrlMsg_::Payload::EventHeartbeat(_) => self.heartbeat_deadline = Instant::now() + HEARTBEAT_MAX_GAP, |
| 343 | CtrlMsg_::Payload::EventStationConnectedToAp(e) => { | ||
| 344 | info!("connected, code {}", e.resp); | ||
| 345 | self.state_ch.set_link_state(LinkState::Up); | ||
| 346 | } | ||
| 343 | CtrlMsg_::Payload::EventStationDisconnectFromAp(e) => { | 347 | CtrlMsg_::Payload::EventStationDisconnectFromAp(e) => { |
| 344 | info!("disconnected, code {}", e.resp); | 348 | info!("disconnected, code {}", e.resp); |
| 345 | self.state_ch.set_link_state(LinkState::Down); | 349 | self.state_ch.set_link_state(LinkState::Down); |
