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 OHOS_BLUETOOTH_STANDARD_PBAP_PCE_SERVER_H 16 #define OHOS_BLUETOOTH_STANDARD_PBAP_PCE_SERVER_H 17 18 #include "i_bluetooth_pbap_pce.h" 19 #include "bluetooth_pbap_pce_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 namespace OHOS { 25 namespace Bluetooth { 26 class BluetoothPbapPceServer : public BluetoothPbapPceStub { 27 public: 28 /** 29 * @brief constructor 30 * @details constructor 31 */ 32 explicit BluetoothPbapPceServer(); 33 34 /** 35 * @brief deconstructor 36 * @details deconstructor 37 */ 38 ~BluetoothPbapPceServer() override; 39 40 // IBluetoothPbapPce overrides: 41 42 /** 43 * @brief register observer 44 * @details register observer for the service of phone book 45 * @param observer the pointer that point to a IBluetoothPbapPceObserver 46 * @return Status 47 */ 48 void RegisterObserver(const sptr<IBluetoothPbapPceObserver> &observer) override; 49 50 // /** 51 // * @brief deregister observer 52 // * @details deregister observer for the service of phone book 53 // * @param observer the pointer that point to a IBluetoothPbapPceObserver 54 // * @return Status 55 // */ 56 void DeregisterObserver(const sptr<IBluetoothPbapPceObserver> &observer) override; 57 58 /** 59 * @brief get the remote devices 60 * @details get the remote device with the specified states 61 * @param states states 62 * @return Status 63 */ 64 void GetDevicesByStates(const ::std::vector<int32_t> states, std::vector<BluetoothRawAddress> &rawDevices) override; 65 66 /** 67 * @brief get the connected remote devices 68 * @details get the remote device with the connected states 69 * @return Status 70 */ 71 ::std::vector<BluetoothRawAddress> GetConnectedDevices() override; 72 73 /** 74 * @brief get the state of device 75 * @details get the state with the specified remote device 76 * @param device remote device 77 * @return Status 78 */ 79 int GetDeviceState(const BluetoothRawAddress &device) override; 80 81 /** 82 * @brief set the strategy of device 83 * @details set the strategy with the specified remote device 84 * @param device remote device 85 * @param strategy specified strategy 86 * @return Status 87 */ 88 int SetConnectionStrategy(const BluetoothRawAddress &device, int32_t strategy) override; 89 90 /** 91 * @brief get the strategy of device 92 * @details get the strategy with the specified remote device 93 * @param device remote device 94 * @return Status 95 */ 96 int GetConnectionStrategy(const BluetoothRawAddress &device) override; 97 98 /** 99 * @brief connect to server 100 * @details connect to phone book server 101 * @param device remote device 102 * @return Status 103 */ 104 int Connect(const BluetoothRawAddress &device) override; 105 106 /** 107 * @brief disconnect device 108 * @details disconnect from remote device 109 * @param device remote device 110 * @return Status 111 */ 112 int Disconnect(const BluetoothRawAddress &device) override; 113 int PullPhoneBook(const BluetoothRawAddress &device, const BluetoothIPbapPullPhoneBookParam ¶m) override; 114 int SetPhoneBook(const BluetoothRawAddress &device, const std::u16string &name, int32_t flag) override; 115 int PullvCardListing(const BluetoothRawAddress &device, const BluetoothIPbapPullvCardListingParam ¶m) override; 116 int PullvCardEntry(const BluetoothRawAddress &device, const BluetoothIPbapPullvCardEntryParam ¶m) override; 117 bool IsDownloading(const BluetoothRawAddress &device) override; 118 int AbortDownloading(const BluetoothRawAddress &device) override; 119 int SetDevicePassword(const BluetoothRawAddress &device, const std::string &password, const std::string &userId) override; 120 121 private: 122 BLUETOOTH_DECLARE_IMPL(); 123 BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothPbapPceServer); 124 }; 125 126 } // namespace Bluetooth 127 } // namespace OHOS 128 #endif // OHOS_BLUETOOTH_STANDARD_PBAP_PCE_SERVER_H