| 123456789101112131415161718192021222324 |
- # return a configuration objects with default values
- def myCar_read_config_defaults(config):
- import configparser
- if not config.sections():
- # there is nothing, lets setup default values
- config['paths'] = { 'app' : '/opt/myCar',
- 'log' : 'data/log',
- 'record' : 'data/rec' }
- config['connections'] = { 'bt_dev' : '/dev/rfcomm',
- 'gps_dev' : '/dev/ttyS1',
- 'wifi_pwd' : 'myCar123' }
- config['startup'] = { 'bt_connect' : True,
- 'autorecord' : True }
- # return a valid config object either
- # with or without default values
- return config
- def myCar_save_config(config):
- import configparser, logging
-
- with open('data/etc/myCar.conf', 'w') as configfile:
- config.write(configfile)
- logging.info('configuration saved')
|