Use Case 1 - Asset Tracking

Use Case 1: Asset Tracking

If you have an asset to be tracked using a BLE tag, you need to:

  • Onboard the BLE device.

  • Register topics for receiving the onboarded device advertisements over MQTT.

Consider a large factory with many moving carts, each equipped with a BLE tag.

To track the location of a cart, you need to:

  • Onboard the BLE device.

  • Register topics for receiving the onboarded device advertisements over MQTT.

In this use case, the device to be tracked has the following details:

  • Display Name: Asset Tag

  • MAC Address Type: Public

  • MAC Address: EF:00:00:00:00:00

For information on the BLE device tracking, refer to the following workflow:

The following workflow covers the sequence of operations:

  1. Onboard a device using the SCIM API.

  2. Register a data receiver application with a topic using the gateway.

  3. Register a topic with Device IDs to subscribe to advertisements.

  4. Subscribe to the topic from the data receiver application.

Onboarding a Device

Request Format:


curl -k --location 'https://10.195.78.33:8081/scim/v2/Devices' \
--header 'x-api-key: 5a9095d0457f24518bba93c50d69efe5' \
--header 'Content-Type: application/json' \
--data '
{
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:Device",
    "urn:ietf:params:scim:schemas:extension:ble:2.0:Device",
    "urn:ietf:params:scim:schemas:extension:endpointapps:2.0:Device"
  ],
  "deviceDisplayName": "BLE Heart Monitor",
  "adminState": true,
  "urn:ietf:params:scim:schemas:extension:ble:2.0:Device": {
    "versionSupport": [
      "5.3"
    ],
    "deviceMacAddress": "CA:2B:5C:EC:95:46",
    "isRandom": false,
    "mobility": false,
    "pairingMethods": [
      "urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device",
      "urn:ietf:params:scim:schemas:extension:pairingJustWorks:2.0:Device"
    ],
    "urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device": null,
    "urn:ietf:params:scim:schemas:extension:pairingJustWorks:2.0:Device": {
      "key": null
    }
  },
  "urn:ietf:params:scim:schemas:extension:endpointAppsExt:2.0:Device": {
    "onboardingUrl": "onboardApplication",
    "deviceControlUrl": [
      "controlApplication"
    ],
    "dataReceiverUrl": []
  }
} 
'

Response Format:


{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:Device",
"urn:ietf:params:scim:schemas:extension:ble:2.0:Device",
"urn:ietf:params:scim:schemas:extension:endpointapps:2.0:Device"
],
"id": "8ba69997-9062-4fc4-9d4e-6956c019c44b",
"deviceDisplayName": "Asset Tag",
"adminState": true,
"urn:ietf:params:scim:schemas:extension:ble:2.0:Device": {
"versionSupport": [
"5.3"
],
"deviceMacAddress": "EF:00:00:00:00:00",
"isRandom": false,
"pairingMethods": [
"urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device"
],
"mobility": false,
"urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device": null
},
"urn:ietf:params:scim:schemas:extension:endpointAppsExt:2.0:Device": {
"onboardingUrl": "onboardApplication",
"deviceControlUrl": [
"controlApplication"
],
"dataReceiverUrl": []
}
}

Registering the Data Receiver Application

You need to register a data receiver application with the app ID “dataApplication” to subscribe to the topic “enterprise/hospital/advertisements”.

Request Format:


curl -k --location
'https://10.195.78.33:8081/control/registration/registerDataApp' \
--header 'Content-Type: application/json' \
--header 'x-api-key: 6aab774c4d474e387ffab9638c3f917f' \
--data '
{
"controlApp": "controlApplication",
"topic": "enterprise/hospital/advertisements",
"dataApps": [
{
"dataAppID": "dataApplication"
}
]
}'

Response Format:


{
"status": "SUCCESS",
"reason": "Data apps are registered",
"topic": "enterprise/hospital/advertisements",
"isOnboarded": true
}

Registering a Topic

You will need to register the topic "enterprise/hospital/advertisements" with the gateway to be able to subscribe to advertisements from the device with ID "8ba69997-9062-4fc4-9d4e-6956c019c44b".

Request Format:


curl -k --location
'https://10.195.78.33:8081/control/registration/registerTopic' \
--header 'x-api-key: 2215dec3718288ad9028d39864f87d4c' \
--header 'Content-Type: application/json' \
--data '
{
"technology": "ble",
"topic": "enterprise/hospital/advertisements",
"ids": [
"8ba69997-9062-4fc4-9d4e-6956c019c44b"
],
"controlApp": "controlApplication",
"ble": {
"type": "advertisements"
}
}
'

Response Format:


{
"status": "SUCCESS",
"topic": "enterprise/hospital/advertisements"
}

Onboarded Advertisements Subscription


mosquitto_sub -h localhost -p 41883 -t enterprise/hospital/advertisements -u
https://dataApplication --pw c4e80e0483af0a4394dfb6e3ec5e820b

$97cfed0b-6729-49a6-9285-92913a4b1e4a dnaspaces.io/iot"
FF:00:00:00:00:01
$97cfed0b-6729-49a6-9285-92913a4b1e4a dnaspaces.io/iot"
FF:00:00:00:00:01
$97cfed0b-6729-49a6-9285-92913a4b1e4a dnaspaces.io/iot"
FF:00:00:00:00:01
$97cfed0b-6729-49a6-9285-92913a4b1e4a dnaspaces.io/iot"
FF:00:00:00:00:01
$97cfed0b-6729-49a6-9285-92913a4b1e4a dnaspaces.io/iot"
FF:00:00:00:00:01