Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
blecommon.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 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 __BLE_COMMON_H__ 00018 #define __BLE_COMMON_H__ 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 00025 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs 00026 * @{ */ 00027 /* Generic UUIDs, applicable to all services */ 00028 enum { 00029 BLE_UUID_UNKNOWN = 0x0000, /**< Reserved UUID. */ 00030 BLE_UUID_SERVICE_PRIMARY = 0x2800, /**< Primary Service. */ 00031 BLE_UUID_SERVICE_SECONDARY = 0x2801, /**< Secondary Service. */ 00032 BLE_UUID_SERVICE_INCLUDE = 0x2802, /**< Include. */ 00033 BLE_UUID_CHARACTERISTIC = 0x2803, /**< Characteristic. */ 00034 BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP = 0x2900, /**< Characteristic Extended Properties Descriptor. */ 00035 BLE_UUID_DESCRIPTOR_CHAR_USER_DESC = 0x2901, /**< Characteristic User Description Descriptor. */ 00036 BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG = 0x2902, /**< Client Characteristic Configuration Descriptor. */ 00037 BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG = 0x2903, /**< Server Characteristic Configuration Descriptor. */ 00038 BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT = 0x2904, /**< Characteristic Presentation Format Descriptor. */ 00039 BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT = 0x2905, /**< Characteristic Aggregate Format Descriptor. */ 00040 00041 /* GATT specific UUIDs */ 00042 BLE_UUID_GATT = 0x1801, /**< Generic Attribute Profile. */ 00043 BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED = 0x2A05, /**< Service Changed Characteristic. */ 00044 00045 /* GAP specific UUIDs */ 00046 BLE_UUID_GAP = 0x1800, /**< Generic Access Profile. */ 00047 BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME = 0x2A00, /**< Device Name Characteristic. */ 00048 BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE = 0x2A01, /**< Appearance Characteristic. */ 00049 BLE_UUID_GAP_CHARACTERISTIC_PPF = 0x2A02, /**< Peripheral Privacy Flag Characteristic. */ 00050 BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR = 0x2A03, /**< Reconnection Address Characteristic. */ 00051 BLE_UUID_GAP_CHARACTERISTIC_PPCP = 0x2A04, /**< Peripheral Preferred Connection Parameters Characteristic. */ 00052 }; 00053 /** @} */ 00054 00055 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values 00056 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml 00057 * @{ */ 00058 enum { 00059 BLE_APPEARANCE_UNKNOWN = 0, /**< Unknown. */ 00060 BLE_APPEARANCE_GENERIC_PHONE = 64, /**< Generic Phone. */ 00061 BLE_APPEARANCE_GENERIC_COMPUTER = 128, /**< Generic Computer. */ 00062 BLE_APPEARANCE_GENERIC_WATCH = 192, /**< Generic Watch. */ 00063 BLE_APPEARANCE_WATCH_SPORTS_WATCH = 193, /**< Watch: Sports Watch. */ 00064 BLE_APPEARANCE_GENERIC_CLOCK = 256, /**< Generic Clock. */ 00065 BLE_APPEARANCE_GENERIC_DISPLAY = 320, /**< Generic Display. */ 00066 BLE_APPEARANCE_GENERIC_REMOTE_CONTROL = 384, /**< Generic Remote Control. */ 00067 BLE_APPEARANCE_GENERIC_EYE_GLASSES = 448, /**< Generic Eye-glasses. */ 00068 BLE_APPEARANCE_GENERIC_TAG = 512, /**< Generic Tag. */ 00069 BLE_APPEARANCE_GENERIC_KEYRING = 576, /**< Generic Keyring. */ 00070 BLE_APPEARANCE_GENERIC_MEDIA_PLAYER = 640, /**< Generic Media Player. */ 00071 BLE_APPEARANCE_GENERIC_BARCODE_SCANNER = 704, /**< Generic Barcode Scanner. */ 00072 BLE_APPEARANCE_GENERIC_THERMOMETER = 768, /**< Generic Thermometer. */ 00073 BLE_APPEARANCE_THERMOMETER_EAR = 769, /**< Thermometer: Ear. */ 00074 BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR = 832, /**< Generic Heart rate Sensor. */ 00075 BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT = 833, /**< Heart Rate Sensor: Heart Rate Belt. */ 00076 BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE = 896, /**< Generic Blood Pressure. */ 00077 BLE_APPEARANCE_BLOOD_PRESSURE_ARM = 897, /**< Blood Pressure: Arm. */ 00078 BLE_APPEARANCE_BLOOD_PRESSURE_WRIST = 898, /**< Blood Pressure: Wrist. */ 00079 BLE_APPEARANCE_GENERIC_HID = 960, /**< Human Interface Device (HID). */ 00080 BLE_APPEARANCE_HID_KEYBOARD = 961, /**< Keyboard (HID Subtype). */ 00081 BLE_APPEARANCE_HID_MOUSE = 962, /**< Mouse (HID Subtype). */ 00082 BLE_APPEARANCE_HID_JOYSTICK = 963, /**< Joystiq (HID Subtype). */ 00083 BLE_APPEARANCE_HID_GAMEPAD = 964, /**< Gamepad (HID Subtype). */ 00084 BLE_APPEARANCE_HID_DIGITIZERSUBTYPE = 965, /**< Digitizer Tablet (HID Subtype). */ 00085 BLE_APPEARANCE_HID_CARD_READER = 966, /**< Card Reader (HID Subtype). */ 00086 BLE_APPEARANCE_HID_DIGITAL_PEN = 967, /**< Digital Pen (HID Subtype). */ 00087 BLE_APPEARANCE_HID_BARCODE = 968, /**< Barcode Scanner (HID Subtype). */ 00088 BLE_APPEARANCE_GENERIC_GLUCOSE_METER = 1024, /**< Generic Glucose Meter. */ 00089 BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR = 1088, /**< Generic Running Walking Sensor. */ 00090 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE = 1089, /**< Running Walking Sensor: In-Shoe. */ 00091 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE = 1090, /**< Running Walking Sensor: On-Shoe. */ 00092 BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP = 1091, /**< Running Walking Sensor: On-Hip. */ 00093 BLE_APPEARANCE_GENERIC_CYCLING = 1152, /**< Generic Cycling. */ 00094 BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER = 1153, /**< Cycling: Cycling Computer. */ 00095 BLE_APPEARANCE_CYCLING_SPEED_SENSOR = 1154, /**< Cycling: Speed Sensor. */ 00096 BLE_APPEARANCE_CYCLING_CADENCE_SENSOR = 1155, /**< Cycling: Cadence Sensor. */ 00097 BLE_APPEARANCE_CYCLING_POWER_SENSOR = 1156, /**< Cycling: Power Sensor. */ 00098 BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR = 1157, /**< Cycling: Speed and Cadence Sensor. */ 00099 BLE_APPEARANCE_GENERIC_PULSE_OXIMETER = 3136, /**< Generic Pulse Oximeter. */ 00100 BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP = 3137, /**< Fingertip (Pulse Oximeter subtype). */ 00101 BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN = 3138, /**< Wrist Worn(Pulse Oximeter subtype). */ 00102 BLE_APPEARANCE_GENERIC_WEIGHT_SCALE = 3200, /**< Generic Weight Scale. */ 00103 BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT = 5184, /**< Generic Outdoor Sports Activity. */ 00104 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP = 5185, /**< Location Display Device (Outdoor Sports Activity subtype). */ 00105 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP = 5186, /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ 00106 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD = 5187, /**< Location Pod (Outdoor Sports Activity subtype). */ 00107 BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD = 5188, /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ 00108 }; 00109 /** @} */ 00110 00111 /**************************************************************************/ 00112 /*! 00113 \brief Error codes for the BLE API 00114 */ 00115 /**************************************************************************/ 00116 enum ble_error_t { 00117 BLE_ERROR_NONE = 0, /**< No error */ 00118 BLE_ERROR_BUFFER_OVERFLOW = 1, /**< The requested action would cause a buffer overflow and has been aborted */ 00119 BLE_ERROR_NOT_IMPLEMENTED = 2, /**< Requested a feature that isn't yet implement or isn't supported by the target HW */ 00120 BLE_ERROR_PARAM_OUT_OF_RANGE = 3, /**< One of the supplied parameters is outside the valid range */ 00121 BLE_ERROR_INVALID_PARAM = 4, /**< One of the supplied parameters is invalid */ 00122 BLE_STACK_BUSY = 5, /**< The stack is busy */ 00123 BLE_ERROR_INVALID_STATE = 6, /**< Invalid state. */ 00124 BLE_ERROR_NO_MEM = 7, /**< Out of Memory */ 00125 BLE_ERROR_OPERATION_NOT_PERMITTED = 8, 00126 BLE_ERROR_UNSPECIFIED = 9, /**< Unknown error. */ 00127 }; 00128 00129 /** @brief Default MTU size. */ 00130 static const unsigned BLE_GATT_MTU_SIZE_DEFAULT = 23; 00131 00132 enum HVXType_t { 00133 BLE_HVX_NOTIFICATION = 0x01, /**< Handle Value Notification. */ 00134 BLE_HVX_INDICATION = 0x02, /**< Handle Value Indication. */ 00135 }; 00136 00137 #ifdef __cplusplus 00138 } 00139 #endif 00140 00141 #endif // ifndef __BLE_COMMON_H__
Generated on Sat Jul 16 2022 17:07:02 by
