BLE HID sample

Dependencies:   BLE_API BLE_HID mbed nRF51822

Committer:
YuuichiAkagawa
Date:
Sat Feb 27 05:08:02 2016 +0000
Revision:
0:3435302551b3
initial commit

Who changed what in which revision?

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