Skip to content

Asset Tracking

Asset tracking is the process of using internet-connected devices to monitor the location of physical assets. It involves attaching tracking devices(smart devices with a GPS unit) to assets, which collect data and transmit it to a central system for analysis and decision-making.  

SocketXP agent supports the asset tracking feature. SocketXP agent can track and transmit the location of your remote devices to the SocketXP cloud gateway.

You can then use the SocketXP webportal's MapView feature to view your devices on a map. SocketXP also provides an API to retrieve the current geographic location(geolocation co-ordinates) of your device.

SocketXP can retrieve the geolocation of your device using any one of the options below:

  • Built-in GPS unit in your device
  • Google GeoLocation API

Built-in GPS Unit:

If your IoT device has a built-in GPS unit (or if you cellular network provider can provide the GPS location of your mobile device), use a custom written app to read the GPS co-ordinates from your GPS unit and write the longitude and latitude values to a file named geolocation.json in the device under the following folder: /var/lib/socketxp in the following format:

$ cat /var/lib/socketxp/geolocation.json

{
    "lat": 37.813699649742475,
    "lng": -122.47787639433689
}
The values shown above are example values only.

Note:

The Latitude and Longitude values are float values and not string.

Use the below agent configuration to turn ON the asset tracking feature in the SocketXP agent running in your device:

{
    "asset_tracking": true,
    "asset_tracking_interval": 86400,
    "tunnels": [
        {
            "destination": "tcp://127.0.0.1:22"
        }
    ]
}

SocketXP agent will periodically read the longitude and latitude values from the geolocation.json file every Asset Tracking Interval seconds and trasmit this information to the SocketXP Cloud Gateway, where it is stored.

By default, the Asset Tracking Interval is 86400 seconds(or 24 hours). Use the asset_tracking_interval field in the config file to change the Asset Tracking Interval(in seconds) for your device. This value will tell the SocketXP agent how frequently to poll the geolocation.json file.

Google GeoLocation API:

If you device doesn't have a built-in GPS unit, SocketXP agent can still retrieve the geolocation of your device using the Google GeoLocation API.

Register with Google GeoLocation service and obtain an API key. Input the API key to the SocketXP agent using the below configuration.

{
    "asset_tracking": true,
    "asset_tracking_interval": 86400,
    "google_api_key": "abcdedfgh123456xyz",
    "tunnels": [
        {
            "destination": "tcp://127.0.0.1:22"
        }
    ]
}
SocketXP agent will invoke the GeoLocation API using the provided API key every asset_tracking_interval seconds and transmit the geolocation information to the SocketXP Cloud Gateway, where it is stored.

You can then use the SocketXP API to retrieve the geolocation of the device stored in the gateway. Alternatively, you can use the SocketXP web portal's MapView feature to view your device location on a map.

Have Questions?

If you have any questions or need further information about this feature, please write to us at: [email protected]