1 /* 2 * Copyright (C) 2021-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_SRC_INTERFACE_H 17 #define OHOS_BLUETOOTH_STANDARD_A2DP_SRC_INTERFACE_H 18 19 #include <string> 20 21 #include "bluetooth_service_ipc_interface_code.h" 22 #include "iremote_broker.h" 23 #include "i_bluetooth_a2dp_src_observer.h" 24 #include "../parcel/bluetooth_raw_address.h" 25 #include "../parcel/bluetooth_a2dp_a2dpCodecStatus.h" 26 #include "../parcel/bluetooth_a2dp_a2dpCodecInfo.h" 27 28 namespace OHOS { 29 namespace Bluetooth { 30 using namespace OHOS::bluetooth; 31 class IBluetoothA2dpSrc : public OHOS::IRemoteBroker { 32 public: 33 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetoothA2dpSrc"); 34 35 virtual int Connect(const RawAddress &device) = 0; 36 virtual int Disconnect(const RawAddress &device) = 0; 37 virtual void RegisterObserver(const sptr<IBluetoothA2dpSourceObserver> &observer) = 0; 38 virtual void DeregisterObserver(const sptr<IBluetoothA2dpSourceObserver> &observer) = 0; 39 virtual int GetDevicesByStates(const std::vector<int32_t> &states, std::vector<RawAddress> &rawAddrs) = 0; 40 virtual int GetDeviceState(const RawAddress &device, int &state) = 0; 41 virtual int GetPlayingState(const RawAddress &device, int &state) = 0; 42 virtual int SetConnectStrategy(const RawAddress &device, int32_t strategy) = 0; 43 virtual int GetConnectStrategy(const RawAddress &device, int &strategy) = 0; 44 virtual int SetActiveSinkDevice(const RawAddress &device) = 0; 45 virtual RawAddress GetActiveSinkDevice() = 0; 46 virtual BluetoothA2dpCodecStatus GetCodecStatus(const RawAddress &device) = 0; 47 virtual int GetCodecPreference(const RawAddress &device, BluetoothA2dpCodecInfo &info) = 0; 48 virtual int SetCodecPreference(const RawAddress &device, const BluetoothA2dpCodecInfo &info) = 0; 49 virtual void SwitchOptionalCodecs(const RawAddress &device, bool isEnable) = 0; 50 virtual int GetOptionalCodecsSupportState(const RawAddress &device) = 0; 51 virtual int StartPlaying(const RawAddress &device) = 0; 52 virtual int SuspendPlaying(const RawAddress &device) = 0; 53 virtual int StopPlaying(const RawAddress &device) = 0; 54 virtual int WriteFrame(const uint8_t *data, uint32_t size) = 0; 55 virtual int GetRenderPosition(const RawAddress &device, uint32_t &delayValue, uint64_t &sendDataSize, 56 uint32_t &timeStamp) = 0; 57 virtual int OffloadStartPlaying(const RawAddress &device, const std::vector<int32_t> &sessionsId) = 0; 58 virtual int OffloadStopPlaying(const RawAddress &device, const std::vector<int32_t> &sessionsId) = 0; 59 virtual int A2dpOffloadSessionPathRequest(const RawAddress &device, 60 const std::vector<BluetoothA2dpStreamInfo> &info) = 0; 61 virtual BluetoothA2dpOffloadCodecStatus GetOffloadCodecStatus(const RawAddress &device) = 0; 62 virtual int EnableAutoPlay(const RawAddress &device) = 0; 63 virtual int DisableAutoPlay(const RawAddress &device, const int duration) = 0; 64 virtual int GetAutoPlayDisabledDuration(const RawAddress &device, int &duration) = 0; 65 virtual void GetVirtualDeviceList(std::vector<std::string> &devices) = 0; 66 virtual void UpdateVirtualDevice(int32_t action, const std::string &address) = 0; 67 }; 68 } // namespace Bluetooth 69 } // namespace OHOS 70 #endif // OHOS_BLUETOOTH_STANDARD_A2DP_INTERFACE_H