added js code for error checking and formatting the JSON string for the call to /setSettings
{"WiFiSSID":"stratux","WiFiSecurityEnabled":true,"WiFiPasscode":"h98tdjepi","WiFiChannel":"5"}
$scope.WiFiSSID = "stratux"; //settings.WiFiSSID;
$scope.WiFiSecurityEnabled = true; //settings.WiFiSecurityEnabled;
$scope.WiFiPasscode = Math.random().toString(36).substring(4); //settings.WiFiPasscode;
$scope.WiFiChannel = "5"; //settings.WiFiChannel;
I have hardcoded the values till they are included in the /getSettings JSON string
FIrst, I added the missing code to pull in the Static IP info the input field from the JSON string
Second and biggest:
This is the code to add the WiFi Settings to the Settings Page. In preparation for the GO code behind the scenes
Before it is live/working a few lines should be removed and the modals cleaned up.
I had some issues getting the ng-bind working in the modalErrorWiFi modal. There is an update issue. Something about being outside of the digest. I'm not sure.
The code sends a JSON string: {"WiFiSSID":"stratux","WiFiSecurityEnabled":true,"WiFiPasscode":"h98tdjepi","WiFiChannel":"5"} to /setSettings
I also did some cleanup in the HTML.
# This script is almost identical to hostapd_manager.sh except all the
# screen outputs are supplressed except for error messages.
#
# Usage:
# hostapd_manager_quiet.sh -s Stratux-N12345 -p SquawkDirty! -c 5
# Command above sets the SSID to "Stratux-N12345, secures the network with the passphrase "SquawkDirty!, and changes the network channel to "5"
#
# hostapd_manager_quiet.sh -o
# Command above opens the network(removes any passphrase)
#
# hostapd_manager_quiet.sh -e
# Command above secures the WiFi network using the default passphrase "SquawkDirtyToMe!"
# Options:
# -s --Sets the SSID to ${BOLD}ssid${NORM}. -s stratux
# -c --Sets the channel to chan. -c 1
# -o --Turns off encryption and sets network to open. Cannot be used with -e or -p.
# -e --Turns on encryption with passphrase SquawkDirtyToMe!. Cannot be used with -o or -p
# -p --Turns on encryption with your chosen passphrase pass. 8-63 Printable Characters(ascii 32-126). Cannot be used with -o or -e. -p password!
#
# Important:
# After each call of this script the wifi network will disconnect and restart all associated services to apply the changes