Searching...

Matching results

    Application Data

    Initializing Table Of Contents...

    Introduction

    This section explains how to describe the data and commands exchanged with the Cloud. You can find samples code in the next section .

    Data Types

    The supported data type are the following data type: double (64bits float), int (32bits signed integer), string (UTF-8 text), boolean, binary and date.

    Application Data: Tree Elements

    Each tree element can have the following attributes:

    Name Comment
    id Identifier must be absolute in the hierarchy
    path Identifier is relative to the parent node. Nodes are separated by “.”
    default-label Label used in AirVantage UI

    An element in the tree can have an id or a path. id and path are mutually exclusive.

    Asset

    The asset is the first node of the tree (also called root node). It has an id and an optional default name.

    The asset is the first node of the tree (also called root node). It has an id and a default name is optional. An asset can contains node, settings, variables, events and commands.

    Example:

    <encoding type="MQTT">
        <asset default-label="my Asset" id="theasset">
            ...
        </asset>
    </encoding>
    

    Node

    Intermediate node in the tree. It can be conditioned to another element (using the depends-on block). If the condition is not true, the node and all its children are not valid.

    The node can have the following attributes:

    Name Default value Comment
    reset false If this attribute is set to true, the server can ask to reset the branch under this node

    A node can have the following child nodes:

    Name Cardinality Comment
    node 0 or any

    setting 0 or any See Setting section
    variable 0 or any See Variable section
    event 0 or any See Event section
    command 0 or any See Command section

    Example:

    <node path="data"
         default-label="FTP State">
    </node>
    
    <node path="config"
    	default-label="FTP Config">
    </node>
    

    Setting

    A setting is a data in the tree that can be read and written by the server.

    The settings can have the following specific attributes:

    Name Default value Comment
    default-value

    type

    The setting’s data type. See the data type section.
    history all By default, the server will store all the values of this data. If this attribute is set to last, it will only store the last value. If this attribute is set to change it will only store the a new value when it changed compared to the previous one.

    A setting can have the following child nodes:

    Name Cardinality Comment
    constraints 0 or any See constraints section for a description

    Example:

    <node path="config"
        default-label="FTP Config">
          <setting path="login" type="string"
             default-label="FTP Login" history="last"
          </setting>
    </node>
    

    Variable

    A variable is a data in the tree that can be read by the server.

    The variables can have the following specific attributes:

    A variable can not have any child node.

    Example:

    <node path="config"
        default-label="FTP State">
         <variable path="FTPError"
                type="int"
                default-label="Number of FTP Error"/>
          <variable path="FTPTransfert"
                  type="int"
                 default-label="Number of FTP Transfert"/>
    </node>
    

    Event

    An event is a data that can be sent by the device and receive by the server. The server cannot ask to read the value of an event.

    The events can have the following specific attributes:

    Name Default value Comment
    type

    The variable’s data type. See the data type section %}}

    history all

    By default, the server will store all the values of this data.

    • If this attribute is set to last, it will only store the last value.
    • If this attribute is set to change it will only store the a new value when it changed compared to the previous one.

    Name Default value Comment
    type

    The variable’s data type. See the data type section.

    An event can not have any child node.

    Command

    A command is an action that can be sent by the server to the device.

    The command can not have any specific attributes.

    A command can have the following child node:

    Name Cardinality Comment
    parameter 0 or any See below for a description.

    Example:

    <command path="reinit"
       default-label="Reinit counter">
    </command>
    

    A command can have several parameters.

    The parameters can have the following specific attributes:

    Name Default value Comment
    default-value

    type

    The setting’s data type.See the data type section.
    default-label

    Label displayed in AirVantage send command dialog box.
    optional false True if the parameter can be empty.
    id

    Required

    A setting can have the following child nodes:

    Name Cardinality Comment
    constraints 0 or any See constraints section for a description.

    The constraints

    The constraints can be defined on values (parameters or settings). Constraints can be enumeration, length (for string), bounds (for number), regex pattern (for string).

    Several constraints can be defined for a setting or a parameter.

    The enumeration

    Define the list of possible values and the optional default label associated with each value.

    An enumeration can have the following child nodes:

    Name Cardinality Comment
    value 1 or any A value can have a default-label attribute and can contain the real value.

    Example:

    <enumeration>
         <value default-label="RED">0</value>
         <value default-label="GREEN">1</value>
         <value default-label="BLUE">2</value>
    </enumeration>
    

    Example:

    <command  
          path="setDeviceMode"                 
          default-label="Set Device Mode">
         <parameter type="int" id="deviceMode"
              default-label="Device mode">
          <constraints>
             <enumeration>
                <value default-label="Stopped">0</value>
                <value default-label="Running">1</value>
                <value default-label="Monitoring">2</value>
             </enumeration>
          </constraints>
       </parameter>
    </command>
    

    The length

    Define the min and max length of a string.

    A length constraint can have the following attributes:

    Name Default value Comment
    min

    The minimum length for a string.
    max

    The maximum length for a string.

    Example:

    <length min="5" max="8"/>
    

    The bounds

    Define the min and max bounds of a number value.

    A bounds constraint can have the following attributes:

    Name Default value Comment
    min

    The minimum length for a string.
    max

    The maximum length for a string.

    Example:

    <bounds min="0" max="100"/>
    

    The regex pattern

    Define the regex to validate a string.

    A regex pattern constraint can have the following attributes:

    Name Default value Comment
    pattern

    Required.

    Example:

    <regex pattern="[a-zA-Z]+" />
    

    TOP