1 /* 2 * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 **************************************************************************************** 18 * 19 * @file sonata_att.h 20 * 21 * @brief Header file - ATT. 22 * 23 **************************************************************************************** 24 */ 25 26 #ifndef SONATA_ATT_H_ 27 #define SONATA_ATT_H_ 28 29 /** 30 **************************************************************************************** 31 * @addtogroup ATT Attribute Protocol 32 * @ingroup HOST 33 * @brief Attribute Protocol. 34 * 35 * The ATT block contains the procedures for discovering, reading, writing 36 * and indicating attributes to peer device . It also defines a number of items 37 * that caters to the security aspect of the block as access to some information 38 * may require both authorization and an authenticated and encrypted physical 39 * link before an attribute can be read or written 40 * 41 * @{ 42 * 43 **************************************************************************************** 44 */ 45 46 /* 47 * INCLUDE FILES 48 **************************************************************************************** 49 */ 50 #include <stdint.h> 51 52 /* 53 * DEFINES 54 **************************************************************************************** 55 */ 56 57 /// Macro used to convert CPU integer define to LSB first 16-bits UUID 58 #define SONATA_ATT_UUID_16(uuid) (uuid) 59 60 /// Invalid attribute handle 61 #define SONATA_ATT_INVALID_HDL (0x0000) 62 /// Invalid attribute idx (used for profiles) 63 #define SONATA_ATT_INVALID_IDX (0xff) 64 65 #define SONATA_ATT_1ST_REQ_START_HDL 0x0001 66 #define SONATA_ATT_1ST_REQ_END_HDL 0xFFFF 67 68 /// Maximum possible attribute handle 69 #define SONATA_ATT_MAX_ATTR_HDL SONATA_ATT_1ST_REQ_END_HDL 70 71 /// Offset of value in signed PDU 72 #define SONATA_ATT_SIGNED_PDU_VAL_OFFSET 0x03 73 74 /// Attribute Features 75 #define SONATA_ATT_SERVER_CONFIG 0x0001 76 #define SONATA_ATT_SERVICE_DISC 0x0002 77 #define SONATA_ATT_RELATIONSHIP_DISC 0x0004 78 #define SONATA_ATT_CHAR_DISC 0x0008 79 #define SONATA_ATT_CHAR_DESC_DISC 0x0010 80 #define SONATA_ATT_RD_CHAR_VALUE 0x0020 81 #define SONATA_ATT_WR_CHAR_VALUE 0x0040 82 #define SONATA_ATT_NOTIF_CHAR_VALUE 0x0080 83 #define SONATA_ATT_IND_CHAR_VALUE 0x0100 84 #define SONATA_ATT_RD_CHAR_DESC 0x0200 85 #define SONATA_ATT_WR_CHAR_DESC 0x0400 86 87 /// Length, number, offset defines 88 #define SONATA_ATT_SVC_VALUE_MAX_LEN 0x0030 89 #define SONATA_ATT_CHAR_NAME_MAX_LEN 0x0030 90 #define SONATA_ATT_UUID_16_LEN 0x0002 91 #define SONATA_ATT_UUID_32_LEN 0x0004 92 #define SONATA_ATT_UUID_128_LEN 0x0010 93 94 /// offset - l2cap header and ATT code 95 #define SONATA_ATT_PDU_DATA_OFFSET 0x05 96 97 /// Characteristic Properties Bit 98 #define SONATA_ATT_CHAR_PROP_BCAST 0x01 99 #define SONATA_ATT_CHAR_PROP_RD 0x02 100 #define SONATA_ATT_CHAR_PROP_WR_NO_RESP 0x04 101 #define SONATA_ATT_CHAR_PROP_WR 0x08 102 #define SONATA_ATT_CHAR_PROP_NTF 0x10 103 #define SONATA_ATT_CHAR_PROP_IND 0x20 104 #define SONATA_ATT_CHAR_PROP_AUTH 0x40 105 #define SONATA_ATT_CHAR_PROP_EXT_PROP 0x80 106 /// Invalid Attribute Handle 107 #define SONATA_ATT_INVALID_SEARCH_HANDLE 0x0000 108 #define SONATA_ATT_INVALID_HANDLE 0x0000 109 /// Read Information Request 110 #define SONATA_ATT_UUID_FILTER_0 0x00 111 #define SONATA_ATT_UUID_FILTER_2 0x02 112 #define SONATA_ATT_UUID_FILTER_16 0x10 113 /// Read Information Response 114 #define SONATA_ATT_FORMAT_LEN 0x0001 115 #define SONATA_ATT_FORMAT_16BIT_UUID 0x01 116 #define SONATA_ATT_FORMAT_128BIT_UUID 0x02 117 /// For No fix length PDU 118 #define SONATA_ATT_HANDLE_LEN 0x0002 119 #define SONATA_ATT_EACHLEN_LEN 0x0001 120 #define SONATA_ATT_PROP_LEN 0x0001 121 #define SONATA_ATT_CODE_LEN 0x0001 122 #define SONATA_ATT_CODE_AND_DATA_LEN 0x0002 123 #define SONATA_ATT_CODE_AND_HANDLE_LEN 0x0003 124 #define SONATA_ATT_CODE_AND_HANDLE_LEN_AND_OFFSET 0x0005 125 #define SONATA_ATT_SIGNATURE_LEN 0x0C 126 127 /// extended characteristics 128 #define SONATA_ATT_EXT_RELIABLE_WRITE 0x0001 129 #define SONATA_ATT_EXT_WRITABLE_AUX 0x0002 130 #define SONATA_ATT_EXT_RFU 0xFFFC 131 132 /// PDU size for error response 133 #define SONATA_ATT_ERROR_RESP_LEN 0x05 134 135 /// Offset of value in signed PDU 136 #define SONATA_ATT_SIGNED_PDU_VAL_OFFSET 0x03 137 138 /// Attribute operation code - Method (bit 5 - 0) 139 #define SONATA_ATT_OPCODE_METHOD_MASK 0x3F 140 #define SONATA_ATT_OPCODE_METHOD_LSB 0 141 /// Attribute operation code - Command Flag (bit 6) 142 #define SONATA_ATT_OPCODE_CMD_FLAG_BIT 0x40 143 #define SONATA_ATT_OPCODE_CMD_FLAG_POS 6 144 /// Attribute operation code - Authentication Signature Flag (bit 7) 145 #define SONATA_ATT_OPCODE_AUTH_SIGNATURE_FLAG_BIT 0x80 146 #define SONATA_ATT_OPCODE_AUTH_SIGNATURE_FLAG_POS 7 147 148 #define SONATA_ATT_BT_UUID_128 {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \ 149 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} 150 151 /// MAC length 152 #define SONATA_ATT_SIGN_MAC_LEN (8) 153 /// SignCounter length 154 #define SONATA_ATT_SIGN_COUNTER_LEN (4) 155 /// Signature length 156 #define SONATA_ATT_SIGN_LEN (SONATA_ATT_SIGN_MAC_LEN + SONATA_ATT_SIGN_COUNTER_LEN) 157 158 /// This value ensure to have up to 128 client feature supported would be sufficient for several years. 159 #define SONATA_ATT_MAX_CLI_FEAT_LEN 16 160 161 /* Attribute Specification Defines */ 162 163 /// Common 16-bit Universal Unique Identifier 164 enum { 165 SONATA_ATT_INVALID_UUID = SONATA_ATT_UUID_16(0x0000), 166 /*----------------- SERVICES ---------------------*/ 167 /// Generic Access Profile 168 SONATA_ATT_SVC_GENERIC_ACCESS = SONATA_ATT_UUID_16(0x1800), 169 /// Attribute Profile 170 SONATA_ATT_SVC_GENERIC_ATTRIBUTE = SONATA_ATT_UUID_16(0x1801), 171 /// Immediate alert Service 172 SONATA_ATT_SVC_IMMEDIATE_ALERT = SONATA_ATT_UUID_16(0x1802), 173 /// Link Loss Service 174 SONATA_ATT_SVC_LINK_LOSS = SONATA_ATT_UUID_16(0x1803), 175 /// Tx Power Service 176 SONATA_ATT_SVC_TX_POWER = SONATA_ATT_UUID_16(0x1804), 177 /// Current Time Service Service 178 SONATA_ATT_SVC_CURRENT_TIME = SONATA_ATT_UUID_16(0x1805), 179 /// Reference Time Update Service 180 SONATA_ATT_SVC_REF_TIME_UPDATE = SONATA_ATT_UUID_16(0x1806), 181 /// Next DST Change Service 182 SONATA_ATT_SVC_NEXT_DST_CHANGE = SONATA_ATT_UUID_16(0x1807), 183 /// Glucose Service 184 SONATA_ATT_SVC_GLUCOSE = SONATA_ATT_UUID_16(0x1808), 185 /// Health Thermometer Service 186 SONATA_ATT_SVC_HEALTH_THERMOM = SONATA_ATT_UUID_16(0x1809), 187 /// Device Information Service 188 SONATA_ATT_SVC_DEVICE_INFO = SONATA_ATT_UUID_16(0x180A), 189 /// Heart Rate Service 190 SONATA_ATT_SVC_HEART_RATE = SONATA_ATT_UUID_16(0x180D), 191 /// Phone Alert Status Service 192 SONATA_ATT_SVC_PHONE_ALERT_STATUS = SONATA_ATT_UUID_16(0x180E), 193 /// Battery Service 194 SONATA_ATT_SVC_BATTERY_SERVICE = SONATA_ATT_UUID_16(0x180F), 195 /// Blood Pressure Service 196 SONATA_ATT_SVC_BLOOD_PRESSURE = SONATA_ATT_UUID_16(0x1810), 197 /// Alert Notification Service 198 SONATA_ATT_SVC_ALERT_NTF = SONATA_ATT_UUID_16(0x1811), 199 /// HID Service 200 SONATA_ATT_SVC_HID = SONATA_ATT_UUID_16(0x1812), 201 /// Scan Parameters Service 202 SONATA_ATT_SVC_SCAN_PARAMETERS = SONATA_ATT_UUID_16(0x1813), 203 /// Running Speed and Cadence Service 204 SONATA_ATT_SVC_RUNNING_SPEED_CADENCE = SONATA_ATT_UUID_16(0x1814), 205 /// Cycling Speed and Cadence Service 206 SONATA_ATT_SVC_CYCLING_SPEED_CADENCE = SONATA_ATT_UUID_16(0x1816), 207 /// Cycling Power Service 208 SONATA_ATT_SVC_CYCLING_POWER = SONATA_ATT_UUID_16(0x1818), 209 /// Location and Navigation Service 210 SONATA_ATT_SVC_LOCATION_AND_NAVIGATION = SONATA_ATT_UUID_16(0x1819), 211 /// Environmental Sensing Service 212 SONATA_ATT_SVC_ENVIRONMENTAL_SENSING = SONATA_ATT_UUID_16(0x181A), 213 /// Body Composition Service 214 SONATA_ATT_SVC_BODY_COMPOSITION = SONATA_ATT_UUID_16(0x181B), 215 /// User Data Service 216 SONATA_ATT_SVC_USER_DATA = SONATA_ATT_UUID_16(0x181C), 217 /// Weight Scale Service 218 SONATA_ATT_SVC_WEIGHT_SCALE = SONATA_ATT_UUID_16(0x181D), 219 /// Bond Management Service 220 SONATA_ATT_SVC_BOND_MANAGEMENT = SONATA_ATT_UUID_16(0x181E), 221 /// Continuous Glucose Monitoring Service 222 SONATA_ATT_SVC_CONTINUOUS_GLUCOSE_MONITORING = SONATA_ATT_UUID_16(0x181F), 223 /// Internet Protocol Support Service 224 SONATA_ATT_SVC_IP_SUPPORT = SONATA_ATT_UUID_16(0x1820), 225 /// Indoor Positioning Service 226 SONATA_ATT_SVC_INDOOR_POSITIONING = SONATA_ATT_UUID_16(0x1821), 227 /// Pulse Oximeter Service 228 SONATA_ATT_SVC_PULSE_OXIMETER = SONATA_ATT_UUID_16(0x1822), 229 /// HTTP Proxy Service 230 SONATA_ATT_SVC_HTTP_PROXY = SONATA_ATT_UUID_16(0x1823), 231 /// Transport Discovery Service 232 SONATA_ATT_SVC_TRANSPORT_DISCOVERY = SONATA_ATT_UUID_16(0x1824), 233 /// Object Transfer Service 234 SONATA_ATT_SVC_OBJECT_TRANSFER = SONATA_ATT_UUID_16(0x1825), 235 /// Mesh Provisioning Service 236 SONATA_ATT_SVC_MESH_PROVISIONING = SONATA_ATT_UUID_16(0x1827), 237 /// Mesh Proxy Service 238 SONATA_ATT_SVC_MESH_PROXY = SONATA_ATT_UUID_16(0x1828), 239 /// OTA Service 240 SONATA_ATT_SVC_OTA = SONATA_ATT_UUID_16(0x1850), 241 242 /*------------------- UNITS ---------------------*/ 243 /// No defined unit 244 SONATA_ATT_UNIT_UNITLESS = SONATA_ATT_UUID_16(0x2700), 245 /// Length Unit - Metre 246 SONATA_ATT_UNIT_METRE = SONATA_ATT_UUID_16(0x2701), 247 /// Mass unit - Kilogram 248 SONATA_ATT_UNIT_KG = SONATA_ATT_UUID_16(0x2702), 249 /// Time unit - second 250 SONATA_ATT_UNIT_SECOND = SONATA_ATT_UUID_16(0x2703), 251 /// Electric current unit - Ampere 252 SONATA_ATT_UNIT_AMPERE = SONATA_ATT_UUID_16(0x2704), 253 /// Thermodynamic Temperature unit - Kelvin 254 SONATA_ATT_UNIT_KELVIN = SONATA_ATT_UUID_16(0x2705), 255 /// Amount of substance unit - mole 256 SONATA_ATT_UNIT_MOLE = SONATA_ATT_UUID_16(0x2706), 257 /// Luminous intensity unit - candela 258 SONATA_ATT_UNIT_CANDELA = SONATA_ATT_UUID_16(0x2707), 259 /// Area unit - square metres 260 SONATA_ATT_UNIT_SQ_METRE = SONATA_ATT_UUID_16(0x2710), 261 /// Colume unit - cubic metres 262 SONATA_ATT_UNIT_CUBIC_METRE = SONATA_ATT_UUID_16(0x2710), 263 /// Velocity unit - metres per second 264 SONATA_ATT_UNIT_METRE_PER_SECOND = SONATA_ATT_UUID_16(0x2711), 265 /// Acceleration unit - metres per second squared 266 SONATA_ATT_UNIT_METRES_PER_SEC_SQ = SONATA_ATT_UUID_16(0x2712), 267 /// Wavenumber unit - reciprocal metre 268 SONATA_ATT_UNIT_RECIPROCAL_METRE = SONATA_ATT_UUID_16(0x2713), 269 /// Density unit - kilogram per cubic metre 270 SONATA_ATT_UNIT_DENS_KG_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x2714), 271 /// Surface density unit - kilogram per square metre 272 SONATA_ATT_UNIT_KG_PER_SQ_METRE = SONATA_ATT_UUID_16(0x2715), 273 /// Specific volume unit - cubic metre per kilogram 274 SONATA_ATT_UNIT_CUBIC_METRE_PER_KG = SONATA_ATT_UUID_16(0x2716), 275 /// Current density unit - ampere per square metre 276 SONATA_ATT_UNIT_AMPERE_PER_SQ_METRE = SONATA_ATT_UUID_16(0x2717), 277 /// Magnetic field strength unit - Ampere per metre 278 SONATA_ATT_UNIT_AMPERE_PER_METRE = SONATA_ATT_UUID_16(0x2718), 279 /// Amount concentration unit - mole per cubic metre 280 SONATA_ATT_UNIT_MOLE_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x2719), 281 /// Mass Concentration unit - kilogram per cubic metre 282 SONATA_ATT_UNIT_MASS_KG_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x271A), 283 /// Luminance unit - candela per square metre 284 SONATA_ATT_UNIT_CANDELA_PER_SQ_METRE = SONATA_ATT_UUID_16(0x271B), 285 /// Refractive index unit 286 SONATA_ATT_UNIT_REFRACTIVE_INDEX = SONATA_ATT_UUID_16(0x271C), 287 /// Relative permeability unit 288 SONATA_ATT_UNIT_RELATIVE_PERMEABILITY = SONATA_ATT_UUID_16(0x271D), 289 /// Plane angle unit - radian 290 SONATA_ATT_UNIT_RADIAN = SONATA_ATT_UUID_16(0x2720), 291 /// Solid angle unit - steradian 292 SONATA_ATT_UNIT_STERADIAN = SONATA_ATT_UUID_16(0x2721), 293 /// Frequency unit - Hertz 294 SONATA_ATT_UNIT_HERTZ = SONATA_ATT_UUID_16(0x2722), 295 /// Force unit - Newton 296 SONATA_ATT_UNIT_NEWTON = SONATA_ATT_UUID_16(0x2723), 297 /// Pressure unit - Pascal 298 SONATA_ATT_UNIT_PASCAL = SONATA_ATT_UUID_16(0x2724), 299 /// Energy unit - Joule 300 SONATA_ATT_UNIT_JOULE = SONATA_ATT_UUID_16(0x2725), 301 /// Power unit - Watt 302 SONATA_ATT_UNIT_WATT = SONATA_ATT_UUID_16(0x2726), 303 /// electric Charge unit - Coulomb 304 SONATA_ATT_UNIT_COULOMB = SONATA_ATT_UUID_16(0x2727), 305 /// Electric potential difference - Volt 306 SONATA_ATT_UNIT_VOLT = SONATA_ATT_UUID_16(0x2728), 307 /// Capacitance unit - Farad 308 SONATA_ATT_UNIT_FARAD = SONATA_ATT_UUID_16(0x2729), 309 /// electric resistance unit - Ohm 310 SONATA_ATT_UNIT_OHM = SONATA_ATT_UUID_16(0x272A), 311 /// Electric conductance - Siemens 312 SONATA_ATT_UNIT_SIEMENS = SONATA_ATT_UUID_16(0x272B), 313 /// Magnetic flux unit - Weber 314 SONATA_ATT_UNIT_WEBER = SONATA_ATT_UUID_16(0x272C), 315 /// Magnetic flux density unit - Tesla 316 SONATA_ATT_UNIT_TESLA = SONATA_ATT_UUID_16(0x272D), 317 /// Inductance unit - Henry 318 SONATA_ATT_UNIT_HENRY = SONATA_ATT_UUID_16(0x272E), 319 /// Temperature unit - degree Celsius 320 SONATA_ATT_UNIT_CELSIUS = SONATA_ATT_UUID_16(0x272F), 321 /// Luminous flux unit - lumen 322 SONATA_ATT_UNIT_LUMEN = SONATA_ATT_UUID_16(0x2730), 323 /// Illuminance unit - lux 324 SONATA_ATT_UNIT_LUX = SONATA_ATT_UUID_16(0x2731), 325 /// Activity referred to a radionuclide unit - becquerel 326 SONATA_ATT_UNIT_BECQUEREL = SONATA_ATT_UUID_16(0x2732), 327 /// Absorbed dose unit - Gray 328 SONATA_ATT_UNIT_GRAY = SONATA_ATT_UUID_16(0x2733), 329 /// Dose equivalent unit - Sievert 330 SONATA_ATT_UNIT_SIEVERT = SONATA_ATT_UUID_16(0x2734), 331 /// Catalytic activity unit - Katal 332 SONATA_ATT_UNIT_KATAL = SONATA_ATT_UUID_16(0x2735), 333 /// Synamic viscosity unit - Pascal second 334 SONATA_ATT_UNIT_PASCAL_SECOND = SONATA_ATT_UUID_16(0x2740), 335 /// Moment of force unit - Newton metre 336 SONATA_ATT_UNIT_NEWTON_METRE = SONATA_ATT_UUID_16(0x2741), 337 /// surface tension unit - Newton per metre 338 SONATA_ATT_UNIT_NEWTON_PER_METRE = SONATA_ATT_UUID_16(0x2742), 339 /// Angular velocity unit - radian per second 340 SONATA_ATT_UNIT_RADIAN_PER_SECOND = SONATA_ATT_UUID_16(0x2743), 341 /// Angular acceleration unit - radian per second squared 342 SONATA_ATT_UNIT_RADIAN_PER_SECOND_SQ = SONATA_ATT_UUID_16(0x2744), 343 /// Heat flux density unit - Watt per square metre 344 SONATA_ATT_UNIT_WSONATA_ATT_PER_SQ_METRE = SONATA_ATT_UUID_16(0x2745), 345 /// HEat capacity unit - Joule per Kelvin 346 SONATA_ATT_UNIT_JOULE_PER_KELVIN = SONATA_ATT_UUID_16(0x2746), 347 /// Specific heat capacity unit - Joule per kilogram kelvin 348 SONATA_ATT_UNIT_JOULE_PER_KG_KELVIN = SONATA_ATT_UUID_16(0x2747), 349 /// Specific Energy unit - Joule per kilogram 350 SONATA_ATT_UNIT_JOULE_PER_KG = SONATA_ATT_UUID_16(0x2748), 351 /// Thermal conductivity - Watt per metre Kelvin 352 SONATA_ATT_UNIT_WSONATA_ATT_PER_METRE_KELVIN = SONATA_ATT_UUID_16(0x2749), 353 /// Energy Density unit - joule per cubic metre 354 SONATA_ATT_UNIT_JOULE_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x274A), 355 /// Electric field strength unit - volt per metre 356 SONATA_ATT_UNIT_VOLT_PER_METRE = SONATA_ATT_UUID_16(0x274B), 357 /// Electric charge density unit - coulomb per cubic metre 358 SONATA_ATT_UNIT_COULOMB_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x274C), 359 /// Surface charge density unit - coulomb per square metre 360 SONATA_ATT_UNIT_SURF_COULOMB_PER_SQ_METRE = SONATA_ATT_UUID_16(0x274D), 361 /// Electric flux density unit - coulomb per square metre 362 SONATA_ATT_UNIT_FLUX_COULOMB_PER_SQ_METRE = SONATA_ATT_UUID_16(0x274E), 363 /// Permittivity unit - farad per metre 364 SONATA_ATT_UNIT_FARAD_PER_METRE = SONATA_ATT_UUID_16(0x274F), 365 /// Permeability unit - henry per metre 366 SONATA_ATT_UNIT_HENRY_PER_METRE = SONATA_ATT_UUID_16(0x2750), 367 /// Molar energy unit - joule per mole 368 SONATA_ATT_UNIT_JOULE_PER_MOLE = SONATA_ATT_UUID_16(0x2751), 369 /// Molar entropy unit - joule per mole kelvin 370 SONATA_ATT_UNIT_JOULE_PER_MOLE_KELVIN = SONATA_ATT_UUID_16(0x2752), 371 /// Exposure unit - coulomb per kilogram 372 SONATA_ATT_UNIT_COULOMB_PER_KG = SONATA_ATT_UUID_16(0x2753), 373 /// Absorbed dose rate unit - gray per second 374 SONATA_ATT_UNIT_GRAY_PER_SECOND = SONATA_ATT_UUID_16(0x2754), 375 /// Radiant intensity unit - watt per steradian 376 SONATA_ATT_UNIT_WSONATA_ATT_PER_STERADIAN = SONATA_ATT_UUID_16(0x2755), 377 /// Radiance unit - watt per square meter steradian 378 SONATA_ATT_UNIT_WSONATA_ATT_PER_SQ_METRE_STERADIAN = SONATA_ATT_UUID_16(0x2756), 379 /// Catalytic activity concentration unit - katal per cubic metre 380 SONATA_ATT_UNIT_KATAL_PER_CUBIC_METRE = SONATA_ATT_UUID_16(0x2757), 381 /// Time unit - minute 382 SONATA_ATT_UNIT_MINUTE = SONATA_ATT_UUID_16(0x2760), 383 /// Time unit - hour 384 SONATA_ATT_UNIT_HOUR = SONATA_ATT_UUID_16(0x2761), 385 /// Time unit - day 386 SONATA_ATT_UNIT_DAY = SONATA_ATT_UUID_16(0x2762), 387 /// Plane angle unit - degree 388 SONATA_ATT_UNIT_ANGLE_DEGREE = SONATA_ATT_UUID_16(0x2763), 389 /// Plane angle unit - minute 390 SONATA_ATT_UNIT_ANGLE_MINUTE = SONATA_ATT_UUID_16(0x2764), 391 /// Plane angle unit - second 392 SONATA_ATT_UNIT_ANGLE_SECOND = SONATA_ATT_UUID_16(0x2765), 393 /// Area unit - hectare 394 SONATA_ATT_UNIT_HECTARE = SONATA_ATT_UUID_16(0x2766), 395 /// Volume unit - litre 396 SONATA_ATT_UNIT_LITRE = SONATA_ATT_UUID_16(0x2767), 397 /// Mass unit - tonne 398 SONATA_ATT_UNIT_TONNE = SONATA_ATT_UUID_16(0x2768), 399 /// Pressure unit - bar 400 SONATA_ATT_UNIT_BAR = SONATA_ATT_UUID_16(0x2780), 401 /// Pressure unit - millimetre of mercury 402 SONATA_ATT_UNIT_MM_MERCURY = SONATA_ATT_UUID_16(0x2781), 403 /// Length unit - angstrom 404 SONATA_ATT_UNIT_ANGSTROM = SONATA_ATT_UUID_16(0x2782), 405 /// Length unit - nautical mile 406 SONATA_ATT_UNIT_NAUTICAL_MILE = SONATA_ATT_UUID_16(0x2783), 407 /// Area unit - barn 408 SONATA_ATT_UNIT_BARN = SONATA_ATT_UUID_16(0x2784), 409 /// Velocity unit - knot 410 SONATA_ATT_UNIT_KNOT = SONATA_ATT_UUID_16(0x2785), 411 /// Logarithmic radio quantity unit - neper 412 SONATA_ATT_UNIT_NEPER = SONATA_ATT_UUID_16(0x2786), 413 /// Logarithmic radio quantity unit - bel 414 SONATA_ATT_UNIT_BEL = SONATA_ATT_UUID_16(0x2787), 415 /// Length unit - yard 416 SONATA_ATT_UNIT_YARD = SONATA_ATT_UUID_16(0x27A0), 417 /// Length unit - parsec 418 SONATA_ATT_UNIT_PARSEC = SONATA_ATT_UUID_16(0x27A1), 419 /// length unit - inch 420 SONATA_ATT_UNIT_INCH = SONATA_ATT_UUID_16(0x27A2), 421 /// length unit - foot 422 SONATA_ATT_UNIT_FOOT = SONATA_ATT_UUID_16(0x27A3), 423 /// length unit - mile 424 SONATA_ATT_UNIT_MILE = SONATA_ATT_UUID_16(0x27A4), 425 /// pressure unit - pound-force per square inch 426 SONATA_ATT_UNIT_POUND_FORCE_PER_SQ_INCH = SONATA_ATT_UUID_16(0x27A5), 427 /// velocity unit - kilometre per hour 428 SONATA_ATT_UNIT_KM_PER_HOUR = SONATA_ATT_UUID_16(0x27A6), 429 /// velocity unit - mile per hour 430 SONATA_ATT_UNIT_MILE_PER_HOUR = SONATA_ATT_UUID_16(0x27A7), 431 /// angular velocity unit - revolution per minute 432 SONATA_ATT_UNIT_REVOLUTION_PER_MINUTE = SONATA_ATT_UUID_16(0x27A8), 433 /// energy unit - gram calorie 434 SONATA_ATT_UNIT_GRAM_CALORIE = SONATA_ATT_UUID_16(0x27A9), 435 /// energy unit - kilogram calorie 436 SONATA_ATT_UNIT_KG_CALORIE = SONATA_ATT_UUID_16(0x27AA), 437 /// energy unit - kilowatt hour 438 SONATA_ATT_UNIT_KILOWSONATA_ATT_HOUR = SONATA_ATT_UUID_16(0x27AB), 439 /// thermodynamic temperature unit - degree Fahrenheit 440 SONATA_ATT_UNIT_FAHRENHEIT = SONATA_ATT_UUID_16(0x27AC), 441 /// percentage 442 SONATA_ATT_UNIT_PERCENTAGE = SONATA_ATT_UUID_16(0x27AD), 443 /// per mille 444 SONATA_ATT_UNIT_PER_MILLE = SONATA_ATT_UUID_16(0x27AE), 445 /// period unit - beats per minute) 446 SONATA_ATT_UNIT_BEATS_PER_MINUTE = SONATA_ATT_UUID_16(0x27AF), 447 /// electric charge unit - ampere hours 448 SONATA_ATT_UNIT_AMPERE_HOURS = SONATA_ATT_UUID_16(0x27B0), 449 /// mass density unit - milligram per decilitre 450 SONATA_ATT_UNIT_MILLIGRAM_PER_DECILITRE = SONATA_ATT_UUID_16(0x27B1), 451 /// mass density unit - millimole per litre 452 SONATA_ATT_UNIT_MILLIMOLE_PER_LITRE = SONATA_ATT_UUID_16(0x27B2), 453 /// time unit - year 454 SONATA_ATT_UNIT_YEAR = SONATA_ATT_UUID_16(0x27B3), 455 //// time unit - month 456 SONATA_ATT_UNIT_MONTH = SONATA_ATT_UUID_16(0x27B4), 457 458 /*---------------- DECLARATIONS -----------------*/ 459 /// Primary service Declaration 460 SONATA_ATT_DECL_PRIMARY_SERVICE = SONATA_ATT_UUID_16(0x2800), 461 /// Secondary service Declaration 462 SONATA_ATT_DECL_SECONDARY_SERVICE = SONATA_ATT_UUID_16(0x2801), 463 /// Include Declaration 464 SONATA_ATT_DECL_INCLUDE = SONATA_ATT_UUID_16(0x2802), 465 /// Characteristic Declaration 466 SONATA_ATT_DECL_CHARACTERISTIC = SONATA_ATT_UUID_16(0x2803), 467 468 /*----------------- DESCRIPTORS -----------------*/ 469 /// Characteristic extended properties 470 SONATA_ATT_DESC_CHAR_EXT_PROPERTIES = SONATA_ATT_UUID_16(0x2900), 471 /// Characteristic user description 472 SONATA_ATT_DESC_CHAR_USER_DESCRIPTION = SONATA_ATT_UUID_16(0x2901), 473 /// Client characteristic configuration 474 SONATA_ATT_DESC_CLIENT_CHAR_CFG = SONATA_ATT_UUID_16(0x2902), 475 /// Server characteristic configuration 476 SONATA_ATT_DESC_SERVER_CHAR_CFG = SONATA_ATT_UUID_16(0x2903), 477 /// Characteristic Presentation Format 478 SONATA_ATT_DESC_CHAR_PRES_FORMAT = SONATA_ATT_UUID_16(0x2904), 479 /// Characteristic Aggregate Format 480 SONATA_ATT_DESC_CHAR_AGGREGATE_FORMAT = SONATA_ATT_UUID_16(0x2905), 481 /// Valid Range 482 SONATA_ATT_DESC_VALID_RANGE = SONATA_ATT_UUID_16(0x2906), 483 /// External Report Reference 484 SONATA_ATT_DESC_EXT_REPORT_REF = SONATA_ATT_UUID_16(0x2907), 485 /// Report Reference 486 SONATA_ATT_DESC_REPORT_REF = SONATA_ATT_UUID_16(0x2908), 487 /// Environmental Sensing Configuration 488 SONATA_ATT_DESC_ES_CONFIGURATION = SONATA_ATT_UUID_16(0x290B), 489 /// Environmental Sensing Measurement 490 SONATA_ATT_DESC_ES_MEASUREMENT = SONATA_ATT_UUID_16(0x290C), 491 /// Environmental Sensing Trigger Setting 492 SONATA_ATT_DESC_ES_TRIGGER_SETTING = SONATA_ATT_UUID_16(0x290D), 493 494 /*--------------- CHARACTERISTICS ---------------*/ 495 /// Device name 496 SONATA_ATT_CHAR_DEVICE_NAME = SONATA_ATT_UUID_16(0x2A00), 497 /// Appearance 498 SONATA_ATT_CHAR_APPEARANCE = SONATA_ATT_UUID_16(0x2A01), 499 /// Privacy flag 500 SONATA_ATT_CHAR_PRIVACY_FLAG = SONATA_ATT_UUID_16(0x2A02), 501 /// Reconnection address 502 SONATA_ATT_CHAR_RECONNECTION_ADDR = SONATA_ATT_UUID_16(0x2A03), 503 /// Peripheral preferred connection parameters 504 SONATA_ATT_CHAR_PERIPH_PREF_CON_PARAM = SONATA_ATT_UUID_16(0x2A04), 505 /// Service handles changed 506 SONATA_ATT_CHAR_SERVICE_CHANGED = SONATA_ATT_UUID_16(0x2A05), 507 /// Alert Level characteristic 508 SONATA_ATT_CHAR_ALERT_LEVEL = SONATA_ATT_UUID_16(0x2A06), 509 /// Tx Power Level 510 SONATA_ATT_CHAR_TX_POWER_LEVEL = SONATA_ATT_UUID_16(0x2A07), 511 /// Date Time 512 SONATA_ATT_CHAR_DATE_TIME = SONATA_ATT_UUID_16(0x2A08), 513 /// Day of Week 514 SONATA_ATT_CHAR_DAY_WEEK = SONATA_ATT_UUID_16(0x2A09), 515 /// Day Date Time 516 SONATA_ATT_CHAR_DAY_DATE_TIME = SONATA_ATT_UUID_16(0x2A0A), 517 /// Exact time 256 518 SONATA_ATT_CHAR_EXACT_TIME_256 = SONATA_ATT_UUID_16(0x2A0C), 519 /// DST Offset 520 SONATA_ATT_CHAR_DST_OFFSET = SONATA_ATT_UUID_16(0x2A0D), 521 /// Time zone 522 SONATA_ATT_CHAR_TIME_ZONE = SONATA_ATT_UUID_16(0x2A0E), 523 /// Local time Information 524 SONATA_ATT_CHAR_LOCAL_TIME_INFO = SONATA_ATT_UUID_16(0x2A0F), 525 /// Time with DST 526 SONATA_ATT_CHAR_TIME_WITH_DST = SONATA_ATT_UUID_16(0x2A11), 527 /// Time Accuracy 528 SONATA_ATT_CHAR_TIME_ACCURACY = SONATA_ATT_UUID_16(0x2A12), 529 /// Time Source 530 SONATA_ATT_CHAR_TIME_SOURCE = SONATA_ATT_UUID_16(0x2A13), 531 /// Reference Time Information 532 SONATA_ATT_CHAR_REFERENCE_TIME_INFO = SONATA_ATT_UUID_16(0x2A14), 533 /// Time Update Control Point 534 SONATA_ATT_CHAR_TIME_UPDATE_CNTL_POINT = SONATA_ATT_UUID_16(0x2A16), 535 /// Time Update State 536 SONATA_ATT_CHAR_TIME_UPDATE_STATE = SONATA_ATT_UUID_16(0x2A17), 537 /// Glucose Measurement 538 SONATA_ATT_CHAR_GLUCOSE_MEAS = SONATA_ATT_UUID_16(0x2A18), 539 /// Battery Level 540 SONATA_ATT_CHAR_BATTERY_LEVEL = SONATA_ATT_UUID_16(0x2A19), 541 /// Temperature Measurement 542 SONATA_ATT_CHAR_TEMPERATURE_MEAS = SONATA_ATT_UUID_16(0x2A1C), 543 /// Temperature Type 544 SONATA_ATT_CHAR_TEMPERATURE_TYPE = SONATA_ATT_UUID_16(0x2A1D), 545 /// Intermediate Temperature 546 SONATA_ATT_CHAR_INTERMED_TEMPERATURE = SONATA_ATT_UUID_16(0x2A1E), 547 /// Measurement Interval 548 SONATA_ATT_CHAR_MEAS_INTERVAL = SONATA_ATT_UUID_16(0x2A21), 549 /// Boot Keyboard Input Report 550 SONATA_ATT_CHAR_BOOT_KB_IN_REPORT = SONATA_ATT_UUID_16(0x2A22), 551 /// System ID 552 SONATA_ATT_CHAR_SYS_ID = SONATA_ATT_UUID_16(0x2A23), 553 /// Model Number String 554 SONATA_ATT_CHAR_MODEL_NB = SONATA_ATT_UUID_16(0x2A24), 555 /// Serial Number String 556 SONATA_ATT_CHAR_SERIAL_NB = SONATA_ATT_UUID_16(0x2A25), 557 /// Firmware Revision String 558 SONATA_ATT_CHAR_FW_REV = SONATA_ATT_UUID_16(0x2A26), 559 /// Hardware revision String 560 SONATA_ATT_CHAR_HW_REV = SONATA_ATT_UUID_16(0x2A27), 561 /// Software Revision String 562 SONATA_ATT_CHAR_SW_REV = SONATA_ATT_UUID_16(0x2A28), 563 /// Manufacturer Name String 564 SONATA_ATT_CHAR_MANUF_NAME = SONATA_ATT_UUID_16(0x2A29), 565 /// IEEE Regulatory Certification Data List 566 SONATA_ATT_CHAR_IEEE_CERTIF = SONATA_ATT_UUID_16(0x2A2A), 567 /// CT Time 568 SONATA_ATT_CHAR_CT_TIME = SONATA_ATT_UUID_16(0x2A2B), 569 /// Magnetic Declination 570 SONATA_ATT_CHAR_MAGN_DECLINE = SONATA_ATT_UUID_16(0x2A2C), 571 /// Scan Refresh 572 SONATA_ATT_CHAR_SCAN_REFRESH = SONATA_ATT_UUID_16(0x2A31), 573 /// Boot Keyboard Output Report 574 SONATA_ATT_CHAR_BOOT_KB_OUT_REPORT = SONATA_ATT_UUID_16(0x2A32), 575 /// Boot Mouse Input Report 576 SONATA_ATT_CHAR_BOOT_MOUSE_IN_REPORT = SONATA_ATT_UUID_16(0x2A33), 577 /// Glucose Measurement Context 578 SONATA_ATT_CHAR_GLUCOSE_MEAS_CTX = SONATA_ATT_UUID_16(0x2A34), 579 /// Blood Pressure Measurement 580 SONATA_ATT_CHAR_BLOOD_PRESSURE_MEAS = SONATA_ATT_UUID_16(0x2A35), 581 /// Intermediate Cuff Pressure 582 SONATA_ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE = SONATA_ATT_UUID_16(0x2A36), 583 /// Heart Rate Measurement 584 SONATA_ATT_CHAR_HEART_RATE_MEAS = SONATA_ATT_UUID_16(0x2A37), 585 /// Body Sensor Location 586 SONATA_ATT_CHAR_BODY_SENSOR_LOCATION = SONATA_ATT_UUID_16(0x2A38), 587 /// Heart Rate Control Point 588 SONATA_ATT_CHAR_HEART_RATE_CNTL_POINT = SONATA_ATT_UUID_16(0x2A39), 589 /// Alert Status 590 SONATA_ATT_CHAR_ALERT_STATUS = SONATA_ATT_UUID_16(0x2A3F), 591 /// Ringer Control Point 592 SONATA_ATT_CHAR_RINGER_CNTL_POINT = SONATA_ATT_UUID_16(0x2A40), 593 /// Ringer Setting 594 SONATA_ATT_CHAR_RINGER_SETTING = SONATA_ATT_UUID_16(0x2A41), 595 /// Alert Category ID Bit Mask 596 SONATA_ATT_CHAR_ALERT_CAT_ID_BIT_MASK = SONATA_ATT_UUID_16(0x2A42), 597 /// Alert Category ID 598 SONATA_ATT_CHAR_ALERT_CAT_ID = SONATA_ATT_UUID_16(0x2A43), 599 /// Alert Notification Control Point 600 SONATA_ATT_CHAR_ALERT_NTF_CTNL_PT = SONATA_ATT_UUID_16(0x2A44), 601 /// Unread Alert Status 602 SONATA_ATT_CHAR_UNREAD_ALERT_STATUS = SONATA_ATT_UUID_16(0x2A45), 603 /// New Alert 604 SONATA_ATT_CHAR_NEW_ALERT = SONATA_ATT_UUID_16(0x2A46), 605 /// Supported New Alert Category 606 SONATA_ATT_CHAR_SUP_NEW_ALERT_CAT = SONATA_ATT_UUID_16(0x2A47), 607 /// Supported Unread Alert Category 608 SONATA_ATT_CHAR_SUP_UNREAD_ALERT_CAT = SONATA_ATT_UUID_16(0x2A48), 609 /// Blood Pressure Feature 610 SONATA_ATT_CHAR_BLOOD_PRESSURE_FEATURE = SONATA_ATT_UUID_16(0x2A49), 611 /// HID Information 612 SONATA_ATT_CHAR_HID_INFO = SONATA_ATT_UUID_16(0x2A4A), 613 /// Report Map 614 SONATA_ATT_CHAR_REPORT_MAP = SONATA_ATT_UUID_16(0x2A4B), 615 /// HID Control Point 616 SONATA_ATT_CHAR_HID_CTNL_PT = SONATA_ATT_UUID_16(0x2A4C), 617 /// Report 618 SONATA_ATT_CHAR_REPORT = SONATA_ATT_UUID_16(0x2A4D), 619 /// Protocol Mode 620 SONATA_ATT_CHAR_PROTOCOL_MODE = SONATA_ATT_UUID_16(0x2A4E), 621 /// Scan Interval Window 622 SONATA_ATT_CHAR_SCAN_INTV_WD = SONATA_ATT_UUID_16(0x2A4F), 623 /// PnP ID 624 SONATA_ATT_CHAR_PNP_ID = SONATA_ATT_UUID_16(0x2A50), 625 /// Glucose Feature 626 SONATA_ATT_CHAR_GLUCOSE_FEATURE = SONATA_ATT_UUID_16(0x2A51), 627 /// Record access control point 628 SONATA_ATT_CHAR_REC_ACCESS_CTRL_PT = SONATA_ATT_UUID_16(0x2A52), 629 /// RSC Measurement 630 SONATA_ATT_CHAR_RSC_MEAS = SONATA_ATT_UUID_16(0x2A53), 631 /// RSC Feature 632 SONATA_ATT_CHAR_RSC_FEAT = SONATA_ATT_UUID_16(0x2A54), 633 /// SC Control Point 634 SONATA_ATT_CHAR_SC_CNTL_PT = SONATA_ATT_UUID_16(0x2A55), 635 /// CSC Measurement 636 SONATA_ATT_CHAR_CSC_MEAS = SONATA_ATT_UUID_16(0x2A5B), 637 /// CSC Feature 638 SONATA_ATT_CHAR_CSC_FEAT = SONATA_ATT_UUID_16(0x2A5C), 639 /// Sensor Location 640 SONATA_ATT_CHAR_SENSOR_LOC = SONATA_ATT_UUID_16(0x2A5D), 641 /// PLX Spot-Check Measurement 642 SONATA_ATT_CHAR_PLX_SPOT_CHECK_MEASUREMENT_LOC = SONATA_ATT_UUID_16(0x2A5E), 643 /// PLX Continuous Measurement 644 SONATA_ATT_CHAR_PLX_CONTINUOUS_MEASUREMENT_LOC = SONATA_ATT_UUID_16(0x2A5F), 645 /// PLX Features 646 SONATA_ATT_CHAR_PLX_FEATURES_LOC = SONATA_ATT_UUID_16(0x2A60), 647 /// CP Measurement 648 SONATA_ATT_CHAR_CP_MEAS = SONATA_ATT_UUID_16(0x2A63), 649 /// CP Vector 650 SONATA_ATT_CHAR_CP_VECTOR = SONATA_ATT_UUID_16(0x2A64), 651 /// CP Feature 652 SONATA_ATT_CHAR_CP_FEAT = SONATA_ATT_UUID_16(0x2A65), 653 /// CP Control Point 654 SONATA_ATT_CHAR_CP_CNTL_PT = SONATA_ATT_UUID_16(0x2A66), 655 /// Location and Speed 656 SONATA_ATT_CHAR_LOC_SPEED = SONATA_ATT_UUID_16(0x2A67), 657 /// Navigation 658 SONATA_ATT_CHAR_NAVIGATION = SONATA_ATT_UUID_16(0x2A68), 659 /// Position Quality 660 SONATA_ATT_CHAR_POS_QUALITY = SONATA_ATT_UUID_16(0x2A69), 661 /// LN Feature 662 SONATA_ATT_CHAR_LN_FEAT = SONATA_ATT_UUID_16(0x2A6A), 663 /// LN Control Point 664 SONATA_ATT_CHAR_LN_CNTL_PT = SONATA_ATT_UUID_16(0x2A6B), 665 /// Elevation 666 SONATA_ATT_CHAR_ELEVATION = SONATA_ATT_UUID_16(0x2A6C), 667 /// Pressure 668 SONATA_ATT_CHAR_PRESSURE = SONATA_ATT_UUID_16(0x2A6D), 669 /// Temperature 670 SONATA_ATT_CHAR_TEMPERATURE = SONATA_ATT_UUID_16(0x2A6E), 671 /// Humidity 672 SONATA_ATT_CHAR_HUMIDITY = SONATA_ATT_UUID_16(0x2A6F), 673 /// True Wind Speed 674 SONATA_ATT_CHAR_TRUE_WIND_SPEED = SONATA_ATT_UUID_16(0x2A70), 675 /// True Wind Direction 676 SONATA_ATT_CHAR_TRUE_WIND_DIR = SONATA_ATT_UUID_16(0x2A71), 677 /// Apparent Wind Speed 678 SONATA_ATT_CHAR_APRNT_WIND_SPEED = SONATA_ATT_UUID_16(0x2A72), 679 /// Apparent Wind Direction 680 SONATA_ATT_CHAR_APRNT_WIND_DIRECTION = SONATA_ATT_UUID_16(0x2A73), 681 /// Gust Factor 682 SONATA_ATT_CHAR_GUST_FACTOR = SONATA_ATT_UUID_16(0x2A74), 683 /// Pollen Concentration 684 SONATA_ATT_CHAR_POLLEN_CONC = SONATA_ATT_UUID_16(0x2A75), 685 /// UV Index 686 SONATA_ATT_CHAR_UV_INDEX = SONATA_ATT_UUID_16(0x2A76), 687 /// Irradiance 688 SONATA_ATT_CHAR_IRRADIANCE = SONATA_ATT_UUID_16(0x2A77), 689 /// Rainfall 690 SONATA_ATT_CHAR_RAINFALL = SONATA_ATT_UUID_16(0x2A78), 691 /// Wind Chill 692 SONATA_ATT_CHAR_WIND_CHILL = SONATA_ATT_UUID_16(0x2A79), 693 /// Heat Index 694 SONATA_ATT_CHAR_HEAT_INDEX = SONATA_ATT_UUID_16(0x2A7A), 695 /// Dew Point 696 SONATA_ATT_CHAR_DEW_POINT = SONATA_ATT_UUID_16(0x2A7B), 697 /// Descriptor Value Changed 698 SONATA_ATT_CHAR_DESCRIPTOR_VALUE_CHANGED = SONATA_ATT_UUID_16(0x2A7D), 699 /// Aerobic Heart Rate Lower Limit 700 SONATA_ATT_CHAR_AEROBIC_HEART_RATE_LOWER_LIMIT = SONATA_ATT_UUID_16(0x2A7E), 701 /// Aerobic Threshhold 702 SONATA_ATT_CHAR_AEROBIC_THRESHHOLD = SONATA_ATT_UUID_16(0x2A7F), 703 /// Age 704 SONATA_ATT_CHAR_AGE = SONATA_ATT_UUID_16(0x2A80), 705 /// Anaerobic Heart Rate Lower Limit 706 SONATA_ATT_CHAR_ANAEROBIC_HEART_RATE_LOWER_LIMIT = SONATA_ATT_UUID_16(0x2A81), 707 /// Anaerobic Heart Rate Upper Limit 708 SONATA_ATT_CHAR_ANAEROBIC_HEART_RATE_UPPER_LIMIT = SONATA_ATT_UUID_16(0x2A82), 709 /// Anaerobic Threshhold 710 SONATA_ATT_CHAR_ANAEROBIC_THRESHHOLD = SONATA_ATT_UUID_16(0x2A83), 711 /// Aerobic Heart Rate Upper Limit 712 SONATA_ATT_CHAR_AEROBIC_HEART_RATE_UPPER_LIMIT = SONATA_ATT_UUID_16(0x2A84), 713 /// Date Of Birth 714 SONATA_ATT_CHAR_DATE_OF_BIRTH = SONATA_ATT_UUID_16(0x2A85), 715 /// Date Of Threshold Assessment 716 SONATA_ATT_CHAR_DATE_OF_THRESHOLD_ASSESSMENT = SONATA_ATT_UUID_16(0x2A86), 717 /// Email Address 718 SONATA_ATT_CHAR_EMAIL_ADDRESS = SONATA_ATT_UUID_16(0x2A87), 719 /// Fat Burn Heart Rate Lower Limit 720 SONATA_ATT_CHAR_FAT_BURN_HEART_RATE_LOWER_LIMIT = SONATA_ATT_UUID_16(0x2A88), 721 /// Fat Burn Heart Rate Upper Limit 722 SONATA_ATT_CHAR_FAT_BURN_HEART_RATE_UPPER_LIMIT = SONATA_ATT_UUID_16(0x2A89), 723 /// First Name 724 SONATA_ATT_CHAR_FIRST_NAME = SONATA_ATT_UUID_16(0x2A8A), 725 /// Five Zone Heart Rate Limits 726 SONATA_ATT_CHAR_FIVE_ZONE_HEART_RATE_LIMITS = SONATA_ATT_UUID_16(0x2A8B), 727 /// Gender 728 SONATA_ATT_CHAR_GENDER = SONATA_ATT_UUID_16(0x2A8C), 729 /// Max Heart Rate 730 SONATA_ATT_CHAR_MAX_HEART_RATE = SONATA_ATT_UUID_16(0x2A8D), 731 /// Height 732 SONATA_ATT_CHAR_HEIGHT = SONATA_ATT_UUID_16(0x2A8E), 733 /// Hip Circumference 734 SONATA_ATT_CHAR_HIP_CIRCUMFERENCE = SONATA_ATT_UUID_16(0x2A8F), 735 /// Last Name 736 SONATA_ATT_CHAR_LAST_NAME = SONATA_ATT_UUID_16(0x2A90), 737 /// Maximum Recommended Heart Rate 738 SONATA_ATT_CHAR_MAXIMUM_RECOMMENDED_HEART_RATE = SONATA_ATT_UUID_16(0x2A91), 739 /// Resting Heart Rate 740 SONATA_ATT_CHAR_RESTING_HEART_RATE = SONATA_ATT_UUID_16(0x2A92), 741 /// Sport Type For Aerobic And Anaerobic Thresholds 742 SONATA_ATT_CHAR_SPORT_TYPE_FOR_AEROBIC_AND_ANAEROBIC_THRESHOLDS = SONATA_ATT_UUID_16(0x2A93), 743 /// Three Zone Heart Rate Limits 744 SONATA_ATT_CHAR_THREE_ZONE_HEART_RATE_LIMITS = SONATA_ATT_UUID_16(0x2A94), 745 /// Two Zone Heart Rate Limit 746 SONATA_ATT_CHAR_TWO_ZONE_HEART_RATE_LIMIT = SONATA_ATT_UUID_16(0x2A95), 747 /// Vo2 Max 748 SONATA_ATT_CHAR_VO2_MAX = SONATA_ATT_UUID_16(0x2A96), 749 /// Waist Circumference 750 SONATA_ATT_CHAR_WAIST_CIRCUMFERENCE = SONATA_ATT_UUID_16(0x2A97), 751 /// Weight 752 SONATA_ATT_CHAR_WEIGHT = SONATA_ATT_UUID_16(0x2A98), 753 /// Database Change Increment 754 SONATA_ATT_CHAR_DATABASE_CHANGE_INCREMENT = SONATA_ATT_UUID_16(0x2A99), 755 /// User Index 756 SONATA_ATT_CHAR_USER_INDEX = SONATA_ATT_UUID_16(0x2A9A), 757 /// Body Composition Feature 758 SONATA_ATT_CHAR_BODY_COMPOSITION_FEATURE = SONATA_ATT_UUID_16(0x2A9B), 759 /// Body Composition Measurement 760 SONATA_ATT_CHAR_BODY_COMPOSITION_MEASUREMENT = SONATA_ATT_UUID_16(0x2A9C), 761 /// Weight Measurement 762 SONATA_ATT_CHAR_WEIGHT_MEASUREMENT = SONATA_ATT_UUID_16(0x2A9D), 763 /// Weight Scale Feature 764 SONATA_ATT_CHAR_WEIGHT_SCALE_FEATURE = SONATA_ATT_UUID_16(0x2A9E), 765 /// User Control Point 766 SONATA_ATT_CHAR_USER_CONTROL_POINT = SONATA_ATT_UUID_16(0x2A9F), 767 /// Flux Density - 2D 768 SONATA_ATT_CHAR_MAGN_FLUX_2D = SONATA_ATT_UUID_16(0x2AA0), 769 /// Magnetic Flux Density - 3D 770 SONATA_ATT_CHAR_MAGN_FLUX_3D = SONATA_ATT_UUID_16(0x2AA1), 771 /// Language string 772 SONATA_ATT_CHAR_LANGUAGE = SONATA_ATT_UUID_16(0x2AA2), 773 /// Barometric Pressure Trend 774 SONATA_ATT_CHAR_BAR_PRES_TREND = SONATA_ATT_UUID_16(0x2AA3), 775 /// Central Address Resolution Support 776 SONATA_ATT_CHAR_CTL_ADDR_RESOL_SUPP = SONATA_ATT_UUID_16(0x2AA6), 777 /// CGM Measurement 778 SONATA_ATT_CHAR_CGM_MEASUREMENT = SONATA_ATT_UUID_16(0x2AA7), 779 /// CGM Features 780 SONATA_ATT_CHAR_CGM_FEATURES = SONATA_ATT_UUID_16(0x2AA8), 781 /// CGM Status 782 SONATA_ATT_CHAR_CGM_STATUS = SONATA_ATT_UUID_16(0x2AA9), 783 /// CGM Session Start 784 SONATA_ATT_CHAR_CGM_SESSION_START = SONATA_ATT_UUID_16(0x2AAA), 785 /// CGM Session Run 786 SONATA_ATT_CHAR_CGM_SESSION_RUN = SONATA_ATT_UUID_16(0x2AAB), 787 /// CGM Specific Ops Control Point 788 SONATA_ATT_CHAR_CGM_SPECIFIC_OPS_CTRL_PT = SONATA_ATT_UUID_16(0x2AAC), 789 /// Resolvable Private Address only 790 SONATA_ATT_CHAR_RSLV_PRIV_ADDR_ONLY = SONATA_ATT_UUID_16(0x2AC9), 791 /// Mesh Provisioning Data In 792 SONATA_ATT_CHAR_MESH_PROV_DATA_IN = SONATA_ATT_UUID_16(0x2ADB), 793 /// Mesh Provisioning Data Out 794 SONATA_ATT_CHAR_MESH_PROV_DATA_OUT = SONATA_ATT_UUID_16(0x2ADC), 795 /// Mesh Proxy Data In 796 SONATA_ATT_CHAR_MESH_PROXY_DATA_IN = SONATA_ATT_UUID_16(0x2ADD), 797 /// Mesh Proxy Data Out 798 SONATA_ATT_CHAR_MESH_PROXY_DATA_OUT = SONATA_ATT_UUID_16(0x2ADE), 799 800 /// Client Supported Features 801 SONATA_ATT_CHAR_CLI_SUP_FEAT = SONATA_ATT_UUID_16(0x2B29), 802 /// Database Hash 803 SONATA_ATT_CHAR_DB_HASH = SONATA_ATT_UUID_16(0x2B2A), 804 /// OTA Data In 805 SONATA_ATT_CHAR_OTA_DATA_IN = SONATA_ATT_UUID_16(0x2C00), 806 /// OTA Data Out 807 SONATA_ATT_CHAR_OTA_DATA_OUT = SONATA_ATT_UUID_16(0x2C01), 808 }; 809 810 /// Format for Characteristic Presentation 811 enum { 812 /// unsigned 1-bit: true or false 813 SONATA_ATT_FORMAT_BOOL = 0x01, 814 /// unsigned 2-bit integer 815 SONATA_ATT_FORMAT_2BIT, 816 /// unsigned 4-bit integer 817 SONATA_ATT_FORMAT_NIBBLE, 818 /// unsigned 8-bit integer 819 SONATA_ATT_FORMAT_UINT8, 820 /// unsigned 12-bit integer 821 SONATA_ATT_FORMAT_UINT12, 822 /// unsigned 16-bit integer 823 SONATA_ATT_FORMAT_UINT16, 824 /// unsigned 24-bit integer 825 SONATA_ATT_FORMAT_UINT24, 826 /// unsigned 32-bit integer 827 SONATA_ATT_FORMAT_UINT32, 828 /// unsigned 48-bit integer 829 SONATA_ATT_FORMAT_UINT48, 830 /// unsigned 64-bit integer 831 SONATA_ATT_FORMAT_UINT64, 832 /// unsigned 128-bit integer 833 SONATA_ATT_FORMAT_UINT128, 834 /// signed 8-bit integer 835 SONATA_ATT_FORMAT_SINT8, 836 /// signed 12-bit integer 837 SONATA_ATT_FORMAT_SINT12, 838 /// signed 16-bit integer 839 SONATA_ATT_FORMAT_SINT16, 840 /// signed 24-bit integer 841 SONATA_ATT_FORMAT_SINT24, 842 /// signed 32-bit integer 843 SONATA_ATT_FORMAT_SINT32, 844 /// signed 48-bit integer 845 SONATA_ATT_FORMAT_SINT48, 846 /// signed 64-bit integer 847 SONATA_ATT_FORMAT_SINT64, 848 /// signed 128-bit integer 849 SONATA_ATT_FORMAT_SINT128, 850 /// IEEE-754 32-bit floating point 851 SONATA_ATT_FORMAT_FLOAT32, 852 /// IEEE-754 64-bit floating point 853 SONATA_ATT_FORMAT_FLOAT64, 854 /// IEEE-11073 16-bit SFLOAT 855 SONATA_ATT_FORMAT_SFLOAT, 856 /// IEEE-11073 32-bit FLOAT 857 SONATA_ATT_FORMAT_FLOAT, 858 /// IEEE-20601 format 859 SONATA_ATT_FORMAT_DUINT16, 860 /// UTF-8 string 861 SONATA_ATT_FORMAT_UTF8S, 862 /// UTF-16 string 863 SONATA_ATT_FORMAT_UTF16S, 864 /// Opaque structure 865 SONATA_ATT_FORMAT_STRUCT, 866 /// Last format 867 SONATA_ATT_FORMAT_LAST 868 }; 869 870 /// Client Characteristic Configuration Codes 871 enum sonata_att_ccc_val { 872 /// Stop notification/indication 873 SONATA_ATT_CCC_STOP_NTFIND = 0x0000, 874 /// Start notification 875 SONATA_ATT_CCC_START_NTF, 876 /// Start indication 877 SONATA_ATT_CCC_START_IND 878 }; 879 880 /* 881 * Type Definition 882 **************************************************************************************** 883 */ 884 885 /// Attribute length type 886 887 /// UUID - 128-bit type 888 struct sonata_att_uuid_128 { 889 /// 128-bit UUID 890 uint8_t uuid[SONATA_ATT_UUID_128_LEN]; 891 }; 892 893 /// UUID - 32-bit type 894 struct sonata_att_uuid_32 { 895 /// 32-bit UUID 896 uint8_t uuid[SONATA_ATT_UUID_32_LEN]; 897 }; 898 899 /// Characteristic Value Descriptor 900 struct sonata_att_char_desc { 901 /// properties 902 uint8_t prop; 903 /// attribute handle 904 uint8_t attr_hdl[SONATA_ATT_HANDLE_LEN]; 905 /// attribute type 906 uint8_t attr_type[SONATA_ATT_UUID_16_LEN]; 907 }; 908 909 /// Characteristic Value Descriptor 910 struct sonata_att_char128_desc { 911 /// properties 912 uint8_t prop; 913 /// attribute handle 914 uint8_t attr_hdl[SONATA_ATT_HANDLE_LEN]; 915 /// attribute type 916 uint8_t attr_type[SONATA_ATT_UUID_128_LEN]; 917 }; 918 919 /// Service Value Descriptor - 16-bit 920 typedef uint16_t att_svc_desc_t; 921 922 /// include service entry element 923 struct sonata_att_incl_desc { 924 /// start handle value of included service 925 uint16_t start_hdl; 926 /// end handle value of included service 927 uint16_t end_hdl; 928 /// attribute value UUID 929 uint16_t uuid; 930 }; 931 932 /// include service entry element 933 struct sonata_att_incl128_desc { 934 /// start handle value of included service 935 uint16_t start_hdl; 936 /// end handle value of included service 937 uint16_t end_hdl; 938 }; 939 940 // --------------------------- Database permissions ----------------------------- 941 942 /// Macro used to retrieve access permission rights 943 #define SONATA_PERM_GET(perm, access) \ 944 (((perm) & (SONATA_PERM_MASK_ ## access)) >> (SONATA_PERM_POS_ ## access)) 945 946 /// Macro used to set a permission value 947 #define SONATA_PERM_SET(perm, access, value) \ 948 perm = (((perm) & ~(SONATA_PERM_MASK_ ## access)) | (((value) << (SONATA_PERM_POS_ ## access)) & (SONATA_PERM_MASK_ ## access))) 949 950 /// Macro used to retrieve permission value from access and rights on attribute. 951 #define SONATA_PERM(access, right) \ 952 (((SONATA_PERM_RIGHT_ ## right) << (SONATA_PERM_POS_ ## access)) & (SONATA_PERM_MASK_ ## access)) 953 954 /// Macro used know if permission is set or not. 955 #define SONATA_PERM_IS_SET(perm, access, right) \ 956 (((perm) & (((SONATA_PERM_RIGHT_ ## right) << (SONATA_PERM_POS_ ## access))) \ 957 & (SONATA_PERM_MASK_ ## access)) == SONATA_PERM(access, right)) 958 959 /// Retrieve attribute security level from attribute right and service right 960 961 /// Retrieve UUID LEN from UUID Length Permission 962 #define SONATA_ATT_UUID_LEN(uuid_len_perm) (((uuid_len_perm) == 0) ? ATT_UUID_16_LEN : \ 963 (((uuid_len_perm) == 1) ? ATT_UUID_32_LEN : \ 964 (((uuid_len_perm) == 2) ? ATT_UUID_128_LEN : 0))) 965 966 /// Initialization of attribute element 967 #define SONATA_ATT_ELEMT_INIT {{NULL}, false} 968 969 /** 970 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 971 * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ 972 * |EXT | WS | I | N | WR | WC | RD | B | NP | IP | WP | RP | 973 * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ 974 * 975 * Bit [0-1] : Read mode (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) 976 * Bit [2-3] : Write mode (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) 977 * Bit [4-5] : Indication mode (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) 978 * Bit [6-7] : Notification mode (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = SEC_CON) 979 * 980 * Bit [8] : Broadcast descriptor present (only relevant for a characteristic value) 981 * Bit [9] : Read accepted 982 * Bit [10] : Write Command accepted 983 * Bit [11] : Write Request accepted 984 * Bit [12] : Notification accepted 985 * Bit [13] : Indication accepted 986 * Bit [14] : Write Signed accepted 987 * Bit [15] : Extended properties present (only relevant for a characteristic value) 988 */ 989 enum sonata_attm_perm_mask { 990 /// retrieve all permission info 991 SONATA_PERM_MASK_ALL = 0x0000, 992 /// Read Permission Mask 993 SONATA_PERM_MASK_RP = 0x0003, 994 SONATA_PERM_POS_RP = 0, 995 /// Write Permission Mask 996 SONATA_PERM_MASK_WP = 0x000C, 997 SONATA_PERM_POS_WP = 2, 998 /// Indication Access Mask 999 SONATA_PERM_MASK_IP = 0x0030, 1000 SONATA_PERM_POS_IP = 4, 1001 /// Notification Access Mask 1002 SONATA_PERM_MASK_NP = 0x00C0, 1003 SONATA_PERM_POS_NP = 6, 1004 /// Broadcast descriptor present 1005 SONATA_PERM_MASK_BROADCAST = 0x0100, 1006 SONATA_PERM_POS_BROADCAST = 8, 1007 /// Read Access Mask 1008 SONATA_PERM_MASK_RD = 0x0200, 1009 SONATA_PERM_POS_RD = 9, 1010 /// Write Command Enabled attribute Mask 1011 SONATA_PERM_MASK_WRITE_COMMAND = 0x0400, 1012 SONATA_PERM_POS_WRITE_COMMAND = 10, 1013 /// Write Request Enabled attribute Mask 1014 SONATA_PERM_MASK_WRITE_REQ = 0x0800, 1015 SONATA_PERM_POS_WRITE_REQ = 11, 1016 /// Notification Access Mask 1017 SONATA_PERM_MASK_NTF = 0x1000, 1018 SONATA_PERM_POS_NTF = 12, 1019 /// Indication Access Mask 1020 SONATA_PERM_MASK_IND = 0x2000, 1021 SONATA_PERM_POS_IND = 13, 1022 /// Write Signed Enabled attribute Mask 1023 SONATA_PERM_MASK_WRITE_SIGNED = 0x4000, 1024 SONATA_PERM_POS_WRITE_SIGNED = 14, 1025 /// Extended properties descriptor present 1026 SONATA_PERM_MASK_EXT = 0x8000, 1027 SONATA_PERM_POS_EXT = 15, 1028 1029 /// Properties 1030 SONATA_PERM_MASK_PROP = 0xFF00, 1031 SONATA_PERM_POS_PROP = 8, 1032 }; 1033 1034 /** 1035 * Value permission bit field 1036 * 1037 * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1038 * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ 1039 * | RI |UUID_LEN |EKS | MAX_LEN (RI = 1) / Value Offset (RI = 0) | 1040 * +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ 1041 * 1042 * Bit [0-11] : Maximum Attribute Length or Value Offset pointer 1043 * Bit [12] : Encryption key Size must be 16 bytes 1044 * Bit [14-13]: UUID Length (0 = 16 bits, 1 = 32 bits, 2 = 128 bits, 3 = RFU) 1045 * Bit [15] : Trigger Read Indication (0 = Value present in Database, 1 = Value not present in Database) 1046 */ 1047 enum sonata_attm_value_perm_mask { 1048 /// Maximum Attribute Length 1049 SONATA_PERM_MASK_MAX_LEN = 0x0FFF, 1050 SONATA_PERM_POS_MAX_LEN = 0, 1051 /// Attribute value Offset 1052 SONATA_PERM_MASK_VAL_OFFSET = 0x0FFF, 1053 SONATA_PERM_POS_VAL_OFFSET = 0, 1054 /// Check Encryption key size Mask 1055 SONATA_PERM_MASK_EKS = 0x1000, 1056 SONATA_PERM_POS_EKS = 12, 1057 /// UUID Length 1058 SONATA_PERM_MASK_UUID_LEN = 0x6000, 1059 SONATA_PERM_POS_UUID_LEN = 13, 1060 /// Read trigger Indication 1061 SONATA_PERM_MASK_RI = 0x8000, 1062 SONATA_PERM_POS_RI = 15, 1063 }; 1064 1065 /** 1066 * Service permissions 1067 * 1068 * 7 6 5 4 3 2 1 0 1069 * +----+----+----+----+----+----+----+----+ 1070 * |SEC |UUID_LEN |DIS | AUTH |EKS | MI | 1071 * +----+----+----+----+----+----+----+----+ 1072 * 1073 * Bit [0] : Task that manage service is multi-instantiated (Connection index is conveyed) 1074 * Bit [1] : Encryption key Size must be 16 bytes 1075 * Bit [2-3]: Service Permission (0 = NO_AUTH, 1 = UNAUTH, 2 = AUTH, 3 = Secure Connect) 1076 * Bit [4] : Disable the service 1077 * Bit [5-6]: UUID Length (0 = 16 bits, 1 = 32 bits, 2 = 128 bits, 3 = RFU) 1078 * Bit [7] : Secondary Service (0 = Primary Service, 1 = Secondary Service) 1079 */ 1080 enum sonata_attm_svc_perm_mask { 1081 /// Task that manage service is multi-instantiated 1082 SONATA_PERM_MASK_SVC_MI = 0x01, 1083 SONATA_PERM_POS_SVC_MI = 0, 1084 /// Check Encryption key size for service Access 1085 SONATA_PERM_MASK_SVC_EKS = 0x02, 1086 SONATA_PERM_POS_SVC_EKS = 1, 1087 /// Service Permission authentication 1088 SONATA_PERM_MASK_SVC_AUTH = 0x0C, 1089 SONATA_PERM_POS_SVC_AUTH = 2, 1090 /// Disable the service 1091 SONATA_PERM_MASK_SVC_DIS = 0x10, 1092 SONATA_PERM_POS_SVC_DIS = 4, 1093 /// Service UUID Length 1094 SONATA_PERM_MASK_SVC_UUID_LEN = 0x60, 1095 SONATA_PERM_POS_SVC_UUID_LEN = 5, 1096 /// Service type Secondary 1097 SONATA_PERM_MASK_SVC_SECONDARY = 0x80, 1098 SONATA_PERM_POS_SVC_SECONDARY = 7, 1099 }; 1100 1101 /// Attribute & Service access mode 1102 enum { 1103 /// Disable access 1104 SONATA_PERM_RIGHT_DISABLE = 0, 1105 /// Enable access 1106 SONATA_PERM_RIGHT_ENABLE = 1, 1107 }; 1108 1109 /// Attribute & Service access rights 1110 enum { 1111 /// No Authentication 1112 SONATA_PERM_RIGHT_NO_AUTH = 0, 1113 /// Access Requires Unauthenticated link 1114 SONATA_PERM_RIGHT_UNAUTH = 1, 1115 /// Access Requires Authenticated link 1116 SONATA_PERM_RIGHT_AUTH = 2, 1117 /// Access Requires Secure Connection link 1118 SONATA_PERM_RIGHT_SEC_CON = 3, 1119 }; 1120 1121 /// Attribute & Service UUID Length 1122 enum { 1123 /// 16 bits UUID 1124 SONATA_PERM_UUID_16 = 0, 1125 SONATA_PERM_RIGHT_UUID_16 = 0, 1126 /// 32 bits UUID 1127 SONATA_PERM_UUID_32 = 1, 1128 SONATA_PERM_RIGHT_UUID_32 = 1, 1129 /// 128 bits UUID 1130 SONATA_PERM_UUID_128 = 2, 1131 SONATA_PERM_RIGHT_UUID_128 = 2, 1132 /// Invalid 1133 SONATA_PERM_UUID_RFU = 3, 1134 }; 1135 1136 /// execute flags 1137 enum { 1138 /// Cancel All the Reliable Writes 1139 SONATA_ATT_CANCEL_ALL_PREPARED_WRITES = 0x00, 1140 /// Write All the Reliable Writes 1141 SONATA_ATT_EXECUTE_ALL_PREPARED_WRITES 1142 }; 1143 1144 /// @} ATT 1145 #endif // SONATA_ATT_H_ 1146