Esempio n. 1
0
    def __init__(self, receiver, userID, robotID, password, reactor):
        """ Initialize the Connection.

            @param receiver:    Object which is responsible for the processing
                                of received data messages.
            @type  receiver:    rce.comm.interfaces.IMessageReceiver

            @param userID:      User ID which will be used to authenticate the
                                connection.
            @type  userID:      str

            @param robotID:     Robot ID which will be used to authenticate the
                                connection.
            @type  robotID:     str

            @param password:    Password which will be used to authenticate the
                                connection.
            @type  password:    str

            @param reactor:     Reference to reactor which is used for this
                                connection.
            @type  reactor:     twisted::reactor
        """
        verifyObject(IMessageReceiver, receiver)

        self._receiver = receiver
        self._userID = userID
        self._robotID = robotID
        self._password = sha256(password).hexdigest()
        self._reactor = reactor
        self._conn = None
        self._connectedDeferred = None
Esempio n. 2
0
    def __init__(self, receiver, userID, robotID, password, reactor):
        """ Initialize the Connection.

            @param receiver:    Object which is responsible for the processing
                                of received data messages.
            @type  receiver:    rce.comm.interfaces.IMessageReceiver

            @param userID:      User ID which will be used to authenticate the
                                connection.
            @type  userID:      str

            @param robotID:     Robot ID which will be used to authenticate the
                                connection.
            @type  robotID:     str

            @param password:    Password which will be used to authenticate the
                                connection.
            @type  password:    str

            @param reactor:     Reference to reactor which is used for this
                                connection.
            @type  reactor:     twisted::reactor
        """
        verifyObject(IClient, receiver)

        self._receiver = receiver
        self._userID = userID
        self._robotID = robotID
        self._password = sha256(password).hexdigest()
        self._reactor = reactor
        self._conn = None
        self._connectedDeferred = None
Esempio n. 3
0
    def registerProtocol(self, protocol):
        """ Register the client protocol.

            @param protocol:    Protocol which should be registered.
            @type  protocol:    rce.comm.interfaces.IServersideProtocol
        """
        assert self._protocol is None
        verifyObject(IProtocol, protocol)
        self._protocol = protocol
Esempio n. 4
0
    def registerProtocol(self, protocol):
        """ Register the client protocol.

            @param protocol:    Protocol which should be registered.
            @type  protocol:    rce.comm.interfaces.IServersideProtocol
        """
        assert self._protocol is None
        verifyObject(IProtocol, protocol)
        self._protocol = protocol
Esempio n. 5
0
    def _authenticate_success(self, avatar):
        """ Method is called by deferred when the connection has been
            successfully authenticated while being in 'onConnect'.
        """
        verifyObject(IRobot, avatar)
        verifyObject(IMessageReceiver, avatar)

        self._realm.registerWebsocketProtocol(avatar, self)
        self._avatar = avatar
        self._assembler.start()
Esempio n. 6
0
    def _authenticate_success(self, avatar):
        """ Method is called by deferred when the connection has been
            successfully authenticated while being in 'onConnect'.
        """
        verifyObject(IRobot, avatar)
        verifyObject(IMessageReceiver, avatar)

        self._realm.registerWebsocketProtocol(avatar, self)
        self._avatar = avatar
        self._assembler.start()
Esempio n. 7
0
    def __init__(self, realm):
        """ Initialize the Robot resource.

            @param realm:       Master realm implementing necessary callback
                                methods.
            @type  realm:       rce.comm.interfaces.IMasterRealm
        """
        Resource.__init__(self)

        verifyObject(IMasterRealm, realm)
        self._realm = realm
Esempio n. 8
0
    def __init__(self, realm):
        """ Initialize the Robot resource.

            @param realm:       Master realm implementing necessary callback
                                methods.
            @type  realm:       rce.comm.interfaces.IMasterRealm
        """
        Resource.__init__(self)

        verifyObject(IMasterRealm, realm)
        self._realm = realm
Esempio n. 9
0
    def __init__(self, realm):
        """ Initialize the Protocol.

            @param realm:       Robot realm implementing necessary callback
                                methods.
            @type  realm:       rce.comm.interfaces.IRobotRealm
        """
        verifyObject(IRobotRealm, realm)

        self._realm = realm
        self._assembler = MessageAssembler(self, self.MSG_QUEUE_TIMEOUT)
        self._avatar = None
Esempio n. 10
0
    def __init__(self, realm):
        """ Initialize the Protocol.

            @param realm:       Robot realm implementing necessary callback
                                methods.
            @type  realm:       rce.comm.interfaces.IRobotRealm
        """
        verifyObject(IRobotRealm, realm)

        self._realm = realm
        self._assembler = MessageAssembler(self, self.MSG_QUEUE_TIMEOUT)
        self._avatar = None