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_SERVER_H
17 #define OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_SERVER_H
18 
19 #include <map>
20 
21 #include "bluetooth_gatt_client_stub.h"
22 #include "bluetooth_types.h"
23 #include "if_system_ability_manager.h"
24 #include "iservice_registry.h"
25 #include "system_ability.h"
26 
27 namespace OHOS {
28 namespace Bluetooth {
29 class BluetoothGattClientServer : public BluetoothGattClientStub {
30 public:
31     explicit BluetoothGattClientServer();
32     ~BluetoothGattClientServer() override;
33 
34     int RegisterApplication(const sptr<IBluetoothGattClientCallback> &callback, const BluetoothRawAddress &addr,
35         int32_t transport, int &appId) override;
36 
37     int RegisterApplication(const sptr<IBluetoothGattClientCallback> &callback, const BluetoothRawAddress &addr,
38         int32_t transport) override;
39     int DeregisterApplication(int32_t appId) override;
40     int Connect(int32_t appId, bool autoConnect) override;
41     int Disconnect(int32_t appId) override;
42     int DiscoveryServices(int32_t appId) override;
43     int ReadCharacteristic(int32_t appId, const BluetoothGattCharacteristic &characteristic) override;
44     int WriteCharacteristic(int32_t appId, BluetoothGattCharacteristic *characteristic, bool withoutRespond) override;
45     int SignedWriteCharacteristic(int32_t appId, BluetoothGattCharacteristic *characteristic) override;
46     int ReadDescriptor(int32_t appId, const BluetoothGattDescriptor &descriptor) override;
47     int WriteDescriptor(int32_t appId, BluetoothGattDescriptor *descriptor) override;
48     int RequestExchangeMtu(int32_t appId, int32_t mtu) override;
49     void GetAllDevice(::std::vector<BluetoothGattDevice> &device) override;
50     int RequestConnectionPriority(int32_t appId, int32_t connPriority) override;
51     int GetServices(int32_t appId, ::std::vector<BluetoothGattService> &service) override;
52     int RequestFastestConn(const BluetoothRawAddress &addr) override;
53     int ReadRemoteRssiValue(int32_t appId) override;
54     int RequestNotification(int32_t appId, uint16_t characterHandle, bool enable) override;
55 
56 private:
57     BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothGattClientServer);
58     BLUETOOTH_DECLARE_IMPL();
59 };
60 }  // namespace Bluetooth
61 }  // namespace OHOS
62 #endif  // OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_SERVER_H