def stopSession(self, session_id): """ Stop an active Session, known to the Server. """ return self.sendAndReceive( SystemRequestFactory.stopSessionId(session_id))
def stopSession(self, session_id): """ Stop an active Session, known to the Server. """ return self.sendAndReceive(SystemRequestFactory.stopSessionId(session_id))
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))
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())
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())
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
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
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())
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())
def listSessions(self): """ Get a list of active sessions on the Server. """ return self.sendAndReceive(SystemRequestFactory.listSessions())
def listDevices(self): """ Get a list of Devices boud to the Server. """ return self.sendAndReceive(SystemRequestFactory.listDevices())
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))