ublox-at-cellular-interface

Committer:
RobMeades
Date:
Fri Mar 02 13:28:32 2018 +0000
Revision:
14:e7dcf3388403
Make sure that the event handler thread is closed cleanly in all cases and add tests that this is the case, both for sleep and for memory.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RobMeades 14:e7dcf3388403 1 import json
RobMeades 14:e7dcf3388403 2 from time import sleep
RobMeades 14:e7dcf3388403 3 import sys
RobMeades 14:e7dcf3388403 4 import re
RobMeades 14:e7dcf3388403 5 import os
RobMeades 14:e7dcf3388403 6
RobMeades 14:e7dcf3388403 7 myfile = os.path.join('example-ublox-cellular-interface','mbed_app.json')
RobMeades 14:e7dcf3388403 8 #with open(myfile, 'r') as f:
RobMeades 14:e7dcf3388403 9 # data = json.load(f)
RobMeades 14:e7dcf3388403 10
RobMeades 14:e7dcf3388403 11 data={}
RobMeades 14:e7dcf3388403 12
RobMeades 14:e7dcf3388403 13 if 'config' not in data:
RobMeades 14:e7dcf3388403 14 data['config'] = {}
RobMeades 14:e7dcf3388403 15 data['target_overrides'] = {}
RobMeades 14:e7dcf3388403 16 data['config']['debug-on'] = {}
RobMeades 14:e7dcf3388403 17 data['config']['default-pin'] = {}
RobMeades 14:e7dcf3388403 18 data['config']['apn'] = {}
RobMeades 14:e7dcf3388403 19 data['config']['username'] = {}
RobMeades 14:e7dcf3388403 20 data['config']['password'] = {}
RobMeades 14:e7dcf3388403 21 data['config']['ntp-server'] = {}
RobMeades 14:e7dcf3388403 22 data['config']['ntp-port'] = {}
RobMeades 14:e7dcf3388403 23
RobMeades 14:e7dcf3388403 24 data['config']['debug-on']['value'] = True
RobMeades 14:e7dcf3388403 25 data['config']['default-pin'] = '\"1234\"'
RobMeades 14:e7dcf3388403 26 data['config']['apn'] = 0
RobMeades 14:e7dcf3388403 27 data['config']['username'] = 0
RobMeades 14:e7dcf3388403 28 data['config']['password'] = 0
RobMeades 14:e7dcf3388403 29 data['config']['ntp-server'] = '\"2.pool.ntp.org\"'
RobMeades 14:e7dcf3388403 30 data['config']['ntp-port'] = 123
RobMeades 14:e7dcf3388403 31
RobMeades 14:e7dcf3388403 32 data['target_overrides']['*'] = {}
RobMeades 14:e7dcf3388403 33 data['target_overrides']['*']['lwip.ppp-enabled'] = True
RobMeades 14:e7dcf3388403 34 data['target_overrides']['*']['platform.stdio-convert-newlines'] = True
RobMeades 14:e7dcf3388403 35
RobMeades 14:e7dcf3388403 36
RobMeades 14:e7dcf3388403 37 print('data', data)
RobMeades 14:e7dcf3388403 38 else:
RobMeades 14:e7dcf3388403 39 data['config']['debug-on']['value'] = True
RobMeades 14:e7dcf3388403 40
RobMeades 14:e7dcf3388403 41 print('debug-on', data['config']['debug-on']['value'])
RobMeades 14:e7dcf3388403 42
RobMeades 14:e7dcf3388403 43 with open(myfile, 'w') as f:
RobMeades 14:e7dcf3388403 44 json.dump(data, f)