> For the complete documentation index, see [llms.txt](https://doc.some3c.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.some3c.com/iphone-farm-setup/xp-api-documentation/callback.md).

# Callback

## 1.Callback Description

### Callback  <a href="#hui-tiao-shuo-ming" id="hui-tiao-shuo-ming"></a>

Although callbacks and asynchronous requests appear in the ws callback, the callback mentioned here is the message that the kernel actively broadcasts to all connected clients.

For example, if a connected client deletes a device, sets device operations, or takes a device offline, the kernel will automatically push messages to all connected clients.

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

```
{
  "fun": "Function number",
  "status": Must be 200
  "message": "",
  "msgid": 0,
  "data": {}Actual data
}
```

### Example 1, the sorting of the device list  <a href="#li-zi-1-she-bei-lie-biao-pai-xu-fa-sheng-gai-bian" id="li-zi-1-she-bei-lie-biao-pai-xu-fa-sheng-gai-bian"></a>

```
{
  "data": {
    "code": 0,
    "id": "",
    "sort_index": 2,
    "sort_value": 1,
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_sort_change"
}
```

### Example 2, USB hardware device   <a href="#li-zi-2usb-ying-jian-she-bei-fa-sheng-gai-bian" id="li-zi-2usb-ying-jian-she-bei-fa-sheng-gai-bian"></a>

```
{
  "data": {
    "list": [
      {
        "vid": "720D",
        "pid": "9523",
        "uid": "952324BD",
        "ver": "4.4",
        "state": 2
      }
    ],
    "code": 12,
    "id": "",
    "message": "There are hardware and mobile phone connections"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "usb_change"
}
```

### Example 3, device  <a href="#li-zi-3-she-bei-fa-sheng-gai-bian" id="li-zi-3-she-bei-fa-sheng-gai-bian"></a>

```
{
  "data": {
    "list": [
      {
        "air_handle": 118639968,
        "air_pid": 17260,
        "rotate": 0,
        "state": 1,
        "imgw": 750,
        "imgh": 1334,
        "gid": 0,
        "air_ratio": 0,
        "air_fps": 0,
        "air_refresh": 0,
        "air_img_fps": 0,
        "air_audio": 0,
        "name": "11",
        "srv_name": "`iMouseXP-D2B6",
        "width": "375",
        "height": "667",
        "ip": "192.168.9.112",
        "mac": "00:E0:99:D9:8B:2E",
        "user_name": "iPhone",
        "version": "15.7.3",
        "model": "iPhone8,1",
        "deviceid": "6C:72:E7:EA:CD:95",
        "device_name": "iPhone 6s",
        "location": "",
        "location_crc": "B0DBD800",
        "vid": "720D",
        "pid": "9523",
        "uid": "952324BD",
        "gname": "未分组",
        "uver": "4.4"
      }
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_change"
}
```

## 2.Connecting to the kernel successfully

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number im\_connect

```
{
  "fun": "im_connect",
  "status": 200,
  "message": "",
  "msgid": 0,
  "data": {
    "ver": "2024.12.21.910"
  }
}
```

* **Response data field description**

| Fields | illustrate            | Remark |
| ------ | --------------------- | ------ |
| ver    | Kernel version number | -      |

## 3.Device connected

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number dev\_connect

```
{
  "data": {
    "list": [
      {
        "air_handle": 118639968,
        "air_pid": 17260,
        "rotate": 0,
        "state": 1,
        "imgw": 1206,
        "imgh": 2622,
        "gid": 0,
        "air_ratio": 0,
        "air_fps": 0,
        "air_refresh": 0,
        "air_img_fps": 0,
        "air_audio": 0,
        "name": "",
        "srv_name": "`iMouseXP-D2B6",
        "width": "402",
        "height": "874",
        "ip": "192.168.9.100",
        "mac": "C6:4D:3A:7A:E0:D3",
        "user_name": "Ss的xx",
        "version": "18.2",
        "model": "iPhone17,1",
        "deviceid": "9A:97:4E:C9:54:71",
        "device_name": "iPhone 16 Pro",
        "location": "",
        "location_crc": "",
        "vid": "",
        "pid": "",
        "uid": "",
        "gname": "未分组",
        "uver": ""
      }
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_connect"
}

```

* **Response data field description**

See Get Device

## 4.Device is disconnected

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number dev\_disconnect

```
{
  "data": {
    "list": [
      {
        "air_handle": 118639968,
        "air_pid": 17260,
        "rotate": 0,
        "state": 0,
        "imgw": 1206,
        "imgh": 2622,
        "gid": 0,
        "air_ratio": 0,
        "air_fps": 0,
        "air_refresh": 0,
        "air_img_fps": 0,
        "air_audio": 0,
        "name": "",
        "srv_name": "`iMouseXP-D2B6",
        "width": "402",
        "height": "874",
        "ip": "192.168.9.100",
        "mac": "C6:4D:3A:7A:E0:D3",
        "user_name": "Ss的xx",
        "version": "18.2",
        "model": "iPhone17,1",
        "deviceid": "9A:97:4E:C9:54:71",
        "device_name": "iPhone 16 Pro",
        "location": "",
        "location_crc": "",
        "vid": "",
        "pid": "",
        "uid": "",
        "gname": "未分组",
        "uver": ""
      }
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_disconnect"
}

```

* **Response data field description**

See Get Device

## 5.Device rotation

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number dev\_rotate

```
{
  "data": {
    "list": [
      {
        "air_handle": 118639968,
        "air_pid": 17260,
        "rotate": 0,
        "state": 0,
        "imgw": 1206,
        "imgh": 2622,
        "gid": 0,
        "air_ratio": 0,
        "air_fps": 0,
        "air_refresh": 0,
        "air_img_fps": 0,
        "air_audio": 0,
        "name": "",
        "srv_name": "`iMouseXP-D2B6",
        "width": "402",
        "height": "874",
        "ip": "192.168.9.100",
        "mac": "C6:4D:3A:7A:E0:D3",
        "user_name": "Ss的xx",
        "version": "18.2",
        "model": "iPhone17,1",
        "deviceid": "9A:97:4E:C9:54:71",
        "device_name": "iPhone 16 Pro",
        "location": "",
        "location_crc": "",
        "vid": "",
        "pid": "",
        "uid": "",
        "gname": "未分组",
        "uver": ""
      }
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_rotate"
}

```

* **Response data field description**

See Get Device

## 6.Equipment changes

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number dev\_change

```
{
  "data": {
    "list": [
      {
        "air_handle": 118639968,
        "air_pid": 17260,
        "rotate": 0,
        "state": 0,
        "imgw": 1206,
        "imgh": 2622,
        "gid": 0,
        "air_ratio": 0,
        "air_fps": 0,
        "air_refresh": 0,
        "air_img_fps": 0,
        "air_audio": 0,
        "name": "",
        "srv_name": "`iMouseXP-D2B6",
        "width": "402",
        "height": "874",
        "ip": "192.168.9.100",
        "mac": "C6:4D:3A:7A:E0:D3",
        "user_name": "Ss的xx",
        "version": "18.2",
        "model": "iPhone17,1",
        "deviceid": "9A:97:4E:C9:54:71",
        "device_name": "iPhone 16 Pro",
        "location": "",
        "location_crc": "",
        "vid": "",
        "pid": "",
        "uid": "",
        "gname": "未分组",
        "uver": ""
      }
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_change"
}

```

* **Response data field description**

See Get Device

## 7.Device deleted

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number dev\_delete

```
{
  "data": {
    "list": [
      "90:81:58:EE:D1:9E"
    ],
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_delete"
}

```

* **Response data field description**

See Deleting a Device

## 8.Grouping changes

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number group\_change

```
{
  "data": {
    "name": "g1",
    "code": 0,
    "id": "222440499",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "group_change"
}

```

* **Response data field description**

See Setting the Return of Groups

## 9.Group deletion

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number group\_delete

```
{
  "data": {
    "list": [
      "1145527833",
      "1145533497"
    ],
    "code": 0,
    "id": "1145527833,1145533497",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "group_delete"
}

```

* **Response data field description**

See the return of deleting a group.

## 10.USB hardware changes

### Callback   <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number usb\_change

```
{
  "data": {
    "list": [
      {
        "vid": "720D",
        "pid": "1F2D",
        "uid": "1F2D24BD",
        "ver": "4.4",
        "state": 2
      }
    ],
    "code": 19,
    "id": "",
    "message": "There is hardware and computer connection"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "usb_change"
}

```

* **Response data field description**

Here we mainly look at the value of code

| Fields | illustrate      | Remark                                                                                                                         |
| ------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| code   | Hardware Status | 19 hardware is connected to the computer, 20 hardware is disconnected from the computer, 12 hardware is connected to the phone |

## 11.Collect mouse parameter status

### Callback [Format](https://www.iosautot.cn/XP%E7%89%88API%E6%96%87%E6%A1%A3/iMouse%E5%9B%9E%E8%B0%83/%E9%87%87%E9%9B%86%E9%BC%A0%E6%A0%87%E5%8F%82%E6%95%B0%E7%8A%B6%E6%80%81#%E5%9B%9E%E8%B0%83%E6%A0%BC%E5%BC%8F) <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number collection\_mouse

```
{
  "data": {
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "collection_mouse"
}

```

* **Response data field description**

Here we mainly look at the value of code

| Fields | illustrate      | Remark                                                                                                                                                                                                  |
| ------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| code   | Hardware Status | 0 Success, 4 Collection failed, 5 A device is collecting, 6 This device ID is not collecting the mouse, 8 Scan the code to open successfully, 9 Enter the collection page, 14 Start working, 21 Working |

## 12.Automatic screen casting log

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number airplay\_connect\_log

```
{
  "data": {
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "airplay_connect_log"
}

```

* **Response data field description**

Here we mainly look at the code value 0 success, when it is not 0, the current status is described in the message

## 13.Restart phone log

### Callback   <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Function number restart\_log

```
{
  "data": {
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "restart_log"
}

```

* **Response data field description**

Here we mainly look at the code value 0 success, when it is not 0, the current status is described in the message

## 14.User information status

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

User information will be pushed automatically every 30 seconds when logging in and at other times.

Function number user\_info

```
{
  "data": {
    "code": 0,
    "id": "",
    "pass": true,
    "total_license": 0,
    "local_total_license": 100,
    "dev_num": 16,
    "dev_online_num": 0,
    "create_time": 1690800970000,
    "overdue_time": 1683288910000,
    "phone": "13999999999",
    "utag": 2,
    "info_clock_in_time": 60000,
    "add_clock_in_time": 60000,
    "info_time": 885192828,
    "add_time": 0,
    "utag_data": "",
    "test_num": 100,
    "user_state": 2,
    "network_time": 1735124455463,
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "user_info"
}

```

* **Response data field description**

For field descriptions, see Obtaining User Information in User-related

## 15.Kernel push log

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Used to tell the client some important information logs, such as exceeding authorization, etc.

Function number im\_log

```
{
  "data": {
    "code": 0,
    "id": "",
    "message": "未登录，不允许上线"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "im_log"
}

```

* **Response data field description**

The log information is in the message

## 16.Kernel push error log

### Callback   <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Used to tell the client some current error information logs, such as unknown hardware errors

Function No. error\_push

```
{
  "data": {
    "code": 0,
    "id": "",
    "call_fun":"/mouse/down",
    "message": "Hardware not working (unknown error)"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "error_push"
}

```

* **Response data field description**

The error message is in message, and call\_fun is what function is called.

## 17.Kernel configuration has been changed

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

When a client changes the kernel configuration, other connected clients will receive this information

Function number im\_config\_change

```
{
  "data": {
    "air_play_name": "iMouseXP-D2B6",
    "lang": "English",
    "mdns_type": 0,
    "connect_failed_retry": 3,
    "air_play_ratio": 0,
    "opencv_num": 1,
    "ocr_num": 1,
    "allow_ip_list": [],
    "air_play_fps": 30,
    "air_play_img_fps": 0,
    "air_play_refresh_rate": 60,
    "air_play_port": 17000,
    "air_play_audio": true,
    "auto_connect": false,
    "auto_updata": false,
    "thread_mode": false,
    "mouse_mode": true,
    "flip_right": true,
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "im_config_change"
}

```

* **Response data field description**

For field descriptions, see Get Kernel Configuration in Configuration Related

## 18.Log out of account

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

Log out of the kernel account

Function number logout

```
{
  "data": {
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "logout"
}

```

* **Response data field description**

none

## 19.Device list sorting changed

### Callback  <a href="#hui-tiao-ge-shi" id="hui-tiao-ge-shi"></a>

You will receive this message when the device list changes

Function number dev\_sort\_change

```
{
  "data": {
    "sort_index": 0,
    "sort_value": 0,
    "code": 0,
    "id": "",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "dev_sort_change"
}

```

* **Response data field description**

For field descriptions, see Get device list sorting.

##
