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

        return self.sendAndReceive(
            SystemRequestFactory.stopSessionId(session_id))
コード例 #2
0
ファイル: server_connector.py プロジェクト: CodingDog/mercury
    def stopSession(self, session_id):
        """
        Stop an active Session, known to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.stopSessionId(session_id))
        
コード例 #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))
コード例 #4
0
ファイル: device.py プロジェクト: CodingDog/mercury
    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())
コード例 #5
0
ファイル: device.py プロジェクト: warlock0007/mercury
    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())
コード例 #6
0
ファイル: device.py プロジェクト: CodingDog/mercury
    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())
コード例 #7
0
ファイル: device.py プロジェクト: warlock0007/mercury
    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())
コード例 #8
0
ファイル: server_connector.py プロジェクト: Syi/mercury
    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
コード例 #9
0
ファイル: server_connector.py プロジェクト: Syi/mercury
    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
コード例 #10
0
ファイル: device.py プロジェクト: warlock0007/mercury
    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())
コード例 #11
0
ファイル: device.py プロジェクト: warlock0007/mercury
    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())
コード例 #12
0
    def listSessions(self):
        """
        Get a list of active sessions on the Server.
        """

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

        return self.sendAndReceive(SystemRequestFactory.listDevices())
コード例 #14
0
ファイル: server_connector.py プロジェクト: CodingDog/mercury
    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))
コード例 #15
0
ファイル: server_connector.py プロジェクト: CodingDog/mercury
    def listSessions(self):
        """
        Get a list of active sessions on the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listSessions())
コード例 #16
0
ファイル: server_connector.py プロジェクト: CodingDog/mercury
    def listDevices(self):
        """
        Get a list of Devices boud to the Server.
        """

        return self.sendAndReceive(SystemRequestFactory.listDevices())