This document describes the interfaces provided by the Cloud Phone PC Client SDK.
API Overview
Engine (ArmcloudEngine)
Interface Name | Description |
---|---|
instance | Get engine instance (singleton pattern) |
init | Initialize engine |
destory | Destroy engine |
setSdkHost | Set server address |
createPhoneClient | Create a cloud phone session for controlling the cloud phone |
createBatchControlVideo | Create a batch streaming controller |
getVideoDeviceList | Get camera list |
getAudioDeviceList | Get microphone list |
Group Control (GroupControl)
Interface Name | Description |
---|---|
destory | Destroy |
startEventSync | Start group control |
stopEventSync | Stop group control |
setEventSyncMaster | Set master control |
sendInputText | Send text to the specified cloud phone input box |
startVideoCapture | Start camera capture |
stopVideoCapture | Stop capture |
getCameraCount | Get camera count |
getCameraInfo | Get camera information |
Small Stream (BatchControlVideo)
Interface Name | Description |
---|---|
start | Start streaming |
stop | Stop streaming |
stop | Batch stop streaming |
stopAll | Stop all streaming |
contains | Check if included |
subscribe | Start subscription |
unsubscribe | Unsubscribe |
setVideoSink | Set video renderer |
setBatchControlObserver | Set callback |
Large Stream (PhoneClient)
Interface Name | Description |
---|---|
start | Start streaming |
stop | Stop streaming |
setVideoSink | Set video renderer |
setSessionObserver | Set callback |
sendSwipe | Send scroll event |
sendKeyCode | Send keyboard key event (send a complete DOWN+UP event) |
sendKeyCode | Send keyboard key event (optionally send a single-state event) |
volumeUp | Increase cloud phone device volume |
volumeDown | Decrease cloud phone device volume |
sendTouchEvent | Send touch event |
setVideoLevel | Change streaming quality |
screenshot | Take a screenshot |
sendInputText | Send input text |
enableAudio | Enable audio |
enableVideo | Enable video |
enableBlow | Enable blow feature |
shake | Shake feature |
startVideoCapture | Start camera capture |
stopVideoCapture | Stop capture |
publishStream | Publish video stream |
unPublishStream | Stop publishing |
sendCommand | Send ADB command |
Detailed Interface Description
Get Engine Instance
Description: Get the ArmcloudEngine engine instance.
Syntax:
static ArmcloudEngine* instance();
Parameter | Type | Required | Description |
---|---|---|---|
appId | string | Yes | Set log file path |
logPath | wstring | No | Log file path |
isInitEngine | bool | No | Whether to initialize the engine in advance |
Initialize Engine
Description: Initialize the ArmcloudEngine engine.
Syntax:
bool init(const std::string& appId, const std::wstring& logPath = L"", bool isInitEngine = false);
Parameter | Type | Required | Description |
---|---|---|---|
appId | string | Yes | Set log file path |
logPath | wstring | No | Log file path |
isInitEngine | bool | No | Whether to initialize the engine in advance |
Destroy Engine
Description: Destroy the ArmcloudEngine engine.
Syntax:
void destory();
Set Server Address
Description: Set the server address.
Syntax:
void setSdkHost(const std::string& host);
Parameter | Type | Required | Description |
---|---|---|---|
host | string | Yes | Set server address |
Create Cloud Phone Session
Description: Creates a cloud phone session.
Syntax:
PhoneClient* createPhoneClient();
Create Batch Stream Controller
Description: Creates a batch stream controller.
Syntax:
BatchControlVideo* createBatchControlVideo();
Get Camera List
Description: Retrieves the list of cameras.
Syntax:
std::vector<DeviceInfo> getVideoDeviceList();
Get Microphone List
Description: Retrieves the list of microphones.
Syntax:
std::vector<DeviceInfo> getAudioDeviceList();
Destroy
Description: Destroys the instance.
Syntax:
void destory();
Start Group Control
Description: Starts group control.
Syntax:
void startEventSync(const BatchPhoneConfig& config);
Parameter | Type | Required | Description |
---|---|---|---|
config | BatchPhoneConfig | Yes | Group control configuration |
Stop Group Control
Description: Stops group control.
Syntax:
void stopEventSync();
Set Master Control
Description: Sets the master control.
Syntax:
void setEventSyncMaster(const std::string& podId);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Master cloud phone ID |
Send Text to Cloud Phone Input Box
Description: Sends text to the specified cloud phone input box.
Syntax:
void sendInputText(const std::string& podId, const std::string& content);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Master cloud phone ID |
content | string | Yes | Text content to send, must be UTF-8 encoded |
Start Streaming
Description: Starts streaming.
Syntax:
void start(const BatchPhoneConfig& config);
Parameter | Type | Required | Description |
---|---|---|---|
config | BatchPhoneConfig | Yes | Batch streaming configuration |
Stop Streaming
Description: Stops streaming.
Syntax:
void stop(const std::string& podId);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Cloud phone ID to stop streaming |
Stop Streaming in Batch
Description: Stops streaming for multiple devices.
Syntax:
void stop(const std::vector<std::string>& podList);
Parameter | Type | Required | Description |
---|---|---|---|
podList | string[] | Yes | List of cloud phone IDs to stop streaming |
Stop All Streaming
Description: Stops all streaming.
Syntax:
void stopAll();
Contains
Description: Checks if a cloud phone is included.
Syntax:
bool contains(const std::string& podId);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Cloud phone ID to check |
Start Subscription
Description: Starts a subscription.
Syntax:
void subscribe(const std::string& podId);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Cloud phone ID to subscribe to video stream |
Unsubscribe
Description: Cancels a subscription.
Syntax:
void unsubscribe(const std::string& podId);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Cloud phone ID to unsubscribe from video stream |
Set Video Renderer
Description: Sets the video renderer.
Syntax:
void setVideoSink(const std::string& podId, VideoRenderSink* sink);
Parameter | Type | Required | Description |
---|---|---|---|
podId | string | Yes | Cloud phone ID to set renderer |
sink | VideoRenderSink | Yes | Video renderer |
Set Callback
Description: Sets the callback.
Syntax:
void setBatchControlObserver(BatchControlObserver* observer);
Parameter | Type | Required | Description |
---|---|---|---|
observer | BatchControlObserver | Yes | Callback observer |
Start Streaming
Description: Starts streaming.
Syntax:
void start(PhoneConfig& config);
Parameter | Type | Required | Description |
---|---|---|---|
config | PhoneConfig | Yes | Cloud phone connection configuration |
Stop Streaming
Description: Stops streaming.
Syntax:
void stop();
Set Video Renderer
Description: Sets the video renderer.
Syntax:
void setVideoSink(VideoRenderSink* sink);
Parameter | Type | Required | Description |
---|---|---|---|
sink | VideoRenderSink* | Yes | Video renderer |
Set Cloud Phone Event Callback
Description: Call setSessionObserver()
to set the cloud phone event callback.
Syntax:
void setSessionObserver(SessionObserver* observer)
Parameter | Type | Required | Description |
---|---|---|---|
observer | SessionObserver* | Yes | Event callback |
Send Scroll Event
Description: Send a scroll event.
Syntax:
void sendSwipe(int action, int x, int y, int width, int height, int swipe)
Parameter | Type | Required | Description |
---|---|---|---|
action | int | Yes | Event type |
x | int | Yes | X-coordinate |
y | int | Yes | Y-coordinate |
width | int | Yes | Width of the event area |
height | int | Yes | Height of the event area |
swipe | int | Yes | Swipe value |
Send Key Event (Full Down + Up)
Description: Sends a complete DOWN+UP
keyboard event to the cloud phone instance. Recommended for simulating system function keys like Home, Back, and Menu.
Syntax:
void sendKeyCode(int code)
Parameter | Type | Required | Description |
---|---|---|---|
code | int | Yes | Key code 3: HOME 4: BACK 82: MENU 187: TASK |
Send Key Event (Single State)
Description: Sends a keyboard event to the cloud phone instance, allowing selection of single-state (DOWN or UP) events. Recommended for high-precision key events like DELETE.
Syntax:
void sendKeyCode(int action, int code)
Parameter | Type | Required | Description |
---|---|---|---|
action | int | Yes | Key action 0: DOWN 1: UP |
code | int | Yes | Key code 3: HOME 4: BACK 82: MENU 187: TASK |
Increase Volume
Description: Increases the cloud phone device volume.
Syntax:
void volumeUp()
Decrease Volume
Description: Decreases the cloud phone device volume.
Syntax:
void volumeDown()
Send Mouse Click Event
Description: Sends a mouse click event.
Syntax:
void sendTouchEvent(int action, int x, int y, int width, int height)
Parameter | Type | Required | Description |
---|---|---|---|
action | int | Yes | Click action 0: DOWN 1: UP 2: MOVE |
x | int | Yes | X-coordinate |
y | int | Yes | Y-coordinate |
width | int | Yes | Local screen width |
height | int | Yes | Local screen height |
Adjust Stream Quality
Description: Sets the video resolution, FPS, and bitrate for cloud phone streaming.
Syntax:
void setVideoLevel(int resolution, int fps, int bitrate)
Parameter | Type | Required | Description |
---|---|---|---|
resolution | int | Yes | Video resolution settings (e.g., 07: 144x256, 20: 2880x1080) |
fps | int | Yes | Frame rate settings (e.g., 1: 20fps, 9: 2fps) |
bitrate | int | Yes | Bitrate settings (e.g., 01: 1Mbps, 15: 600kbps) |
Screenshot
Description: Captures a screenshot of the current cloud phone display.
Syntax:
void screenshot(bool local)
Parameter | Type | Required | Description |
---|---|---|---|
local | bool | No | Save location true: Local false: Cloud phone |
Send Input Text
Description: Sends text to replace the content in the cloud phone's input field (works only when the input field is focused).
Syntax:
void sendInputText(const std::string& text)
Parameter | Type | Required | Description |
---|---|---|---|
text | string | Yes | Text to send (UTF-8 encoded) |
Enable Audio
Description: Enables or disables audio.
Syntax:
void enableAudio(bool enable)
Parameter | Type | Required | Description |
---|---|---|---|
enable | bool | Yes | State true: Enable false: Disable |
Enable Video
Description: Enables or disables video.
Syntax:
void enableVideo(bool enable)
Parameter | Type | Required | Description |
---|---|---|---|
enable | bool | Yes | State true: Enable false: Disable |
Enable Blow Detection
Description: Enables or disables the "Blow Detection" feature.
Syntax:
void enableBlow(bool enable)
Parameter | Type | Required | Description |
---|---|---|---|
enable | bool | Yes | State true: Enable false: Disable |
Shake
Description: Simulates a shake gesture.
Syntax:
void shake()
Start Video Capture
Description: Starts video capture from a camera.
Syntax:
void startVideoCapture(int cameraId)
Parameter | Type | Required | Description |
---|---|---|---|
cameraId | int | Yes | Camera ID |
Stop Video Capture
Description: Stops video capture.
Syntax:
void stopVideoCapture()
Publish Video Stream
Description: Publishes a video stream.
Syntax:
void publishStream()
Unpublish Video Stream
Description: Stops publishing a video stream.
Syntax:
void unPublishStream()
Send ADB Command
Description: Sends an ADB command to the cloud phone.
Syntax:
void sendCommand(const std::string& cmd)
Parameter | Type | Required | Description |
---|---|---|---|
cmd | string | Yes | ADB command |