# Keyboard and Mouse

## 1.Mouse clicks

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type    | illustrate                                                                                      | Remark                                                                            |
| --------- | ------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| fun       | String  | /mouse/click                                                                                    | Request function name                                                             |
| id        | String  | Device unique ID                                                                                | Separate multiple devices with commas                                             |
| button    | String  | 1 left button, 2 right button, 3 middle button, 4, 5, 6, 7, 8 button                            | If it is empty, the default left key is supported, and up to 8 keys are supported |
| x         | Integer | x-coordinate                                                                                    | -                                                                                 |
| y         | Integer | y coordinate                                                                                    | -                                                                                 |
| time      | Integer | The delay between pressing and popping up, if not filled in, it will be handled by the internal | millisecond                                                                       |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/click?id=5C:F7:E6:CE:65:22&x=100&y=100'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/click  \
  --form id=5C:F7:E6:CE:65:22 \
  --form x=100 \
  --form y=100 
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/mouse/click",
    "data": {
        "id":"5C:F7:E6:CE:65:22",
        "x":100,
        "y":100
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/click"
}
```

* **Response data data field description**\
  None

## 2.Mouse slide

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter   | type                   | illustrate                                                    | Remark                                                           |
| ----------- | ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------- |
| fun         | String                 | /mouse/swipe                                                  | Request function name                                            |
| id          | String                 | Device unique ID                                              | Separate multiple devices with commas                            |
| button      | String                 | 1 left button, 2 right button                                 | Empty default left button                                        |
| direction   | Integer                | Slide direction up, down, left, right                         | Corresponding to up, down, left and right respectively           |
| len         | Floating point numbers | Slide distance percentage                                     | Assume 0.9 will slide from 10% to 90% of the screen              |
| step\_sleep | Integer                | When steping is greater than 1, it takes effect               | The interval between multiple slides in milliseconds             |
| stepping    | Integer                | How many times to slide to the specified position in the loop | -                                                                |
| brake       | Integer                | Stop immediately after sliding                                | Some interfaces may be delayed after sliding                     |
| sx          | Integer                | y coordinate                                                  | 0 Automatically calculated using the sliding distance percentage |
| sy          | Integer                | y coordinate                                                  | 0 Automatically calculated using the sliding distance percentage |
| ex          | Integer                | y coordinate                                                  | 0 Automatically calculated using the sliding distance percentage |
| ey          | Integer                | y coordinate                                                  | 0 Automatically calculated using the sliding distance percentage |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/swipe?id=1C:5C:F2:BC:D0:CC&direction=up&len=0.9'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/swipe  \
  --form id=1C:5C:F2:BC:D0:CC \
  --form direction=up \
  --form len=0.8 
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/mouse/swipe",
     "msgid": 1,
     "data": {
          "id": "1C:5C:F2:BC:D0:CC",
          "direction": "up",
          "len": 0.9,
          "steping": 10,
          "step_sleep": 10,
          "brake": true,
          "sx": 100,
          "ex": 100
     }
}'
```

{ "fun": "/mouse/swipe", "msgid": 2, "data": { "id": "0C:51:01:0B:E5:EA", "button": "left", "direction": "left", "steping": 0, "step\_sleep": 0, "brake": true, "sx": 100, "sy": 100, "ex": 100, "ey": 100 } }

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/swipe"
}
```

* **Response data data field description**\
  None

## 3.Mouse pop-up

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate                                                           | Remark                                                                            |
| --------- | ------ | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| fun       | String | /mouse/up                                                            | Request function name                                                             |
| id        | String | Device unique ID                                                     | Separate multiple devices with commas                                             |
| button    | String | 1 left button, 2 right button, 3 middle button, 4, 5, 6, 7, 8 button | If it is empty, the default left key is supported, and up to 8 keys are supported |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/up?id=5C:F7:E6:CE:65:22'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/up  \
  --form id=5C:F7:E6:CE:65:22
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/mouse/up",
    "data": {
        "id":"5C:F7:E6:CE:65:22"
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/up"
}
```

