WallbotBLE default code

Dependencies:   mbed

Fork of BLE_WallbotBLE_Challenge by Wallbot BLE Developer

Committer:
jksoft
Date:
Fri Feb 20 00:07:48 2015 +0000
Revision:
2:3c406d25860e
Parent:
0:76dfa9657d9d
Wallbot BLE??????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:76dfa9657d9d 1 /* mbed Microcontroller Library
jksoft 0:76dfa9657d9d 2 * Copyright (c) 2006-2013 ARM Limited
jksoft 0:76dfa9657d9d 3 *
jksoft 0:76dfa9657d9d 4 * Licensed under the Apache License, Version 2.0 (the "License");
jksoft 0:76dfa9657d9d 5 * you may not use this file except in compliance with the License.
jksoft 0:76dfa9657d9d 6 * You may obtain a copy of the License at
jksoft 0:76dfa9657d9d 7 *
jksoft 0:76dfa9657d9d 8 * http://www.apache.org/licenses/LICENSE-2.0
jksoft 0:76dfa9657d9d 9 *
jksoft 0:76dfa9657d9d 10 * Unless required by applicable law or agreed to in writing, software
jksoft 0:76dfa9657d9d 11 * distributed under the License is distributed on an "AS IS" BASIS,
jksoft 0:76dfa9657d9d 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
jksoft 0:76dfa9657d9d 13 * See the License for the specific language governing permissions and
jksoft 0:76dfa9657d9d 14 * limitations under the License.
jksoft 0:76dfa9657d9d 15 */
jksoft 0:76dfa9657d9d 16
jksoft 0:76dfa9657d9d 17 #ifndef __BLE_COMMON_H__
jksoft 0:76dfa9657d9d 18 #define __BLE_COMMON_H__
jksoft 0:76dfa9657d9d 19
jksoft 0:76dfa9657d9d 20 #define NRF51
jksoft 0:76dfa9657d9d 21 #define DEBUG_NRF_USER
jksoft 0:76dfa9657d9d 22 #define BLE_STACK_SUPPORT_REQD
jksoft 0:76dfa9657d9d 23 #define BOARD_PCA10001
jksoft 0:76dfa9657d9d 24
jksoft 0:76dfa9657d9d 25 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 26 extern "C" {
jksoft 0:76dfa9657d9d 27 #endif
jksoft 0:76dfa9657d9d 28
jksoft 0:76dfa9657d9d 29 #include <stdint.h>
jksoft 0:76dfa9657d9d 30
jksoft 0:76dfa9657d9d 31 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs
jksoft 0:76dfa9657d9d 32 * @{ */
jksoft 0:76dfa9657d9d 33 /* Generic UUIDs, applicable to all services */
jksoft 0:76dfa9657d9d 34 enum {
jksoft 0:76dfa9657d9d 35 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */
jksoft 0:76dfa9657d9d 36 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */
jksoft 0:76dfa9657d9d 37 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */
jksoft 0:76dfa9657d9d 38 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */
jksoft 0:76dfa9657d9d 39 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */
jksoft 0:76dfa9657d9d 40 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */
jksoft 0:76dfa9657d9d 41 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */
jksoft 0:76dfa9657d9d 42 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */
jksoft 0:76dfa9657d9d 43 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */
jksoft 0:76dfa9657d9d 44 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */
jksoft 0:76dfa9657d9d 45 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */
jksoft 0:76dfa9657d9d 46
jksoft 0:76dfa9657d9d 47 /* GATT specific UUIDs */
jksoft 0:76dfa9657d9d 48 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */
jksoft 0:76dfa9657d9d 49 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */
jksoft 0:76dfa9657d9d 50
jksoft 0:76dfa9657d9d 51 /* GAP specific UUIDs */
jksoft 0:76dfa9657d9d 52 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */
jksoft 0:76dfa9657d9d 53 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */
jksoft 0:76dfa9657d9d 54 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */
jksoft 0:76dfa9657d9d 55 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */
jksoft 0:76dfa9657d9d 56 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */
jksoft 0:76dfa9657d9d 57 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */
jksoft 0:76dfa9657d9d 58 };
jksoft 0:76dfa9657d9d 59 /** @} */
jksoft 0:76dfa9657d9d 60
jksoft 0:76dfa9657d9d 61 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values
jksoft 0:76dfa9657d9d 62 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
jksoft 0:76dfa9657d9d 63 * @{ */
jksoft 0:76dfa9657d9d 64 enum {
jksoft 0:76dfa9657d9d 65 BLE_APPEARANCE_UNKNOWN = 0, /**< Unknown. */
jksoft 0:76dfa9657d9d 66 BLE_APPEARANCE_GENERIC_PHONE = 64, /**< Generic Phone. */
jksoft 0:76dfa9657d9d 67 BLE_APPEARANCE_GENERIC_COMPUTER = 128, /**< Generic Computer. */
jksoft 0:76dfa9657d9d 68 BLE_APPEARANCE_GENERIC_WATCH = 192, /**< Generic Watch. */
jksoft 0:76dfa9657d9d 69 BLE_APPEARANCE_WATCH_SPORTS_WATCH = 193, /**< Watch: Sports Watch. */
jksoft 0:76dfa9657d9d 70 BLE_APPEARANCE_GENERIC_CLOCK = 256, /**< Generic Clock. */
jksoft 0:76dfa9657d9d 71 BLE_APPEARANCE_GENERIC_DISPLAY = 320, /**< Generic Display. */
jksoft 0:76dfa9657d9d 72 BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384, /**< Generic Remote Control. */
jksoft 0:76dfa9657d9d 73 BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448, /**< Generic Eye-glasses. */
jksoft 0:76dfa9657d9d 74 BLE_APPEARANCE_GENERIC_TAG = 512, /**< Generic Tag. */
jksoft 0:76dfa9657d9d 75 BLE_APPEARANCE_GENERIC_KEYRING = 576, /**< Generic Keyring. */
jksoft 0:76dfa9657d9d 76 BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640, /**< Generic Media Player. */
jksoft 0:76dfa9657d9d 77 BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner. */
jksoft 0:76dfa9657d9d 78 BLE_APPEARANCE_GENERIC_THERMOMETER = 768, /**< Generic Thermometer. */
jksoft 0:76dfa9657d9d 79 BLE_APPEARANCE_THERMOMETER_EAR = 769, /**< Thermometer: Ear. */
jksoft 0:76dfa9657d9d 80 BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart rate Sensor. */
jksoft 0:76dfa9657d9d 81 BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Heart Rate Sensor: Heart Rate Belt. */
jksoft 0:76dfa9657d9d 82 BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure. */
jksoft 0:76dfa9657d9d 83 BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897, /**< Blood Pressure: Arm. */
jksoft 0:76dfa9657d9d 84 BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, /**< Blood Pressure: Wrist. */
jksoft 0:76dfa9657d9d 85 BLE_APPEARANCE_GENERIC_HID = 960, /**< Human Interface Device (HID). */
jksoft 0:76dfa9657d9d 86 BLE_APPEARANCE_HID_KEYBOARD = 961, /**< Keyboard (HID Subtype). */
jksoft 0:76dfa9657d9d 87 BLE_APPEARANCE_HID_MOUSE = 962, /**< Mouse (HID Subtype). */
jksoft 0:76dfa9657d9d 88 BLE_APPEARANCE_HID_JOYSTICK = 963, /**< Joystiq (HID Subtype). */
jksoft 0:76dfa9657d9d 89 BLE_APPEARANCE_HID_GAMEPAD = 964, /**< Gamepad (HID Subtype). */
jksoft 0:76dfa9657d9d 90 BLE_APPEARANCE_HID_DIGITIZERSUBTYPE = 965, /**< Digitizer Tablet (HID Subtype). */
jksoft 0:76dfa9657d9d 91 BLE_APPEARANCE_HID_CARD_READER = 966, /**< Card Reader (HID Subtype). */
jksoft 0:76dfa9657d9d 92 BLE_APPEARANCE_HID_DIGITAL_PEN = 967, /**< Digital Pen (HID Subtype). */
jksoft 0:76dfa9657d9d 93 BLE_APPEARANCE_HID_BARCODE = 968, /**< Barcode Scanner (HID Subtype). */
jksoft 0:76dfa9657d9d 94 BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter. */
jksoft 0:76dfa9657d9d 95 BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running Walking Sensor. */
jksoft 0:76dfa9657d9d 96 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< Running Walking Sensor: In-Shoe. */
jksoft 0:76dfa9657d9d 97 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090, /**< Running Walking Sensor: On-Shoe. */
jksoft 0:76dfa9657d9d 98 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091, /**< Running Walking Sensor: On-Hip. */
jksoft 0:76dfa9657d9d 99 BLE_APPEARANCE_GENERIC_CYCLING = 1152, /**< Generic Cycling. */
jksoft 0:76dfa9657d9d 100 BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER = 1153, /**< Cycling: Cycling Computer. */
jksoft 0:76dfa9657d9d 101 BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154, /**< Cycling: Speed Sensor. */
jksoft 0:76dfa9657d9d 102 BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155, /**< Cycling: Cadence Sensor. */
jksoft 0:76dfa9657d9d 103 BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156, /**< Cycling: Power Sensor. */
jksoft 0:76dfa9657d9d 104 BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR = 1157, /**< Cycling: Speed and Cadence Sensor. */
jksoft 0:76dfa9657d9d 105 BLE_APPEARANCE_GENERIC_PULSE_OXIMETER = 3136, /**< Generic Pulse Oximeter. */
jksoft 0:76dfa9657d9d 106 BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip (Pulse Oximeter subtype). */
jksoft 0:76dfa9657d9d 107 BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn(Pulse Oximeter subtype). */
jksoft 0:76dfa9657d9d 108 BLE_APPEARANCE_GENERIC_WEIGHT_SCALE = 3200, /**< Generic Weight Scale. */
jksoft 0:76dfa9657d9d 109 BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT = 5184, /**< Generic Outdoor Sports Activity. */
jksoft 0:76dfa9657d9d 110 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP = 5185, /**< Location Display Device (Outdoor Sports Activity subtype). */
jksoft 0:76dfa9657d9d 111 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP = 5186, /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */
jksoft 0:76dfa9657d9d 112 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD = 5187, /**< Location Pod (Outdoor Sports Activity subtype). */
jksoft 0:76dfa9657d9d 113 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD = 5188, /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */
jksoft 0:76dfa9657d9d 114 };
jksoft 0:76dfa9657d9d 115 /** @} */
jksoft 0:76dfa9657d9d 116
jksoft 0:76dfa9657d9d 117 /**************************************************************************/
jksoft 0:76dfa9657d9d 118 /*!
jksoft 0:76dfa9657d9d 119 \brief Error codes for the BLE API
jksoft 0:76dfa9657d9d 120 */
jksoft 0:76dfa9657d9d 121 /**************************************************************************/
jksoft 0:76dfa9657d9d 122 typedef enum ble_error_e
jksoft 0:76dfa9657d9d 123 {
jksoft 0:76dfa9657d9d 124 BLE_ERROR_NONE = 0, /**< No error */
jksoft 0:76dfa9657d9d 125 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted */
jksoft 0:76dfa9657d9d 126 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implement or isn't supported by the target HW */
jksoft 0:76dfa9657d9d 127 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range */
jksoft 0:76dfa9657d9d 128 BLE_STACK_BUSY = 4, /**< The stack is busy */
jksoft 0:76dfa9657d9d 129 } ble_error_t;
jksoft 0:76dfa9657d9d 130
jksoft 0:76dfa9657d9d 131 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 132 }
jksoft 0:76dfa9657d9d 133 #endif
jksoft 0:76dfa9657d9d 134
jksoft 0:76dfa9657d9d 135 #endif // ifndef __BLE_COMMON_H__