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 OHOS_BLUETOOTH_STANDARD_BLE_CENTRAL_MANAGER_INTERFACE_H
17 #define OHOS_BLUETOOTH_STANDARD_BLE_CENTRAL_MANAGER_INTERFACE_H
18 
19 #include <set>
20 #include "../parcel/bluetooth_ble_scan_filter.h"
21 #include "../parcel/bluetooth_ble_scan_settings.h"
22 #include "../parcel/bluetooth_ble_advertiser_data.h"
23 #include "../parcel/bluetooth_ble_advertiser_settings.h"
24 #include "bluetooth_service_ipc_interface_code.h"
25 #include "i_bluetooth_ble_central_manager_callback.h"
26 #include "iremote_broker.h"
27 
28 namespace OHOS {
29 namespace Bluetooth {
30 struct BluetoothActiveDeviceInfo {
31     std::vector<int8_t> deviceId;
32     int32_t status;
33     int32_t timeOut;
34 };
35 struct BluetoothLpDeviceParamSet {
36     BluetoothBleScanSettings btScanSettings;
37     std::vector<BluetoothBleScanFilter> btScanFilters;
38     BluetoothBleAdvertiserSettings btAdvSettings;
39     BluetoothBleAdvertiserData btAdvData;
40     BluetoothBleAdvertiserData btRespData;
41     bluetooth::Uuid uuid;
42     std::vector<BluetoothActiveDeviceInfo> activeDeviceInfos;
43     int32_t deliveryMode;
44     int32_t advHandle;
45     int32_t duration;
46     uint32_t fieldValidFlagBit;
47 };
48 
49 class IBluetoothBleCentralManager : public OHOS::IRemoteBroker {
50 public:
51     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetootBleCentralManager");
52     virtual void RegisterBleCentralManagerCallback(int32_t &scannerId, bool enableRandomAddrMode,
53         const sptr<IBluetoothBleCentralManagerCallback> &callback) = 0;
54     virtual void DeregisterBleCentralManagerCallback(int32_t scannerId,
55         const sptr<IBluetoothBleCentralManagerCallback> &callback) = 0;
56     virtual int StartScan(int32_t scannerId, const BluetoothBleScanSettings &settings,
57         const std::vector<BluetoothBleScanFilter> &filters) = 0;
58     virtual int StopScan(int32_t scannerId) = 0;
59     virtual void RemoveScanFilter(int32_t scannerId) = 0;
60     virtual bool FreezeByRss(std::set<int> pidSet, bool isProxy) = 0;
61     virtual bool ResetAllProxy() = 0;
62     virtual int SetLpDeviceAdvParam(int duration, int maxExtAdvEvents, int window, int interval, int advHandle) = 0;
63     virtual int SetScanReportChannelToLpDevice(int32_t scannerId, bool enable) = 0;
64     virtual int EnableSyncDataToLpDevice() = 0;
65     virtual int DisableSyncDataToLpDevice() = 0;
66     virtual int SendParamsToLpDevice(const std::vector<uint8_t> &dataValue, int32_t type) = 0;
67     virtual bool IsLpDeviceAvailable() = 0;
68     virtual int SetLpDeviceParam(const BluetoothLpDeviceParamSet &paramSet) = 0;
69     virtual int RemoveLpDeviceParam(const bluetooth::Uuid &uuid) = 0;
70 };
71 }  // namespace Bluetooth
72 }  // namespace OHOS
73 #endif  // OHOS_BLUETOOTH_STANDARD_BLE_CENTRAL_MANAGER_INTERFACE_H