Example #1
0
    def stopSession(self, session_id):
        """
        Stop an active Session, known to the Server.
        """

        return self.sendAndReceive(
            SystemRequestFactory.stopSessionId(session_id))
Example #2
0
    def stopSession(self, session_id):
        """
        Stop an active Session, known to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.stopSessionId(session_id))
        
Example #3
0
    def startSession(self, device_id, password):
        """
        Start a new Session with a Device known to the Server.
        """

        return self.sendAndReceive(
            SystemRequestFactory.startSession(device_id).setPassword(password))
Example #4
0
    def enumerateSessions(self):
        """
        Send a request to the Agent, asking it to enumerate all sessions.

        The response will be intercepted by a message handler, and the Sessions
        collection updated at some point in the future.
        """
        self.write(SystemRequestFactory.listSessions().setId(999).build())
Example #5
0
    def enumerateSessions(self):
        """
        Send a request to the Agent, asking it to enumerate all sessions.

        The response will be intercepted by a message handler, and the Sessions
        collection updated at some point in the future.
        """
        self.write(SystemRequestFactory.listSessions().setId(999).build())
Example #6
0
    def ping(self):
        """
        Send a ping request to the Agent.

        The response will be intercepted by a message handler, and the
        last_pong identifier updated at some point in the future.
        """

        self.last_ping += 1
        
        self.write(SystemRequestFactory.ping().setId(self.last_ping).build())
Example #7
0
    def ping(self):
        """
        Send a ping request to the Agent.

        The response will be intercepted by a message handler, and the
        last_pong identifier updated at some point in the future.
        """

        self.last_ping += 1

        self.write(SystemRequestFactory.ping().setId(self.last_ping).build())
Example #8
0
    def startSession(self, device_id, password):
        """
        Start a new Session with a Device known to the Server.
        """

        try:
            return self.sendAndReceive(SystemRequestFactory.startSession(device_id).setPassword(password))
        except RuntimeError as e:
            if e.message == 'Received an empty response from the Agent. This normally means the remote service has crashed.':
                raise ConnectionError(e)
            else:
                raise
Example #9
0
    def listSessions(self):
        """
        Get a list of active sessions on the Server.
        """

        try:
            return self.sendAndReceive(SystemRequestFactory.listSessions())
        except RuntimeError as e:
            if e.message == 'Received an empty response from the Agent. This normally means the remote service has crashed.':
                raise ConnectionError(e)
            else:
                raise
Example #10
0
    def stopSession(self, console, session, message):
        """
        Terminates an active Session with the Agent, by sending a STOP_SESSION
        request.

        At some point in the future, the Agent will acknowledge the Session has
        terminated, and the __stoppedSession() callback will be invoked to
        pass update the internal state.
        """

        self.onMessage(message.id, self.__stoppedSession(console, session))

        self.write(
            SystemRequestFactory.stopSession(session).setId(
                message.id).build())
Example #11
0
    def startSession(self, console, message):
        """
        Instantiates a new Session with the Agent, by sending a START_SESSION
        request.

        At some point in the future, the Agent will acknowledge the Session and
        the __startedSession() callback will be invoked to pass the session
        identifier back to the console.
        """

        self.onMessage(message.id, self.__startedSession(console))

        self.write(
            SystemRequestFactory.startSession(self.device_id).setPassword(
                message.system_request.password).setId(message.id).build())
Example #12
0
    def listSessions(self):
        """
        Get a list of active sessions on the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listSessions())
Example #13
0
    def listDevices(self):
        """
        Get a list of Devices boud to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listDevices())
Example #14
0
    def startSession(self, device_id, password):
        """
        Start a new Session with a Device known to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.startSession(device_id).setPassword(password))
Example #15
0
    def listSessions(self):
        """
        Get a list of active sessions on the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listSessions())
Example #16
0
    def listDevices(self):
        """
        Get a list of Devices boud to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listDevices())