config parsing
This commit is contained in:
38
ConfigGen/configGen.py
Normal file
38
ConfigGen/configGen.py
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from Cheetah.Template import Template
|
||||
from ConfigDataStructure import configItems, magic, appName
|
||||
|
||||
|
||||
|
||||
#configItems = [
|
||||
# {"label":"_", "key":"magic", "type":"I", "default": ""},
|
||||
# {"label":"Config Username", "key":"confUser", "type":"C", "length":16, "default":"admin"},
|
||||
# {"label":"Config Password", "key":"confPasswd", "type":"C", "length":16, "default":"geheim123"},
|
||||
# {"label":"Wifi SSID", "key":"wifiSsid", "type":"C", "length":32, "default":"test"},
|
||||
# {"label":"Wifi Key", "key":"wifiKey", "type":"C", "length":64, "default":"geheim"},
|
||||
# {"label":"MQTT Broker", "key":"mqttBroker", "type":"C", "length":32, "default":"broker.hottis.de"},
|
||||
# {"label":"MQTT Username", "key":"mqttUser", "type":"C", "length":32, "default":"RgbLed1"},
|
||||
# {"label":"MQTT Password", "key":"mqttPass", "type":"C", "length":32, "default":"geheim123"},
|
||||
# {"label":"MQTT ClientId", "key":"mqttClientId", "type":"C", "length":32, "default":"RgbLed1"},
|
||||
# {"label":"MQTT Port", "key":"mqttPort", "type":"I", "default":8883},
|
||||
# {"label":"MQTT Topic Color Command", "key":"mqttTopicColorCommand", "type":"C", "length":64, "default":"IoT/RgbLed1/ColorCommand"},
|
||||
# {"label":"MQTT Topic Command", "key":"mqttTopicCommand", "type":"C", "length":64, "default":"IoT/RgbLed1/Command"},
|
||||
# {"label":"MQTT DebugTopic", "key":"mqttDebugTopic", "type":"C", "length":64, "default":"IoT/RgbLed1/Debug"},
|
||||
# {"label":"DebugMode", "key":"debugMode", "type":"I", "default":0}
|
||||
#]
|
||||
|
||||
|
||||
confWifiSsid = "espconfig"
|
||||
|
||||
params = {
|
||||
"magic":magic,
|
||||
"appName":appName,
|
||||
"confWifiSsid":confWifiSsid,
|
||||
"configItems":configItems
|
||||
}
|
||||
|
||||
h_file = Template(file="configuration_h.tmpl", searchList=[params])
|
||||
open('configuration.h','w').write(str(h_file))
|
||||
c_file = Template(file="configuration_c.tmpl", searchList=[params])
|
||||
open('configuration.cpp','w').write(str(c_file))
|
Reference in New Issue
Block a user