summaryrefslogtreecommitdiff
path: root/slixmpp/plugins/xep_0323/stanza/sensordata.py
diff options
context:
space:
mode:
Diffstat (limited to 'slixmpp/plugins/xep_0323/stanza/sensordata.py')
-rw-r--r--slixmpp/plugins/xep_0323/stanza/sensordata.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/slixmpp/plugins/xep_0323/stanza/sensordata.py b/slixmpp/plugins/xep_0323/stanza/sensordata.py
index 92946498..eb08975c 100644
--- a/slixmpp/plugins/xep_0323/stanza/sensordata.py
+++ b/slixmpp/plugins/xep_0323/stanza/sensordata.py
@@ -20,14 +20,14 @@ class Sensordata(ElementBase):
interfaces = set(tuple())
class FieldTypes():
- """
+ """
All field types are optional booleans that default to False
"""
field_types = set([ 'momentary','peak','status','computed','identity','historicalSecond','historicalMinute','historicalHour', \
'historicalDay','historicalWeek','historicalMonth','historicalQuarter','historicalYear','historicalOther'])
class FieldStatus():
- """
+ """
All field statuses are optional booleans that default to False
"""
field_status = set([ 'missing','automaticEstimate','manualEstimate','manualReadout','automaticReadout','timeOffset','warning','error', \
@@ -41,7 +41,7 @@ class Request(ElementBase):
interfaces.update(FieldTypes.field_types);
_flags = set(['serviceToken','deviceToken','userToken','from','to','when','historical','all']);
_flags.update(FieldTypes.field_types);
-
+
def __init__(self, xml=None, parent=None):
ElementBase.__init__(self, xml, parent);
self._nodes = set()
@@ -64,8 +64,8 @@ class Request(ElementBase):
def _get_flags(self):
"""
- Helper function for getting of flags. Returns all flags in
- dictionary format: { "flag name": "flag value" ... }
+ Helper function for getting of flags. Returns all flags in
+ dictionary format: { "flag name": "flag value" ... }
"""
flags = {};
for f in self._flags:
@@ -75,10 +75,10 @@ class Request(ElementBase):
def _set_flags(self, flags):
"""
- Helper function for setting of flags.
+ Helper function for setting of flags.
Arguments:
- flags -- Flags in dictionary format: { "flag name": "flag value" ... }
+ flags -- Flags in dictionary format: { "flag name": "flag value" ... }
"""
for f in self._flags:
if flags is not None and f in flags:
@@ -94,7 +94,7 @@ class Request(ElementBase):
Arguments:
nodeId -- The ID for the node.
sourceId -- [optional] identifying the data source controlling the device
- cacheType -- [optional] narrowing down the search to a specific kind of node
+ cacheType -- [optional] narrowing down the search to a specific kind of node
"""
if nodeId not in self._nodes:
self._nodes.add((nodeId))
@@ -318,7 +318,7 @@ class Fields(ElementBase):
Arguments:
nodeId -- The ID for the node.
sourceId -- [optional] identifying the data source controlling the device
- cacheType -- [optional] narrowing down the search to a specific kind of node
+ cacheType -- [optional] narrowing down the search to a specific kind of node
"""
if nodeId not in self._nodes:
self._nodes.add((nodeId))
@@ -411,7 +411,7 @@ class FieldsNode(ElementBase):
def add_timestamp(self, timestamp, substanzas=None):
"""
- Add a new timestamp element.
+ Add a new timestamp element.
Arguments:
timestamp -- The timestamp in ISO format.
@@ -485,7 +485,7 @@ class FieldsNode(ElementBase):
self.iterables.remove(timestamp)
class Field(ElementBase):
- """
+ """
Field element in response Timestamp. This is a base class,
all instances of fields added to Timestamp must be of types:
DataNumeric
@@ -494,7 +494,7 @@ class Field(ElementBase):
DataDateTime
DataTimeSpan
DataEnum
- """
+ """
namespace = 'urn:xmpp:iot:sensordata'
name = 'field'
plugin_attrib = name
@@ -523,8 +523,8 @@ class Field(ElementBase):
def _get_flags(self):
"""
- Helper function for getting of flags. Returns all flags in
- dictionary format: { "flag name": "flag value" ... }
+ Helper function for getting of flags. Returns all flags in
+ dictionary format: { "flag name": "flag value" ... }
"""
flags = {};
for f in self._flags:
@@ -534,10 +534,10 @@ class Field(ElementBase):
def _set_flags(self, flags):
"""
- Helper function for setting of flags.
+ Helper function for setting of flags.
Arguments:
- flags -- Flags in dictionary format: { "flag name": "flag value" ... }
+ flags -- Flags in dictionary format: { "flag name": "flag value" ... }
"""
for f in self._flags:
if flags is not None and f in flags:
@@ -576,7 +576,7 @@ class Timestamp(ElementBase):
def add_data(self, typename, name, value, module=None, stringIds=None, unit=None, dataType=None, flags=None):
"""
- Add a new data element.
+ Add a new data element.
Arguments:
typename -- The type of data element (numeric, string, boolean, dateTime, timeSpan or enum)
@@ -661,9 +661,9 @@ class Timestamp(ElementBase):
self.iterables.remove(data)
class DataNumeric(Field):
- """
- Field data of type numeric.
- Note that the value is expressed as a string.
+ """
+ Field data of type numeric.
+ Note that the value is expressed as a string.
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'numeric'
@@ -672,11 +672,11 @@ class DataNumeric(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "numeric"
+ return "numeric"
class DataString(Field):
- """
- Field data of type string
+ """
+ Field data of type string
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'string'
@@ -685,12 +685,12 @@ class DataString(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "string"
+ return "string"
class DataBoolean(Field):
- """
+ """
Field data of type boolean.
- Note that the value is expressed as a string.
+ Note that the value is expressed as a string.
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'boolean'
@@ -699,12 +699,12 @@ class DataBoolean(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "boolean"
+ return "boolean"
class DataDateTime(Field):
- """
+ """
Field data of type dateTime.
- Note that the value is expressed as a string.
+ Note that the value is expressed as a string.
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'dateTime'
@@ -713,12 +713,12 @@ class DataDateTime(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "dateTime"
+ return "dateTime"
class DataTimeSpan(Field):
- """
+ """
Field data of type timeSpan.
- Note that the value is expressed as a string.
+ Note that the value is expressed as a string.
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'timeSpan'
@@ -727,12 +727,12 @@ class DataTimeSpan(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "timeSpan"
+ return "timeSpan"
class DataEnum(Field):
- """
+ """
Field data of type enum.
- Note that the value is expressed as a string.
+ Note that the value is expressed as a string.
"""
namespace = 'urn:xmpp:iot:sensordata'
name = 'enum'
@@ -741,7 +741,7 @@ class DataEnum(Field):
interfaces.update(Field.interfaces);
def _get_typename(self):
- return "enum"
+ return "enum"
class Done(ElementBase):
""" Done element used to signal that all data has been transferred """