def _initPackets(self): #status self.statusResponsePacket = packets.packet(template = [packets.pString('status', 1), #status is encoded as 'b' for bootloader, 'a' for app. packets.pInteger('appValidity', 1)]) #app validity byte, gets set to 170 if app is valid #bootloader command self.bootCommandRequestPacket = packets.packet(template = [packets.pInteger('commandCode', 1)]) self.bootCommandResponsePacket = packets.packet(template = [ packets.pInteger('responseCode', 1), packets.pInteger('pageNumber', 2)]) #bootloader write self.bootWriteRequestPacket = packets.packet(template = [packets.pInteger('commandCode', 1), packets.pInteger('pageNumber', 2), packets.pList('writeData', self.bootPageSize)]) self.bootWriteResponsePacket = packets.packet(self.bootCommandResponsePacket) #bootloader read self.bootReadRequestPacket = packets.packet(template = [packets.pInteger('pageNumber', 2)]) self.bootReadResponsePacket = packets.packet(template = [packets.pList('readData', self.bootPageSize)]) #request URL self.urlResponsePacket = packets.packet(template = [packets.pString('URL')]) #set IP address self.setIPRequestPacket = packets.packet(template = [packets.pList('setAddress',2)]) self.setIPResponsePacket = packets.packet(self.urlResponsePacket)
def __init__(self, name=None, interface=None, owner=None): self.name = name #name becomes important for networked gestalt self.owner = owner self.interface = interfaceShell( interface, self ) #uses the interfaceShell object for connecting to sub-interface self.receiveQueue = Queue.Queue() self.CRC = CRC() self.nodeManager = self.nodeManager( ) #used to map network addresses (physical devices) to nodes self.startInterfaceThreads( ) #this will start the receiver, packetRouter, channelPriority, and channelAccess threads. #define standard gestalt packet self.gestaltPacket = packets.packet(template=[ packets.pInteger('startByte', 1), packets.pList('address', 2), packets.pInteger('port', 1), packets.pLength(), packets.pList('payload') ])
def __init__(self, name=None, interface=None, owner=None): self.name = name # name becomes important for networked gestalt self.owner = owner self.interface = interfaceShell( interface, self ) # uses the interfaceShell object for connecting to sub-interface self.receiveQueue = Queue.Queue() self.CRC = CRC() self.nodeManager = self.nodeManager() # used to map network addresses (physical devices) to nodes self.startInterfaceThreads() # this will start the receiver, packetRouter, channelPriority, and channelAccess threads. # define standard gestalt packet self.gestaltPacket = packets.packet( template=[ packets.pInteger("startByte", 1), packets.pList("address", 2), packets.pInteger("port", 1), packets.pLength(), packets.pList("payload"), ] )