back up of work during May 2019

Dependencies:   microbit

Committer:
tht216
Date:
Wed Jun 05 15:21:14 2019 +0000
Branch:
class_implmentation
Revision:
6:f372773ad32f
Parent:
1:c840c2b6f490
TODO:; 1. multi keypresses; 2. integration

Who changed what in which revision?

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