def writeToServer(self, action, *args, **kw):        
        logger.debug(("writeToServer(" + action + ", [" + ', '.join(args) + "])"))
        
        block = QtCore.QByteArray()
        out = QtCore.QDataStream(block, QtCore.QIODevice.ReadWrite)
        out.setVersion(QtCore.QDataStream.Qt_4_2)
        out.writeUInt32(0)
        out.writeQString(action)
        
        for arg in args :            
            if type(arg) is IntType:
                out.writeInt(arg)
            elif isinstance(arg, basestring):
                out.writeQString(arg)
            elif type(arg) is FloatType:
                out.writeFloat(arg)
            elif type(arg) is ListType:
                out.writeQVariantList(arg)
            else:
                logger.warn("Uninterpreted Data Type: " + str(type(arg)) + " of value: " + str(arg))
                out.writeQString(str(arg))

        out.device().seek(0)
        out.writeUInt32(block.size() - 4)

        self.bytesToSend = block.size() - 4        
        self.replayVaultSocket.write(block)
Esempio n. 2
0
    def writeToServer(self, action, *args, **kw):
        logger.debug(
            ("writeToServer(" + action + ", [" + ', '.join(args) + "])"))

        block = QtCore.QByteArray()
        out = QtCore.QDataStream(block, QtCore.QIODevice.ReadWrite)
        out.setVersion(QtCore.QDataStream.Qt_4_2)
        out.writeUInt32(0)
        out.writeQString(action)

        for arg in args:
            if type(arg) is IntType:
                out.writeInt(arg)
            elif isinstance(arg, basestring):
                out.writeQString(arg)
            elif type(arg) is FloatType:
                out.writeFloat(arg)
            elif type(arg) is ListType:
                out.writeQVariantList(arg)
            else:
                logger.warn("Uninterpreted Data Type: " + str(type(arg)) +
                            " of value: " + str(arg))
                out.writeQString(str(arg))

        out.device().seek(0)
        out.writeUInt32(block.size() - 4)

        self.bytesToSend = block.size() - 4
        self.replayVaultSocket.write(block)
Esempio n. 3
0
 def disconnected(self):
     logger.debug("Disconnected from server")
Esempio n. 4
0
 def process(self, action, stream):
     logger.debug("Replay Vault Server: " + action)
     self.receiveJSON(action, stream)
Esempio n. 5
0
 def send(self, message):
     data = json.dumps(message)
     logger.debug("Outgoing JSON Message: " + data)
     self.writeToServer(data)
 def disconnected(self):
     logger.debug("Disconnected from server")
 def process(self, action, stream):
     logger.debug("Replay Vault Server: " + action)
     self.receiveJSON(action, stream)
 def send(self, message):
     data = json.dumps(message)
     logger.debug("Outgoing JSON Message: " + data)
     self.writeToServer(data)