IAP/MQ Topic Syntax
The syntax for topics is as follows:
glp / {IAP_Version} / {SID} / {Channel} / {Resource_Type} [ / {Resource_Detail} ] [ / {Property_Path} ] |
Example:
glp/0/s1/fb/dev/lon/2/if/light/1 |
Where:
glp | IAP topics always begin with glp, where glp is a constant keyword. A topic cannot begin with a slash. | ||||||||||||||||||||||||
IAP_Version | The topic must specify the IAP version. The current version is 0 (zero). All IAP implementations support version 0 of the protocol. The number provided here indicates the highest protocol version supported. IAP supports all versions up to and including the maximum protocol version indicated with glp/0/{SID}/about/version. There are cases where the CMS, edge servers, and edge devices may end up are aware of different versions of IAP. How this is handled by IAP depends on the specific situation, but in general the CMS uses the highest version required by the message that is supported by the CMS and the edge servers. For example:
| ||||||||||||||||||||||||
SID | The SID is the Segment Identifier, which is the logical address of the device that controls a segment. In IAP, that device is either an edge server, or, an IAP-native edge device that is the only device on that segment. Such an edge device can still implement other object types, such as alarms or connections for itself, and uses the standard topic layout. An SID consists of the letters A-Z, a-z, digits 0-9, and special characters period (.), hyphen (-), and underscore (_). Special characters are not allowed as the first character of a SID. A valid SID matches this regular expression:
The SID is assigned to the edge server when the segment is provisioned. A regular SID has the format shown above. A different address is used in place of the SID in certain specific circumstances, such as before the segment is provisioned, or to indicate a local address for the edge server. For information about SIDs before an edge server is provisioned, see Segment Discovery. A local address for the edge server can be used for communication between IAP components within a segment. Topics using “.” for the SID are called local topics. Local topics are not relayed to the CMS or other segments through bridges. Topics using local addressing never traverse connections between CMS and a remote edge server. A period identifier used outside the segment represents a segment-independent address. And like local topics, segment-independent topics are not relayed across bridge connections.
Note: The = sign is used to indicate that the topic is addressing a service, instead of an object. Changing a segment identifier requires that the segment be deprovisioned first, then re-provisioned with the new segment identifier. Reserved SIDs:
Wildcards and SIDs:No tool or service should subscribe to IAP/MQ topics using a wildcard for the SID. Do not subscribe with | ||||||||||||||||||||||||
Channel | The IAP groups topics and message handling attributes into directional communication channels. Additional channels may exist within an edge server, but tools must not react to channel types that they are unaware of. When necessary, tools must process any unknown channel types verbatim. IAP includes the following channels, with the following identifiers:
| ||||||||||||||||||||||||
Resource_Type | IAP supports a variety of resource types such as devices, groups, schedules, etc. The supported resource types includes those in the following list. Additional resources are used in special cases, typically within the edge server.
| ||||||||||||||||||||||||
Resource_Detail | The general syntax for the Resource Detail is:
Possible topic syntax for a dev Resource and grp Resource is shown below:
See Device Syntax below for more syntax information. | ||||||||||||||||||||||||
Property_Path | Many resources allow topics to address a property within the selected object. This includes nested properties, which are separated with a single forward slash. Consider the following example:
|
Device Syntax
.../dev / {Edge_Protocol_ID} / {Handle} / {Object_Path} [ / {Property_Path} ] |
Following the dev resource element, device topics can include the following elements:
Topic Element | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Edge_Protocol_ID | Topics separate device objects according to their edge protocol. The edge protocol identifiers are typically two or three-letter acronyms, defined by the edge protocol driver. When required, the edge protocol identifier follows the resource type identifier. Edge servers may support the following edge protocols:
| ||||||||||
Handle | Handles are identifiers of addressable items used with IAP topics. The handle is a unique identifier within its scope. For example, every device object has a unique handle within its edge protocol and within its segment. A handle is a case-sensitive string at least one character long, and consists of letters A-Z and a-z, digits 0-9, and special characters period (.), hyphen (-), and underscore (_). A period can be used to separate parts of a handle, but cannot be used as the first character. The following characters are reserved, and must not be used: =, :, & The handle is assigned by the tool that creates the primary item. For example, a tool might create a LonWorks device and assign handle "1" or "2" as shown in the example below.
Tools allocate handles when creating resources through the request channel. Tools are responsible for allocating a unique handle. For more information, see Handle Allocation. | ||||||||||
Object_Path | The Object Path refers to the object addressed within the device. Depending on the specific object, the Object Path can actually be multiple levels deep and can contain additional handles. Each device supports a configuration object with the cfg endpoint in the request and the feedback channel. In the request channel it is used to support modifications to the object configuration. In the feedback channel it provides the complete and correct configuration object at all times. The following examples show the cfg endpoint in the feedback and request channels.
Nested PropertiesMany properties and nested properties within an addressable object can be addressed with the object path, but exceptions exist: a datapoint value, which is within most interface blocks, can only be written in its entirety, and can never be written only in parts. Therefore, a datapoint value can be addressed and written with an object path alone only if the datapoint implements a scalar type. Datapoints implementing complex types must be written with an object path that ends at the value property within the datapoint object. For example: value 1234 can be published to a scalar datapoint with a topic such as A datapoint that implements a complex type such as a structure with r, g, b values, must be written in its entirety, for example by writing |
Wildcards
The following wildcards can be used in the topic syntax for MQTT subscriptions: # and +
Clients can receive messages by creating subscriptions. A subscription may be to an explicit topic, in which case only messages to that topic will be received. Or a subscription may include wildcards. The following table describes the two wildcards:
Wildcard | Description |
---|---|
# | Can be used to represent all remaining levels of hierarchy. This means that it must be the final character in a subscription. |
+ | Can be used to represent a single level of hierarchy in a subscription. |