* **Response data data field description**\
  None

## 4.Mouse down

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate                                                           | Remark                                                                            |
| --------- | ------ | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| fun       | String | /mouse/down                                                          | Request function name                                                             |
| id        | String | Device unique ID                                                     | Separate multiple devices with commas                                             |
| button    | String | 1 left button, 2 right button, 3 middle button, 4, 5, 6, 7, 8 button | If it is empty, the default left key is supported, and up to 8 keys are supported |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/down?id=5C:F7:E6:CE:65:22'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/down  \
  --form id=5C:F7:E6:CE:65:22
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/mouse/down",
    "data": {
        "id":"5C:F7:E6:CE:65:22"
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/down"
}
```

* **Response data data field description**\
  None

## 5.Mouse movement

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type    | illustrate       | Remark                                |
| --------- | ------- | ---------------- | ------------------------------------- |
| fun       | String  | /mouse/move      | Request function name                 |
| id        | String  | Device unique ID | Separate multiple devices with commas |
| x         | Integer | x-coordinate     | -                                     |
| y         | Integer | y coordinate     | -                                     |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/move?id=5C:F7:E6:CE:65:22&x=100&y=100'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/move  \
  --form id=5C:F7:E6:CE:65:22 \
  --form x=100 \
  --form y=100
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/mouse/move",
    "data": {
        "id":"5C:F7:E6:CE:65:22",
        "x":100,
        "y":10
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/move"
}
```

* **Response data data field description**\
  None

## 6.Mouse reset

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate       | Remark                                |
| --------- | ------ | ---------------- | ------------------------------------- |
| fun       | String | /mouse/reset     | Request function name                 |
| id        | String | Device unique ID | Separate multiple devices with commas |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/reset?id=5C:F7:E6:CE:65:22'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/reset  \
  --form id=5C:F7:E6:CE:65:22
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
    "fun": "/mouse/reset",
    "data": {
        "id":"5C:F7:E6:CE:65:22"
    }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/reset"
}
```

* **Response data data field description**\
  None

## 7.Mouse wheel

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate       | Remark                                |
| --------- | ------ | ---------------- | ------------------------------------- |
| fun       | String | /mouse/wheel     | Request function name                 |
| id        | String | Device unique ID | Separate multiple devices with commas |
| direction | String | Scroll direction | up, down, left, right                 |
| len       | String | Device unique ID | Scroll length 1-127                   |
| number    | String | Device unique ID | Number of scrolls                     |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/mouse/wheel?id=5C:F7:E6:CE:65:22&direction=up&len=30&number=1'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/mouse/wheel  \
  --form id=5C:F7:E6:CE:65:22 \
  --form direction=up \
  --form len=30 \
  --form number=1
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/mouse/wheel",
     "data": {
          "id": "1C:5C:F2:BC:D0:CC",
          "direction": "up",
          "len": 30,
          "number": 3
     }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/mouse/wheel"
}
```

* **Response data data field description**\
  None

## 8.Keyboard Pressed

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate             | Remark                                                                                     |
| --------- | ------ | ---------------------- | ------------------------------------------------------------------------------------------ |
| fun       | String | /key/down              | Request function name                                                                      |
| id        | String | Device unique ID       | Separate multiple devices with commas                                                      |
| key       | String | Press the keyboard key | Only supports English, numbers and English characters, hotkeys (only supports single keys) |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/key/down?id=5C:F7:E6:CE:65:22&key=a'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/key/down  \
  --form id=5C:F7:E6:CE:65:22 \
  --form key=a
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/key/down",
     "data": {
          "id": "1C:5C:F2:BC:D0:CC",
          "key": "a"
     }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/key/down"
}
```

* **Response data data field description**\
  None

## 9.Keyboard pop-up

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate          | Remark                                                                                     |
| --------- | ------ | ------------------- | ------------------------------------------------------------------------------------------ |
| fun       | String | /key/up             | Request function name                                                                      |
| id        | String | Device unique ID    | Separate multiple devices with commas                                                      |
| key       | String | Pop-up keyboard key | Only supports English, numbers and English characters, hotkeys (only supports single keys) |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/key/up?id=5C:F7:E6:CE:65:22&key=a'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/key/up  \
  --form id=5C:F7:E6:CE:65:22 \
  --form key=a
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/key/up",
     "data": {
          "id": "1C:5C:F2:BC:D0:CC",
          "key": "a"
     }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/key/up"
}
```

