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 bool IsBrEnabled() override; 47 bool IsBleEnabled() override; 48 std::vector<uint32_t> GetProfileList() override; 49 int32_t GetMaxNumConnectedAudioDevices() override; 50 int32_t GetBtConnectionState(int &state) override; 51 int32_t GetBtProfileConnState(uint32_t profileId, int &state) override; 52 int32_t GetLocalDeviceClass() override; 53 bool SetLocalDeviceClass(const int32_t &deviceClass) override; 54 int32_t GetLocalName(std::string &name) override; 55 int32_t SetLocalName(const std::string &name) override; 56 int32_t GetBtScanMode(int32_t &scanMode) override; 57 int32_t SetBtScanMode(int32_t mode, int32_t duration) override; 58 int32_t GetBondableMode(const int32_t transport) override; 59 bool SetBondableMode(int32_t transport, int32_t mode) override; 60 int32_t StartBtDiscovery() override; 61 int32_t CancelBtDiscovery() override; 62 int32_t IsBtDiscovering(bool &isDisCovering, const int32_t transport) override; 63 long GetBtDiscoveryEndMillis() override; 64 int32_t GetPairedDevices(std::vector<BluetoothRawAddress> &pairedAddr) override; 65 int32_t RemovePair(const int32_t transport, const sptr<BluetoothRawAddress> &device) override; 66 bool RemoveAllPairs() override; 67 void RegisterRemoteDeviceObserver(const sptr<IBluetoothRemoteDeviceObserver> &observer) override; 68 void DeregisterRemoteDeviceObserver(const sptr<IBluetoothRemoteDeviceObserver> &observer) override; 69 int32_t GetBleMaxAdvertisingDataLength() override; 70 int32_t GetDeviceType(int32_t transport, const std::string &address) override; 71 int32_t GetPhonebookPermission(const std::string &address) override; 72 bool SetPhonebookPermission(const std::string &address, int32_t permission) override; 73 int32_t GetMessagePermission(const std::string &address) override; 74 bool SetMessagePermission(const std::string &address, int32_t permission) override; 75 int32_t GetPowerMode(const std::string &address) override; 76 int32_t GetDeviceName(int32_t transport, const std::string &address, std::string &name) override; 77 std::string GetDeviceAlias(const std::string &address) override; 78 int32_t SetDeviceAlias(const std::string &address, const std::string &aliasName) override; 79 int32_t GetRemoteDeviceBatteryInfo(const std::string &address, BluetoothBatteryInfo &info) override; 80 int32_t GetPairState(int32_t transport, const std::string &address, int32_t &pairState) override; 81 int32_t StartPair(int32_t transport, const std::string &address) override; 82 int32_t StartCrediblePair(int32_t transport, const std::string &address) override; 83 bool CancelPairing(int32_t transport, const std::string &address) override; 84 bool IsBondedFromLocal(int32_t transport, const std::string &address) override; 85 bool IsAclConnected(int32_t transport, const std::string &address) override; 86 bool IsAclEncrypted(int32_t transport, const std::string &address) override; 87 int32_t GetDeviceClass(const std::string &address, int &cod) override; 88 int32_t SetDevicePin(const std::string &address, const std::string &pin) override; 89 int32_t SetDevicePairingConfirmation(int32_t transport, const std::string &address, bool accept) override; 90 bool SetDevicePasskey(int32_t transport, const std::string &address, int32_t passkey, bool accept) override; 91 bool PairRequestReply(int32_t transport, const std::string &address, bool accept) override; 92 bool ReadRemoteRssiValue(const std::string &address) override; 93 void GetLocalSupportedUuids(std::vector<std::string> &uuids) override; 94 int32_t GetDeviceUuids(const std::string &address, std::vector<std::string> &uuids) override; 95 int32_t GetLocalProfileUuids(std::vector<std::string> &uuids) override; 96 void RegisterBleAdapterObserver(const sptr<IBluetoothHostObserver> &observer) override; 97 void DeregisterBleAdapterObserver(const sptr<IBluetoothHostObserver> &observer) override; 98 void RegisterBlePeripheralCallback(const sptr<IBluetoothBlePeripheralObserver> &observer) override; 99 void DeregisterBlePeripheralCallback(const sptr<IBluetoothBlePeripheralObserver> &observer) override; 100 int32_t SetFastScan(bool isEnable) override; 101 int32_t GetRandomAddress(const std::string &realAddr, std::string &randomAddr) override; 102 int32_t SyncRandomAddress(const std::string &realAddr, const std::string &randomAddr) override; 103 int32_t ConnectAllowedProfiles(const std::string &remoteAddr) override; 104 int32_t DisconnectAllowedProfiles(const std::string &remoteAddr) override; 105 int32_t SetDeviceCustomType(const std::string &address, int32_t deviceType) override; 106 int32_t GetRemoteDeviceInfo(const std::string &address, 107 std::shared_ptr<BluetoothRemoteDeviceInfo> &deviceInfo, int type) override; 108 void RegisterBtResourceManagerObserver(const sptr<IBluetoothResourceManagerObserver> &observer) override; 109 void DeregisterBtResourceManagerObserver(const sptr<IBluetoothResourceManagerObserver> &observer) override; 110 void UpdateVirtualDevice(int32_t action, const std::string &address) override; 111 int32_t IsSupportVirtualAutoConnect(const std::string &address, bool &outSupport) override; 112 int32_t SetVirtualAutoConnectType(const std::string &address, int connType, int businessType) override; 113 int32_t SetFastScanLevel(int level) override; 114 int32_t EnableBluetoothToRestrictMode(void) override; 115 private: 116 int32_t InnerTransact(uint32_t code, MessageOption &flags, MessageParcel &data, MessageParcel &reply); 117 static inline BrokerDelegator<BluetoothHostProxy> delegator_; 118 }; 119 } // namespace Bluetooth 120 } // namespace OHOS 121 #endif // OHOS_BLUETOOTH_STANDARD_HOST_PROXY_H 122