Dynamic Interfaces

Some devices support dynamic interfaces. Such a device supports the addition and removal of interface blocks, properties, and datapoints within a block at runtime, subject to the following constraints:

  • A device signals support for dynamic interfaces with sts.interfaceType: "dynamic".  Dynamically created items will then report their interfaceType as "dynamic." 

  • Properties must be based on a well-defined property type.

  • Datapoints must be based on a well-defined datapoint type.

  • Blocks can be based on a well-defined profile or implement no profile at all.  Blocks that are not based on a profile, or those that implement a virtual profile to accumulate device datapoints and device properties, accept any well-defined datapoint or property.    

  • Removing a block removes all implemented members.   

Adding a Block

Adding a block requires publishing an add action to the device’s do endpoint.  For information on the available arguments, see Add Action Properties.

To add a block that does not implement a profile:

Use the name argument, as in the following example.  name becomes the Block_Type in the IAP/MQ topic. The Block_Handle is always zero.

{
     action: “add”,
     args: {
          name: “myBlock”
     }
}

 

Adding a Datapoint or Property

Adding a datapoint or property requires publishing an add action to the device’s do endpoint.  For information on the available arguments, see Add Action Properties.  

To add a datapoint or property to a block that does not implement a well-defined profile:

Provide the implementation name along with implementation details: datapoint or property type and direction, and indicate the desired member name, as in the following example.

{
     action: “add”,
     args: {
          name: “myBlock”,
          implementation: {
               member: “myDatapoint”,
               type: “8010200000000000-3/UNVT_my_temp”,
               cat: “out”
          }
     }
}

To add a datapoint or property to the device or to the device block that accumulates all device properties and datapoints:

Set the block name to null, as in the following example.

{
     action: “add”,
     args: {
          name: null,
          implementation: {
               member: “myDatapoint”,
               type: “8010200000000000-3/UNVT_my_temp”,
               cat: “in”
          }
     }
}

type is the fully-qualified datapoint or property type reference for types not defined at scope 0. Types that are defined at scope 0 do not carry the resource set identifier.  cat is the category indicator described in Monitoring Preference Object.

Removing a Block

To remove a block or to remove optional members from a block, publish a remove action on the device’s do topic (see Remove Action Properties).

To remove a block, publish the following remove action to the device’s do endpoint:

{
     action: “remove”,
     args: {
           name: “myBlock”
     }
}

To remove an optional member for a block that is based on a profile, or to remove a member of a block that does not implement a profile, publish the following remove action to the device’s do endpoint:

{
     action: “remove”,
     args: {
           name: “myBlock”,
           implementation: {
                 member: “nvoTempValue”
           }
     }
}

To remove a datapoint or property from the device or from the virtual block that accumulates all device properties and datapoints, set the block name to null:

{
     action: “remove”,
     args: {
           name: null,
           implementation: {
                 member: “myDatapoint”,
           }
     }
}