Commit ca9e565a authored by Peter Waher's avatar Peter Waher

Adding event subscription schema.

parent 03cb7b2b
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ieee:iot:sub'
xmlns='urn:ieee:iot:sub'
xmlns:sd='urn:ieee:iot:sd'
elementFormDefault='qualified'>
<xs:import namespace='urn:ieee:iot:sd'/>
<xs:element name='subscribe'>
<xs:annotation>
<xs:documentation>Defines a subscription of sensor data.</xs:documentation>
<xs:documentation>This element is sent in an iq set stanza.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='nd'>
<xs:annotation>
<xs:documentation>Defines a node restriction of the subscription.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name='id' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>Node identity. (Required)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='src' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>Source identity. (Optional. Scopes the node identity.)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='pt' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>Source partition. (Optional. Scopes the node identity, within a source.)</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name='f'>
<xs:annotation>
<xs:documentation>Defines a field restriction of the request.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name='n' type='xs:string' use='required'>
<xs:annotation>
<xs:documentation>Field name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='v' type='xs:double' use='optional'>
<xs:annotation>
<xs:documentation>Clients perception of the current value of the field.</xs:documentation>
<xs:documentation>If not provided, server will use the current value, as seen by the server.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='by' type='PositiveDouble' use='optional'>
<xs:annotation>
<xs:documentation>Trigger event if value changes more than this value, from the current value at the time of subscription, or last event.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='up' type='PositiveDouble' use='optional'>
<xs:annotation>
<xs:documentation>Trigger event if value changes more than this value upwards, from the current value at the time of subscription, or last event.</xs:documentation>
<xs:documentation>Can be used together with the dn attribute, to create different trigger levels around the current value.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='dn' type='PositiveDouble' use='optional'>
<xs:annotation>
<xs:documentation>Trigger event if value changes more than this value downwards, from the current value at the time of subscription, or last event.</xs:documentation>
<xs:documentation>Can be used together with the up attribute, to create different trigger levels around the current value.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name='id' type='xs:string' use='required'>
<xs:annotation>
<xs:documentation>Request identity. Will be used when sending sensor data back to the client.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref='sd:category'>
<xs:annotation>
<xs:documentation>Categories of fields requested.</xs:documentation>
</xs:annotation>
</xs:attributeGroup>
<xs:attribute name='all' type='xs:boolean' use='optional' default='false'>
<xs:annotation>
<xs:documentation>Field used to request all categories of fields.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='maxAge' type='xs:duration' use='optional'>
<xs:annotation>
<xs:documentation>Maximum age of historical data to return, when event is triggered.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='minInt' type='xs:duration' use='optional'>
<xs:annotation>
<xs:documentation>The longest time allowed between triggers.</xs:documentation>
<xs:documentation>If the event hasn't been triggered withing this amount of time, the event is triggered.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='maxInt' type='xs:duration' use='optional'>
<xs:annotation>
<xs:documentation>The shortest time allowed between triggers.</xs:documentation>
<xs:documentation>If conditions for an event to trigger occur before this time has elapsed, the trigger is delayed until the end of this time period.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='st' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>Service token, identifying the service generating the original request.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='dt' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>Device token, identifying the device generating the original request.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='ut' type='xs:string' use='optional'>
<xs:annotation>
<xs:documentation>User token, identifying the user generating the original request.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name='req' type='xs:boolean' use='optional' default='false'/>
</xs:complexType>
</xs:element>
<xs:element name='unsubscribe'>
<xs:annotation>
<xs:documentation>Removes a subscription</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name='id' type='xs:string' use='required'>
<xs:annotation>
<xs:documentation>Identity of the subscription request to cancel.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name='PositiveDouble'>
<xs:annotation>
<xs:documentation>A positive floating-point value.</xs:documentation>
</xs:annotation>
<xs:restriction base='xs:double'>
<xs:minExclusive value='0'/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
\ No newline at end of file
...@@ -21,6 +21,7 @@ Schemas ...@@ -21,6 +21,7 @@ Schemas
------------- -------------
* [SensorData.xsd](SensorData.xsd) * [SensorData.xsd](SensorData.xsd)
* [EventSubscription.xsd](EventSubscription.xsd)
Implementations Implementations
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment