This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
2018-09-21 12:31:52 +02:00
|
|
|
package updater
|
2018-09-19 17:45:38 +02:00
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
import (
|
|
|
|
"log"
|
2018-09-19 17:45:38 +02:00
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
"forge.cadoles.com/Pyxis/orion/emlid"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Example_usage() {
|
2018-09-19 17:45:38 +02:00
|
|
|
// Create a new Updater client instance
|
2018-09-21 12:31:52 +02:00
|
|
|
updater := NewClient(
|
|
|
|
emlid.WithEndpoint("192.168.42.1", 80), // Define the module endpoint
|
2018-09-19 17:45:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// Connect to the ReachRS Updater endpoint
|
|
|
|
if err := updater.Connect(); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2018-09-20 11:33:51 +02:00
|
|
|
networks, err := updater.WifiNetworks()
|
2018-09-19 17:45:38 +02:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do something with network
|
|
|
|
for _, n := range networks {
|
|
|
|
log.Printf("Save WiFi network: SSID: '%s', Security: '%s'", n.SSID, n.Security)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dont forget to close the connection when you are done
|
|
|
|
defer updater.Close()
|
|
|
|
}
|