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 #ifndef OHOS_BLUETOOTH_STANDARD_GATT_SERVER_SERVER_H
16 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_SERVER_H
17 
18 #include "i_bluetooth_gatt_server.h"
19 #include "bluetooth_gatt_server_stub.h"
20 #include "if_system_ability_manager.h"
21 #include "iservice_registry.h"
22 #include "system_ability.h"
23 #include "bluetooth_types.h"
24 namespace OHOS {
25 namespace Bluetooth {
26 class BluetoothGattServerServer : public BluetoothGattServerStub {
27 public:
28     BluetoothGattServerServer();
29     ~BluetoothGattServerServer() override;
30 
31     int AddService(int32_t appId, BluetoothGattService *services) override;
32     void ClearServices(int appId) override;
33     int Connect(int appId, const BluetoothGattDevice &device, bool isDirect) override;
34     int CancelConnection(int appId, const BluetoothGattDevice &device) override;
35     int RegisterApplication(const sptr<IBluetoothGattServerCallback> &callback) override;
36     int DeregisterApplication(int32_t appId) override;
37     int NotifyClient(
38         const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, bool needConfirm) override;
39     int RemoveService(int32_t appId, const BluetoothGattService &services) override;
40     int RespondCharacteristicRead(
41         const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, int32_t ret) override;
42     int RespondCharacteristicWrite(
43         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int32_t ret) override;
44     int RespondDescriptorRead(
45         const BluetoothGattDevice &device, BluetoothGattDescriptor *descriptor, int32_t ret) override;
46     int RespondDescriptorWrite(
47         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor, int32_t ret) override;
48 
49 private:
50     BLUETOOTH_DECLARE_IMPL();
51     BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothGattServerServer);
52 };
53 }  // namespace Bluetooth
54 }  // namespace OHOS
55 #endif  // OHOS_BLUETOOTH_STANDARD_A2DP_SOURCE_SERVER_H