Child pages
  • SenseData XML Format
Skip to end of metadata
Go to start of metadata

Example

<?xml version="1.0" ?>
<sensedata>
    <package id="Sumit-Local-Laptop" timestamp="1346113433203">
        <gps>
           <location longitude="38.446" latitude="96.334" altitude="100.34" />
           <delta climb="0.0" track="130.4" speed="0.0" />
           <accuracy longitude_error="1.0" latitude_error="2.5" altitude_error="" climb_error="" track_error="" speed_error="" />
        </gps>
        <sensors>
            <sensor id="SUMTEMP001" type="Temperature" units="C">
                <data>11</data>
            </sensor>
            <sensor id="SUMVOL001" type="Volume" units="l">
                <data>484</data>
            </sensor>
            <sensor id="SUMFLO001" type="FlowRate" units="l">
                <data>776.300</data>
            </sensor>
        </sensors>
    </package>
</sensedata>

SenseData elements can contain multiple package elements. Each package contains the Relay ID listed as just id and a timestamp which is a standard UNIX timestamp in seconds. Each package should contain only one sensors element. The sensors element can have multiple sensor elements, each with an id (Sensor ID), type and units. The sensor can contain one data element with the sensor data in its TEXT field.

Valid Sensor Types

  • Temperature
  • Volume*
  • FlowRate*

*Volume and FlowRate are typically both components of the same counter. For 1-Wire devices in LtSense, currently a single counter will be represented by two sensor elements, one where the id ends with a -FR and the other with a -V for FlowRate and Volume respectively.

**Capitalization matters.

Spatial Data

Location data is optional and can be specified using the gps tag. All three sections within the gps tag, location, delta, and accuracy are optional. However if a tag is present, all attributes within that tag are required. If data is not available for a given field, simply use the empty string ("").

  • location - Contains a longitutde, latitude and altitude. Both longitude and latitude must be present together or absent (if you only have an altitude sensor, you can only report the altitude, but the other two fields must be present and blank). Longitude or Latitude by itself without the other is not valid.
  • delta - Contains fields relating to rates of change. speed is speed in meters per second, track is course over ground (degrees from true north) and climb is vertical ascent/descent speed in meters per second
  • accuracy - Potential +/- error for each field longitude_error, latitude_error, altitude_error, speed_error, climb_error, and track_error

Future Sensors

  • pH
  • Humidity
  • Soil Moisture

Security

If security is enabled within BigSense, then a signature will need to be attached to the XML data. The attachment should be a Base64 encoded RSA with SHA1 digest signature of the XML data in its transmitted form, not including any leading or trailing whitespace or newlines. The signature must be separated by two newline characters. Both XML data and the signature should be in the HTTP POST Body. The following is a full POST request from a client to the BigSense web service from the LtSense client:

POST /bigsense/api/Sensor.sense.xml HTTP/1.1
Accept-Encoding: identity
Content-Length: 703
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Connection: close
User-Agent: Python-urllib/2.7

<?xml version="1.0" ?><SenseData><package id="Sumit-Local-Laptop" timestamp="1346251838355"><sensors><sensor id="SUMTEMP001" type="Temperature" units="C"><data>1</data></sensor><sensor id="SUMVOL001" type="Volume" units="l"><data>488</data></sensor><sensor id="SUMFLO001" type="FlowRate" units="l"><data>776.659</data></sensor></sensors></package></SenseData>

uWKUWtrqkL7B81K7jV47k2Kw7neOdl3npxao4zCk4tVgcdMeaj7IDMrVnw0wKYcsX7YMftHg83GRsf+Ovtu8ZC6OymgdpR4mAzb3jdk7cOBoDXLq0/O88TVLASHzhZ4BPu4qv0K8jQ/omSix1T49zYUeKL8jTHD+AOXBzksGX2J6SHkWLvTbUUqwkgMOwcm6sMO7Xb/f+aq/UFRkpafvHjHfCzLXwD3RGte4qqGgM+K+bpJOmv4OGZyx+FozXo5FAqYn7O/OA1JkzGnyPrUXxVdUKcKg+njDIcTl3CNeuUt6ZNWhxIO/LPtD9j0uI2HLH/b4mpNSPzcbAGeMOBe4Kg==

For information on how to build these signatures in both Python 2 and Java, please refer to http://penguindreams.org/blog/signature-verification-between-java-and-python/.

 

 

 

 

  • No labels