wifi/espat, rtl8720dn, wifinina: move towards standard common interface for wifi adaptors

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2022-01-12 20:42:41 +01:00
committed by Ron Evans
parent 905fc6fce3
commit d8c813d515
28 changed files with 187 additions and 102 deletions
+9 -13
View File
@@ -124,22 +124,18 @@ func makeHTTPRequest() {
// connect to access point
func connectToAP() {
if len(ssid) == 0 || len(pass) == 0 {
time.Sleep(2 * time.Second)
println("Connecting to " + ssid)
err := adaptor.ConnectToAccessPoint(ssid, pass, 10*time.Second)
if err != nil { // error connecting to AP
for {
println("Connection failed: Either ssid or password not set")
time.Sleep(10 * time.Second)
println(err)
time.Sleep(1 * time.Second)
}
}
time.Sleep(2 * time.Second)
message("Connecting to " + ssid)
adaptor.SetPassphrase(ssid, pass)
for st, _ := adaptor.GetConnectionStatus(); st != wifinina.StatusConnected; {
message("Connection status: " + st.String())
time.Sleep(1 * time.Second)
st, _ = adaptor.GetConnectionStatus()
}
message("Connected.")
time.Sleep(2 * time.Second)
println("Connected.")
ip, _, _, err := adaptor.GetIP()
for ; err != nil; ip, _, _, err = adaptor.GetIP() {
message(err.Error())