ublox-at-cellular-interface
TESTS/unit_tests/default/platform_config.py@36:9d48ec522cb4, 2019-08-19 (annotated)
- Committer:
- wajahat.abbas@u-blox.com
- Date:
- Mon Aug 19 17:36:04 2019 +0500
- Revision:
- 36:9d48ec522cb4
- Parent:
- 9:ffab574dcc20
Fix to read OK as well
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fahim alavi |
9:ffab574dcc20 | 1 | import json |
fahim alavi |
9:ffab574dcc20 | 2 | from time import sleep |
fahim alavi |
9:ffab574dcc20 | 3 | import sys |
fahim alavi |
9:ffab574dcc20 | 4 | import re |
fahim alavi |
9:ffab574dcc20 | 5 | import os |
fahim alavi |
9:ffab574dcc20 | 6 | |
fahim alavi |
9:ffab574dcc20 | 7 | myfile = os.path.join('example-ublox-cellular-interface','mbed_app.json') |
fahim alavi |
9:ffab574dcc20 | 8 | #with open(myfile, 'r') as f: |
fahim alavi |
9:ffab574dcc20 | 9 | # data = json.load(f) |
fahim alavi |
9:ffab574dcc20 | 10 | |
fahim alavi |
9:ffab574dcc20 | 11 | data={} |
fahim alavi |
9:ffab574dcc20 | 12 | |
fahim alavi |
9:ffab574dcc20 | 13 | if 'config' not in data: |
fahim alavi |
9:ffab574dcc20 | 14 | data['config'] = {} |
fahim alavi |
9:ffab574dcc20 | 15 | data['target_overrides'] = {} |
fahim alavi |
9:ffab574dcc20 | 16 | data['config']['echo-udp-port'] ={} |
fahim alavi |
9:ffab574dcc20 | 17 | data['config']['echo-server'] ={} |
fahim alavi |
9:ffab574dcc20 | 18 | data['config']['echo-tcp-port']={} |
fahim alavi |
9:ffab574dcc20 | 19 | data['config']['debug-on'] = {} |
fahim alavi |
9:ffab574dcc20 | 20 | data['config']['run-sim-pin-change-tests'] = {} |
fahim alavi |
9:ffab574dcc20 | 21 | data['config']['default-pin'] = {} |
fahim alavi |
9:ffab574dcc20 | 22 | data['config']['apn'] = {} |
fahim alavi |
9:ffab574dcc20 | 23 | data['config']['username'] = {} |
fahim alavi |
9:ffab574dcc20 | 24 | data['config']['password'] = {} |
fahim alavi |
9:ffab574dcc20 | 25 | data['config']['alt-pin'] = {} |
fahim alavi |
9:ffab574dcc20 | 26 | data['config']['incorrect-pin'] = {} |
fahim alavi |
9:ffab574dcc20 | 27 | data['config']['ntp-server'] = {} |
fahim alavi |
9:ffab574dcc20 | 28 | data['config']['ntp-port'] = {} |
fahim alavi |
9:ffab574dcc20 | 29 | data['config']['local-port'] = {} |
fahim alavi |
9:ffab574dcc20 | 30 | data['config']['udp-max-packet-size'] = {} |
fahim alavi |
9:ffab574dcc20 | 31 | data['config']['udp-max-frag-packet-size'] = {} |
fahim alavi |
9:ffab574dcc20 | 32 | |
fahim alavi |
9:ffab574dcc20 | 33 | #data['config']['echo-server']['value'] = '\"echo.u-blox.com\"' |
fahim alavi |
9:ffab574dcc20 | 34 | data['config']['echo-server']['value'] = '\"ciot.it-sgn.u-blox.com\"' |
fahim alavi |
9:ffab574dcc20 | 35 | data['config']['echo-udp-port']['value'] = 7 |
fahim alavi |
9:ffab574dcc20 | 36 | data['config']['echo-tcp-port']['value'] = 7 |
fahim alavi |
9:ffab574dcc20 | 37 | data['config']['echo-udp-port']['value'] = 5050 |
fahim alavi |
9:ffab574dcc20 | 38 | data['config']['echo-tcp-port']['value'] = 5055 |
fahim alavi |
9:ffab574dcc20 | 39 | data['config']['debug-on']['value'] = True |
fahim alavi |
9:ffab574dcc20 | 40 | data['config']['run-sim-pin-change-tests'] = 0 |
fahim alavi |
9:ffab574dcc20 | 41 | data['config']['default-pin'] = '\"1234\"' |
fahim alavi |
9:ffab574dcc20 | 42 | data['config']['apn'] = 0 |
fahim alavi |
9:ffab574dcc20 | 43 | data['config']['username'] = 0 |
fahim alavi |
9:ffab574dcc20 | 44 | data['config']['password'] = 0 |
fahim alavi |
9:ffab574dcc20 | 45 | data['config']['alt-pin'] = '\"9876\"' |
fahim alavi |
9:ffab574dcc20 | 46 | data['config']['incorrect-pin'] = '\"1530\"' |
fahim alavi |
9:ffab574dcc20 | 47 | data['config']['ntp-server'] = '\"2.pool.ntp.org\"' |
fahim alavi |
9:ffab574dcc20 | 48 | data['config']['ntp-port'] = 123 |
fahim alavi |
9:ffab574dcc20 | 49 | data['config']['local-port'] = 16 |
fahim alavi |
9:ffab574dcc20 | 50 | data['config']['udp-max-packet-size'] = 508 |
fahim alavi |
9:ffab574dcc20 | 51 | data['config']['udp-max-frag-packet-size'] = 1500 |
fahim alavi |
9:ffab574dcc20 | 52 | |
fahim alavi |
9:ffab574dcc20 | 53 | data['target_overrides']['*'] = {} |
fahim alavi |
9:ffab574dcc20 | 54 | data['target_overrides']['*']['lwip.ppp-enabled'] = True |
fahim alavi |
9:ffab574dcc20 | 55 | data['target_overrides']['*']['platform.stdio-convert-newlines'] = True |
fahim alavi |
9:ffab574dcc20 | 56 | |
fahim alavi |
9:ffab574dcc20 | 57 | |
fahim alavi |
9:ffab574dcc20 | 58 | print('data', data) |
fahim alavi |
9:ffab574dcc20 | 59 | else: |
fahim alavi |
9:ffab574dcc20 | 60 | data['config']['echo-server']['value'] = '\"ciot.it-sgn.u-blox.com\"' |
fahim alavi |
9:ffab574dcc20 | 61 | data['config']['echo-udp-port']['value'] = 5050 |
fahim alavi |
9:ffab574dcc20 | 62 | data['config']['echo-tcp-port']['value'] = 5055 |
fahim alavi |
9:ffab574dcc20 | 63 | data['config']['debug-on']['value'] = True |
fahim alavi |
9:ffab574dcc20 | 64 | |
fahim alavi |
9:ffab574dcc20 | 65 | print('echo-server',data['config']['echo-server']['value']) |
fahim alavi |
9:ffab574dcc20 | 66 | print('echo-udp-port',data['config']['echo-udp-port']['value']) |
fahim alavi |
9:ffab574dcc20 | 67 | print('echo-tcp-port',data['config']['echo-tcp-port']['value']) |
fahim alavi |
9:ffab574dcc20 | 68 | print('debug-on', data['config']['debug-on']['value']) |
fahim alavi |
9:ffab574dcc20 | 69 | |
fahim alavi |
9:ffab574dcc20 | 70 | with open(myfile, 'w') as f: |
fahim alavi |
9:ffab574dcc20 | 71 | json.dump(data, f) |