wifi-rs
                                
                                
                                
                                    wifi-rs copied to clipboard
                            
                            
                            
                        Use of undeclared type 'HotspotConfig', 'HotspotBand', 'Channel'
I tried your example on creating WiFi hotspot and it wasn't able to find 'HotspotConfig', and enums 'HotspotBand' and 'Channel'. I am using the version "0.2.2" release.
use std::io;
use wifi_rs::{prelude::*, WiFi};
fn main() -> Result<(), io::Error> {
    let config = Some(Config {
        interface: Some("wlo1"),
    });
    let mut wifi = WiFi::new(config);
    let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
    wifi.create_hotspot("test-hotspot", "password", Some(&config));
    Ok(())
}
error[E0433]: failed to resolve: use of undeclared type HotspotConfig
--> src/main.rs:10:18
|
10 |     let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|                  ^^^^^^^^^^^^^ use of undeclared type HotspotConfig
error[E0433]: failed to resolve: use of undeclared type HotspotBand
--> src/main.rs:10:42
|
10 |     let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|                                          ^^^^^^^^^^^ use of undeclared type HotspotBand
error[E0433]: failed to resolve: use of undeclared type Channel
--> src/main.rs:10:65
|
10 |     let config = HotspotConfig::new(Some(HotspotBand::Bg), Some(Channel::One));
|                                                                 ^^^^^^^ use of undeclared type Channel
error: aborting due to 3 previous errors
The workaround for me to build this successfully is to clone the repository and include directly to my dependencies in Cargo.toml.
Cargo.toml
[dependencies]
wifi-rs = { git = "https://github.com/tnkemdilim/wifi-rs.git" }
                                    
                                    
                                    
                                
Hi @chriamue did the hack work out fine
Cargo.toml
[dependencies] wifi-rs = { git = "https://github.com/tnkemdilim/wifi-rs.git" }
Hi @chriamue did the hack work out fine
Apologies for not responding to this earlier.
@murro-jr What OS did you try this on? Hotspot functionality for each operating system is selected based on thetarget_os it's built on.
The types Channel, HostpotConfig, and HotspotBand are only available when the target_os=linux.
Apologies for not responding to this earlier.
@murro-jr What OS did you try this on? Hotspot functionality for each operating system is selected based on the
target_osit's built on.The types
Channel,HostpotConfig, andHotspotBandare only available when thetarget_os=linux.
It works fine on Linux distro ?
Apologies for not responding to this earlier.
@murro-jr What OS did you try this on? Hotspot functionality for each operating system is selected based on the
target_osit's built on.The types
Channel,HostpotConfig, andHotspotBandare only available when thetarget_os=linux.
I see, was using win64 but will try it out with linux