Telit Cinterion IoT Developer Community
Combine The New JAT API with Location Service
Showcase, December 25, 2018 - 12:23pm, 5795 views
On the newest JavaES LTE product, like ELS61 R2, the module supports a new set of API called JAT. In the forum there is already a dedicated post showing how to use it. For my article, I want to demonstrate one of it's power: to combine some function one may need into a new and handy AT command.
In this case, I would like to demo the integration of Google and OpenCell ID API and use the available cellular base station IDs to query the two services for a set of GPS coordinate.
The theory is simple, like the graph shows below:
The project src has attached with this article. You can import it into the Eclipse install via ELS61-E/-US R2 Java CD, and build the project to get the demo midlet. The output files are JAtGeolocationDemo.jar/.jad files.
Before install to an ELS61 R2 module and run it, you'll need to modify the JAtGeolocationDemo.jad file and specify the Google / OpencellID API keys to make query possible, also you need to specify an APN according to the SIM you used.
For the API keys, you can visit below sites and registrate a test ID for keys:
https://developers.google.com/maps/documentation/geolocation/get-api-key
https://developers.google.com/maps/documentation/static-maps/
https://unwiredlabs.com/pricing
Obviously, the first two are related to Google API; you'll need at one key for geolocation to get GPS coordinate from Google, the static-maps key is for generating a beatifule static map url for one to demo this project with a PC browser, so it's optional.
For OpencellID key you must register with unwiredlabs.
After you get key(s) and APN of the SIM card, you can modify the JAtGeolocationDemo.jad:
OPENCELLID_API_KEY: <YOUR_OPENCELLID_API_KEY>
GOOGLE_API_KEY: <YOUR_GOOGLE_API_KEY>
GOOGLE_STATIC_MAP_API_KEY: <YOUR_GOOGLE_STATIC_MAP_API_KEY>
Please change the assignment above for corresponding key(s).
For APN please change the value of access_point, assuming your APN is INTERNET, you can specify it like below:
NET_PARAMS: bearer_type=GPRS;access_point=internet
After the modification, please remember to save JAtGeolocationDemo.jad file. At this point, you can copy the
JAtGeolocationDemo.jar/JAtGeolocationDemo.jad files into ELS61 R2 modules and install it. You can use attached ELS61_R2_Geolocation_Demo.zip which contains a TeraTerm script to help one to install the midlet in an ELS61 R2 module.
After install the midlet, if you run it, you'll have 2 new AT commands for location service demo: one is AT^SCLCQ which will query location service via current attached cell ID, another is AT^SCLAQ to use all surrounding neighbor cells to query a large set of GPS points from location service.
One can use attached ELS61_R2_JAT_Location_Demo.zip which contains a TeraTerm script to run the midlet and also the two new AT commands for demo.
Below is a screenshot showing running the demo via ELS61_R2_JAT_Location_Demo.ttl:
Below is a screenshot showing the demo generate a static map via Google Map API to show surround cell locations:
HI,
WoW!! Amazing!!
Regards
ALopez
Somewhere over the rainbow!!! Looking for the Oz Land!!!