1 /*
2  * Copyright (C) 2021 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_GATT_CLIENT_INTERFACE_H
17 #define OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 #include "bluetooth_service_ipc_interface_code.h"
21 #include "i_bluetooth_gatt_client_callback.h"
22 #include "../parcel/bluetooth_gatt_characteristic_parcel.h"
23 #include "../parcel/bluetooth_gatt_descriptor_parcel.h"
24 #include "../parcel/bluetooth_gatt_device.h"
25 #include "../parcel/bluetooth_gatt_service_parcel.h"
26 #include "../parcel/bluetooth_raw_address.h"
27 
28 namespace OHOS {
29 namespace Bluetooth {
30 class IBluetoothGattClient : public OHOS::IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetoothGattClient");
33 
34     virtual int RegisterApplication(
35         const sptr<IBluetoothGattClientCallback> &callback, const BluetoothRawAddress &addr, int32_t transport) = 0;
36     virtual int RegisterApplication(const sptr<IBluetoothGattClientCallback> &callback,
37         const BluetoothRawAddress &addr, int32_t transport, int &appId) = 0;
38     virtual int DeregisterApplication(int32_t appId) = 0;
39     virtual int Connect(int32_t appId, bool autoConnect) = 0;
40     virtual int Disconnect(int32_t appId) = 0;
41     virtual int DiscoveryServices(int32_t appId) = 0;
42     virtual int ReadCharacteristic(int32_t appId, const BluetoothGattCharacteristic &characteristic) = 0;
43     virtual int WriteCharacteristic(
44         int32_t appId, BluetoothGattCharacteristic *characteristic, bool withoutRespond) = 0;
45     virtual int SignedWriteCharacteristic(int32_t appId, BluetoothGattCharacteristic *characteristic) = 0;
46     virtual int ReadDescriptor(int32_t appId, const BluetoothGattDescriptor &descriptor) = 0;
47     virtual int WriteDescriptor(int32_t appId, BluetoothGattDescriptor *descriptor) = 0;
48     virtual int RequestExchangeMtu(int32_t appId, int32_t mtu) = 0;
49     virtual void GetAllDevice(std::vector<BluetoothGattDevice> &device) = 0;
50     virtual int RequestConnectionPriority(int32_t appId, int32_t connPriority) = 0;
51     virtual int GetServices(int32_t appId, std::vector<BluetoothGattService> &service) = 0;
52     virtual int RequestFastestConn(const BluetoothRawAddress &addr) = 0;
53     virtual int ReadRemoteRssiValue(int32_t appId) = 0;
54     virtual int RequestNotification(int32_t appId, uint16_t characterHandle, bool enable) = 0;
55 };
56 }  // namespace Bluetooth
57 }  // namespace OHOS
58 #endif  // OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_INTERFACE_H