def example_api_creation(): DEVICE_IP = "192.168.1.10" DEVICE_PORT = 10000 transport = UDPTransport() transport.connect(DEVICE_IP, DEVICE_PORT) router = RouterClient(transport, lambda kException: print("Error during connection")) # Create session session_info = Session_pb2.CreateSessionInfo() session_info.username = '******' session_info.password = '******' session_info.session_inactivity_timeout = 600000 # 10 minutes session_info.connection_inactivity_timeout = 2000 # 2 second print("Creating session for communication") session_manager = SessionManager(router) session_manager.CreateSession(session_info) # Create needed services device_config_service = DeviceConfigClient(router) base_client_service = BaseClient(router) print(device_config_service.GetDeviceType()) print(base_client_service.GetAvailableWifi()) session_manager.CloseSession()
print("Create sequence on device and execute it") base_client_service = BaseClient(router) handle_sequence = base_client_service.CreateSequence(sequence) base_client_service.PlaySequence(handle_sequence) print("Waiting 30 seconds to finish movement...") time.sleep(30) if __name__ == "__main__": DEVICE_IP = "192.168.1.10" DEVICE_PORT = 10000 transport = UDPTransport() transport.connect(DEVICE_IP, DEVICE_PORT) router = RouterClient(transport, lambda kException: print("Error during connection")) session_info = Session_pb2.CreateSessionInfo() session_info.username = '******' session_info.password = '******' session_info.session_inactivity_timeout = 600000 # 10 minutes session_info.connection_inactivity_timeout = 2000 # 2 seconds session_manager = SessionManager(router) session_manager.CreateSession(session_info) # Example core create_sequence(router)