CellLocate Service-to-Service access

Introduction

Service-to-Service access allows to access to the service requesting the location estimation directly from your application platform instead of from your devices. This approach is preferred, for example,  whenever you need the position information directly on server side  and not in the device or when your fleet does not have access to the public internet and cannot reach directly the CellLocate end-points reported in the Getting started guide.

This documentation will guide you through the process of setting up your Thingstream account for service-to-service access using the REST API

Prerequisites

The prerequisites to complete the procedure are:

Procedure overview

The mains steps of this procedure are


Create a CellLocate S2S Thing

The first step is to create a CellLocate S2S things that provides you all the parameters to issue the API:

The Thing let also you to:

Sign-in into the Thingstream portal and select the Location Things item from the Location Services section. Click the button to create a new Location Thing and browse to the CellLocate section from where you can select the wizard to create CellLocate S2S Thing.  

During the creation steps you are suggested to assign a price plan. If you skip this step the Thing will not be automatically activated and cannot be used. When you are ready to assign a plan, open the Thing panel and assign the preferred one. 

Module configuration

The module can be configured using  the same AT command reported in the Getting started guide

AT+UGSRV="primaryServer","secondaryServer","optional_device_ID"

where:

This ID is for your internal use and you do not need to forward it to CellLocate endpoint

Setup your application platform

The picture below displays the flow of data to obtain a position estimation:

/CellGetOnlineData.ashx?celltype=gsm;token=XXXXXXXXXXXXXXXXXX;datatype=pos;format=mga;

where the token parameter is the information configured through the UGSRV command  described in the previous section and can represent a device identifier

Dummy response format

A dummy response is required to close the loop, and acknowledge the CEL module request so that it stop listening for the answer.

The dummy response  to be sent by your application server to the device (CEL module) , shall contain:

B5 62 13 40 18 00 10 00 00 12 E5 07 05 1B 0C 1F 0F 00 C0 1E 6B 24 00 00 00 00 80 1A 06 00 E0 45

In this why the device stops the +ULOC procedure, used to request the position, and print out

+UULOC: 27/05/2021,14:42:38.000,0.0000000,0.0000000,0,20000000,0,0,0,0,0,0,0

NOTE: since it's a dummy response, it shall be ignored by the device application


UBX-MGA-INI-TIME_UTC  frame structure

Send a measurement and get a position

As explained above, to trigger on the module the generation of the measurements used to get a position estimation you can use the +ULOC AT command exactly in the same way described in the Getting started guide.

Once you have received the measurement on your application server, to obtain a position you need to use the API

https://{endpoint}/v1/celllocate/s2s/location/get 

as described in the CellLocate API documentation where:

can be retrieved in the credential section of your just created CellLocate S2S thing

The API response is in JSON format as reported below

{

"Location":

{

  "Lat": 51.6387347,

  "Lon": 0.1121669,

  "Unc50": 20.1,

  "Unc95": 70.1

},

"DateTime": "2020-08-17T20:18:12",

"DeviceID": "357861090015763",

"DeviceType": "SARA-R510S-00B-00/01.02,A00.01"