This document describes the interface provided by the Cloud Phone PC client SDK.
API Overview
Engine (ArmcloudEngine)
| Interface name | Interface description |
|---|---|
| [instance] (#get-the-engine-instance) | Obtain engine instances (Singleton mode) |
| [init] (#initialize-the-engine) | Initialize the engine |
| [destory] (#destroy-the-engine) | Destroy the engine |
| [setSdkHost] (#set-the-server-address) | Set the server address |
| [createPhoneClient] (#create-cloud-machine-talk) | Create a cloud phone to operate the cloud phone |
| [createBatchControlVideo] (#create-a-batch-pull-controller) | Create a batch pull controller |
| [getVideoDeviceList] (#get-a-list-of-cameras) | Get a list of cameras |
| [getAudioDeviceList] (#get-a-list-of-microphones) | Get a list of microphones |
Group Control
| Interface name | Interface description |
|---|---|
| [destory] (#destruction) | Destruction |
| [startEventSync] (#activate-group-control) | Activate group control |
| [stopEventSync] (#stop-mass-control) | Stop mass control |
| [setEventSyncMaster] (#set-up-the-main-controller) | Set up the main controller |
| [sendInputText] (#send-text-to-the-specified-cloud-machine-input-box) | Send text to the specified cloud phone input box |
| [startVideoCapture] (#enable-camera-capture) | Enable camera capture |
| [stopVideoCapture] (#stop-collecting) | Stop collecting |
| [getCameraCount] (#get-the-number-of-cameras) | Get the number of cameras |
| [getCameraInfo] (#obtain-camera-information) | Obtain camera information |
Xiaoliu (BatchControlVideo)
| Interface name | Interface description |
|---|---|
| [start] (#start-pulling-traffic) | Start pulling traffic |
| [stop] (#stop-pulling-flow) | Stop pulling flow |
| [stop] (#batch-stopping-flow-pulling) | Batch stopping flow pulling |
| [stopAll] (#stop-all-the-flow-pulling) | Stop all the flow pulling |
| [contains] (#is-it-included) | Is it included? |
| [subscribe] (#start-subscribing) | Start subscribing |
| [unsubscribe] (#unsubscribe) | Unsubscribe |
| [setVideoSink] (#set-up-the-video-renderer) | Set up the video renderer |
| [setBatchControlObserver] (#set-callbacks) | Set callbacks |
Major Flow (PhoneClient)
| Interface name | Interface description |
|---|---|
| [start] (#start-pulling-streams) | Start pulling streams |
| [stop] (#stop-pulling-flow) | Stop pulling flow |
| [setVideoSink] (#set-up-the-video-renderer) | Set up the video renderer |
| [setSessionObserver] (#set-up-cloud-phone-event-callbacks) | Set callbacks |
| [sendSwipe] (#send-a-scroll-event) | Send a scroll event |
| [sendKeyCode] (#send-key-events) | Send a keyboard key event (send a full DOWN+UP event) |
| [sendKeyCode] (#send-key-events) | Send keyboard key events (optionally send single status events) |
| [volumeUp] (#turn-up-the-volume) | Increase the volume of cloud phone equipment |
| [volumeDown] (#turn-down-the-volume) | Reduce the volume of cloud devices |
| [sendTouchEvent] (#send-a-touch-event) | Send a touch event |
| [setVideoLevel] (#modify-the-streaming-quality) | Modify the streaming quality |
| [screenshot] (#screenshot) | Screenshot |
| [sendInputText] (#send-input-text) | Send input text |
| [enableAudio] (#turn-on-audio) | Turn on audio |
| [enableVideo] (#start-the-video) | Start the video |
| [enableBlow] (#open-it-and-blow-on-it) | Open it and blow on it |
| [shake] (#shake-it-a-little) | Shake it a little |
| [startVideoCapture] (#enable-camera-capture) | Enable camera capture |
| [stopVideoCapture] (#stop-collecting) | Stop collecting |
| [publishStream] (#release-video-streams) | Release video streams |
| [unPublishStream] (#stopped-publishing) | Stopped publishing |
| [sendCommand] (#send-the-adb-command) | Send the adb command |
Detailed interface description
Get the engine instance
Description: Obtain an ArmcloudEngine instance
Syntax:
static ArmcloudEngine* instance();
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| appId | string | Yes | Set the log file path |
| logPath | wstring | No | log file path |
| isInitEngine | bool | No | Whether to initialize the engine in advance |
Initializing the engine
Description: Initialize the ArmcloudEngine engine
Syntax:
bool init(const std::string& appId, const std::wstring& logPath = L"", bool isInitEngine = false);
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| appId | string | Yes | Set the log file path |
| logPath | wstring | No | log file path |
| isInitEngine | bool | No | Whether to initialize the engine in advance |
Destroy the engine
Description: Destroy the ArmcloudEngine engine
Syntax:
void destory();
Set the server address
Description: Set the server address Syntax:
void setSdkHost(const std::string& host);
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| host | string | Yes | Set the server address |
Creating Cloud Opportunity Talk
Description: Create a cloud phone conversation Syntax:
PhoneClient* createPhoneClient();
Create a batch stream pull controller
Description: Create a batch pull controller
Syntax:
BatchControlVideo* createBatchControlVideo();
Get the camera list
Description: Get a list of cameras
Syntax:
std::vector<DeviceInfo> getVideoDeviceList();
Get the list of microphones
Description: Retrieve the microphone list
Syntax:
std::vector<DeviceInfo> getAudioDeviceList();
Destruction
Description: Destroyed
Syntax:
void destory();
Enable group control
Description: Enable group control
Syntax:
void startEventSync(const BatchPhoneConfig& config)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| config | BatchPhoneConfig | Yes | Group control configuration |
Stop group control
Description: Stop group control
Syntax:
void stopEventSync()
Set up the main controller
Description: Set up the main control
Syntax:
void setEventSyncMaster(const std::string& podId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | Main control cloud phone ID |
Send text to the specified cloud phone input box
Description: Send text to the specified cloud phone input box
Syntax:
void sendInputText(const std::string& podId, const std::string& content)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | Main control cloud phone ID |
| content | string | Yes | The text content sent must be encoded in UTF-8 |
Start boosting traffic
Description: Starting to pull flow
Syntax:
void start(const BatchPhoneConfig& config)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| config | BatchPhoneConfig | Yes | Batch traffic pulling configuration |
Stop pulling traffic
Description: Stop pulling the flow
Syntax:
void stop(const std::string& podId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | Cloud server IDs that need to stop pulling streams |
Batch stop pulling traffic
Description: Batch stop pulling traffic
Syntax:
void stop(const std::vector<std::string>& podList)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podList | string[] | Yes | List of cloud phone IDs that need to stop pulling traffic |
Stop pulling traffic completely
Description: Completely stop pulling flow
Syntax:
void stopAll()
Is it included?
Description: Whether it is included
Syntax:
bool contains(const std::string& podId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | The cloud server ID that needs to be queried |
Start subscribing
Description: Start subscribing
Syntax:
void subscribe(const std::string& podId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | Cloud ID that needs to subscribe to video streams |
Unsubscribe
Description: Unsubscribe
Syntax:
void unsubscribe(const std::string& podId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | You need to unsubscribe from the cloud server ID for video streaming |
Set up the video renderer
Description: Set up the video renderer
Syntax:
void setVideoSink(const std::string& podId, VideoRenderSink* sink)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| podId | string | Yes | You need to set the renderer's cloud ID |
| sink | VideoRenderSink | Yes | Video renderer |
Set callbacks
Description: Set callback
Syntax:
void setBatchControlObserver(BatchControlObserver* observer)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| observer | BatchControlObserver | Yes | Pullback |
Activating Traffic Pulling
Description: Enable streaming pulling
Syntax:
void start(PhoneConfig& config)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| config | PhoneConfig | Yes | Cloud machine connection configuration |
Stop pulling traffic
Description: Stop pulling the flow
Syntax:
void stop();
Set up the video renderer
Description: Set up the video renderer
Syntax:
void setVideoSink(VideoRenderSink* sink)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| sink | VideoRenderSink* | Yes | Video renderer |
Set up Cloud Phone event callbacks
Description: Call setSessionObserver() to set up cloud phone event callbacks
Syntax:
void setSessionObserver(SessionObserver* observer)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| observer | SessionObserver* | Yes | Event retracement |
Send a scroll wheel event
Description: Send a scroll wheel event
Syntax:
void sendSwipe(int action, int x, int y, int width, int height, int swipe)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| action | int | Yes | Event retracement |
| x | int | Yes | Event retracement |
| y | int | Yes | Event retracement |
| width | int | Yes | Event retracement |
| height | int | Yes | Event retracement |
| swipe | int | Yes | Event retracement |
Send key events
Description: Send keyboard key event commands to cloud phone instances. This interface sends a full DOWN+UP event. If you need to simulate the Home button, Back key, menu key, or other system function keys, it is recommended.
Syntax:
void sendKeyCode(int code)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| code | int | Yes | Key values 3: HOME key 4: BACK key 82: MENU key 187: TASK key |
Send key events
Description: Send keyboard key event commands to cloud phone instances. This interface allows you to select the single state (DOWN or UP events). If you need to simulate key events with higher state requirements, such as DELETE, it is recommended.
Syntax:
void sendKeyCode(int action, int code)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| action | int | Yes | Key type 0: DOWN status 1: UP status |
| code | int | Yes | Key values 3: HOME key 4: BACK key 82: MENU key 187: TASK key |
Turn up the volume
Description: Increase the volume of cloud phone devices
Syntax:
void volumeUp()
Turn down the volume
Description: Reduce the volume of cloud phone devices
Syntax:
void volumeDown()
Send mouse button events
Description: Sending mouse button events
Syntax:
void sendTouchEvent(int action, int x, int y, int width, int height)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| action | int | Yes | Key type 0, DOWN status 1, UP status 2, MOVE status |
| x | int | Yes | Click the coordinates in the x-axis direction |
| y | int | Yes | Click the coordinates in the Y-axis direction |
| width | int | Yes | Local screen width of cloud phones |
| height | int | Yes | The local screen height of cloud phones |
Modify the Pull Flow Quality
Description: Sets the image clarity of cloud phones
Syntax:
void setVideoLevel(int resolution, int fps, int bitrate)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| resolution | int | Yes | 07:144x256 08:216x384 08:216x384 09:288x512 10:360x640 11:480x848 12:540x960 13:600x1024 14:480x1280 15:720x1280 16:720x1920 17:1080x1920 18:1440x1920 19:1600x2560 20:2880x1080 |
| fps | int | Yes | 1:20fps 2:25fps 3:30fps 4:60fps 5:1fps 6:5fps 7:10fps 8:15fps 9:2fps |
| bitrate | int | Yes | 01:1Mbps 02:1.5Mbps 03:2Mbps 04:2.5Mbps 05:3Mbps 06:3.5Mbps 07:4Mbps 08:5Mbps 09:6Mbps 10:8Mbps 11:10Mbps 12:12Mbps 13:200kbps 14:400kbps 15:600kbps |
Screenshot
Description: Screenshot the current cloud phone screen
Syntax:
void screenshot(bool local)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| local | bool | No | Screenshot save location: true: local false: cloud phone |
Send input text
Description: Send text to replace the cloud phone input box content (it only takes effect when the cloud phone input box is on the focus).
Syntax:
void sendInputText(const std::string& text)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| text | string | Yes | The text content sent must be encoded in UTF-8 |
Start the audio
Description: Audio on and off
Syntax:
void enableAudio(bool enable)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| enable | bool | Yes | Status true, Enable false, Stop |
Start the video
Description: Video on/on
Syntax:
void enableVideo(bool enable)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| enable | bool | Yes | Status true, Enable false, Stop |
Start blowing on it
Description: Blow to turn on the switch
Syntax:
void enableBlow(bool enable)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| enable | bool | Yes | Status true, Enable false, Stop |
Shake it up
Description: Shake it
Syntax:
void shake()
Enable Camera Capture
Description: Camera data collection enabled
Syntax:
void startVideoCapture(int cameraId)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| cameraId | int | Yes | Camera ID |
Stop collecting
Description: Stop collecting
Syntax:
void stopVideoCapture()
Publish video streams
Description: Publish video streams
Syntax:
void publishStream()
Stopped publishing
Description: Stopped publishing
Syntax:
void unPublishStream()
Send the adb command
Description: Send the adb command
Syntax:
void sendCommand(const std::string& cmd)
| Parameters | Type | Is it required? | Description |
|---|---|---|---|
| cmd | string | Yes | adb command |