1 /* 2 * Copyright (C) 2022 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_A2DP_SINK_PROXY_H 17 #define OHOS_BLUETOOTH_STANDARD_A2DP_SINK_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "i_bluetooth_a2dp_sink.h" 21 #include "raw_address.h" 22 23 namespace OHOS { 24 namespace Bluetooth { 25 using namespace OHOS::bluetooth; 26 class BluetoothA2dpSinkProxy : public IRemoteProxy<IBluetoothA2dpSink> { 27 public: BluetoothA2dpSinkProxy(const sptr<IRemoteObject> & impl)28 explicit BluetoothA2dpSinkProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBluetoothA2dpSink>(impl) 29 {} ~BluetoothA2dpSinkProxy()30 ~BluetoothA2dpSinkProxy() 31 {} 32 33 int Connect(const RawAddress &device) override; 34 int Disconnect(const RawAddress &device) override; 35 void RegisterObserver(const sptr<IBluetoothA2dpSinkObserver> &observer) override; 36 void DeregisterObserver(const sptr<IBluetoothA2dpSinkObserver> &observer) override; 37 std::vector<RawAddress> GetDevicesByStates(const std::vector<int32_t> &states) override; 38 int GetDeviceState(const RawAddress &device) override; 39 int GetPlayingState(const RawAddress &device, int &state) override; 40 int SetConnectStrategy(const RawAddress &device, int32_t strategy) override; 41 int GetConnectStrategy(const RawAddress &device) override; 42 int SendDelay(const RawAddress &device, int32_t delayValue) override; 43 44 private: 45 static inline BrokerDelegator<BluetoothA2dpSinkProxy> delegator_; 46 /** 47 * @brief Write the serializable data 48 * @param parcelableVector The communication data of IPC 49 * @param reply Serializable data 50 * @return true: Write the serializable data successfully; otherwise is not. 51 */ 52 bool WriteParcelableInt32Vector(const std::vector<int32_t> &parcelableVector, Parcel &reply); 53 }; 54 } // namespace Bluetooth 55 } // namespace OHOS 56 #endif // OHOS_BLUETOOTH_STANDARD_A2DP_SINK_PROXY_H