This interface can use http and websocket to access and interact.The websocket port number is 9911The http access port number is 9912
1.http request method
interface address
Server address:9912/apiExample: http://127.0.0.1:9912/api
Request method
post
Request content format
json
2.websocket request method
Using the websocket method to request the interface can get a faster response, but it is more complicated than the http request method. All request results are within the callback function.Because it is an asynchronous method, if you want to wait for the request result before proceeding to the next step, you need to convert from asynchronous to synchronous.Each interface will have a msgid field, and the server will return it unchanged after receiving it, which is used for asynchronous to synchronous conversion.
json
All interface calls will return success or failure. A status of 0 represents success, and a status of non-0 represents failure.The failure information will be explained in the message. The following is a list of error codes.
2.Functional interface (Phonefarm.some3c.com)
2.1 Set up device
This interface is used to set the basic information of the device, such as (usb mouse and key device), (group), (custom name). Multiple items can be set together or only one item can be set individually.The pid and vid of (usb mouse and keyboard device) can be obtained by getting the callback call of the connected USB device list and the usb device changes
Request parameters
{
"fun": "set_dev", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "F4:0F:24:D8:42:24", //device id
"vid": "520A", //usb device vid
"pid": "000A", //usb device pid
"gid": "140735290", //Group id
//The crc value of the mouse parameter of the USB device. Do not fill in this parameter randomly. It must be collected using the mouse parameters or matched by the official library.
"location_crc": "8BEDAD44",
"name": "Unit No. 1" //Device name (user-defined name)
} //Parameter content
}
After the call is successful, all properties of this device will be returned.
{
"fun": "set_dev", //Function number
"msgid": 0,
"data": {
"ip": "192.168.0.108", //device ip address
"airhandle": 51318224, //Current connection screen mirroring service handle (internal use)
"mac": "D6:5B:90:54:BB:2F", //device mac address
"username": "Xiao Ming's iPhone", //The name of the local definition on the device
"version": "15.6", //Mobile phone system version
"model": "iPhone9,2", //Device internal model
"deviceid": "F4:0F:24:D8:42:24", //device id
"srvname": "Screencast 2", //The name of the connected screencasting service
"width": "414", //The real width of the mobile phone screen
"height": "736", //The real width of the mobile phone screen
"device_name": "iPhone 7 Plus", //Mobile phone model
"location_crc": "8BEDAD44", // usb device mouse parameter crc value
"state": 0, //0 is not online, non-0 is online
"rotate": 0, //Screen direction, 0 vertical screen 1 horizontal screen
"vid": "520A", //usb device vid
"pid": "000A", //usb device pid
"gid": "140735290", //Group id
"name": "Unit No. 1" //Device name (user-defined name)
}, //return data
"status": 0, //0 success, non-0 failure
"message": "success" //Call returns message
}
Return on failure
{
"fun": "set_dev", //Function number
"msgid": 0,
"data": {
"deviceid": "00:00:00:00:00" //Device id
}, //return data
"status": 1, //0 success, non-0 failure
"message": "No device found" //Call returns message
}
2.2 Remove device
Request parameters
Delete an existing device. Online devices are not allowed to be deleted.
{
"data": {
"deviceid": "76:90:DE:1F:12:2A" //Device id
}, //Parameter content
"fun": "del_dev", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "del_dev", //Function number
"msgid": 0,
"data": {
"deviceid": "76:90:DE:1F:12:2A" //Device id
}, //return data
"status": 0, //0 success, non-0 failure
"message": "success" //Call returns message
}
Return on failure
{
"fun": "del_dev", //Function number
"msgid": 0,
"data": {
"deviceid": "76:90:DE:1F:12:2A" //Device id
}, //return data
"status": 1,
"message": "Deletion failed, the device is online or the device does not exist" //Call returns message
}
2.3Separate Group
Request parameters
{
"data": {
"gid": "0", //Group id, if it is 0, it means new
"name": "Group 1" //Group name
}, //Parameter content
"fun": "set_group", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "set_group", //Function number
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": {
"gid": "1647622429", //Group id
"name": "Group 1" //Group name
}, //return data
"message": "success" //Call returns message
}
Return on failure
{
"fun": "set_group", //Function number
"msgid": 0,
"status": 1, //0 successful, 3 group does not exist
"message": "Group does not exist", //Call returns message
"data": {
"gid": "123456", //Group id
"name": "Group 1" //Group name
} //return data
}
2.4 Delete group
Request parameters
{
"data": {
"gid": "1647622429" //Group id
}, //Parameter content
"fun": "del_group", //function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "del_group", //Function number
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": {
"gid": "1647622429" //Group id
}, //return data
"message": "success" //Call returns message
}
Return on failure
{
"fun": "del_group", //Function number
"msgid": 0,
"status": 1,
"message": "Group does not exist", //Call returns message
"data": {
"gid": "1647622429" //Group id
} //return data
}
2.5 Get device list
Request parameters
{
"data": {},
"fun": "get_device_list", //function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "get_device_list", //function number
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": { //This contains multiple pieces of data
"F4:0F:24:D8:42:24": {
"ip": "192.168.0.108", //device ip address
"airhandle": 51318224, //Current connection screen mirroring service handle (internal use)
"mac": "D6:5B:90:54:BB:2F", //Device MAC address
"username": "nickname's iPhone", //The name of the local definition on the device
"version": "15.6", //Mobile phone system version
"model": "iPhone9,2", //Device internal model
"deviceid": "F4:0F:24:D8:42:24", //device id
"srvname": "Screencast 2", //The name of the connected screencasting service
"width": "414", //The real width of the mobile phone screen
"height": "736", //The real width of the mobile phone screen
"device_name": "iPhone 7 Plus", //Mobile phone model
"location": "", //usb device mouse parameters, usually empty. When this value is present, it represents a custom configuration, which means that it is not saved to the general library after collection.
"location_crc":"615D5A7B",//usb mouse parameter crc
"state": 0, //0 is not online, non-0 is online
"rotate": 0, //Screen direction, 0 vertical screen 1 horizontal screen
"vid": "520A", //usb device vid
"pid": "000A", //usb device pid
"gid": "140735290", //Group id
"name": "1111" //Device name (user-defined name)
}
}, //return data
"message": "success" //Call returns message
}
Return on failure
{
"data": {}, //return data
"fun": "get_device_list", //function number
"message": "Failure", //call returns message
"msgid": 0,
"status": 1
}
Get group list
Request parameters
{
"data": {},
"fun": "get_group_list", //function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "get_group_list", //Function number
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": { //Here are multiple pieces of data
"1658666987": {
"gid": "1658666987", //Group id
"name": "222" //Group name
}
}, //return data
"message": "success" //Call returns message
}
Return on failure
{
"data": {}, //return data
"fun": "get_group_list", //Function number
"message": "Failure", //call returns message
"msgid": 0,
"status": 1
}
2.6 Get connected USB list
The (usb device) obtained by this interface refers to the special support for programming control (usb mouse and key device), and other devices will not obtain it.
Request parameters
{
"data": {},
"fun": "get_usb_list", //function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "get_usb_list", //function name
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": { //Here are multiple pieces of data
"520A|000A": {
"vid": "520A", //usb device vid
"pid": "000A", //usb device pid
}
}, //return data
"message": "success" //Call returns message
}
Return on failure
{
"data": {}, //return data
"fun": "get_usb_list", //function number
"message": "Failure", //call returns message
"msgid": 0,
"status": 1
}
2.7 Get device type and mouse parameter library list
The result after calling this interface is the currently supported mobile phone models and corresponding mouse parameters:
Request parameters
{
"data": {},
"fun": "get_devicemodel_list", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {
"deviceid": "76:90:DE:1F:12:2A",//device id
"gzip": false, //Whether to enable zip compression. If enabled, you need to decompress it yourself. This parameter is invalid when using binary
"binary": false, //Whether to use binary transmission, http mode is not supported, the obtained data needs to be obtained in the binary callback
"isjpg":true, //Whether to return images in jpg format, do not fill in the default jpg
"original":false //Whether to return the high-definition image (in jpg format) without changing the resolution. The high-definition image will be different from the resolution of the mobile phone, and you need to convert it to the coordinates of the mobile phone yourself.
}, //Parameter content
"fun": "get_device_screenshot", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"fun": "get_device_screenshot", //Function name
"msgid": 0,
"data": {
"deviceid": "F4:0F:24:D8:42:24",
"gzip": false,
"binary": false,
"isjpg":false,
"original":false
},
"status": 2,
"message": "The device is not online"
}
2.9 Capture device screen in a loop
This function can only be called using (websocket). After calling, the image binary data needs to be processed in the connection (callback)If you need to stop, please send this request again and set the (stop) value to (true)If you need to modify the frequency of screenshots, please send the request again and adjust the time of (time)After the call is successful, the kernel will actively push screenshots of the device according to the set frequency. You need to get the sent data in the callback of (websocket).See the specific processing (loop interception of the device screen and return)
Request parameters
{
"data": {
"deviceid": "76:90:DE:1F:12:2A",//device id
"time": 100, //Loop interval time
"isjpg":true //Whether to return images in jpg format, default jpg if not filled in
}, //Parameter content
"fun": "loop_device_screenshot", //Function name
"msgid": 0
}
{
"data": {},
"fun": "loop_device_screenshot",
"message": "The device does not exist", //The call returns the message
"msgid": 0,
"status": 1,
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE"
}
}
2.10 mouse click
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"button": "left", //Mouse button "left" (left button), "right" (right button) If not filled in, the default is left
"x": 100, //Screen coordinate X
"y": 100 //Screen coordinate Y
"time": 0 //The interval between pressing and popping up. If not filled in or filled in with 0, the click action will be automatically completed internally.
}, //Parameter content
"fun": "click", //function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "click", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.11 mouse slide
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"direction": "up", //Sliding direction (choose 1 from 4 "left", "right", "up", "down" left, right, up, down)
"button": "left", //Mouse button "left" (left button), "right" (right button) If not filled in, the default is left
"length": 0.9, //Sliding distance percentage, the default 0.9 will slide from 10% of the screen to 90%, if filled in 0.8, it will slide from 20% of the screen to 80%, automatically calculate the starting and ending coordinates x, y values, and randomly transform the starting X, Y and ending X, Y values
"sx": 102, //Start coordinate
"sy": 8, //Start coordinate Y (if you do not fill in this value when sliding up or down, the sliding percentage will be used to automatically calculate it internally)
"ex": 117, //End coordinate X
"ey": 401, //End coordinate Y
"for": 0 //How many times to slide to the specified position in the loop (the sliding distance/number of loops will be automatically used internally to slide to the specified position multiple times. The number of left and right sliding loops is 4, and up and down is 6)
}, //Parameter content
"fun": "swipe", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "swipe", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"status": 1
}
2.12 Mouse pops up
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"button": "left" //Mouse button "left" (left button), "right" (right button) defaults to left if not filled in
}, //Parameter content
"fun": "mouse_up", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "mouse_up", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.13 mouse pressed
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"button": "left" //Mouse button "left" (left button), "right" (right button) defaults to left if not filled in
}, //Parameter content
"fun": "mouse_down", //Function name
"msgid": 0
}
{
"data": {}, //return data
"fun": "mouse_down", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.14 mouse movement
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"x": 100, //Screen coordinate X
"y": 100 //Screen coordinate Y
}, //Parameter content
"fun": "mouse_move", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "mouse_move", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.15 Mouse reset
Reset the mouse to the position of x=0 y=0
Request parameters
{
"data": {
"deviceid": "{{deviceid}}" //Device id
}, //Parameter content
"fun": "mouse_reset_pos", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "mouse_reset_pos", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.16 mouse wheel
Request parameters
{
"fun":"mouse_wheel",//function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
"direction": "down", //Scroll wheel direction (choose 1 from 2 "up", "down" up or down)
"length":30, //The scrolling length of the wheel can only be 127 at most
"number":2 //number of scrolls
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "mouse_wheel", //function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
2.17 Pop up all keys
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
}, //Parameter content
"fun": "key_release_all", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "key_release_all", //function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.18 Keyboard pops up
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"key": "a" //Press the keyboard key, only supports English, numbers and English characters, hot keys (only supports a single key)
}, //Parameter content
"fun": "key_up", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "key_up", //function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.19 keyboard pressed
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"key": "a" //Press the keyboard key, only supports English, numbers and English characters, hot keys (only supports a single key)
}, //Parameter content
"fun": "key_down", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"data": {}, //return data
"fun": "key_down", //function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.20 keyboard input
Request parameters
{
"data": {
"deviceid": "{{deviceid}}", //device id
"key": "abc123!@#", //Press the keyboard key, only English, numbers and English characters are supported (Chinese is not supported)
"fn_key": "WIN+h" //Please leave the key parameter blank when pressing the key combination. Parameters such as: shortcut key to return to the home screen Win+h screenshot WIN+SHIFT+3
}, //Parameter content
"fun": "send_key", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
BACKSPACE SPACE TAB WIN ENTER SHIFT CTRL ALT ESC PAGEUP PAGEDOWN RightArrow LeftArrow DownArrow UpArrow F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 FN
{
"data": {}, //return data
"fun": "send_key", //function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.21 Restart the kernel
This interface only returns success, not failure.
Request parameters
{
"fun": "restart", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
{
"fun": "get_airplaysrvnum", //Function name
"msgid": 0 //Message id, the server will return it unchanged after receiving it. The websocket connection can be used to convert asynchronous to synchronous. Directly fill in 0 in http mode
}
Return successfully
{
"fun": "get_airplaysrvnum", //Function name
"msgid": 0,
"status": 0, //0 succeeded
"data": {
"airplaysrvnum": 1 //Number of services
"ver":"1.0.0.0" //Kernel version number
}, //Parameter content
"message": "success" //Call returns message
}
2.23 Set the number of screen mirroring services
This interface only returns success and does not return failure. After setting, you need to restart the kernel to take effect.
Request parameters
{
"fun": "set_airplaysrvnum", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"airplaysrvnum": 2 //Number of services
} //Parameter content
}
{
"fun": "mouse_collection_cfg", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "F4:0F:24:D8:42:21" //Device id
}, //Parameter content
"message": "The device does not exist", //The call returns the message
"status": 3
}
2.25 Turn off mouse parameter collection
After calling this interface, the mobile browser cannot be opened (mouse collection page)This interface must be called to close every time mouse parameters are collected.
Request parameters
{
"fun": "mouse_collection_close", //Function name
"msgid": 0,
"data": {
"deviceid": "F4:0F:24:D8:42:21" //Device id
} //Parameter content
}
{
"fun": "mouse_collection_cfg", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "F4:0F:24:D8:42:21" //Device id
}, //Parameter content
"message": "The device does not exist", //The call returns the message
"status": 3
}
2.26 Mouse parameter collection
Before calling this interface, you must first call (mouse_collection_open) to enable the mouse collection interface before the mobile phone can request the collection page.Each device requires a mouse parameter for precise positioning. By default, it will automatically match from the general library. If it cannot match, you need to manually collect the mouse parameters.Because this interface is time-consuming to call, it only returns a feedback that can be collected. The specific collection results are returned in the (mouse_collection_cfg_ret) callback.This interface does not support http calls.
Before collecting mouse parameters, the device needs to be correctly connected to the USB device, and the collection page must be opened in full-screen mode (running from the desktop) on the mobile phone.
Mouse parameter collection page address http://{IP address of the kernel service}:9911/api?fun=collection
For example: http://192.168.0.233:9911/api?fun=collection
Request parameters
{
"fun": "mouse_collection_cfg", //Function name
"msgid": 0,
"data": {
"deviceid": "F4:0F:24:D8:42:21" //Device id
} //Parameter content
}
{
"fun": "mouse_collection_cfg", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "F4:0F:24:D8:42:21" //Device id
}, //Parameter content
"message": "The device does not exist", //The call returns the message
"status": 3
}
2.27 Save device mouse parameters to common library
After saving the mouse parameter configuration of the specified device to the universal library, the next time a mobile phone of the same model and version system comes online, it will automatically match this mouse parameter.
Request parameters
{
"fun": "save_dev_location", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "F4:0F:24:D8:42:24", //device id
"describe": "No remarks" //Remarks
} //Parameter content
}
2.28 Remove mouse parameters from universal library
Request parameters
{
"fun": "del_dev_location", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"model": "iPhone9,2", //Internal device model
"version": "15.6", //system version
"crc": "38272847" //Mouse parameter crc
} //Parameter content
}
{
"fun": "del_dev_location", //Function name
"msgid": 0,
"message": "The configuration to be deleted was not found", //The call returns the message
"status": 1
}
2.29 Send Chinese characters
To use this interface, you must bind the hotkey of the shortcut command. This interface can only be called asynchronously. The result returned synchronously only represents the success of the call. In fact, only the message that the callback returns the send_text_ok function number represents the success of the execution. Successful execution only means that the shortcut command successfully obtains Chinese characters. Characters will not be entered until 3 seconds after receiving the callback of send_text_ok.
Request parameters
{
"fun": "send_text", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"key": "Haha", //Characters to be sent
"fn_key": "CTRL+ALT+SHIFT+WIN+v" //Call the hotkey for sending Chinese shortcut commands. If set using the console, it is CTRL+ALT+SHIFT+WIN+v.
} //Parameter content
}
Return successfully
{
"fun": "send_text", //Function name
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"msgid": 0,
"message": "success", //call returns message
"status": 0 //0 success, non-0 failure
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "send_text", //Function number
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
2.30 Execute shortcut command
This interface only supports professional version calls. You must add the iMouse shortcut command to the correct phone and bind it correctly.
Request parameters
{
"fun": "shortcut", //function name
"msgid": 0,
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE",//device id
"id":1, //function id
"devlist": [ //List of devices for executing shortcut commands
"50:1D:D9:ED:D9:DE",
"51:1D:D9:ED:D9:DE",
"52:1D:D9:ED:D9:DE"
],
"outtime": 15, //timeout time, unit is seconds, default is 15 seconds if not filled in
"parameter": ""//Function parameters, json string, the parameters corresponding to each function are different
}
//Parameter content
}
Return successfully
{
"fun": "shortcut", //function name
"data": {//return data
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"retdata": ""//Return results
},
"id":1,//function id
"msgid": 0,
"message": "success", //call returns message
"status": 0 //0 success, non-0 failure
}
Return on failure
{
"data": {//return data
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
},
"id":1,//function id
"fun": "shortcut", //function name
"message": "USB device not initialized", //call returns message
"msgid": 0,
"status": 1
}
Specific function parameters and return results
Get mobile photo album list
Request parameters
{
"date": "2023/07/28 19:09", //Date and time, get the date and time after this date and time, leave blank to get all
"num": 5 //Get the number of items
}
Return results
[
{//First record
"name": "abc1", //File name
"ext": "png", //Extension name
"size": "1.6 MB", //File size
"time": "August 10, 2023 22:05"//File creation time
},
{//The second record
"name": "abc2", //File name
"ext": "png", //Extension name
"size": "1.6 MB", //File size
"time": "August 10, 2023 22:05"//File creation time
}
]
Transfer photos or video files from your phone’s photo album to your computer
Request parameters
[
"abc1.png", //File name
"abc2.png" //File name
]
Return resultsThe received files are stored in the iMouse installation directory\Shortcut\Media directory.
Delete mobile photo or video files
Request parameters
[
"abc1.png", //File name
"abc2.png" //File name
]
Return resultsnone
Get the list of files in the specified directory on the mobile phone
Request parameters
{
"path": "/" //Get the path, fill in / means to get all the files in my iPhone directory
}
Return results
[
{//First record
"name": "iMouse", //File name or directory name
"ext": "", //Extension, if the extension is empty, it means a directory
"size": "320 bytes", //File size
"time": "August 10, 2023 22:05"//File creation time
},
{//The second record
"name": "abc1", //File name or directory name
"ext": "png", //Extension name
"size": "1.6 MB", //File size
"time": "August 10, 2023 22:05"//File creation time
},
{//The third record
"name": "abc2", //File name or directory name
"ext": "png", //Extension name
"size": "1.6 MB", //File size
"time": "August 10, 2023 22:05"//File creation time
}
]
Transfer specified files from mobile phone to computer
Request parameters
[
"/iMouse/1.txt", //Full path and file name of mobile phone files
"/iMouse/2.txt" //Full path and file name of mobile phone files
]
Return resultsThe received files are stored in the iMouse installation directory\Shortcut\File directory.
Delete specified files on mobile phone
Request parameters
[
"/iMouse/1.txt", //Full path and file name of mobile phone files
"/iMouse/2.txt" //Full path and file name of mobile phone files
]
Return resultsnone
Send photos or videos to your phone’s photo album
Request parameters
{
"list":[//List of files to be sent
"d:\iMouse\1.png",//Computer file full path and file name
"d:\iMouse\2.png"//Computer file full path and file name
],
"name": ""//The name to put in the album, leave it blank and put it in the recent project album
}
Return resultsnone
Send files to the specified directory on the mobile phone
Request parameters
{
"list":[//List of files to be sent
"d:\iMouse\1.txt",//Computer file full path and file name
"d:\iMouse\2.txt"//Computer file full path and file name
],
"path": "/iMouse/"//The path to store the file must start with / and end with /
}
Return resultsnone
Send text to phone clipboard
Request parameters
{
"text": "Hahahaha" //The text content sent
}
Return resultsnone
Get text from phone clipboard
Request parameters
Null
Return results
{
"text": "Hahahaha" //Text content obtained from the mobile phone clipboard
}
Open url on mobile phone
Request parameters
{
"url": ""
}
Return resultsnone
Set screen brightness
Request parameters
{
"num": 0.1 //Brightness, floating point number within 1
}
{
"fun": "find_image", //function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"rect":[ //Specify the search area, if not filled in, search in full screen
[233,288], //upper left coordinate
[233,1100],//Lower left coordinate
[609,288], //upper right coordinate
[609,1100] //Lower right coordinate
],
"img":"",//The sub-image to be found, base64 string
"similarity":0.8 //similarity
}
}
Return successfully
{
"fun":"find_image",
"msgid":0,
"status":0,//0 success, non-0 failure
"data":{
"result":[421,694], //Find the center point of the picture position
"rectangle":[ //Find a rectangular coordinate array of the picture location
[233,288], //upper left coordinate
[233,1100],//Lower left coordinate
[609,288], //upper right coordinate
[609,1100] //Lower right coordinate
],
"confidence":0.999994397163391, //similarity of matched images
"code":0, //This indicates the actual result of finding the image. 0 is successful, 1 is not finding the subimage, and 2 is failing to read the image stream.
"deviceid":"5C:1D:D9:ED:D9:DE"
},
"message":"success"
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "find_image", //Function number
"message": "The picture search plug-in is not connected", //The call returns the message
"msgid": 0,
"status": -1
}
2.32 Find multiple pictures
Request parameters
{
"fun": "find_image_ex", //function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"img_list":[],//Array of sub-pictures to be found, base64 string
"all":false,//Whether to search all, false will return after finding one, true will return after searching all
"repeat": false,//Whether to find duplicate images
"rect":[ //Specify the search area, if not filled in, search in full screen
[233,288], //upper left coordinate
[233,1100],//Lower left coordinate
[609,288], //upper right coordinate
[609,1100] //Lower right coordinate
],
"similarity":0.8 //similarity
}
}
Return successfully
{
"fun": "find_image_ex",
"msgid": 0,
"status": 0, //0 success, non-0 failure
"data": {
"deviceid":"5C:1D:D9:ED:D9:DE",
"list": [
{
"index": 0,//Find the index of the image
"result":[421,694], //Find the center point of the picture position
"rectangle":[ //Find a rectangular coordinate array of the picture location
[233,288], //upper left coordinate
[233,1100],//Lower left coordinate
[609,288], //upper right coordinate
[609,1100] //Lower right coordinate
],
"confidence":0.999994397163391, //similarity of matched images
"code":0 //This represents the actual result of finding the image. 0 is successful, 1 is not finding the subimage, and 2 is failing to read the image stream.
}]
},
"message": "success"
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "find_image_ex", //Function number
"message": "The picture search plug-in is not connected", //The call returns the message
"msgid": 0,
"status": -1
}
2.33 Ocr text recognition
Request parameters
{
"fun":"ocr",//Function name, there is also a function name ocr_ex. The enhanced version of OCR recognition is more accurate, but it takes up resources and only supports professional version calls.
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
"rect":[ //Rectangular coordinate array
[376,272],//upper left coordinate
[376,287],//Lower left coordinate
[435,272],//upper right coordinate
[435,287]//Lower right coordinate
]
}
}
Return successfully
{
"fun":"ocr",
"msgid":9,
"status":0,//0 success, non-0 failure
"data":{
"list":[ //List of all text recognized
{
"txt":"Start the game", //Text information successfully recognized
"confidence":0.982732,//similarity of successful recognition
"result":[406,280],//The center point coordinates of the text are recognized
"rectangle":[//The rectangular coordinate array of the recognized text
[385,275],//upper left coordinate
[385,285],//Lower left coordinate
[428,275],//upper right coordinate
[428,285]//Lower right coordinate
]
}
],
"code":0,//This represents the actual result of finding the image. 0 is successful, 1 is not finding the subimage, and 2 is failing to read the image stream.
"deviceid":"5C:1D:D9:ED:D9:DE"
},
"message":"success"
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "ocr", //function number
"message": "ocr plug-in is not connected", //call returns message
"msgid": 0,
"status": -1
}
2.34 Find more colors
Request parameters
{
"fun": "find_multi_color", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"x1":0,//The upper left X coordinate of the area
"y1":0,//The upper left Y coordinate of the area
"x2":2000,//The lower right X coordinate of the area
"y2":2000,//The lower right Y coordinate of the area
"first_color": "",//The color format is "RRGGBB-DRDGDB|RRGGBB-DRDGDB|…………", such as "123456-000000"
"offset_color": "",//Offset color can support any number of points
"similarity":0.8, //similarity
"dir":0 //Search direction 0: left to right, top to bottom 1: left to right, bottom to top 2: right to left, top to bottom 3: right to left, from bottom to top
}
}
Return successfully
{
'data': {
'result': [//Returned coordinates
129,
483
],
'code': 0, //This represents the actual result of color search. 0 is successful, 1 is failed.
'deviceid': '9C:F4:8E:57:10:C4'//Device id
},
'status': 0, //0 success, non-0 failure
'message': 'success',
'msgid': 1,
'fun': 'find_multi_color'
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "find_multi_color", //Function number
"message": "Failed to call the interface", //The call returns message
"msgid": 0,
"status": -1
}
2.35 Find more colors Ex
Request parameters
{
"fun": "find_multi_color_ex", //Function name
"msgid": 0, //Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE", //device id
"all":false,//Whether to search all, false will return when the bar is found, true will return after all are found.
"list":[{
"x1":0,//The upper left X coordinate of the area
"y1":0,//The upper left Y coordinate of the area
"x2":2000,//The lower right X coordinate of the area
"y2":2000,//The lower right Y coordinate of the area
"first_color": "",//The color format is "RRGGBB-DRDGDB|RRGGBB-DRDGDB|…………", such as "123456-000000"
"offset_color": "",//Offset color can support any number of points
"similarity":0.8, //similarity
"dir":0 //Search direction 0: left to right, top to bottom 1: left to right, bottom to top 2: right to left, top to bottom 3: right to left, from bottom to top
}]
}
}
Return successfully
{
"data": {
"list": [
{
"index":0,//The index found
"result": [129, 483] //The found x, y coordinates
}
],
'code': 0, //This represents the actual result of color search. 0 is successful, 1 is failed.
'deviceid': '9C:F4:8E:57:10:C4'//Device id
},
'status': 0, //0 success, non-0 failure
'message': 'success',
'msgid': 1,
'fun': 'find_multi_color_ex'
}
Return on failure
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "find_multi_color_ex", //Function number
"message": "Failed to call the interface", //The call returns message
"msgid": 0,
"status": -1
}
2.36 Automatically cast screen
Before using this interface, you need to obtain the coordinate points for automatic screen projection, otherwise automatic screen projection will not work.This interface is time-consuming to call. It is recommended to use asynchronous mode.
Request parameters
{
"fun":"auto_connect_screen",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
"force": true //Whether to forcefully disconnect the current screencast, if not filled in, it will not be disconnected by default
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "auto_connect_screen", //Function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
2.37 Automatically cast to all offline phones
Request parameters
{
"fun":"auto_connect_screen_all",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "auto_connect_screen_all", //function number
"message": "AirPlay screen mirroring service not found", //call returns message
"msgid": 0,
"status": 30
}
2.38 Disconnect screencast
Request parameters
{
"fun":"discon_airplay",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
2.39 Get automatic screen projection coordinate points
Before using this interface, you must keep your phone online, install the OCR and image search plug-ins, and the hardware mouse parameters are normal.This interface is time-consuming to call, so it is recommended to use asynchronous mode.
Request parameters
{
"fun":"save_autoscreen_point",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "auto_connect_screen", //Function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
2.40 Restart USB device
Request parameters
{
"fun":"restart_usb",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "restart_usb", //function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
2.41 Switch connection hardware to automatically project the screen
After turning on the function, the screen mirroring operation will be automatically performed after connecting to the iMouse hardware, but it will not affect the manual sending of automatic screen mirroring instructions.
Request parameters
{
"fun":"set_usb_autoairplay",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
"autoairplay":false //true turns on, false turns off
}
}
2.42 Get the automatic screen projection status of the connected hardware
Request parameters
{
"fun":"get_usb_autoairplay",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
Return successfully
{
"fun":"get_usb_autoairplay",
"msgid":0,
"status":0,
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",
"autoairplay": true //true turns on, false turns off
},
"message":"success"
}
Return on failure
None
2.43 Set screen mirroring transmission mode
[Energy Saving Mode] saves the most traffic and CPU resources, and the image is a bit laggy (a single horizontal screen game has about 5M traffic, which is suitable for 100 mobile phone users)[Normal Mode] The traffic and CPU usage are not large, and the image is slightly delayed (about 10M traffic for a single horizontal screen game is suitable for users with about 50 mobile phones)[High-performance mode] The traffic and CPU usage are large, and the image is basically no delay (a single horizontal screen game has about 20M traffic)
Request parameters
{
"fun":"set_airplay_mode",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
"airplay_mode":0 //0 Energy saving mode 1 Normal mode 2 High performance mode
}
}
{
"fun":"get_airplay_mode",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
Return successfully
{
"fun":"get_airplay_mode",
"msgid":0,
"status":0,
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",
"airplay_mode":0 //0 Energy saving mode 1 Normal mode 2 High performance mode
},
"message":"success"
}
Return on failure
none
2.45 Get the coordinate point of restarting the phone
Before using this interface, you must keep your phone online, install the OCR text recognition plug-in, and the iMouse hardware connection is normal.
Request parameters
{
"fun":"save_restart_point",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE"//Device id
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "save_restart_point", //Function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
2.46 restart cellphone
Before using this interface, you need to obtain the coordinate point for restarting the phone. For mobile phones of the same model, you only need to obtain it once.
Request parameters
{
"fun":"restart_device",//Function name
"msgid":0,//Message id, the server will return it as it is after receiving it. The websocket connection can be used to convert from asynchronous to synchronous. Directly fill in 0 in http mode
"data":{
"deviceid":"5C:1D:D9:ED:D9:DE",//device id
}
}
{
"data": {
"deviceid": "5C:1D:D9:ED:D9:DE" //Device id
}, //return data
"fun": "restart_device", //Function number
"message": "No USB device is bound", //The call returns the message
"msgid": 0,
"status": 1
}
This callback is generated by the 9912 port connection. The callback data is binary. The first byte of the returned data 261 is the device id, and the remaining bytes are image data.
python decoding device id and image data
def _binaryEvent(self, data: bytes): #Websocket binary data reception
deviceid = data[:261].decode(encoding="utf-8").split('\x00')[0] #Get device id
isjpg = int.from_bytes(data[261:265], "little") #Is it in jpg format?
img_data = data[265:] #Picture data
3.9 Easy language decoding device id and picture data
4. Python call (Phonefarm.some3c.com)
Using environment python3.9
ios_at_api.py encapsulated api interface
main.py example using pyqt
main_form.py form unit is automatically generated by pyuic through
main_form.uimain_form.ui qt interface file generated by QtDesigner
ios_at_api.py needs to install the following dependent libraries
pip install websocket-client -i https://pypi.tuna.tsinghua.edu.cn/simple/
Examples using pyqt require the following dependent libraries to be installed
import base64
import gzip
import io
import ios_at_api # Import ios_at_api module
import time
# Save base64 string as image
def base64_to_bmp(data: dict):
image_base64 = data['data']['img']
is_gzip = data['data']['gzip']
is_jpg = data['data']['isjpg']
imgdata = base64.b64decode(image_base64)
if is_gzip:
with gzip.GzipFile(fileobj=io.BytesIO(imgdata)) as f:
imgdata = f.read()
if is_jpg:
img_path = "{}.jpg".format(time.strftime("%Y-%m-%d-%H%M%S", time.localtime()))
else:
img_path = "{}.bmp".format(time.strftime("%Y-%m-%d-%H%M%S", time.localtime()))
with open(img_path, 'wb') as f:
f.write(imgdata)
del data['data']['img']
print(data)
print("Save image successfully: " + img_path)
# Instantiate the HttpApi class and pass in the kernel server IP address as a parameter
api = ios_at_api.HttpApi('127.0.0.1')
# Call the screenshot interface
image_data = api.get_device_screenshot(deviceid='F4:0F:24:D8:42:24')
if image_data['status'] > 0:
print('Screen capture call failed, reason: {}'.format(image_data['message']))
else:
print('Screenshot call successful')
base64_to_bmp(image_data)
Use websocket protocol to call the interface
#Text message callback function
def on_message(data: dict):
if data["fun"] == "get_device_screenshot":
if data['status'] > 0:
print('Screenshot call failed, reason: {}'.format(data['message']))
else:
print('Screenshot call successful')
if "img" in data['data']: # Save image data to a file
base64_to_bmp(data)
return # The screenshot message is too long to print, so return here
print("Received callback message{}".format(data))
# Binary message callback function
def on_binary(data: bytes):
deviceid = data[:261].decode(encoding="utf-8").split('\x00')[0]
isjpg = int.from_bytes(data[261:265], "little")
bmp = data[265:]
print("Received screen data of device {}".format(deviceid))
if isjpg == 1:
img_path = "{}.jpg".format(time.strftime("%Y-%m-%d-%H%M%S", time.localtime()))
else:
img_path = "{}.bmp".format(time.strftime("%Y-%m-%d-%H%M%S", time.localtime()))
with open(img_path, 'wb') as f:
f.write(bmp)
print("Save image successfully: " + img_path)
# Instantiate the WsApi class, passing in the kernel server IP address, text message callback function, and binary message callback function as parameters
api = ios_at_api.WsApi('127.0.0.1', on_message=on_message, on_binary=on_binary)
# Start connecting to the kernel
api.start()
# Wait for successful connection
while not api.is_onnect():
time.sleep(1)
# Synchronously call the screenshot interface and use base64 string to return
ret = api.get_device_screenshot(deviceid='5C:1D:D9:ED:D9:DE')
if ret['status'] > 0:
print('Screen capture call failed, reason: {}'.format(ret['message']))
else:
print('Screenshot call successful')
base64_to_bmp(ret)
'''
#Asynchronously call the screenshot interface and use base64 string to return
ret = api.get_device_screenshot(deviceid='5C:1D:D9:ED:D9:DE', sync=False)
print(ret)
'''
'''
# Asynchronously call the screenshot interface and use binary return
ret = api.get_device_screenshot(deviceid='5C:1D:D9:ED:D9:DE', binary=True)
print(ret)
'''
input("Press any key to exit")
api.stop()
Open the iMouse console control window->Open the QR code->right-click to copy->send to mobile browser->open->get the shortcut command->modify the IP address in the shortcut command->run the shortcut command once->allow all
Bind iMouse shortcut commands
Open the iMouse console control window -> Enter accessibility on the phone -> Assistive Touch -> Device -> iMouse4.x -> Customize more buttons -> In the iMouse console control window -> Click Send Binding Key
Calling this interface will force both ends of the USB device to be reset. It only supports kernel version 1.2.0.3 or above and firmware of iMouse 3.0 or above hardware.
To check the firmware version, go to Settings->Accessibility->Touch->Assistive Touch->Device
Settings->Shortcuts->Advanced->Allow scripts, allow sharing of large amounts of data, allow direct deletion without confirmation, allow deletion of large amounts of data
error codes
explanation
error codes
explanation
error codes
explanation
error codes
explanation
1
Device ID does not exist
9
The general library does not have a corresponding model
17
The resource map does not exist
25
Failed to call interface
2
Device online
10
Configuration already exists
18
Failed to find picture
26
The plug-in is not connected and may not be installed.
3
group does not exist
11
The general library does not have a corresponding model
19
OCR failed
27
Interface call timeout
4
The device is not online
12
The configuration to be deleted was not found
20
OCR does not recognize text
28
Error when calling interface
5
Screenshot failed
13
The official library does not allow deletion
21
There is no corresponding coordinate parameter
29
AirPlay service does not exist
6
No USB device bound
14
USB device not connected
22
unknown error
30
AirPlay screen mirroring service not found
7
No mouse parameters
15
Must be in portrait orientation
23
No restart coordinate point
21
is already casting
8
Parameters are incorrect
16
Failed to send hotkey
24
Key files missing
32
Failed to cast screen
Function ID
Function Description
Function ID
Function Description
Function ID
Function Description
1
Get mobile photo album list
17
Turn off the flashlight (no function parameters required)
2
Transfer photos or video files from your phone’s photo album to your computer
10
Send text to phone clipboard
18
Turn on airplane mode (no function parameters required)
3
Delete mobile phone photos or video files
11
Get text from phone clipboard
19
Turn off airplane mode (no function parameters required)
4
Get the list of files in the specified directory on the mobile phone
12
Send SMS
20
Turn on cellular data (no function parameters required)
5
Transfer specified files from mobile phone to computer
13
Open url on mobile phone
21
Turn off cellular data (no function parameters required)
6
Delete specified files on mobile phone
14
Read text aloud on mobile phone
22
Turn on wireless LAN (no function parameters required)
7
Send photos or videos to mobile phone album
15
Set screen brightness
23
Turn off wireless LAN (no function parameters required)
8
Send files to the specified directory on the mobile phone
16
Turn on the flashlight (no function parameters required)
24
Get the external network IP of the mobile phone
parameter name
Example value
Parameter Type
Parameter Description
fun
dev_connect
String
function number
data
-
Object
Return data
Parameter name
Parameter description
Parameter name
Parameter description
ip
ip address of the device
width
The real width of the mobile phone screen
airhandle
The handle of the current device connected to airplay, used internally
height
The actual height of the mobile phone screen
mac
device mac address
device_name
mobile phone model
username
The name of the local definition on the device
location
usb device mouse parameters
version
mobile phone system version
state
state > 0 means online. Because this callback is online, the state is definitely not 0.