1 /*
2  * Copyright (C) 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 #ifndef OHOS_BLUETOOTH_IBLUETOOTHPAN_H
16 #define OHOS_BLUETOOTH_IBLUETOOTHPAN_H
17 
18 #include <vector>
19 #include <string_ex.h>
20 #include <iremote_broker.h>
21 #include "bluetooth_service_ipc_interface_code.h"
22 #include "i_bluetooth_pan_observer.h"
23 
24 using OHOS::Bluetooth::IBluetoothPanObserver;
25 
26 namespace OHOS {
27 namespace Bluetooth {
28 using namespace OHOS::bluetooth;
29 
30 class IBluetoothPan : public IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Bluetooth.IBluetoothPan");
33 
34     virtual int32_t Disconnect(const BluetoothRawAddress &device) = 0;
35     virtual int32_t GetDeviceState(const BluetoothRawAddress &device, int32_t &state) = 0;
36     virtual int32_t GetDevicesByStates(const std::vector<int32_t> &states,
37         std::vector<BluetoothRawAddress>& result) = 0;
38     virtual ErrCode RegisterObserver(const sptr<IBluetoothPanObserver> observer) = 0;
39     virtual ErrCode DeregisterObserver(const sptr<IBluetoothPanObserver> observer) = 0;
40     virtual int32_t SetTethering(const bool value) = 0;
41     virtual int32_t IsTetheringOn(bool &result) = 0;
42 
43 protected:
44     static constexpr int COMMAND_DISCONNECT = MIN_TRANSACTION_ID + 0;
45     static constexpr int COMMAND_GET_DEVICE_STATE = MIN_TRANSACTION_ID + 1;
46     static constexpr int COMMAND_GET_DEVICES_BY_STATES = MIN_TRANSACTION_ID + 2;
47     static constexpr int COMMAND_REGISTER_OBSERVER = MIN_TRANSACTION_ID + 3;
48     static constexpr int COMMAND_DEREGISTER_OBSERVER = MIN_TRANSACTION_ID + 4;
49     static constexpr int COMMAND_SET_TETHERING = MIN_TRANSACTION_ID + 5;
50     static constexpr int COMMAND_IS_TETHERING_ON = MIN_TRANSACTION_ID + 6;
51 };
52 }  // namespace Bluetooth
53 }  // namespace OHOS
54 
55 #endif  // OHOS_BLUETOOTH_IBLUETOOTHPAN_H