Implementation of the CellularInterface for u-blox C027 and C030 (non-N2xx flavour) modems that uses the IP stack on-board the cellular modem, hence not requiring LWIP (and so less RAM) and allowing any AT command exchanges to be carried out at the same time as data transfers (since the modem remains in AT mode all the time). This library may be used from mbed 5.5 onwards. If you need to use SMS, USSD or access the modem file system at the same time as using the CellularInterface then use ublox-at-cellular-interface-ext instead.

Dependents:   example-ublox-cellular-interface example-ublox-cellular-interface_r410M example-ublox-mbed-client example-ublox-cellular-interface ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers <title>platform_config.py Source File</title>

platform_config.py

00001 import json
00002 from time import sleep
00003 import sys
00004 import re
00005 import os
00006 
00007 myfile = os.path.join('example-ublox-cellular-interface','mbed_app.json')
00008 #with open(myfile, 'r') as f:
00009 #  data = json.load(f)
00010 
00011 data={}
00012   
00013 if 'config' not in data:
00014   data['config'] = {}
00015   data['target_overrides'] = {}
00016   data['config']['echo-udp-port'] ={}  
00017   data['config']['echo-server'] ={}  
00018   data['config']['echo-tcp-port']={}  
00019   data['config']['debug-on'] = {}
00020   data['config']['run-sim-pin-change-tests'] = {}
00021   data['config']['default-pin'] = {}
00022   data['config']['apn'] = {}
00023   data['config']['username'] = {}
00024   data['config']['password'] = {}
00025   data['config']['alt-pin'] = {}
00026   data['config']['incorrect-pin'] = {}
00027   data['config']['ntp-server'] = {}
00028   data['config']['ntp-port'] = {}
00029   data['config']['local-port'] = {}
00030   data['config']['udp-max-packet-size'] = {}
00031   data['config']['udp-max-frag-packet-size'] = {}  
00032   
00033   #data['config']['echo-server']['value'] = '\"echo.u-blox.com\"'
00034   data['config']['echo-server']['value'] = '\"ciot.it-sgn.u-blox.com\"'
00035   data['config']['echo-udp-port']['value'] = 7
00036   data['config']['echo-tcp-port']['value'] = 7
00037   data['config']['echo-udp-port']['value'] = 5050
00038   data['config']['echo-tcp-port']['value'] = 5055
00039   data['config']['debug-on']['value'] = True
00040   data['config']['run-sim-pin-change-tests'] = 0
00041   data['config']['default-pin'] = '\"1234\"'
00042   data['config']['apn'] = 0
00043   data['config']['username'] = 0
00044   data['config']['password'] = 0
00045   data['config']['alt-pin'] = '\"9876\"'
00046   data['config']['incorrect-pin'] = '\"1530\"'
00047   data['config']['ntp-server'] = '\"2.pool.ntp.org\"'
00048   data['config']['ntp-port'] = 123
00049   data['config']['local-port'] = 16
00050   data['config']['udp-max-packet-size'] = 508
00051   data['config']['udp-max-frag-packet-size'] = 1500
00052   
00053   data['target_overrides']['*'] = {}
00054   data['target_overrides']['*']['lwip.ppp-enabled'] = True
00055   data['target_overrides']['*']['platform.stdio-convert-newlines'] = True
00056   
00057   
00058   print('data', data)
00059 else:
00060   data['config']['echo-server']['value'] = '\"ciot.it-sgn.u-blox.com\"'
00061   data['config']['echo-udp-port']['value'] = 5050
00062   data['config']['echo-tcp-port']['value'] = 5055
00063   data['config']['debug-on']['value'] = True
00064 
00065   print('echo-server',data['config']['echo-server']['value'])
00066   print('echo-udp-port',data['config']['echo-udp-port']['value'])
00067   print('echo-tcp-port',data['config']['echo-tcp-port']['value'])
00068   print('debug-on', data['config']['debug-on']['value'])
00069 
00070 with open(myfile, 'w') as f:
00071   json.dump(data, f)