1 /****************************************************************************** 2 * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 3 * All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *****************************************************************************/ 18 #pragma once 19 20 #include "tl_common.h" 21 22 typedef enum { 23 Gap_Role_Broadcaster = 0, 24 Gap_Role_Observer = 1, 25 Gap_Role_Peripheral = 2, 26 Gap_Role_Central = 3, 27 } gap_role_t; 28 29 #define GAP_ADTYPE_FLAGS 0x01 // !< Discovery Mode: @ref GAP_ADTYPE_FLAGS_MODES 30 #define GAP_ADTYPE_16BIT_INCOMPLETE 0x02 // !< Incomplete List of 16-bit Service Class UUIDs 31 #define GAP_ADTYPE_16BIT_COMPLETE 0x03 // !< Complete List of 16-bit Service Class UUIDs 32 #define GAP_ADTYPE_32BIT_INCOMPLETE 0x04 // !< Service: More 32-bit UUIDs available 33 #define GAP_ADTYPE_32BIT_COMPLETE 0x05 // !< Service: Complete list of 32-bit UUIDs 34 #define GAP_ADTYPE_128BIT_INCOMPLETE 0x06 // !< Service: More 128-bit UUIDs available 35 #define GAP_ADTYPE_128BIT_COMPLETE 0x07 // !< Service: Complete list of 128-bit UUIDs 36 #define GAP_ADTYPE_LOCAL_NAME_SHORT 0x08 // !< Shortened local name 37 #define GAP_ADTYPE_LOCAL_NAME_COMPLETE 0x09 // !< Complete local name 38 #define GAP_ADTYPE_TX_POWER_LEVEL 0x0A // !< TX Power Level: 0xXX: -127 to +127 dBm 39 #define GAP_ADTYPE_OOB_CLASS_OF_DEVICE 0x0D // !< Simple Pairing OOB Tag: Class of device (3 octets) 40 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_HASHC 0x0E // !< Simple Pairing OOB Tag: Simple Pairing Hash C (16 octets) 41 #define GAP_ADTYPE_OOB_SIMPLE_PAIRING_RANDR 0x0F // !< Simple Pairing OOB Tag: Simple Pairing Randomizer R (16 octets) 42 #define GAP_ADTYPE_DEVICE_ID 0x10 // !< Device ID Profile v1.3 or later 43 #define GAP_ADTYPE_SM_TK 0x10 // !< Security Manager TK Value 44 #define GAP_ADTYPE_SM_OOB_FLAG 0x11 // !< Secutiry Manager OOB Flags 45 #define GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE \ 46 0x12 // !< Min and Max values of the connection interval (2 octets Min, 2 octets Max) 47 // (0xFFFF indicates no conn interval min or max) 48 #define GAP_ADTYPE_SERVICES_LIST_16BIT 0x14 // !< Service Solicitation: list of 16-bit Service UUIDs 49 #define GAP_ADTYPE_SERVICES_LIST_32BIT 0x1F // !< Service Solicitation: list of 32-bit Service UUIDs 50 #define GAP_ADTYPE_SERVICES_LIST_128BIT 0x15 // !< Service Solicitation: list of 128-bit Service UUIDs 51 #define GAP_ADTYPE_SERVICE_DATA 0x16 // !< Service Data 52 #define GAP_ADTYPE_SERVICE_DATA_UUID_16BIT 0x16 // !< Service Data - 16-bit UUID 53 #define GAP_ADTYPE_SERVICE_DATA_UUID_32BIT 0x20 // !< Service Data - 32-bit UUID 54 #define GAP_ADTYPE_SERVICE_DATA_UUID_128BIT 0x21 // !< Service Data - 128-bit UUID 55 #define GAP_ADTYPE_TARGET_ADDR_PUBLIC 0x17 // !< Public Target Address 56 #define GAP_ADTYPE_TARGET_ADDR_RANDOM 0x18 // !< Random Target Address 57 #define GAP_ADTYPE_APPEARANCE 0x19 // !< Appearance 58 #define GAP_ADTYPE_ADVERTISING_INTERVAL 0x1A // !< Advertising Interval 59 #define GAP_ADTYPE_LE_BLUETOOTH_DEVICE_ADDR 0x1B // !< LE Bluetooth Device Address 60 #define GAP_ADTYPE_LE_ROLE 0x1C // !< LE Role 61 #define GAP_ADTYPE_SIMPLE_PAIRING_HASHC_256 0x1D // !< Simple Pairing Hash C-256 62 #define GAP_ADTYPE_SIMPLE_PAIRING_RAND_R256 0x1E // !< Simple Pairing Randomizer R-256 63 #define GAP_ADTYPE_3D_INFORMATION_DATA 0x3D // !< 3D Synchronization Profile, v1.0 or later 64 #define GAP_ADTYPE_MANUFACTURER_SPECIFIC \ 65 0xFF // !< Manufacturer Specific Data: \ 66 // first 2 octets contain the Company Identifier Code followed by the additional manufacturer specific data 67 68 #define GAP_ADTYPE_LE_LIMITED_DISCOVERABLE_MODE_BIT 0x01 69 #define GAP_ADTYPE_LE_GENERAL_DISCOVERABLE_MODE_BIT 0x02 70 #define GAP_ADTYPE_LMP_BIT37_BIT 0x04 71 72 #define GAP_APPEARE_UNKNOWN 0x0000 // !< Unknown 73 74 /* 75 * @brief this function is used to set data pending time for a single connection. 76 * i.e in num_10ms*10ms after service discovery, notify/indication on this connection will fail. 77 * @param connHandle. connection handle. 78 * num_10ms.unit is *10ms. for example if num_10ms = 30, that indicate 30*10 = 300ms. 79 */ 80 u8 blc_gap_setSingleServerDataPendingTime_upon_ClientCmd(u16 connHandle, u16 num_10ms); 81 82 /* 83 * @brief this function is used to set data pending time. 84 * i.e in num_10ms*10ms after service discovery, notify/indication will fail. 85 * @param num_10ms.unit is *10ms. for example if num_10ms = 30, that indicate 30*10 = 300ms. 86 */ 87 void blc_att_setServerDataPendingTime_upon_ClientCmd(u16 num_10ms); 88 89 /** 90 * @brief this function is used to initialize GAP 91 * @param none 92 * @return none 93 */ 94 void blc_gap_init(void); 95