Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There is an example Python program that can be used to parse the data described below attached to this article, near the bottom.

Http Post

Device will try to make an Http Post connection whenever the action is triggered and repeatedly according to reminder interval setup. The Http Post request has the following format:

If there are N elements selected to be reported in action:

<?xml version="1.0" standalone="yes"?>
<report version = "0.1.0.0T0">
<reportgroup name="device">
     <reportitem name = "serial number">
          <value>000000000000</value>
     </reportitem>
     <reportitem name = "system long name">
          <value>System long name</value>
     </reportitem>
</reportgroup>
<reportgroup name="data">
     <reportitem name = "title">
          <value>Title 1</value>
     </reportitem>
     <reportitem name = "identifier">
          <value>Identifier 1</value>
     </reportitem>
     <reportitem name = "timestamp">
          <value>Timestamp 1</value>
     </reportitem>
     <reportitem name = "value">
          <value>Reading/State 1</value>
     </reportitem>
     <reportitem name = "unit">
          <value>Unit 1</value>
     </reportitem>
</reportgroup>
<reportgroup name="data">
     <reportitem name = "title">
          <value>Title 2</value>
     </reportitem>
     <reportitem name = "identifier">
          <value>Identifier 2</value>
     </reportitem>
     <reportitem name = "timestamp">
          <value>Timestamp 2</value>
     </reportitem>
     <reportitem name = "value">
          <value>Reading/State 2</value>
     </reportitem>
     <reportitem name = "unit">
          <value>Unit 2</value>
     </reportitem>
</reportgroup>

<reportgroup name="data">
     <reportitem name = "title">
          <value>Title N</value>
     </reportitem>
     <reportitem name = "identifier">
          <value>Identifier N</value>
     </reportitem>
     <reportitem name = "timestamp">
          <value>Timestamp N</value>
     </reportitem>
     <reportitem name = "value">
          <value>Reading/State N</value>
     </reportitem>
     <reportitem name = "unit">
          <value>Unit N</value>
     </reportitem>
</reportgroup>
</report>
*Note that tabs and new lines are added in between xml tags for easier viewing. DTD for xml validation is not shown.

where each reporting element follows right after the preceding one. System long name is configurable and serial number can serve as device identifier. Identifier, timestamp and unit show up according to DAQ format configured. Timestamp shows as system uptime or system clock according to DAQ format also. Unit will be shown if the reporting element has a unit (e.g. analog input) and DAQ format is configured to show it. Title follows user configuration if applicable (e.g. analog input is editable). Reporting element will show up only if its reporting is enabled and its displayed is enabled (e.g. analog input display can be disabled globally).

For example:

<?xml version="1.0" standalone="yes"?><!DOCTYPE report [
   <!ELEMENT report (reportgroup*)>
   <!ELEMENT reportgroup (reportitem*,reportgroup*)>
   <!ELEMENT reportitem (value*)>
   <!ELEMENT value (#PCDATA)>
   <!ATTLIST report version CDATA #IMPLIED>
   <!ATTLIST reportgroup name CDATA #IMPLIED>
   <!ATTLIST reportgroup instance CDATA #IMPLIED>
   <!ATTLIST reportitem name CDATA #IMPLIED>
   <!ATTLIST reportitem instance CDATA #IMPLIED>
   <!ATTLIST value name CDATA #IMPLIED>
]>
<report version = "0.1.0.0T0"><reportgroup name="device"><reportitem name = "serial number"><value>00204AD78CA4</value></reportitem><reportitem name = "system long name"><value>Lantronix xSenso 21A2</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Terminal Block Power</value></reportitem><reportitem name = "identifier"><value>P1</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.398</value></reportitem><reportitem name = "value"><value>Dead</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Barrel Connector Power</value></reportitem><reportitem name = "identifier"><value>P2</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.097</value></reportitem><reportitem name = "value"><value>Live</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Input 1</value></reportitem><reportitem name = "identifier"><value>I1</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.417</value></reportitem><reportitem name = "value"><value>+5.99980</value></reportitem><reportitem name = "unit"><value>V</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Input 2</value></reportitem><reportitem name = "identifier"><value>I2</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.458</value></reportitem><reportitem name = "value"><value>+0.00126</value></reportitem><reportitem name = "unit"><value>V</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Ouput 1</value></reportitem><reportitem name = "identifier"><value>O1</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.531</value></reportitem><reportitem name = "value"><value>Open    </value></reportitem><reportitem name = "unit"><value>mA</value></reportitem></reportgroup><reportgroup name = "data"><reportitem name = "title"><value>Output 2</value></reportitem><reportitem name = "identifier"><value>O2</value></reportitem><reportitem name = "timestamp"><value>2012/11/16 20:43:53.531</value></reportitem><reportitem name = "value"><value>Open    </value></reportitem><reportitem name = "unit"><value>mA</value></reportitem></reportgroup></report>

Ftp Put

Device will try to make an Ftp Put connection whenever the action is triggered and repeatedly according to reminder interval setup. The remote file is created or appended with the following format (csv: comma separated value):

...

00204AD78CA4,Lantronix xSenso 21A2,Terminal Block Power,P1,2012/11/02 14:47:12.913,Live,Barrel Connector Power,P2,2012/11/02 14:47:13.214,Dead,Input 1,I1,2012/11/02 14:47:13.219,+0.00000,V,Input 2,I2,2012/11/02 14:47:13.260,+0.00000,V,Output 1,O1,2012/11/02 14:47:13.282,+0.00000,V,Output 2,O2,2012/11/02 14:47:13.282,+0.00000,V,


File Attachment :

View file
nametest.py
height150


...

[Originally Published On: 06/28/2013 04:08 PM]