Exemplo n.º 1
0
 def makeCommandStringDatagram(self, commandString):
     datagram = PyDatagram()
     datagram.addUint32(self.packetNumber)
     self.packetNumber = self.packetNumber + 1
     datagram.addUint8(CLUSTER_COMMAND_STRING)
     datagram.addString(commandString)
     return datagram
Exemplo n.º 2
0
 def makeCommandStringDatagram(self, commandString):
     datagram = PyDatagram()
     datagram.addUint32(self.packetNumber)
     self.packetNumber = self.packetNumber + 1
     datagram.addUint8(CLUSTER_COMMAND_STRING)
     datagram.addString(commandString)
     return datagram
Exemplo n.º 3
0
 def makeNamedObjectMovementDatagram(self, xyz, hpr, scale, color, hidden, name):
     datagram = PyDatagram()
     datagram.addUint32(self.packetNumber)
     self.packetNumber = self.packetNumber + 1
     datagram.addUint8(CLUSTER_NAMED_OBJECT_MOVEMENT)
     datagram.addString(name)
     datagram.addFloat32(xyz[0])
     datagram.addFloat32(xyz[1])
     datagram.addFloat32(xyz[2])
     datagram.addFloat32(hpr[0])
     datagram.addFloat32(hpr[1])
     datagram.addFloat32(hpr[2])
     datagram.addFloat32(scale[0])
     datagram.addFloat32(scale[1])
     datagram.addFloat32(scale[2])
     datagram.addFloat32(color[0])
     datagram.addFloat32(color[1])
     datagram.addFloat32(color[2])
     datagram.addFloat32(color[3])        
     datagram.addBool(hidden)
     return datagram    
Exemplo n.º 4
0
    def send(self, message, sentArgs=[]):
        """
        Send message to All AI and Uber Dog servers.
        """
        assert self.notify.debugCall()
        datagram = PyDatagram()
        # To:
        datagram.addUint8(1)
        datagram.addChannel(self.channels[0])
        # From:
        datagram.addChannel(self.air.ourChannel)
        #if 1: # We send this just because the air expects it:
        #    # Add an 'A' for AI
        #    datagram.addUint8(ord('A'))

        messageType = MESSAGE_STRINGS.get(message, 0)
        datagram.addUint16(messageType)
        if messageType:
            datagram.addString(str(dumps(sentArgs)))
        else:
            datagram.addString(str(dumps((message, sentArgs))))
        self.air.send(datagram)
Exemplo n.º 5
0
 def makeNamedObjectMovementDatagram(self, xyz, hpr, scale, color, hidden,
                                     name):
     datagram = PyDatagram()
     datagram.addUint32(self.packetNumber)
     self.packetNumber = self.packetNumber + 1
     datagram.addUint8(CLUSTER_NAMED_OBJECT_MOVEMENT)
     datagram.addString(name)
     datagram.addFloat32(xyz[0])
     datagram.addFloat32(xyz[1])
     datagram.addFloat32(xyz[2])
     datagram.addFloat32(hpr[0])
     datagram.addFloat32(hpr[1])
     datagram.addFloat32(hpr[2])
     datagram.addFloat32(scale[0])
     datagram.addFloat32(scale[1])
     datagram.addFloat32(scale[2])
     datagram.addFloat32(color[0])
     datagram.addFloat32(color[1])
     datagram.addFloat32(color[2])
     datagram.addFloat32(color[3])
     datagram.addBool(hidden)
     return datagram
Exemplo n.º 6
0
    def send(self, message, sentArgs=[]):
        """
        Send message to All AI and Uber Dog servers.
        """
        assert self.notify.debugCall()
        datagram = PyDatagram()
        # To:
        datagram.addUint8(1)
        datagram.addChannel(self.channels[0])
        # From:
        datagram.addChannel(self.air.ourChannel)
        #if 1: # We send this just because the air expects it:
        #    # Add an 'A' for AI
        #    datagram.addUint8(ord('A'))

        messageType=MESSAGE_STRINGS.get(message, 0)
        datagram.addUint16(messageType)
        if messageType:
            datagram.addString(str(dumps(sentArgs)))
        else:
            datagram.addString(str(dumps((message, sentArgs))))
        self.air.send(datagram)