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.
// 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)
// log.Printf("handleSettingsSetRequest:raw: %s\n", raw)
decoder := json.NewDecoder(r.Body);
decoder := json.NewDecoder(r.Body)
for {
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 {
// log.Printf("handleSettingsSetRequest:json: testing for key:%s of type %s\n", key, reflect.TypeOf(val))
switch key {
case "UAT_Enabled": globalSettings.UAT_Enabled = val.(bool)
case "ES_Enabled": globalSettings.ES_Enabled = val.(bool)
case "GPS_Enabled": globalSettings.GPS_Enabled = val.(bool)
case "AHRS_Enabled": 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)
case "UAT_Enabled":
globalSettings.UAT_Enabled = val.(bool)
case "ES_Enabled":
globalSettings.ES_Enabled = val.(bool)
case "GPS_Enabled":
globalSettings.GPS_Enabled = val.(bool)
case "AHRS_Enabled":
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()