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@4:8fb54802ba2b, 2016-04-03 (annotated)
- Committer:
- Jean-Philippe Brucker
- Date:
- Sun Apr 03 22:06:47 2016 +0100
- Revision:
- 4:8fb54802ba2b
- Parent:
- 1:0a97297327eb
v0.4 - small change to enable Win10 support
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jean-Philippe Brucker |
1:0a97297327eb | 1 | /* mbed Microcontroller Library |
Jean-Philippe Brucker |
1:0a97297327eb | 2 | * Copyright (c) 2015 ARM Limited |
Jean-Philippe Brucker |
1:0a97297327eb | 3 | * |
Jean-Philippe Brucker |
1:0a97297327eb | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Jean-Philippe Brucker |
1:0a97297327eb | 5 | * you may not use this file except in compliance with the License. |
Jean-Philippe Brucker |
1:0a97297327eb | 6 | * You may obtain a copy of the License at |
Jean-Philippe Brucker |
1:0a97297327eb | 7 | * |
Jean-Philippe Brucker |
1:0a97297327eb | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jean-Philippe Brucker |
1:0a97297327eb | 9 | * |
Jean-Philippe Brucker |
1:0a97297327eb | 10 | * Unless required by applicable law or agreed to in writing, software |
Jean-Philippe Brucker |
1:0a97297327eb | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Jean-Philippe Brucker |
1:0a97297327eb | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Jean-Philippe Brucker |
1:0a97297327eb | 13 | * See the License for the specific language governing permissions and |
Jean-Philippe Brucker |
1:0a97297327eb | 14 | * limitations under the License. |
Jean-Philippe Brucker |
1:0a97297327eb | 15 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 16 | |
Jean-Philippe Brucker |
1:0a97297327eb | 17 | #ifndef HID_EXAMPLES_COMMON_H_ |
Jean-Philippe Brucker |
1:0a97297327eb | 18 | #define HID_EXAMPLES_COMMON_H_ |
Jean-Philippe Brucker |
1:0a97297327eb | 19 | |
Jean-Philippe Brucker |
1:0a97297327eb | 20 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 21 | * Functions and configuration common to all HID demos |
Jean-Philippe Brucker |
1:0a97297327eb | 22 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 23 | |
Jean-Philippe Brucker |
1:0a97297327eb | 24 | #include "ble/BLE.h" |
Jean-Philippe Brucker |
1:0a97297327eb | 25 | |
Jean-Philippe Brucker |
1:0a97297327eb | 26 | #include "HIDServiceBase.h" |
Jean-Philippe Brucker |
1:0a97297327eb | 27 | |
Jean-Philippe Brucker |
1:0a97297327eb | 28 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 29 | * IO capabilities of the device. During development, you most likely want "JustWorks", which means |
Jean-Philippe Brucker |
1:0a97297327eb | 30 | * no IO capabilities. |
Jean-Philippe Brucker |
1:0a97297327eb | 31 | * It is also possible to use IO_CAPS_DISPLAY_ONLY to generate and show a pincode on the serial |
Jean-Philippe Brucker |
1:0a97297327eb | 32 | * output. |
Jean-Philippe Brucker |
1:0a97297327eb | 33 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 34 | #ifndef HID_SECURITY_IOCAPS |
Jean-Philippe Brucker |
1:0a97297327eb | 35 | #define HID_SECURITY_IOCAPS (SecurityManager::IO_CAPS_NONE) |
Jean-Philippe Brucker |
1:0a97297327eb | 36 | #endif |
Jean-Philippe Brucker |
1:0a97297327eb | 37 | |
Jean-Philippe Brucker |
1:0a97297327eb | 38 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 39 | * Security level. MITM disabled forces "Just Works". If you require MITM, HID_SECURITY_IOCAPS must |
Jean-Philippe Brucker |
1:0a97297327eb | 40 | * be at least IO_CAPS_DISPLAY_ONLY. |
Jean-Philippe Brucker |
1:0a97297327eb | 41 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 42 | #ifndef HID_SECURITY_REQUIRE_MITM |
Jean-Philippe Brucker |
1:0a97297327eb | 43 | #define HID_SECURITY_REQUIRE_MITM false |
Jean-Philippe Brucker |
1:0a97297327eb | 44 | #endif |
Jean-Philippe Brucker |
1:0a97297327eb | 45 | |
Jean-Philippe Brucker |
1:0a97297327eb | 46 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 47 | * Disable debug messages by setting NDEBUG |
Jean-Philippe Brucker |
1:0a97297327eb | 48 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 49 | #ifndef NDEBUG |
Jean-Philippe Brucker |
1:0a97297327eb | 50 | #define HID_DEBUG(...) printf(__VA_ARGS__) |
Jean-Philippe Brucker |
1:0a97297327eb | 51 | #else |
Jean-Philippe Brucker |
1:0a97297327eb | 52 | #define HID_DEBUG(...) |
Jean-Philippe Brucker |
1:0a97297327eb | 53 | #endif |
Jean-Philippe Brucker |
1:0a97297327eb | 54 | |
Jean-Philippe Brucker |
1:0a97297327eb | 55 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 56 | * Initialize security manager: set callback functions and required security level |
Jean-Philippe Brucker |
1:0a97297327eb | 57 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 58 | void initializeSecurity(BLE &ble); |
Jean-Philippe Brucker |
1:0a97297327eb | 59 | |
Jean-Philippe Brucker |
1:0a97297327eb | 60 | /** |
Jean-Philippe Brucker |
1:0a97297327eb | 61 | * - Initialize auxiliary services required by the HID-over-GATT Profile. |
Jean-Philippe Brucker |
1:0a97297327eb | 62 | * - Initialize common Gap advertisement. |
Jean-Philippe Brucker |
1:0a97297327eb | 63 | * |
Jean-Philippe Brucker |
1:0a97297327eb | 64 | * Demos only have to set a custom device name and appearance, and their HID |
Jean-Philippe Brucker |
1:0a97297327eb | 65 | * service. |
Jean-Philippe Brucker |
1:0a97297327eb | 66 | */ |
Jean-Philippe Brucker |
1:0a97297327eb | 67 | void initializeHOGP(BLE &ble); |
Jean-Philippe Brucker |
1:0a97297327eb | 68 | |
Jean-Philippe Brucker |
1:0a97297327eb | 69 | #endif /* !BLE_HID_COMMON_H_ */ |