Dependencies:   microbit

Committer:
xx316
Date:
Wed Jun 12 15:21:01 2019 +0000
Revision:
1:032b96b05e51
for demo on Thursday;

Who changed what in which revision?

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