The TMM API allows your application to configure Trimble and Spectra Geospatial GNSS receivers, and get precise GNSS positions in your application.
The TMM API consists of:
The Trimble Mobile Manager application
Platform specific methods for showing TMM user interface
Android: Intents
iOS: Custom URL Schemes
Windows: Custom URI Scheme
A REST API on localhost for TMM operations that can be performed without showing TMM user interface
A WebSocket on localhost for streaming precise GNSS positions from a connected Trimble or Spectra Geospatial GNSS receiver.
To use the TMM API, you need to:
Contact Trimble and get a unique Application ID for your application.
Register your Application ID with Trimble Mobile Manager (TMM) using the platform specific method described below. This will do two things:
Add your application to TMM’s client application registry.
Return the localhost port of the REST API server.
Use the positionStream REST API endpoint to start streaming positions, and get the WebSocket Position port.
Open the WebSocket Position port and start receiving precise GNSS positions in JSON format.
Client Application Registration
Before you can use TMM’s REST API, you must register your application with TMM. On Android this is done by sending the REGISTER intent. On iOS this is done using the tmmregister URL scheme. On Windows this is done by sending the tmmRegister URI Request. Registration accomplishes three things:
It launches TMM if TMM is not already running.
It registers your Application ID with TMM so you can use the REST API.
It returns a list of ports for interacting with TMM.
Android: REGISTER Intent
On Android, TMM uses the REGISTER Intent mechanism to register client applications.
Setup (Java)
Response (Java)
iOS: tmmregister URL Scheme
Use the tmmregister URL scheme to register your client app with TMM.
Setup (Swift)
First you will open the tmmregister URL scheme, supplying:
application_id: String, your assigned application ID from Trimble
returnurl: the callback URL for your own app that TMM will open when the registration operation is complete.
Response (Swift)
When TMM has finished it will return control back to your application by opening the previously provided returnurl. Add code to your app delegate to handle the incoming callback url.
Windows: tmmRegister URI Request
TMM registers a custom URI scheme with Windows for handling requests from client applications. The calling application supplies a callback URI, which TMM will launch when it has finished processing the request.
Use the tmmRegister request to register your client application with TMM to use TMM API.
Setup (C#)
Package.appxmanifest
First, register your own custom URI scheme with Windows so that you can receive the response from TMM. Do this by adding a windows.protocol extension to your Application in Package.appxmanifest file.
Launching the URI
Use the Windows URI launcher to send the tmmRegister request. Windows will route the URI to an instance of TMM.
Response (C#, MAUI WinUI)
To get a response back from the TMM request URI scheme, you must register your own app’s URI scheme, and then handle the incoming URI from your app. Below we show how to do this in a .NET MAUI Windows app, but the procedure is similar for any Windows app.
App.xaml.windows.cs
REST API
Now that you’ve registered your application with TMM, you can start sending requests to the REST API.
Access Codes
A valid access code is required to grant access to TMM’s REST API.
Access codes are generated using a combination of your Application ID, and the current time.
The access code is added to the HTTP request in the Authorization header.
An access code is valid for 1 second after generation.
A new access code should be generated for every REST API call.
Access Code Generation (C#):
To test and verify your access code generation code, we have provided you with access-code-gold-file.json, which contains a set of random ApplicationID + UTC Time and the access code they should generate. The data looks like this:
HTTP Authorization Header
When you have generated an access code, insert it into the HTTP Authorization header, using the Basic scheme. Upon receiving the request, TMM will validate the Access Code against all registered client applications. If the Code checks out, then TMM will process the request. If the code does not check out, then TMM will respond with 401 Unauthorized.
Now that your client app is registered, you can use the positionStream REST API endpoint to start the WebSocket position stream.
Reading WebSocket Positions (C#)
Now that you have the WebSocket port for the position stream, you can open the WebSocket and start reading positions. See v2SocketPort for more details on the JSON format.