Provide option to disable admin wireless network.

This commit is contained in:
Patrick Fairbank
2018-09-22 11:15:29 -07:00
parent 2267259f7c
commit aeec870e3f
4 changed files with 8 additions and 2 deletions

View File

@@ -54,8 +54,13 @@ func (ap *AccessPoint) ConfigureAdminWifi() error {
ap.mutex.Lock()
defer ap.mutex.Unlock()
disabled := 0
if ap.adminChannel == 0 {
disabled = 1
}
commands := []string{
fmt.Sprintf("set wireless.radio0.channel='%d'", ap.teamChannel),
fmt.Sprintf("set wireless.radio1.disabled='%d'", disabled),
fmt.Sprintf("set wireless.radio1.channel='%d'", ap.adminChannel),
fmt.Sprintf("set wireless.@wifi-iface[0].key='%s'", ap.adminWpaKey),
"commit wireless",

View File

@@ -50,7 +50,7 @@ func (database *Database) GetEventSettings() (*EventSettings, error) {
eventSettings.SelectionRound3Order = ""
eventSettings.TBADownloadEnabled = true
eventSettings.ApTeamChannel = 157
eventSettings.ApAdminChannel = 11
eventSettings.ApAdminChannel = 0
eventSettings.ApAdminWpaKey = "1234Five"
err = database.eventSettingsMap.Insert(eventSettings)

View File

@@ -14,7 +14,7 @@ func TestEventSettingsReadWrite(t *testing.T) {
eventSettings, err := db.GetEventSettings()
assert.Nil(t, err)
assert.Equal(t, EventSettings{Id: 0, Name: "Untitled Event", NumElimAlliances: 8, SelectionRound2Order: "L",
SelectionRound3Order: "", TBADownloadEnabled: true, ApTeamChannel: 157, ApAdminChannel: 11,
SelectionRound3Order: "", TBADownloadEnabled: true, ApTeamChannel: 157, ApAdminChannel: 0,
ApAdminWpaKey: "1234Five"}, *eventSettings)
eventSettings.Name = "Chezy Champs"

View File

@@ -189,6 +189,7 @@
<label class="col-lg-5 control-label">AP Admin Channel (2.4GHz)</label>
<div class="col-lg-7">
<select class="form-control" name="apAdminChannel" value="{{.ApAdminChannel}}">
<option{{if eq .ApAdminChannel 0}} selected{{end}}>Disabled</option>
<option{{if eq .ApAdminChannel 1}} selected{{end}}>1</option>
<option{{if eq .ApAdminChannel 6}} selected{{end}}>6</option>
<option{{if eq .ApAdminChannel 11}} selected{{end}}>11</option>