class IoTCommunication(object):
"""Aggregates Rx and Tx channel for sending and receiving IoTData."""
+
def __init__(self, tx, rx):
pass
Implements communication concepts of starting and stopping communication.
Only methods _start() and _stop() should be implemented by child classes.
"""
+
def __init__(self):
self._started = False
Uses protocol specific encoder to encode IoTData and protocol specific
decoder to decode result.
"""
+
def __init__(self, encoder, decoder):
self.encoder = encoder
self.decoder = decoder
IoTData and protocol specific encoder is used to encode result of
handling.
"""
+
def __init__(self, decoder, encoder):
self.encoder = encoder
self.decoder = decoder
class OneM2MHttpTx(IoTTx):
"""Implementation of HTTP OneM2M Tx channel"""
+
def __init__(self, encoder, decoder):
super(OneM2MHttpTx, self).__init__(encoder, decoder)
self.session = None
class OneM2MHttpRx(IoTRx):
"""Implementation of HTTP OneM2M Rx channel"""
+
def __init__(self, decoder, encoder, port, interface=""):
super(OneM2MHttpRx, self).__init__(decoder, encoder)
self.interface = interface
class OneM2MHttpJsonPrimitiveBuilder(OneM2MJsonPrimitiveBuilder):
"""Builder class specialized for OneM2MHttpJsonPrimitive objects"""
+
def build(self):
return OneM2MHttpJsonPrimitive(self.parameters, self.content, self.protocol, self.proto_params)
class OneM2MEncodeDecodeData(object):
"""Utility class which allows to define encoding/decoding dictionaries"""
+
def __init__(self, data_type):
if not data_type:
raise Exception("No data type string specified")
class OneM2MPrimitiveBuilder(IoTDataBuilder, OneM2MPrimitive):
"""Abstract class describes OneM2M primitive object builder"""
+
def set_parameters(self, parameters):
raise NotImplementedError()
class OneM2MPrimitiveEncoder(IoTDataEncoder):
"""IoT Data Encoder specialization for OneM2M primitives"""
+
def encode(self, onem2m_primitive):
raise NotImplementedError()
class OneM2MPrimitiveDecoder(IoTDataDecoder):
"""IoT Data Decoder specialization for OneM2M primitives"""
+
def decode(self, protocol_message):
raise NotImplementedError()
allias, communication)
if replies != count:
raise AssertionError(("Unexpected number of auto replies to notification from subscription {}, " +
- "auto replies: {}, expected: {}").format(subscription_resource_id, count, replies))
+ "auto replies: {}, expected: {}").format(subscription_resource_id, count, replies))
# Primitive getters uses JSON pointer object or string