Skip to content

Commit 3bc7901

Browse files
authored
Update README.md
1 parent 98e39a9 commit 3bc7901

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

README.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,23 +201,34 @@ Subscription Mode overrides Context Mode - that is, if a key on a keyboard has b
201201
Each Subscribe endpont also has a corresponding Unsubscribe endpoint, which removes the subscription and any block associated with it.
202202

203203
#### Subscribing to Keyboard keys
204-
Subscribe to a key on a specific keyboard
204+
##### Subscribe to a specific key on a specific keyboard
205205
`SubscribeKey(<deviceId>, <scanCode>, <block>, <callback>, <concurrent>)`
206206
`UnsubscribeKey(<deviceId>, <scanCode>)`
207-
```
208-
AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent"))
209-
return
210-
```
207+
eg
208+
`AHI.SubscribeKey(keyboardId, GetKeySC("1"), true, Func("KeyEvent"))`
211209

212210
Callback function is passed state `0` (released) or `1` (pressed)
213211
```
214212
KeyEvent(state){
215213
ToolTip % "State: " state
216214
}
217215
```
218-
219216
Parameter `<concurrent>` is optional and is <b>false</b> by default meaning that all the events raised for that key will be handled sequentially (i.e. callback function will be called on a single thread). If set to <b>true</b>, a new thread will be created for each event and the callback function will be called on it.
217+
218+
##### Subscribe to all keys on a specific keyboard
219+
`SubscribeKeyboard(<deviceId>, <block>, <callback>, <concurrent>)`
220+
eg
221+
`AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))`
222+
223+
Callback function is passed scancode of pressed key and state
224+
```
225+
KeyEvent(code, state){
226+
ToolTip % "Keyboard Key - Code: " code ", State: " state
227+
}
228+
```
229+
220230
#### Subscribing to Mouse Buttons
231+
##### Subscribing to a specific button on a specific mouse
221232
`SubscribeMouseButton(<deviceId>, <button>, <block>, <callback>, <concurrent>)`
222233
`UnsubscribeMouseButton(<deviceId>, <button>)`
223234
Where `button` is one of:
@@ -234,6 +245,18 @@ For Mouse Wheel events, the `<state>` parameter will be `1` for Wheel Up / Right
234245

235246
Otherwise, usage is identical to `SubscribeKey`
236247

248+
##### Subscribing to all buttons on a specific mouse
249+
`SubscribeMouseButtons(<deviceId>, <block>, <callback>, <concurrent>)`
250+
eg
251+
`AHI.SubscribeMouseButtons(mouseId, true, Func("MouseButtonEvent"))`
252+
253+
Callback function is passed ID (See above) of pressed button and state
254+
```
255+
MouseButtonEvent(code, state){
256+
ToolTip % "Mouse Button - Code: " code ", State: " state
257+
}
258+
```
259+
237260
#### Subscribing to Mouse Movement
238261
**Warning!** When Subscribing to mouse movement, you will get **LOTS** of callbacks.
239262
Note the CPU usage of the demo Monitor app.

0 commit comments

Comments
 (0)