MCPcopy
hub / github.com/zai-org/Open-AutoGLM / example_remote_device

Function example_remote_device

examples/basic_usage.py:118–149  ·  view source on GitHub ↗

Remote device example / 远程设备示例

(lang: str = "cn")

Source from the content-addressed store, hash-verified

116
117
118def example_remote_device(lang: str = "cn"):
119 """Remote device example / 远程设备示例"""
120 from phone_agent.adb import ADBConnection
121
122 msgs = get_messages(lang)
123
124 # Create connection manager
125 conn = ADBConnection()
126
127 # Connect to remote device
128 success, message = conn.connect("192.168.1.100:5555")
129 if not success:
130 print(f"{msgs['connection_failed']}: {message}")
131 return
132
133 print(f"{msgs['connection_successful']}: {message}")
134
135 # Create Agent with device specified
136 agent_config = AgentConfig(
137 device_id="192.168.1.100:5555",
138 verbose=True,
139 lang=lang,
140 )
141
142 agent = PhoneAgent(agent_config=agent_config)
143
144 # Execute task
145 result = agent.run("打开微信查看消息")
146 print(f"{msgs['task_result']}: {result}")
147
148 # Disconnect
149 conn.disconnect("192.168.1.100:5555")
150
151
152if __name__ == "__main__":

Callers

nothing calls this directly

Calls 7

connectMethod · 0.95
runMethod · 0.95
disconnectMethod · 0.95
get_messagesFunction · 0.90
ADBConnectionClass · 0.90
AgentConfigClass · 0.90
PhoneAgentClass · 0.90

Tested by

no test coverage detected