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_HCI_CALLBACKS_H
17 #define BLUETOOTH_HCI_CALLBACKS_H
18 
19 #include <stdint.h>
20 #include <v1_0/ihci_callback.h>
21 #include "bluetooth_hdi.h"
22 #include "v1_0/hci_types.h"
23 #include "vector"
24 
25 #ifndef NO_SANITIZE
26 #ifdef __has_attribute
27 #if __has_attribute(no_sanitize)
28 #define NO_SANITIZE(type) __attribute__((no_sanitize(type)))
29 #endif
30 #endif
31 #endif
32 
33 #ifndef NO_SANITIZE
34 #define NO_SANITIZE(type)
35 #endif
36 
37 using OHOS::HDI::Bluetooth::Hci::V1_0::IHciCallback;
38 using OHOS::HDI::Bluetooth::Hci::V1_0::BtStatus;
39 using OHOS::HDI::Bluetooth::Hci::V1_0::BtType;
40 
41 class BluetoothHciCallbacks : public IHciCallback {
42 public:
BluetoothHciCallbacks(BtHciCallbacks * callbacks)43     BluetoothHciCallbacks(BtHciCallbacks *callbacks) : callbacks_(callbacks)
44     {}
~BluetoothHciCallbacks()45     virtual ~BluetoothHciCallbacks()
46     {}
47 
48     int32_t OnInited(BtStatus status) override;
49 
50     int32_t OnReceivedHciPacket(BtType type, const std::vector<uint8_t> &data) override;
51 
52 private:
53     BtHciCallbacks *callbacks_;
54 };
55 #endif
56