31 lines
776 B
Go
31 lines
776 B
Go
package reach
|
|
|
|
import "log"
|
|
|
|
// ReachRS modules provides an Updater application when reset in factory mode.
|
|
// This package provides an API to communicate with this application.
|
|
func Example_updaterClientUsage() {
|
|
// Create a new Updater client instance
|
|
updater := NewUpdaterClient(
|
|
WithEndpoint("192.168.42.1", 80), // Define the module endpoint
|
|
)
|
|
|
|
// Connect to the ReachRS Updater endpoint
|
|
if err := updater.Connect(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
networks, err := updater.SavedWifiNetworks()
|
|
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()
|
|
}
|