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( 33 const BluetoothGattDevice &device, int32_t ret, int32_t state, int32_t disconnectReason) override; 34 void OnAddService(int32_t ret, const BluetoothGattService &service) override; 35 void OnCharacteristicWriteRequest(const BluetoothGattDevice &device, 36 const BluetoothGattCharacteristic &characteristic, bool needRespones) override; 37 void OnDescriptorReadRequest(const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) override; 38 void OnDescriptorWriteRequest( 39 const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor) override; 40 void OnMtuChanged(const BluetoothGattDevice &device, int32_t mtu) override; 41 void OnNotifyConfirm( 42 const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int result) override; 43 void OnConnectionParameterChanged( 44 const BluetoothGattDevice &device, int32_t interval, int32_t latency, int32_t timeout, int32_t status) override; 45 46 private: 47 static inline BrokerDelegator<BluetoothGattServerCallbackProxy> delegator_; 48 }; 49 } // namespace Bluetooth 50 } // namespace OHOS 51 #endif // OHOS_BLUETOOTH_STANDARD_GATT_SERVER_CALLBACK_PROXY_H