GTLV is a project mainly written in PYTHON and JAVA, based on the LGPL-3.0 license.
gTLV is a transport protocol that can be used to exchange generic information between two peers by means of Type-Length-Value (TLV) data encapsulation. Applications may take advantage of this protocol by extending these libraries with their specific
gTLV is a transport protocol that can be used to exchange generic information between two peers by means of Type-Length-Value (TLV) data encapsulation.
Applications may take advantage of this protocol by extending this specification with their specific requirements (actually, gTLV does not provide any functionality by itself). To do this, several requirements must be observed:
class MoteId(Attribute): type = 0x01 typedef = 'i'
def __init__(self, value):
Attribute.__init__(self)
self.value = value
class DataRequest(Packet): application = 0x01 code = 0x01 mandatory_attributes = {MoteId: 1}
def __init__(self):
Packet.__init__(self)
class ListManager():
packet_list = PacketList((DataRequest,))
attribute_list = AttributeList((MoteId,))
class Server(GtlvServer): def callback(self, raw_packet): packet = decode(raw_packet, self.list_manager) return packet.get_values(MoteId)
server = Server("localhost", 50000, ListManager) server.start()
target = Target("localhost", 50000, ListManager)
new_packet = DataRequest() new_packet.add_attribute(MoteId(123)) rsp = target.send(new_packet) # rsp is whatever the callback function returns
gTLV has only been tested against Python 2.5
gTLV uses the standard distutils system for installation:
python setup.py install