//***************************************************************************** // //! @file gatt_db.c //! //! @brief GATT Databse. //! // //***************************************************************************** //***************************************************************************** // // Copyright (c) 2020, Ambiq Micro // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // Third party software included in this distribution is subject to the // additional license terms as defined in the /docs/licenses directory. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // This is part of revision 2.4.2 of the AmbiqSuite Development Package. // //***************************************************************************** /** * \file gatt_db.c * GATT Databse. */ /** * GATT DATABASE QUICK REFERENCE TABLE: * Abbreviations used for Permission: * Rd = Read * WwR = Write Without Response * Wr = Write * Swr = Signed Write * Ntf = Notification * Ind = Indication * * Handle | ATT_Type | Permission | ATT_VALUE * ========+====================+==================+===================== * 0x0001 | 0x2800 | Rd | 0x1800 * --------+--------------------+------------------+--------------------- * 0x0002 | 0x2803 | Rd | 0x02, 0x0003, 0x2A00 * --------+--------------------+------------------+--------------------- * 0x0003 | 0x2A00 | Rd | MindtreeHeartRateBelt * --------+--------------------+------------------+--------------------- * 0x0004 | 0x2803 | Rd | 0x02, 0x0005, 0x2A01 * --------+--------------------+------------------+--------------------- * 0x0005 | 0x2A01 | Rd | 833.0 * ========+====================+==================+===================== * 0x0006 | 0x2800 | Rd | 0x1801 * --------+--------------------+------------------+--------------------- * 0x0007 | 0x2803 | Rd | 0x20, 0x0008, 0x2A05 * --------+--------------------+------------------+--------------------- * 0x0008 | 0x2A05 | Ind | N/A * --------+--------------------+------------------+--------------------- * 0x0009 | 0x2902 | Rd, Wr | 0x0000 * ========+====================+==================+===================== * 0x000A | 0x2800 | Rd | 0x180F * --------+--------------------+------------------+--------------------- * 0x000B | 0x2803 | Rd | 0x12, 0x000C, 0x2A19 * --------+--------------------+------------------+--------------------- * 0x000C | 0x2A19 | Rd, Ntf | 100.0 * --------+--------------------+------------------+--------------------- * 0x000D | 0x2902 | Rd, Wr | 0x0000 * --------+--------------------+------------------+--------------------- * 0x000E | 0x2904 | Rd | VALUE * ========+====================+==================+===================== * 0x000F | 0x2800 | Rd | 0x180A * --------+--------------------+------------------+--------------------- * 0x0010 | 0x2803 | Rd | 0x02, 0x0011, 0x2A29 * --------+--------------------+------------------+--------------------- * 0x0011 | 0x2A29 | Rd | Mindtree Limited. * --------+--------------------+------------------+--------------------- * 0x0012 | 0x2803 | Rd | 0x02, 0x0013, 0x2A24 * --------+--------------------+------------------+--------------------- * 0x0013 | 0x2A24 | Rd | HRS-1.0.0 * --------+--------------------+------------------+--------------------- * 0x0014 | 0x2803 | Rd | 0x02, 0x0015, 0x2A25 * --------+--------------------+------------------+--------------------- * 0x0015 | 0x2A25 | Rd | 1.0.0 * --------+--------------------+------------------+--------------------- * 0x0016 | 0x2803 | Rd | 0x02, 0x0017, 0x2A26 * --------+--------------------+------------------+--------------------- * 0x0017 | 0x2A26 | Rd | 1.0.0 * --------+--------------------+------------------+--------------------- * 0x0018 | 0x2803 | Rd | 0x02, 0x0019, 0x2A27 * --------+--------------------+------------------+--------------------- * 0x0019 | 0x2A27 | Rd | 1.0.0 * --------+--------------------+------------------+--------------------- * 0x001A | 0x2803 | Rd | 0x02, 0x001B, 0x2A28 * --------+--------------------+------------------+--------------------- * 0x001B | 0x2A28 | Rd | 1.0.0 * --------+--------------------+------------------+--------------------- * 0x001C | 0x2803 | Rd | 0x02, 0x001D, 0x2A23 * --------+--------------------+------------------+--------------------- * 0x001D | 0x2A23 | Rd | 11223344.0 * --------+--------------------+------------------+--------------------- * 0x001E | 0x2803 | Rd | 0x02, 0x001F, 0x2A2A * --------+--------------------+------------------+--------------------- * 0x001F | 0x2A2A | Rd | 0.0 * --------+--------------------+------------------+--------------------- * 0x0020 | 0x2803 | Rd | 0x02, 0x0021, 0x2A50 * --------+--------------------+------------------+--------------------- * 0x0021 | 0x2A50 | Rd | 0 */ /* * Copyright (C) 2013. Mindtree Ltd. * All rights reserved. */ /* --------------------------------------------- Header File Inclusion */ #include "BT_gatt_db_api.h" #include "gatt_db.h" #include "gatt_defines.h" #if ((defined AMS) && (defined GATT_DB)) /* ----------------------------------------- Global Variables */ #ifndef GATT_DB_HAVE_STATIC_CONFIGURATION DECL_CONST UCHAR gatt_service_count = GATT_SERVICE_COUNT; DECL_CONST UCHAR gatt_characteristic_count = GATT_CHARACTERISTIC_COUNT; DECL_CONST UCHAR gatt_db_max_type_count = GATT_DB_MAX_TYPE_COUNT; DECL_CONST UCHAR gatt_db_peer_val_arr_size = GATT_DB_PEER_VALUE_ARRAY_SIZE; #ifdef STORAGE_RETENTION_SUPPORT DECL_CONST UINT16 gatt_value_array_size = GATT_VALUE_ARRAY_SIZE; DECL_CONST UINT16 gatt_db_max_peer_config = GATT_DB_MAX_PEER_CONFIGURATION; #endif /* STORAGE_RETENTION_SUPPORT */ #endif /* GATT_DB_HAVE_STATIC_CONFIGURATION */ DECL_CONST UCHAR gatt_const_uuid_arr[GATT_UUID_ARRAY_SIZE] = { /* 0 - Primary Service UUID */ 0x00, 0x28, /* 2 - Secondary Service UUID */ 0x01, 0x28, /* 4 - Include UUID */ 0x02, 0x28, /* 6 - Characteristic UUID */ 0x03, 0x28, /* 8 - Characteristic Extended Properties UUID */ 0x00, 0x29, /* 10 - Characteristic User Description UUID */ 0x01, 0x29, /* 12 - Client Configuration UUID */ 0x02, 0x29, /* 14 - Server Configuration UUID */ 0x03, 0x29, /* 16 - Characteristic Format UUID */ 0x04, 0x29, /* 18 - Characteristic Aggregate Format UUID */ 0x05, 0x29, /* 20 - GAP Service UUID */ 0x00, 0x18, /* 22 - DeviceName Characteristic UUID */ 0x00, 0x2A, /* 24 - Appearance Characteristic UUID */ 0x01, 0x2A, /* 26 - GATT Service UUID */ 0x01, 0x18, /* 28 - Service Changed Characteristic UUID */ 0x05, 0x2A, /* 30 - Battery Service UUID */ 0x0F, 0x18, /* 32 - BatteryLevel Characteristic UUID */ 0x19, 0x2A, /* 34 - DeviceInformation Service UUID */ 0x0A, 0x18, /* 36 - ManufacturerName Characteristic UUID */ 0x29, 0x2A, /* 38 - ModelNumber Characteristic UUID */ 0x24, 0x2A, /* 40 - SerialNumber Characteristic UUID */ 0x25, 0x2A, /* 42 - FirmwareRevision Characteristic UUID */ 0x26, 0x2A, /* 44 - HardwareRevision Characteristic UUID */ 0x27, 0x2A, /* 46 - SoftwareRevision Characteristic UUID */ 0x28, 0x2A, /* 48 - SystemId Characteristic UUID */ 0x23, 0x2A, /* 50 - RegCertDataList Characteristic UUID */ 0x2A, 0x2A, /* 52 - PnPID Characteristic UUID */ 0x50, 0x2A, }; UCHAR gatt_value_arr[GATT_VALUE_ARRAY_SIZE] = { /* 0 - BatteryLevel(3); Default: 100.0 */ 0x64, }; DECL_CONST UCHAR gatt_const_value_arr[GATT_CONST_VALUE_ARRAY_SIZE] = { /* 0 - DeviceName(0); Property: 0x02, Value Handle: 0x0003, UUID: 0x2A00 */ 0x02, 0x03, 0x00, 0x00, 0x2A, /* 5 - DeviceName(0); Default: AmbiqMicro AMS demo */ 0x41, 0x6d, 0x62, 0x69, 0x71, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x20, 0x41, 0x4d, 0x53, 0x20, 0x64, 0x65, 0x6d, 0x6f, /* 24 - Appearance(1); Property: 0x02, Value Handle: 0x0005, UUID: 0x2A01 */ 0x02, 0x05, 0x00, 0x01, 0x2A, /* 29 - Appearance(1); Default: 833.0 */ 0x03, 0x41, /* 31 - Service Changed(2); Property: 0x20, Value Handle: 0x0008, UUID: 0x2A05 */ 0x20, 0x08, 0x00, 0x05, 0x2A, /* 36 - BatteryLevel(3); Property: 0x12, Value Handle: 0x000C, UUID: 0x2A19 */ 0x12, 0x0C, 0x00, 0x19, 0x2A, /* 41 - Presentation Fromat for BatteryLevel */ /** * Characteristic Presentation Format for BatteryLevel * - Format (1 octet) * - Exponent (1 octet) * - Unit (2 octet) * - Name Space (1 octet) * - Description (2 octet) */ 0x04, 0x00, 0xAD, 0x27, 0x01, 0x00, 0x00, /* 48 - ManufacturerName(4); Property: 0x02, Value Handle: 0x0011, UUID: 0x2A29 */ 0x02, 0x11, 0x00, 0x29, 0x2A, /* 53 - ManufacturerName(4); Default: Ambiq Micro */ 0x41, 0x6d, 0x62, 0x69, 0x71, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, /* 64 - ModelNumber(5); Property: 0x02, Value Handle: 0x0013, UUID: 0x2A24 */ 0x02, 0x13, 0x00, 0x24, 0x2A, /* 69 - ModelNumber(5); Default: AMS-1.0.0 */ 0x41, 0x4d, 0x53, 0x2d, 0x31, 0x2e, 0x30, 0x2e, 0x30, /* 78 - SerialNumber(6); Property: 0x02, Value Handle: 0x0015, UUID: 0x2A25 */ 0x02, 0x15, 0x00, 0x25, 0x2A, /* 83 - SerialNumber(6); Default: 1.0.0 */ 0x31, 0x2E, 0x30, 0x2E, 0x30, /* 88 - FirmwareRevision(7); Property: 0x02, Value Handle: 0x0017, UUID: 0x2A26 */ 0x02, 0x17, 0x00, 0x26, 0x2A, /* 93 - FirmwareRevision(7); Default: 1.0.0 */ 0x31, 0x2E, 0x30, 0x2E, 0x30, /* 98 - HardwareRevision(8); Property: 0x02, Value Handle: 0x0019, UUID: 0x2A27 */ 0x02, 0x19, 0x00, 0x27, 0x2A, /* 103 - HardwareRevision(8); Default: 1.0.0 */ 0x31, 0x2E, 0x30, 0x2E, 0x30, /* 108 - SoftwareRevision(9); Property: 0x02, Value Handle: 0x001B, UUID: 0x2A28 */ 0x02, 0x1B, 0x00, 0x28, 0x2A, /* 113 - SoftwareRevision(9); Default: 1.0.0 */ 0x31, 0x2E, 0x30, 0x2E, 0x30, /* 118 - SystemId(10); Property: 0x02, Value Handle: 0x001D, UUID: 0x2A23 */ 0x02, 0x1D, 0x00, 0x23, 0x2A, /* 123 - SystemId(10); Default: 11223344.0 */ 0x31, 0x31, 0x32, 0x32, 0x33, 0x33, 0x34, 0x34, /* 131 - RegCertDataList(11); Property: 0x02, Value Handle: 0x001F, UUID: 0x2A2A */ 0x02, 0x1F, 0x00, 0x2A, 0x2A, /* 136 - RegCertDataList(11); Default: 0.0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 168 - PnPID(12); Property: 0x02, Value Handle: 0x0021, UUID: 0x2A50 */ 0x02, 0x21, 0x00, 0x50, 0x2A, /* 173 - PnPID(12); Default: 0 */ 0x01, 0x6A, 0x00, 0x4D, 0x01, 0x00, 0x01, }; UCHAR gatt_db_peer_specific_val_arr[GATT_DB_MAX_PEER_CONFIGURATION]; DECL_CONST UCHAR gatt_db_const_peer_specific_val_arr[GATT_DB_PEER_VALUE_ARRAY_SIZE] = { /* 0 - Client Configuration for Service Changed */ /* Client Instance 0 */ 0x00, 0x00, /* 2 - Client Configuration for BatteryLevel */ /* Client Instance 0 */ 0x00, 0x00, }; DECL_CONST GATT_ATTR_TYPE gatt_type_table[GATT_DB_MAX_TYPE_COUNT] = { { /* UUID Offset */ 0, /* First Occurence for Type */ 1, /* Last Occurence for Type */ 34, }, { /* UUID Offset */ 6, /* First Occurence for Type */ 2, /* Last Occurence for Type */ 40, }, { /* UUID Offset */ 12, /* First Occurence for Type */ 9, /* Last Occurence for Type */ 37, }, { /* UUID Offset */ 16, /* First Occurence for Type */ 14, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 20, /* First Occurence for Type */ 1, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 22, /* First Occurence for Type */ 3, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 24, /* First Occurence for Type */ 5, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 26, /* First Occurence for Type */ 6, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 28, /* First Occurence for Type */ 8, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 30, /* First Occurence for Type */ 10, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 32, /* First Occurence for Type */ 12, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 34, /* First Occurence for Type */ 15, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 36, /* First Occurence for Type */ 17, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 38, /* First Occurence for Type */ 19, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 40, /* First Occurence for Type */ 21, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 42, /* First Occurence for Type */ 23, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 44, /* First Occurence for Type */ 25, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 46, /* First Occurence for Type */ 27, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 48, /* First Occurence for Type */ 29, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 50, /* First Occurence for Type */ 31, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, { /* UUID Offset */ 52, /* First Occurence for Type */ 33, /* Last Occurence for Type */ ATT_INVALID_ATTR_HANDLE_VAL, }, }; DECL_CONST GATT_DB_DESC_DATA gatt_db_attr_table[GATT_DB_MAX_ATTRIBUTES] = { /* Dummy */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ ATT_INVALID_ATTR_HANDLE_VAL, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ ATT_INVALID_ATTR_HANDLE_VAL, /* Value */ NULL, }, /* Handle - 0x0001 */ /* 0 - GAP - Service Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 6, /* UUID Offset */ 0, /* Value */ (UCHAR *)(gatt_const_uuid_arr + 20), }, /* Handle - 0x0002 */ /* 0 - DeviceName - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 4, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 0), }, /* Handle - 0x0003 */ /* 0 - DeviceName - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 20, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 22, /* Value */ (UCHAR *)(gatt_const_value_arr + 5), }, /* Handle - 0x0004 */ /* 1 - Appearance - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 7, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 24), }, /* Handle - 0x0005 */ /* 1 - Appearance - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 24, /* Value */ (UCHAR *)(gatt_const_value_arr + 29), }, /* Handle - 0x0006 */ /* 1 - GATT - Service Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 10, /* UUID Offset */ 0, /* Value */ (UCHAR *)(gatt_const_uuid_arr + 26), }, /* Handle - 0x0007 */ /* 2 - Service Changed - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 11, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 31), }, /* Handle - 0x0008 */ /* 2 - Service Changed - Characteristic Value */ { /* Property */ GATT_DB_CHAR_INDICATE_PROPERTY, /* Auxillary Property */ GATT_DB_NO_AUXILLARY_PROPERTY, /* Value Length */ 0, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 28, /* Value */ NULL, }, /* Handle - 0x0009 */ /* 2 - Service Changed - CCD */ { /* Property */ GATT_DB_READ | GATT_DB_WRITE, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY | GATT_DB_PEER_SPECIFIC_VAL_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 13, /* UUID Offset */ 12, /* Value */ gatt_db_peer_specific_val_arr + 0, }, /* Handle - 0x000A */ /* 2 - Battery - Service Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 15, /* UUID Offset */ 0, /* Value */ (UCHAR *)(gatt_const_uuid_arr + 30), }, /* Handle - 0x000B */ /* 3 - BatteryLevel - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 16, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 36), }, /* Handle - 0x000C */ /* 3 - BatteryLevel - Characteristic Value */ { /* Property */ GATT_DB_READ | GATT_DB_CHAR_NOTIFY_PROPERTY, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 1, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 32, /* Value */ gatt_value_arr + 0, }, /* Handle - 0x000D */ /* 3 - BatteryLevel - CCD */ { /* Property */ GATT_DB_READ | GATT_DB_WRITE, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY | GATT_DB_PEER_SPECIFIC_VAL_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 37, /* UUID Offset */ 12, /* Value */ gatt_db_peer_specific_val_arr + 2, }, /* Handle - 0x000E */ /* Characteristic 3 - BatteryLevel - Presentation Format */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 7, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 16, /* Value */ (UCHAR *)(gatt_const_value_arr + 41), }, /* Handle - 0x000F */ /* 3 - DeviceInformation - Service Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 2, /* Next Attribute Type Index */ 34, /* UUID Offset */ 0, /* Value */ (UCHAR *)(gatt_const_uuid_arr + 34), }, /* Handle - 0x0010 */ /* 4 - ManufacturerName - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 18, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 48), }, /* Handle - 0x0011 */ /* 4 - ManufacturerName - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 11, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 36, /* Value */ (UCHAR *)(gatt_const_value_arr + 53), }, /* Handle - 0x0012 */ /* 5 - ModelNumber - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 20, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 64), }, /* Handle - 0x0013 */ /* 5 - ModelNumber - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 10, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 38, /* Value */ (UCHAR *)(gatt_const_value_arr + 69), }, /* Handle - 0x0014 */ /* 6 - SerialNumber - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 22, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 78), }, /* Handle - 0x0015 */ /* 6 - SerialNumber - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 40, /* Value */ (UCHAR *)(gatt_const_value_arr + 83), }, /* Handle - 0x0016 */ /* 7 - FirmwareRevision - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 24, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 88), }, /* Handle - 0x0017 */ /* 7 - FirmwareRevision - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 42, /* Value */ (UCHAR *)(gatt_const_value_arr + 93), }, /* Handle - 0x0018 */ /* 8 - HardwareRevision - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 26, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 98), }, /* Handle - 0x0019 */ /* 8 - HardwareRevision - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 44, /* Value */ (UCHAR *)(gatt_const_value_arr + 103), }, /* Handle - 0x001A */ /* 9 - SoftwareRevision - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 28, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 108), }, /* Handle - 0x001B */ /* 9 - SoftwareRevision - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 46, /* Value */ (UCHAR *)(gatt_const_value_arr + 113), }, /* Handle - 0x001C */ /* 10 - SystemId - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 30, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 118), }, /* Handle - 0x001D */ /* 10 - SystemId - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 8, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 48, /* Value */ (UCHAR *)(gatt_const_value_arr + 123), }, /* Handle - 0x001E */ /* 11 - RegCertDataList - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 32, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 131), }, /* Handle - 0x001F */ /* 11 - RegCertDataList - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 32, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 50, /* Value */ (UCHAR *)(gatt_const_value_arr + 136), }, /* Handle - 0x0020 */ /* 12 - PnPID - Characteristic Declaration */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 5, /* Next Attribute Type Index */ 35, /* UUID Offset */ 6, /* Value */ (UCHAR *)(gatt_const_value_arr + 168), }, /* Handle - 0x0021 */ /* 12 - PnPID - Characteristic Value */ { /* Property */ GATT_DB_READ, /* Auxillary Property */ GATT_DB_FIXED_LENGTH_PROPERTY, /* Value Length */ 7, /* Next Attribute Type Index */ ATT_INVALID_ATTR_HANDLE_VAL, /* UUID Offset */ 52, /* Value */ (UCHAR *)(gatt_const_value_arr + 173), }, }; DECL_CONST GATT_DB_CHARACERISTIC gatt_characteristic[GATT_CHARACTERISTIC_COUNT] = { /* 0 - DeviceName */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0002, /* Characteristic Service Index */ 0, }, /* 1 - Appearance */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0004, /* Characteristic Service Index */ 0, }, /* 2 - Service Changed */ { { /* Number of attributes in characteristic including the definition */ 3, }, /* Characteristic Start Handle */ 0x0007, /* Characteristic Service Index */ 1, }, /* 3 - BatteryLevel */ { { /* Number of attributes in characteristic including the definition */ 4, }, /* Characteristic Start Handle */ 0x000B, /* Characteristic Service Index */ 2, }, /* 4 - ManufacturerName */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0010, /* Characteristic Service Index */ 3, }, /* 5 - ModelNumber */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0012, /* Characteristic Service Index */ 3, }, /* 6 - SerialNumber */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0014, /* Characteristic Service Index */ 3, }, /* 7 - FirmwareRevision */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0016, /* Characteristic Service Index */ 3, }, /* 8 - HardwareRevision */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0018, /* Characteristic Service Index */ 3, }, /* 9 - SoftwareRevision */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x001A, /* Characteristic Service Index */ 3, }, /* 10 - SystemId */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x001C, /* Characteristic Service Index */ 3, }, /* 11 - RegCertDataList */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x001E, /* Characteristic Service Index */ 3, }, /* 12 - PnPID */ { { /* Number of attributes in characteristic including the definition */ 2, }, /* Characteristic Start Handle */ 0x0020, /* Characteristic Service Index */ 3, }, }; DECL_CONST GATT_DB_SERVICE gatt_service[GATT_SERVICE_COUNT] = { /* 0 - GAP */ { { /* Number of attributes in Service */ 1, }, /* Service Description */ GATT_DB_SER_NO_SECURITY_PROPERTY | GATT_DB_SER_SUPPORT_ANY_LINK_TYPE, /* Service Start Handle */ 0x0001, /* Service End Handle */ 0x0005, /* Characteristic Start Index */ 0, /* Characteristic End Index */ 1 }, /* 1 - GATT */ { { /* Number of attributes in Service */ 1, }, /* Service Description */ GATT_DB_SER_NO_SECURITY_PROPERTY | GATT_DB_SER_SUPPORT_ANY_LINK_TYPE, /* Service Start Handle */ 0x0006, /* Service End Handle */ 0x0009, /* Characteristic Start Index */ 2, /* Characteristic End Index */ 2 }, /* 2 - Battery */ { { /* Number of attributes in Service */ 1, }, /* Service Description */ GATT_DB_SER_NO_SECURITY_PROPERTY | GATT_DB_SER_SUPPORT_ANY_LINK_TYPE, /* Service Start Handle */ 0x000A, /* Service End Handle */ 0x000E, /* Characteristic Start Index */ 3, /* Characteristic End Index */ 3 }, /* 3 - DeviceInformation */ { { /* Number of attributes in Service */ 1, }, /* Service Description */ GATT_DB_SER_NO_SECURITY_PROPERTY | GATT_DB_SER_SUPPORT_ANY_LINK_TYPE, /* Service Start Handle */ 0x000F, /* Service End Handle */ 0x0021, /* Characteristic Start Index */ 4, /* Characteristic End Index */ 12 }, }; #endif /* ((defined AMS) && (defined GATT_DB)) */