MouseScroll example from BLE_HID
Dependencies: BLE_API BLE_HID mbed nRF51822
This example is currently copied as-is from the github development repo.
examples_common.h@0:43cdec802ecb, 2015-09-15 (annotated)
- Committer:
- jbru
- Date:
- Tue Sep 15 19:46:54 2015 +0000
- Revision:
- 0:43cdec802ecb
- Child:
- 1:0a97297327eb
Initial commit; ; Simplest HID demo that associates mouse scroll events (one up and one down) to standard buttons 1 and 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbru | 0:43cdec802ecb | 1 | #ifndef HID_EXAMPLES_COMMON_H_ |
jbru | 0:43cdec802ecb | 2 | #define HID_EXAMPLES_COMMON_H_ |
jbru | 0:43cdec802ecb | 3 | |
jbru | 0:43cdec802ecb | 4 | /** |
jbru | 0:43cdec802ecb | 5 | * Functions and configuration common to all HID demos |
jbru | 0:43cdec802ecb | 6 | */ |
jbru | 0:43cdec802ecb | 7 | |
jbru | 0:43cdec802ecb | 8 | #include "ble/BLE.h" |
jbru | 0:43cdec802ecb | 9 | |
jbru | 0:43cdec802ecb | 10 | #include "HIDServiceBase.h" |
jbru | 0:43cdec802ecb | 11 | |
jbru | 0:43cdec802ecb | 12 | /** |
jbru | 0:43cdec802ecb | 13 | * IO capabilities of the device. During development, you most likely want "JustWorks", which means |
jbru | 0:43cdec802ecb | 14 | * no IO capabilities. |
jbru | 0:43cdec802ecb | 15 | * It is also possible to use IO_CAPS_DISPLAY_ONLY to generate and show a pincode on the serial |
jbru | 0:43cdec802ecb | 16 | * output. |
jbru | 0:43cdec802ecb | 17 | */ |
jbru | 0:43cdec802ecb | 18 | #ifndef HID_SECURITY_IOCAPS |
jbru | 0:43cdec802ecb | 19 | #define HID_SECURITY_IOCAPS (SecurityManager::IO_CAPS_NONE) |
jbru | 0:43cdec802ecb | 20 | #endif |
jbru | 0:43cdec802ecb | 21 | |
jbru | 0:43cdec802ecb | 22 | /** |
jbru | 0:43cdec802ecb | 23 | * Security level. MITM disabled forces "Just Works". If you require MITM, HID_SECURITY_IOCAPS must |
jbru | 0:43cdec802ecb | 24 | * be at least IO_CAPS_DISPLAY_ONLY. |
jbru | 0:43cdec802ecb | 25 | */ |
jbru | 0:43cdec802ecb | 26 | #ifndef HID_SECURITY_REQUIRE_MITM |
jbru | 0:43cdec802ecb | 27 | #define HID_SECURITY_REQUIRE_MITM false |
jbru | 0:43cdec802ecb | 28 | #endif |
jbru | 0:43cdec802ecb | 29 | |
jbru | 0:43cdec802ecb | 30 | /** |
jbru | 0:43cdec802ecb | 31 | * Disable debug messages by setting NDEBUG |
jbru | 0:43cdec802ecb | 32 | */ |
jbru | 0:43cdec802ecb | 33 | #ifndef NDEBUG |
jbru | 0:43cdec802ecb | 34 | #define HID_DEBUG(...) printf(__VA_ARGS__) |
jbru | 0:43cdec802ecb | 35 | #else |
jbru | 0:43cdec802ecb | 36 | #define HID_DEBUG(...) |
jbru | 0:43cdec802ecb | 37 | #endif |
jbru | 0:43cdec802ecb | 38 | |
jbru | 0:43cdec802ecb | 39 | /** |
jbru | 0:43cdec802ecb | 40 | * Initialize security manager: set callback functions and required security level |
jbru | 0:43cdec802ecb | 41 | */ |
jbru | 0:43cdec802ecb | 42 | void initializeSecurity(BLE &ble); |
jbru | 0:43cdec802ecb | 43 | |
jbru | 0:43cdec802ecb | 44 | /** |
jbru | 0:43cdec802ecb | 45 | * - Initialize auxiliary services required by the HID-over-GATT Profile. |
jbru | 0:43cdec802ecb | 46 | * - Initialize common Gap advertisement. |
jbru | 0:43cdec802ecb | 47 | * |
jbru | 0:43cdec802ecb | 48 | * Demos only have to set a custom device name and appearance, and their HID |
jbru | 0:43cdec802ecb | 49 | * service. |
jbru | 0:43cdec802ecb | 50 | */ |
jbru | 0:43cdec802ecb | 51 | void initializeHOGP(BLE &ble); |
jbru | 0:43cdec802ecb | 52 | |
jbru | 0:43cdec802ecb | 53 | #endif /* !BLE_HID_COMMON_H_ */ |