ar - deviceactionmapping Function

You use this function when you want to trigger an event in IoT CS based on the actions that are called in the AR app. The current example in the code uses a call when a procedure is stopped.

Configure your device mappings in JSON first. You create this mapping by connecting the IoT CS device ID to the IoT action that it supports and the AR app trigger.

The Device ID and Application ID values are supplied by IoT CS. The IoT trigger name is the trigger that is configured for the device model.
{
  "items": [
    {
      "deviceId": "B47C0F65-F1D7-4642-9694-E00B9500C63D",
      "applicationId": "0-AB",
      "arAppEvent": "procedureEnd",
      "iotTriggerName": "resetFilter"
    }
  ]
}

You can configure as many triggers as are required. Add each new trigger as an element in the items array.

Once your array is finished, minify and escape the JSON payload into a string.
"{\"items\":[{\"deviceId\":\"B47C0F65-F1D7-4642-9694-E00B9500C63D\",\"applicationId\":\"0-AB\",\"arAppEvent\":\"procedureEnd\",\"iotTriggerName\":\"resetFilter\"}]}"
Run the following F(n) command to set the configuration.
fn config f ar-accelerator ar-deviceactionmapping mapping "{\"items\":[{\"deviceId\":\"B47C0F65-F1D7-4642-9694-E00B9500C63D\",\"applicationId\":\"0-AB\",\"arAppEvent\":\"procedureEnd\",\"iotTriggerName\":\"resetFilter\"}]}"
Test the configuration is correct by running invoke:
echo -n '{"deviceId":"B47C0F65-F1D7-4642-9694-E00B9500C63D","applicationId":"0-AB"}' | fn invoke ar-accelerator ar-deviceactionmapping
The results should return a JSON object with the variables set above nested in a “service” object.
{"items":[{"deviceId":"B47C0F65-F1D7-4642-9694-E00B9500C63D","applicationId":"0-AB","arAppEvent":"procedureEnd","iotTriggerName":"resetFilter"}]}