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_HOST_PROXY_H 17 #define OHOS_BLUETOOTH_STANDARD_HOST_PROXY_H 18 19 #include "bluetooth_raw_address.h" 20 #include "i_bluetooth_host.h" 21 #include "iremote_proxy.h" 22 #include "bt_def.h" 23 #include "bluetooth_remote_device_info.h" 24 25 namespace OHOS { 26 namespace Bluetooth { 27 class BluetoothHostProxy : public IRemoteProxy<IBluetoothHost> { 28 public: BluetoothHostProxy(const sptr<IRemoteObject> & impl)29 explicit BluetoothHostProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBluetoothHost>(impl) 30 {} ~BluetoothHostProxy()31 ~BluetoothHostProxy() 32 {} 33 34 void RegisterObserver(const sptr<IBluetoothHostObserver> &observer) override; 35 void DeregisterObserver(const sptr<IBluetoothHostObserver> &observer) override; 36 int32_t EnableBt() override; 37 int32_t DisableBt() override; 38 int32_t SatelliteControl(int type, int state) override; 39 sptr<IRemoteObject> GetProfile(const std::string &name) override; 40 sptr<IRemoteObject> GetBleRemote(const std::string &name) override; 41 int32_t BluetoothFactoryReset() override; 42 int32_t GetBtState(int &state) override; 43 int32_t GetLocalAddress(std::string &addr) override; 44 int32_t DisableBle() override; 45 int32_t EnableBle() override; 46 std::vector<uint32_t> GetProfileList() override; 47 int32_t GetMaxNumConnectedAudioDevices() override; 48 int32_t GetBtConnectionState(int &state) override; 49 int32_t GetBtProfileConnState(uint32_t profileId, int &state) override; 50 int32_t GetLocalDeviceClass() override; 51 bool SetLocalDeviceClass(const int32_t &deviceClass) override; 52 int32_t GetLocalName(std::string &name) override; 53 int32_t SetLocalName(const std::string &name) override; 54 int32_t GetBtScanMode(int32_t &scanMode) override; 55 int32_t SetBtScanMode(int32_t mode, int32_t duration) override; 56 int32_t GetBondableMode(const int32_t transport) override; 57 bool SetBondableMode(int32_t transport, int32_t mode) override; 58 int32_t StartBtDiscovery() override; 59 int32_t CancelBtDiscovery() override; 60 int32_t IsBtDiscovering(bool &isDisCovering, const int32_t transport) override; 61 long GetBtDiscoveryEndMillis() override; 62 int32_t GetPairedDevices(std::vector<BluetoothRawAddress> &pairedAddr) override; 63 int32_t RemovePair(const int32_t transport, const sptr<BluetoothRawAddress> &device) override; 64 bool RemoveAllPairs() override; 65 void RegisterRemoteDeviceObserver(const sptr<IBluetoothRemoteDeviceObserver> &observer) override; 66 void DeregisterRemoteDeviceObserver(const sptr<IBluetoothRemoteDeviceObserver> &observer) override; 67 int32_t GetBleMaxAdvertisingDataLength() override; 68 int32_t GetDeviceType(int32_t transport, const std::string &address) override; 69 int32_t GetPhonebookPermission(const std::string &address) override; 70 bool SetPhonebookPermission(const std::string &address, int32_t permission) override; 71 int32_t GetMessagePermission(const std::string &address) override; 72 bool SetMessagePermission(const std::string &address, int32_t permission) override; 73 int32_t GetPowerMode(const std::string &address) override; 74 int32_t GetDeviceName(int32_t transport, const std::string &address, std::string &name) override; 75 std::string GetDeviceAlias(const std::string &address) override; 76 int32_t SetDeviceAlias(const std::string &address, const std::string &aliasName) override; 77 int32_t GetRemoteDeviceBatteryInfo(const std::string &address, BluetoothBatteryInfo &info) override; 78 int32_t GetPairState(int32_t transport, const std::string &address, int32_t &pairState) override; 79 int32_t StartPair(int32_t transport, const std::string &address) override; 80 int32_t StartCrediblePair(int32_t transport, const std::string &address) override; 81 bool CancelPairing(int32_t transport, const std::string &address) override; 82 bool IsBondedFromLocal(int32_t transport, const std::string &address) override; 83 bool IsAclConnected(int32_t transport, const std::string &address) override; 84 bool IsAclEncrypted(int32_t transport, const std::string &address) override; 85 int32_t GetDeviceClass(const std::string &address, int &cod) override; 86 int32_t SetDevicePin(const std::string &address, const std::string &pin) override; 87 int32_t SetDevicePairingConfirmation(int32_t transport, const std::string &address, bool accept) override; 88 bool SetDevicePasskey(int32_t transport, const std::string &address, int32_t passkey, bool accept) override; 89 bool PairRequestReply(int32_t transport, const std::string &address, bool accept) override; 90 bool ReadRemoteRssiValue(const std::string &address) override; 91 void GetLocalSupportedUuids(std::vector<std::string> &uuids) override; 92 int32_t GetDeviceUuids(const std::string &address, std::vector<std::string> &uuids) override; 93 int32_t GetLocalProfileUuids(std::vector<std::string> &uuids) override; 94 void RegisterBleAdapterObserver(const sptr<IBluetoothHostObserver> &observer) override; 95 void DeregisterBleAdapterObserver(const sptr<IBluetoothHostObserver> &observer) override; 96 void RegisterBlePeripheralCallback(const sptr<IBluetoothBlePeripheralObserver> &observer) override; 97 void DeregisterBlePeripheralCallback(const sptr<IBluetoothBlePeripheralObserver> &observer) override; 98 int32_t SetFastScan(bool isEnable) override; 99 int32_t GetRandomAddress(const std::string &realAddr, std::string &randomAddr) override; 100 int32_t SyncRandomAddress(const std::string &realAddr, const std::string &randomAddr) override; 101 int32_t ConnectAllowedProfiles(const std::string &remoteAddr) override; 102 int32_t DisconnectAllowedProfiles(const std::string &remoteAddr) override; 103 int32_t SetDeviceCustomType(const std::string &address, int32_t deviceType) override; 104 int32_t GetRemoteDeviceInfo(const std::string &address, 105 std::shared_ptr<BluetoothRemoteDeviceInfo> &deviceInfo, int type) override; 106 void RegisterBtResourceManagerObserver(const sptr<IBluetoothResourceManagerObserver> &observer) override; 107 void DeregisterBtResourceManagerObserver(const sptr<IBluetoothResourceManagerObserver> &observer) override; 108 int32_t IsSupportVirtualAutoConnect(const std::string &address, bool &outSupport) override; 109 int32_t SetVirtualAutoConnectType(const std::string &address, int connType, int businessType) override; 110 int32_t SetFastScanLevel(int level) override; 111 void UpdateVirtualDevice(int32_t action, const std::string &address) override; 112 int32_t EnableBluetoothToRestrictMode(void) override; 113 private: 114 int32_t InnerTransact(uint32_t code, MessageOption &flags, MessageParcel &data, MessageParcel &reply); 115 static inline BrokerDelegator<BluetoothHostProxy> delegator_; 116 }; 117 } // namespace Bluetooth 118 } // namespace OHOS 119 #endif // OHOS_BLUETOOTH_STANDARD_HOST_PROXY_H 120