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_PROXY_H 17 #define OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "i_bluetooth_gatt_client.h" 21 22 namespace OHOS { 23 namespace Bluetooth { 24 class BluetoothGattClientProxy : public IRemoteProxy<IBluetoothGattClient> { 25 public: BluetoothGattClientProxy(const sptr<IRemoteObject> & impl)26 explicit BluetoothGattClientProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBluetoothGattClient>(impl) 27 {} ~BluetoothGattClientProxy()28 ~BluetoothGattClientProxy() 29 {} 30 31 int RegisterApplication(const sptr<IBluetoothGattClientCallback> &callback, const BluetoothRawAddress &addr, 32 int32_t transport) override; 33 34 int RegisterApplication(const sptr<IBluetoothGattClientCallback> &callback, const BluetoothRawAddress &addr, 35 int32_t transport, int &appId) override; 36 int DeregisterApplication(int32_t appId) override; 37 int Connect(int32_t appId, bool autoConnect) override; 38 int Disconnect(int32_t appId) override; 39 int DiscoveryServices(int32_t appId) override; 40 int ReadCharacteristic(int32_t appId, const BluetoothGattCharacteristic &characteristic) override; 41 int WriteCharacteristic(int32_t appId, BluetoothGattCharacteristic *characteristic, bool withoutRespond) override; 42 int SignedWriteCharacteristic(int32_t appId, BluetoothGattCharacteristic *characteristic) override; 43 int ReadDescriptor(int32_t appId, const BluetoothGattDescriptor &descriptor) override; 44 int WriteDescriptor(int32_t appId, BluetoothGattDescriptor *descriptor) override; 45 int RequestExchangeMtu(int32_t appId, int32_t mtu) override; 46 void GetAllDevice(std::vector<BluetoothGattDevice> &devices) override; 47 int RequestConnectionPriority(int32_t appId, int32_t connPriority) override; 48 int GetServices(int32_t appId, std::vector<BluetoothGattService> &service) override; 49 int RequestFastestConn(const BluetoothRawAddress &addr) override; 50 int ReadRemoteRssiValue(int32_t appId) override; 51 int RequestNotification(int32_t appId, uint16_t characterHandle, bool enable) override; 52 53 private: 54 static inline BrokerDelegator<BluetoothGattClientProxy> delegator_; 55 }; 56 } // namespace Bluetooth 57 } // namespace OHOS 58 #endif // OHOS_BLUETOOTH_STANDARD_GATT_CLIENT_PROXY_H