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_PROXY_H 17 #define OHOS_BLUETOOTH_STANDARD_GATT_SERVER_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "i_bluetooth_host.h" 21 #include "i_bluetooth_gatt_server.h" 22 namespace OHOS { 23 namespace Bluetooth { 24 class BluetoothGattServerProxy : public IRemoteProxy<IBluetoothGattServer> { 25 public: BluetoothGattServerProxy(const sptr<IRemoteObject> & impl)26 explicit BluetoothGattServerProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBluetoothGattServer>(impl){}; ~BluetoothGattServerProxy()27 ~BluetoothGattServerProxy(){}; 28 29 int AddService(int32_t appId, BluetoothGattService *services) override; 30 void ClearServices(int appId) override; 31 int Connect(int appId, const BluetoothGattDevice &device, bool isDirect) override; 32 int CancelConnection(int appId, const BluetoothGattDevice &device) override; 33 int RegisterApplication(const sptr<IBluetoothGattServerCallback> &callback) override; 34 int DeregisterApplication(int appId) override; 35 int NotifyClient( 36 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, bool needConfirm) override; 37 int RemoveService(int32_t appId, const BluetoothGattService &services) override; 38 int RespondCharacteristicRead( 39 const BluetoothGattDevice &device, BluetoothGattCharacteristic *characteristic, int32_t ret) override; 40 int RespondCharacteristicWrite( 41 const BluetoothGattDevice &device, const BluetoothGattCharacteristic &characteristic, int32_t ret) override; 42 int RespondDescriptorRead( 43 const BluetoothGattDevice &device, BluetoothGattDescriptor *descriptor, int32_t ret) override; 44 int RespondDescriptorWrite( 45 const BluetoothGattDevice &device, const BluetoothGattDescriptor &descriptor, int32_t ret) override; 46 47 private: 48 static inline BrokerDelegator<BluetoothGattServerProxy> delegator_; 49 }; 50 } // namespace Bluetooth 51 } // namespace OHOS 52 #endif // OHOS_BLUETOOTH_STANDARD_HOST_PROXY_H