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 #ifndef BLUETOOTH_PBAP_PSE_SERVER_H 16 #define BLUETOOTH_PBAP_PSE_SERVER_H 17 18 #include "i_bluetooth_pbap_pse.h" 19 #include "bluetooth_pbap_pse_stub.h" 20 #include "if_system_ability_manager.h" 21 #include "iservice_registry.h" 22 #include "system_ability.h" 23 #include "bluetooth_types.h" 24 25 namespace OHOS { 26 namespace Bluetooth { 27 class BluetoothPbapPseServer : public BluetoothPbapPseStub { 28 public: 29 /** 30 * @brief constructor 31 * @details constructor 32 */ 33 explicit BluetoothPbapPseServer(); 34 35 /** 36 * @brief deconstructor 37 * @details deconstructor 38 */ 39 ~BluetoothPbapPseServer() override; 40 41 // IBluetoothPbapPse overrides: 42 43 /** 44 * @brief register observer 45 * @details register observer for the service of phone book 46 * @param observer the pointer that point to a IBluetoothPbapPseObserver 47 * @return Status 48 */ 49 void RegisterObserver(const sptr<IBluetoothPbapPseObserver>& observer) override; 50 51 /** 52 * @brief deregister observer 53 * @details deregister observer for the service of phone book 54 * @param observer the pointer that point to a IBluetoothPbapPseObserver 55 * @return Status 56 */ 57 void DeregisterObserver(const sptr<IBluetoothPbapPseObserver>& observer) override; 58 59 /** 60 * @brief get the remote devices 61 * @details get the remote device with the specified states 62 * @param states states 63 * @return Status 64 */ 65 void GetDevicesByStates( 66 const ::std::vector<int32_t> tmpStates, std::vector<BluetoothRawAddress> &rawDevices) override; 67 68 /** 69 * @brief get the connected remote devices 70 * @details get the remote device with the connected states 71 * @return Status 72 */ 73 std::vector<BluetoothRawAddress> GetConnectedDevices() override; 74 75 /** 76 * @brief get the state of device 77 * @details get the state with the specified remote device 78 * @param device remote device 79 * @return Status 80 */ 81 int GetDeviceState(const BluetoothRawAddress &device) override; 82 83 /** 84 * @brief disconnect device 85 * @details disconnect from remote device 86 * @param device remote device 87 * @return Status 88 */ 89 int Disconnect(const BluetoothRawAddress &device) override; 90 int SetConnectionStrategy(const BluetoothRawAddress &device, int32_t strategy) override; 91 int GetConnectionStrategy(const BluetoothRawAddress &device) override; 92 // /** 93 // * @brief grant device's connect permission 94 // * @details grant device's connect permission 95 // * @param device remote device 96 // * @return Status 97 // */ 98 void GrantPermission(const BluetoothRawAddress& device, bool allow, bool save) override; 99 int SetDevicePassword( 100 const BluetoothRawAddress& device, const std::string &password, const std::string &userId) override; 101 102 private: 103 BLUETOOTH_DECLARE_IMPL(); 104 BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothPbapPseServer); 105 }; 106 } // namespace Bluetooth 107 } // namespace OHOS 108 #endif // OHOS_BLUETOOTH_STANDARD_PBAP_PSE_SERVER_H 109