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_INTERFACE_H 17 #define OHOS_BLUETOOTH_STANDARD_A2DP_SINK_INTERFACE_H 18 19 #include <string> 20 21 #include "iremote_broker.h" 22 #include "i_bluetooth_a2dp_sink_observer.h" 23 #include "raw_address.h" 24 #include "../parcel/bluetooth_raw_address.h" 25 #include "../parcel/bluetooth_a2dp_a2dpCodecStatus.h" 26 27 namespace OHOS { 28 namespace Bluetooth { 29 using namespace bluetooth; 30 class IBluetoothA2dpSink : public OHOS::IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ipc.IBluetoothA2dpSink"); 33 34 enum Code { 35 BT_A2DP_SINK_CONNECT = 0, 36 BT_A2DP_SINK_DISCONNECT, 37 BT_A2DP_SINK_REGISTER_OBSERVER, 38 BT_A2DP_SINK_DEREGISTER_OBSERVER, 39 BT_A2DP_SINK_GET_DEVICE_BY_STATES, 40 BT_A2DP_SINK_GET_DEVICE_STATE, 41 BT_A2DP_SINK_GET_PLAYING_STATE, 42 BT_A2DP_SINK_SET_CONNECT_STRATEGY, 43 BT_A2DP_SINK_GET_CONNECT_STRATEGY, 44 }; 45 46 virtual int Connect(const RawAddress &device) = 0; 47 virtual int Disconnect(const RawAddress &device) = 0; 48 virtual void RegisterObserver(const sptr<IBluetoothA2dpSinkObserver> &observer) = 0; 49 virtual void DeregisterObserver(const sptr<IBluetoothA2dpSinkObserver> &observer) = 0; 50 virtual std::vector<RawAddress> GetDevicesByStates(const std::vector<int32_t> &states) = 0; 51 virtual int GetDeviceState(const RawAddress &device) = 0; 52 virtual int GetPlayingState(const RawAddress &device) = 0; 53 virtual int SetConnectStrategy(const RawAddress &device, int32_t strategy) = 0; 54 virtual int GetConnectStrategy(const RawAddress &device) = 0; 55 }; 56 } // namespace Bluetooth 57 } // namespace OHOS 58 #endif // OHOS_BLUETOOTH_STANDARD_A2DP_INTERFACE_H