Skip to content

Commit

Permalink
Fix examples for the new heapless
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Dec 30, 2023
1 parent 7bca238 commit 9f9e4b4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
6 changes: 4 additions & 2 deletions examples/http_request.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Simple HTTP client example.
use core::convert::TryInto;

use embedded_svc::{
http::{client::Client as HttpClient, Method},
io::Write,
Expand Down Expand Up @@ -166,10 +168,10 @@ fn post_chunked_request(client: &mut HttpClient<EspHttpConnection>) -> anyhow::R

fn connect_wifi(wifi: &mut BlockingWifi<EspWifi<'static>>) -> anyhow::Result<()> {
let wifi_configuration: Configuration = Configuration::Client(ClientConfiguration {
ssid: SSID.into(),
ssid: SSID.try_into().unwrap(),
bssid: None,
auth_method: AuthMethod::WPA2Personal,
password: PASSWORD.into(),
password: PASSWORD.try_into().unwrap(),
channel: None,
});

Expand Down
6 changes: 4 additions & 2 deletions examples/json_post_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//!
//! Go to 192.168.71.1 to test
use core::convert::TryInto;

use embedded_svc::{
http::{Headers, Method},
io::{Read, Write},
Expand Down Expand Up @@ -98,10 +100,10 @@ fn create_server() -> anyhow::Result<EspHttpServer<'static>> {
)?;

let wifi_configuration = wifi::Configuration::AccessPoint(AccessPointConfiguration {
ssid: SSID.into(),
ssid: SSID.try_into().unwrap(),
ssid_hidden: true,
auth_method: AuthMethod::WPA2Personal,
password: PASSWORD.into(),
password: PASSWORD.try_into().unwrap(),
channel: CHANNEL,
..Default::default()
});
Expand Down
7 changes: 4 additions & 3 deletions examples/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
//!
//! Add your own ssid and password
use std::ffi::CStr;
use core::convert::TryInto;
use core::ffi::CStr;

use embedded_svc::wifi::{AuthMethod, ClientConfiguration, Configuration};

Expand Down Expand Up @@ -98,10 +99,10 @@ fn main() -> anyhow::Result<()> {

fn connect_wifi(wifi: &mut BlockingWifi<EspWifi<'static>>) -> anyhow::Result<()> {
let wifi_configuration: Configuration = Configuration::Client(ClientConfiguration {
ssid: SSID.into(),
ssid: SSID.try_into().unwrap(),
bssid: None,
auth_method: AuthMethod::WPA2Personal,
password: PASSWORD.into(),
password: PASSWORD.try_into().unwrap(),
channel: None,
});

Expand Down
6 changes: 4 additions & 2 deletions examples/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//!
//! Add your own ssid and password
use core::convert::TryInto;

use embedded_svc::wifi::{AuthMethod, ClientConfiguration, Configuration};

use esp_idf_svc::hal::prelude::Peripherals;
Expand Down Expand Up @@ -42,10 +44,10 @@ fn main() -> anyhow::Result<()> {

fn connect_wifi(wifi: &mut BlockingWifi<EspWifi<'static>>) -> anyhow::Result<()> {
let wifi_configuration: Configuration = Configuration::Client(ClientConfiguration {
ssid: SSID.into(),
ssid: SSID.try_into().unwrap(),
bssid: None,
auth_method: AuthMethod::WPA2Personal,
password: PASSWORD.into(),
password: PASSWORD.try_into().unwrap(),
channel: None,
});

Expand Down
5 changes: 3 additions & 2 deletions examples/ws_guessing_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! Go to http://192.168.71.1 to play
use core::cmp::Ordering;
use core::convert::TryInto;

use embedded_svc::{
http::Method,
Expand Down Expand Up @@ -223,10 +224,10 @@ fn create_server() -> anyhow::Result<EspHttpServer<'static>> {
)?;

let wifi_configuration = wifi::Configuration::AccessPoint(AccessPointConfiguration {
ssid: SSID.into(),
ssid: SSID.try_into().unwrap(),
ssid_hidden: true,
auth_method: AuthMethod::WPA2Personal,
password: PASSWORD.into(),
password: PASSWORD.try_into().unwrap(),
channel: CHANNEL,
..Default::default()
});
Expand Down

0 comments on commit 9f9e4b4

Please sign in to comment.