MT2523 API Reference  LinkIt SDK v4
bt_type.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_PRIMARY_TYPE_H__
36 #define __BT_PRIMARY_TYPE_H__
37 
38 #ifdef BT_PLATFORM_BLE_ONLY
39 
45  #else /* BT_PLATFORM_BLE_ONLY */
46 
52  #endif /* BT_PLATFORM_BLE_ONLY */
53 
73 #include <stdbool.h>
74 #include "bt_platform.h"
75 
84 #define BT_HANDLE_INVALID 0xFFFF
85 typedef uint16_t bt_handle_t;
90 #define BT_KEY_SIZE 16
91 typedef uint8_t bt_key_t[BT_KEY_SIZE];
96 #define BT_ROLE_MASTER 0x00
97 #define BT_ROLE_SLAVE 0x01
98 typedef uint8_t bt_role_t;
100 /*
101  * +---------+-----------------------------+
102  * |Module ID | Data |
103  * +---------+-----------------------------+
104  */
105 #define BT_MODULE_OFFSET 26
106 #define BT_MODULE_MASK 0x03FFFFFFU
108 #define BT_MODULE_GENERAL (0x00U<<BT_MODULE_OFFSET)
109 #define BT_MODULE_TIMER (0x01U<<BT_MODULE_OFFSET)
110 #define BT_MODULE_MM (0x02U<<BT_MODULE_OFFSET)
111 #define BT_MODULE_HCI (0x03U<<BT_MODULE_OFFSET)
112 #define BT_MODULE_GAP (0x04U<<BT_MODULE_OFFSET)
113 #define BT_MODULE_L2CAP (0x05U<<BT_MODULE_OFFSET)
114 #define BT_MODULE_SM (0x06U<<BT_MODULE_OFFSET)
115 #define BT_MODULE_ATT (0x07U<<BT_MODULE_OFFSET)
116 #define BT_MODULE_GATT (0x08U<<BT_MODULE_OFFSET)
117 #define BT_MODULE_SYSTEM (0x09U<<BT_MODULE_OFFSET)
118 #define BT_MODULE_SDP (0x0AU<<BT_MODULE_OFFSET)
119 #define BT_MODULE_RFCOMM (0x0BU<<BT_MODULE_OFFSET)
120 #define BT_MODULE_HFP (0x0CU<<BT_MODULE_OFFSET)
121 #define BT_MODULE_SPP (0x0DU<<BT_MODULE_OFFSET)
122 #define BT_MODULE_AVRCP (0x0EU<<BT_MODULE_OFFSET)
123 #define BT_MODULE_A2DP (0x0FU<<BT_MODULE_OFFSET)
124 #define BT_MODULE_GOEP (0x10U<<BT_MODULE_OFFSET)
125 #define BT_MODULE_PBAPC (0x11U<<BT_MODULE_OFFSET)
126 #define BT_MODULE_AWS (0x12U<<BT_MODULE_OFFSET)
127 #define BT_MODULE_GENERAL_ERROR (0x3FU<<BT_MODULE_OFFSET)
129 #define BT_MODULE_NUM BT_MODULE_GENERAL_ERROR
130 typedef uint32_t bt_msg_type_t;
135 #define BT_STATUS_SUCCESS (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x00))
136 #define BT_STATUS_PENDING (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x01))
137 #define BT_STATUS_BUSY (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x02))
139 #define BT_STATUS_TIMER_FULL (BT_MODULE_TIMER|(BT_MODULE_MASK&0x1))
140 #define BT_STATUS_TIMER_NOT_FOUND (BT_MODULE_TIMER|(BT_MODULE_MASK&0x2))
142 #define BT_STATUS_FAIL (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF1))
143 #define BT_STATUS_OUT_OF_MEMORY (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF2))
144 #define BT_STATUS_TIMEOUT (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF3))
145 #define BT_STATUS_BUFFER_USED (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF4))
146 #define BT_STATUS_UNSUPPORTED (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF5))
147 #define BT_STATUS_CONNECTION_IN_USE (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF6))
148 #define BT_STATUS_LINK_IS_DISCONNECTING (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF7))
149 #define BT_STATUS_LINK_SECURITY_BLCOK (BT_MODULE_GENERAL|(BT_MODULE_MASK&0x03FFFFF8))
151 #define BT_STATUS_HCI_FLOW_CONTROLLED (BT_MODULE_HCI|0x01)
152 #define BT_STATUS_RX_PENDING (BT_MODULE_HCI|0x02)
154 #define BT_STATUS_DIRECTED_ADVERTISING_TIMEOUT (BT_MODULE_GAP|0x03)
155 #define BT_STATUS_CONNECTION_NOT_FOUND (BT_MODULE_GAP|0x04)
158 #define BT_STATUS_L2CAP_REQUEST_TIMEOUT (BT_MODULE_L2CAP|0x01)
159 #define BT_STATUS_L2CAP_LOCAL_SECURITY_BLOCKED (BT_MODULE_L2CAP|0x02)
160 #define BT_STATUS_L2CAP_LOCAL_PSM_UNSUPPORTED (BT_MODULE_L2CAP|0x03)
161 #define BT_STATUS_L2CAP_USER_REQUEST_DISCONNECT (BT_MODULE_L2CAP|0x04)
162 #define BT_STATUS_L2CAP_UNEXPECTED_SIGNAL_RECEIVED (BT_MODULE_L2CAP|0x05)
163 #define BT_STATUS_L2CAP_LOCAL_REJECTED_NO_RESOURCES (BT_MODULE_L2CAP|0x06)
164 #define BT_STATUS_L2CAP_REMOTE_PSM_UNSUPPORTED (BT_MODULE_L2CAP|0x42)
165 #define BT_STATUS_L2CAP_REMOTE_SECURITY_BLOCKED (BT_MODULE_L2CAP|0x43)
166 #define BT_STATUS_L2CAP_REMOTE_NO_RESOURCES (BT_MODULE_L2CAP|0x44)
167 #define BT_STATUS_L2CAP_CONFIG_UNACCEPTED (BT_MODULE_L2CAP|0x81)
168 #define BT_STATUS_L2CAP_CONFIG_REJECTED (BT_MODULE_L2CAP|0x82)
169 #define BT_STATUS_L2CAP_CONFIG_OPTIONS_UNKNOWN (BT_MODULE_L2CAP|0x83)
170 #define BT_STATUS_L2CAP_CHANNEL_EXISTED (BT_MODULE_L2CAP|0xA0)
173 typedef int32_t bt_status_t;
175 #define BT_BD_ADDR_LEN 6
180 typedef uint8_t bt_bd_addr_t[BT_BD_ADDR_LEN];
181 typedef uint8_t const *bt_bd_addr_ptr_t;
186 #define BT_ADDR_PUBLIC 0x00
187 #define BT_ADDR_RANDOM 0x01
188 #define BT_ADDR_PUBLIC_IDENTITY 0x02
189 #define BT_ADDR_RANDOM_IDENTITY 0x03
190 typedef uint8_t bt_addr_type_t;
192 #define BT_NULL 0
197 typedef uint8_t bt_data_t[1];
198 
211 BT_PACKED (
212 typedef struct {
213  bt_addr_type_t type;
214  bt_bd_addr_t addr;
216 
227 #endif /*__BT_PRIMARY_TYPE_H__*/
228 
#define BT_KEY_SIZE
Bluetooth SM key size, please refer to the Bluetooth core specification version 4.2 [VOL 3, part H] Section 2.3.4.
Definition: bt_type.h:90
uint8_t bt_addr_type_t
Define the address type.
Definition: bt_type.h:190
uint8_t bt_bd_addr_t[6]
Address type, defined in Bluetooth core specification version 4.2.
Definition: bt_type.h:180
This structure defines the Bluetooth address.
Definition: bt_type.h:215
uint8_t bt_key_t[16]
Define the SM key type.
Definition: bt_type.h:91