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 using shared subscriptions.

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://173.39.84.53:8081/scim/v2/Devices' \
--header 'Content-Type: application/json' \
--header 'x-api-key: 596f0eba1668e6afeb3b25669990b7d84b8bf70408f21465a05e227664763024' \
--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": "Asset tracking tag",
    "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": "79ca0f72-4ae2-436a-8bd4-24a2770faa83",
  "deviceDisplayName": "Asset tracking tag",
  "adminState": true,
  "urn:ietf:params:scim:schemas:extension:ble:2.0:Device": {
    "versionSupport": [
      "5.3"
    ],
    "deviceMacAddress": "CA:2B:5C:EC:95:46",
    "isRandom": false,
    "pairingMethods": [
      "urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device",
      "urn:ietf:params:scim:schemas:extension:pairingJustWorks:2.0:Device"
    ],
    "mobility": false,
    "urn:ietf:params:scim:schemas:extension:pairingNull:2.0:Device": {},
    "urn:ietf:params:scim:schemas:extension:pairingJustWorks:2.0:Device": {
      "key": 0
    },
    "urn:ietf:params:scim:schemas:extension:pairingPassKey:2.0:Device": {
      "key": 0
    },
    "urn:ietf:params:scim:schemas:extension:pairingOOB:2.0:Device": {
      "key": "",
      "randNumber": 0,
      "confirmationNumber": 0
    }
  },
  "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://173.39.84.53:8081/control/registration/registerDataApp' \
--header 'Content-Type: application/json' \
--header 'x-api-key: b922958a7b030857b3e40f8d6a4db58f6a2bd65741f47fb120517ff8bb6fb0cb' \
--data '{
    "controlApp": "controlApplication",
    "topic": "enterprise/hospital/advertisements",
    "dataApps": [
        {   
            "dataAppID": "dataApplication"
        }
    ]
}'

Response Format:


{
  "status" : "SUCCESS",
  "topic" : "enterprise/hospital/advertisements",
  "reason" : "Data applications successfully registered!"
}

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 "79ca0f72-4ae2-436a-8bd4-24a2770faa83".

Request Format:


curl -k --location 'https://173.39.84.53:8081/control/registration/registerTopic' \
--header 'Content-Type: application/json' \
--header 'x-api-key: b922958a7b030857b3e40f8d6a4db58f6a2bd65741f47fb120517ff8bb6fb0cb' \
--data '{
    "technology": "ble",
    "topic": "enterprise/hospital/advertisements",
    "ids": [
        "79ca0f72-4ae2-436a-8bd4-24a2770faa83"
    ],
    "controlApp": "controlApplication",
    "ble": {
        "type": "advertisements"
    }
}'

Response Format:


{
  "status" : "SUCCESS",
  "topic" : "enterprise/hospital/advertisements",
  "reason" : "Onboarded advertisement topics successfully registered!",
  "registeredIDs" : [ "79ca0f72-4ae2-436a-8bd4-24a2770faa83" ]
}

Onboarded Advertisements Subscription


mosquitto_sub -h localhost -p 41883 -t '$share/group/enterprise/hospital/advertisements' -u 
dataApplication --pw d5a4c7b1afd862a070514528006f22d4964f6c61ec0e2e0b6c3ebd03c2fbb507

$dbdb70f8-b02d-4733-9d1e-8875fa74bda8 dnaspaces.io/iot
"44:e8:80:00:00:00b
EF:00:00:00:00:02
 
$dbdb70f8-b02d-4733-9d1e-8875fa74bda8 dnaspaces.io/iot
"44:e8:80:00:00:00b
EF:00:00:00:00:02
 
$dbdb70f8-b02d-4733-9d1e-8875fa74bda8 dnaspaces.io/iot
"44:e8:80:00:00:00b
EF:00:00:00:00:02
 
$dbdb70f8-b02d-4733-9d1e-8875fa74bda8 dnaspaces.io/iot
"44:e8:80:00:00:00b
EF:00:00:00:00:02 

Note


The partner application must run multiple instances of the mosquitto_sub command. The number of instances is based on the Cisco Catalyst 9800 Wireless Controller platform on which the IoT Orchestrator is deployed. For more information, see the table.