* **Response data data field description**\
  None

## 10.Keyboard pops up all

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate       | Remark                                |
| --------- | ------ | ---------------- | ------------------------------------- |
| fun       | String | /key/upall       | Request function name                 |
| id        | String | Device unique ID | Separate multiple devices with commas |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/key/upall?id=5C:F7:E6:CE:65:22'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/key/upall  \
  --form id=5C:F7:E6:CE:65:22
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/key/upall",
     "data": {
          "id": "1C:5C:F2:BC:D0:CC"
     }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/key/upall"
}
```

* **Response data data field description**\
  None

## 11.Keyboard Input

### Calling  <a href="#diao-yong-shuo-ming" id="diao-yong-shuo-ming"></a>

* **Request Parameters**

| parameter | type   | illustrate       | Remark                                                     |
| --------- | ------ | ---------------- | ---------------------------------------------------------- |
| fun       | String | /key/sendkey     | Request function name                                      |
| id        | String | Device unique ID | Separate multiple devices with commas                      |
| key       | String | character        | Only English, numbers and English characters are supported |
| fn\_key   | String | Hotkeys          | When using hotkeys, please leave the key parameter empty   |

* **httpGet request example**

```
curl --request GET \
  --url 'http://192.168.9.9:9911/api/key/sendkey?id=5C:F7:E6:CE:65:22&key=abcdefg'
```

* **httpPost request example**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'content-type: multipart/form-data' \
  --form fun=/key/sendkey  \
  --form id=5C:F7:E6:CE:65:22 \
  --form fn_key=win+h
```

* **httpPost json request example \[websocket can also send the same json request]**

```
curl --request POST \
  --url http://192.168.9.9:9911/api \
  --header 'Content-Type: application/json' \
  --data '{
     "fun": "/key/sendkey",
     "data": {
          "id": "1C:5C:F2:BC:D0:CC",
          "key":"abce12345,?"
     }
}'
```

### Response  <a href="#xiang-ying-jie-guo" id="xiang-ying-jie-guo"></a>

```
{
  "data": {
    "code": 0,
    "id": "5C:F7:E6:CE:65:22",
    "message": "成功"
  },
  "status": 200,
  "message": "成功",
  "msgid": 0,
  "fun": "/key/sendkey"
}
```

* **Common hotkey list**

| Hotkeys              | illustrate                                           |
| -------------------- | ---------------------------------------------------- |
| WIN+h                | Home Screen                                          |
| TAB+b                | Return (not supported by all apps)                   |
| AppSwitch            | App Switcher                                         |
| ControlBar           | Control Center                                       |
| NoticeBar            | Notification Center                                  |
| TAB+l                | Lock screen                                          |
| OPENKeyboard         | Open the on-screen keyboard                          |
| shift+win+3          | screenshot                                           |
| shift+win+4          | Screen capture and editing                           |
| CTRL+ALT+SHIFT+WIN+r | Restart                                              |
| CTRL+ALT+WIN+p       | Pass-through mode (turn the full keyboard on or off) |
| WIN+c                | copy                                                 |
| WIN+v                | Paste                                                |
| WIN+a                | Select All                                           |
| WIN+x                | Cut                                                  |
| SwitchIme            | Switch input method                                  |
| BACKSPACE            | Backspace key                                        |
|                      | Spacebar (just a space)                              |
| TAB                  | TAB key                                              |
| ENTER                | Enter key                                            |
| UpArrow              | Direction                                            |
| DownArrow            | Direction Down                                       |
| LeftArrow            | Direction Left                                       |
| RightArrow           | Direction Right                                      |

* **Response data data field description**\
  None
