added methods for adding node/device specific fileds

This commit is contained in:
Rod A Santiago 2016-09-08 17:52:08 -07:00
parent fa1b79fe68
commit ebd931d2ec

View file

@ -86,9 +86,10 @@ class NodeMsg(CoreNodeMessage):
if opaque is not None: if opaque is not None:
tlvdata = tlvdata + CoreNodeTlv.pack(CORE_TLV_NODE_OPAQUE,opaque) tlvdata = tlvdata + CoreNodeTlv.pack(CORE_TLV_NODE_OPAQUE,opaque)
hdr = struct.pack(CoreMessage.hdrfmt, CoreNodeMessage.msgtype, flags, len(tlvdata)) hdr = struct.pack(CoreMessage.hdrfmt, CoreNodeMessage.msgtype, flags, len(tlvdata))
return CoreNodeMessage(flags, hdr, tlvdata) return NodeMsg(flags, hdr, tlvdata)
def __init__(self, flags, hdr, tlvdata):
super(NodeMsg, self).__init__(flags,hdr,tlvdata)
def getNumber(self): def getNumber(self):
return self.gettlv(CORE_TLV_NODE_NUMBER) return self.gettlv(CORE_TLV_NODE_NUMBER)
def getType(self): def getType(self):
@ -129,6 +130,14 @@ class NodeMsg(CoreNodeMessage):
return self.gettlv(CORE_TLV_NODE_ICON) return self.gettlv(CORE_TLV_NODE_ICON)
def getOpaque(self): def getOpaque(self):
return self.gettlv(CORE_TLV_NODE_OPAQUE) return self.gettlv(CORE_TLV_NODE_OPAQUE)
def addModel(self,model):
if model: self.addtlvdata(CORE_TLV_NODE_MODEL,model)
def addType(self,type):
if type: self.tlvdata[CORE_TLV_NODE_TYPE]=type
def addServer(self,server):
if server: self.addtlvdata(CORE_TLV_NODE_EMUSRV,server)
class LinkMsg(CoreLinkMessage): class LinkMsg(CoreLinkMessage):