• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
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 #ifndef BLUETOOTH_HDI_H
17 #define BLUETOOTH_HDI_H
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // Hci hal backend status
25 typedef enum {
26     SUCCESS,
27     TRANSPORT_ERROR,
28     INITIALIZATION_ERROR,
29     UNKNOWN,
30 } BtInitStatus;
31 
32 typedef enum {
33     PACKET_TYPE_UNKNOWN = 0,
34     PACKET_TYPE_CMD = 1,
35     PACKET_TYPE_ACL = 2,
36     PACKET_TYPE_SCO = 3,
37     PACKET_TYPE_EVENT = 4
38 } BtPacketType;
39 
40 // Hci packet received from backend
41 typedef struct BtPacket {
42     uint8_t *data;
43     uint32_t size;
44 } BtPacket;
45 
46 // BluetoothHciCallbacks register to hal by upperlayer protocol
47 typedef struct BtHciCallbacks {
48     void (*OnInited)(BtInitStatus status);
49     void (*OnReceivedHciPacket)(BtPacketType type, const BtPacket *packet);
50 } BtHciCallbacks;
51 
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58 
59