Skip to content

Commit

Permalink
Updated thunder_wifi.rs (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsenth200 authored Aug 29, 2024
1 parent 14dff82 commit 3fc9f71
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions device/thunder_ripple_sdk/src/processors/thunder_wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct ThunderSSID {
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct SSIDEventResponse {
#[serde(default)]
more_data: bool,
ssids: Vec<ThunderSSID>,
}
Expand Down Expand Up @@ -268,7 +269,19 @@ impl ThunderWifiRequestProcessor {
tokio::spawn(async move {
if let Ok(Some(m)) = timeout(Duration::from_secs(timeout_value), sub_rx.recv()).await {
let mut list = Vec::new();
let ssid_response: SSIDEventResponse = serde_json::from_value(m.message).unwrap();
let ssid_response: SSIDEventResponse = match serde_json::from_value(m.message) {
Ok(response) => response,
Err(e) => {
let access_point_list = AccessPointList { list: Vec::new() };
info!(
"Failed to parse SSIDEventResponse: {}. Access point list: {:#?}",
e, access_point_list
);
tx.send(access_point_list).await.unwrap();
return;
}
};

let mut dedup = Vec::new();
for ssid in ssid_response.ssids {
let check_ssid = ssid.ssid.clone();
Expand Down Expand Up @@ -300,7 +313,6 @@ impl ThunderWifiRequestProcessor {
});

// Receive the access point list sent from the Tokio task

rx.recv().await.unwrap()
}

Expand Down

0 comments on commit 3fc9f71

Please sign in to comment.