pull/71/head
Christopher Young 2015-09-30 10:22:27 -04:00
rodzic 2d770d5b2e
commit 797f71a4da
1 zmienionych plików z 59 dodań i 51 usunięć

Wyświetl plik

@ -124,11 +124,11 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
// for an OPTION method request, we return header without processing. // for an OPTION method request, we return header without processing.
// this insures we are recognized as supporting cross-domain AJAX REST calls // this insures we are recognized as supporting cross-domain AJAX REST calls
if (r.Method == "POST") { if r.Method == "POST" {
// raw, _ := httputil.DumpRequest(r, true) // raw, _ := httputil.DumpRequest(r, true)
// log.Printf("handleSettingsSetRequest:raw: %s\n", raw) // log.Printf("handleSettingsSetRequest:raw: %s\n", raw)
decoder := json.NewDecoder(r.Body); decoder := json.NewDecoder(r.Body)
for { for {
var msg map[string]interface{} // support arbitrary JSON var msg map[string]interface{} // support arbitrary JSON
@ -141,14 +141,22 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
for key, val := range msg { for key, val := range msg {
// log.Printf("handleSettingsSetRequest:json: testing for key:%s of type %s\n", key, reflect.TypeOf(val)) // log.Printf("handleSettingsSetRequest:json: testing for key:%s of type %s\n", key, reflect.TypeOf(val))
switch key { switch key {
case "UAT_Enabled": globalSettings.UAT_Enabled = val.(bool) case "UAT_Enabled":
case "ES_Enabled": globalSettings.ES_Enabled = val.(bool) globalSettings.UAT_Enabled = val.(bool)
case "GPS_Enabled": globalSettings.GPS_Enabled = val.(bool) case "ES_Enabled":
case "AHRS_Enabled": globalSettings.AHRS_Enabled = val.(bool) globalSettings.ES_Enabled = val.(bool)
case "DEBUG": globalSettings.DEBUG = val.(bool) case "GPS_Enabled":
case "ReplayLog": globalSettings.ReplayLog = val.(bool) globalSettings.GPS_Enabled = val.(bool)
case "PPM": globalSettings.PPM = int(val.(float64)) case "AHRS_Enabled":
default: log.Printf("handleSettingsSetRequest:json: unrecognized key:%s\n", key) globalSettings.AHRS_Enabled = val.(bool)
case "DEBUG":
globalSettings.DEBUG = val.(bool)
case "ReplayLog":
globalSettings.ReplayLog = val.(bool)
case "PPM":
globalSettings.PPM = int(val.(float64))
default:
log.Printf("handleSettingsSetRequest:json: unrecognized key:%s\n", key)
} }
} }
saveSettings() saveSettings()