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_SERVER_CALLBACK_PROXY_H
17 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_CALLBACK_PROXY_H
18 
19 #include "iremote_proxy.h"
20 #include "i_bluetooth_host.h"
21 #include "i_bluetooth_gatt_server_callback.h"
22 namespace OHOS {
23 namespace Bluetooth {
24 class BluetoothGattServerCallbackProxy : public IRemoteProxy<IBluetoothGattServerCallback> {
25 public:
BluetoothGattServerCallbackProxy(const sptr<IRemoteObject> & impl)26     explicit BluetoothGattServerCallbackProxy(const sptr<IRemoteObject> &impl)
27         : IRemoteProxy<IBluetoothGattServerCallback>(impl) {};
~BluetoothGattServerCallbackProxy()28     ~BluetoothGattServerCallbackProxy() {};
29 
30     void OnCharacteristicReadRequest(
31         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic) override;
32     void OnConnectionStateChanged(const BluetoothGattDevice &device, int32_t ret, int32_t state) override;
33     void OnAddService(int32_t ret, const BluetoothGattService &service) override;
34     void OnCharacteristicWriteRequest(const BluetoothGattDevice &device,
35         const BluetoothGattCharacteristic &characteristic, bool needRespones) override;
36     void OnDescriptorReadRequest(const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) override;
37     void OnDescriptorWriteRequest(
38         const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) override;
39     void OnMtuChanged(const BluetoothGattDevice &device, int32_t mtu) override;
40     void OnNotifyConfirm(
41         const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int result) override;
42     void OnConnectionParameterChanged(
43         const BluetoothGattDevice &device, int32_t interval, int32_t latency, int32_t timeout, int32_t status) override;
44 
45 private:
46     static inline BrokerDelegator<BluetoothGattServerCallbackProxy> delegator_;
47 };
48 }  // namespace Bluetooth
49 }  // namespace OHOS
50 #endif  // OHOS_BLUETOOTH_STANDARD_GATT_SERVER_CALLBACK_PROXY_H