KeyboardStream example from BLE_HID

Dependencies:   BLE_API BLE_HID mbed nRF51822

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers examples_common.h Source File

examples_common.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2015 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef HID_EXAMPLES_COMMON_H_
00018 #define HID_EXAMPLES_COMMON_H_
00019 
00020 /**
00021  * Functions and configuration common to all HID demos
00022  */
00023 
00024 #include "ble/BLE.h"
00025 
00026 #include "HIDServiceBase.h"
00027 
00028 /**
00029  * IO capabilities of the device. During development, you most likely want "JustWorks", which means
00030  * no IO capabilities.
00031  * It is also possible to use IO_CAPS_DISPLAY_ONLY to generate and show a pincode on the serial
00032  * output.
00033  */
00034 #ifndef HID_SECURITY_IOCAPS
00035 #define HID_SECURITY_IOCAPS (SecurityManager::IO_CAPS_NONE)
00036 #endif
00037 
00038 /**
00039  * Security level. MITM disabled forces "Just Works". If you require MITM, HID_SECURITY_IOCAPS must
00040  * be at least IO_CAPS_DISPLAY_ONLY.
00041  */
00042 #ifndef HID_SECURITY_REQUIRE_MITM
00043 #define HID_SECURITY_REQUIRE_MITM false
00044 #endif
00045 
00046 /**
00047  * Disable debug messages by setting NDEBUG
00048  */
00049 #ifndef NDEBUG
00050 #define HID_DEBUG(...) printf(__VA_ARGS__)
00051 #else
00052 #define HID_DEBUG(...)
00053 #endif
00054 
00055 /**
00056  * Initialize security manager: set callback functions and required security level
00057  */
00058 void initializeSecurity(BLE &ble);
00059 
00060 /**
00061  * - Initialize auxiliary services required by the HID-over-GATT Profile.
00062  * - Initialize common Gap advertisement.
00063  *
00064  * Demos only have to set a custom device name and appearance, and their HID
00065  * service.
00066  */
00067 void initializeHOGP(BLE &ble);
00068 
00069 #endif /* !BLE_HID_COMMON_H_ */