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_AVRCP_TG_PROXY_H
17 #define OHOS_BLUETOOTH_STANDARD_AVRCP_TG_PROXY_H
18 
19 #include "iremote_proxy.h"
20 #include "i_bluetooth_avrcp_tg.h"
21 
22 namespace OHOS {
23 namespace Bluetooth {
24 class BluetoothAvrcpTgProxy : public IRemoteProxy<IBluetoothAvrcpTg> {
25 public:
BluetoothAvrcpTgProxy(const sptr<IRemoteObject> & impl)26     explicit BluetoothAvrcpTgProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IBluetoothAvrcpTg>(impl) {}
~BluetoothAvrcpTgProxy()27     ~BluetoothAvrcpTgProxy() {}
28 
29     void RegisterObserver(const sptr<IBluetoothAvrcpTgObserver> &observer) override;
30     void UnregisterObserver(const sptr<IBluetoothAvrcpTgObserver> &observer) override;
31     void SetActiveDevice(const BluetoothRawAddress &addr) override;
32     int32_t Connect(const BluetoothRawAddress &addr) override;
33     int32_t Disconnect(const BluetoothRawAddress &addr) override;
34     std::vector<BluetoothRawAddress> GetConnectedDevices() override;
35     std::vector<BluetoothRawAddress> GetDevicesByStates(const std::vector<int32_t> &states) override;
36     int32_t GetDeviceState(const BluetoothRawAddress &addr) override;
37     void NotifyPlaybackStatusChanged(int32_t playStatus, int32_t playbackPos) override;
38     void NotifyTrackChanged(int64_t uid, int32_t playbackPos) override;
39     void NotifyTrackReachedEnd(int32_t playbackPos) override;
40     void NotifyTrackReachedStart(int32_t playbackPos) override;
41     void NotifyPlaybackPosChanged(int32_t playbackPos) override;
42     void NotifyPlayerAppSettingChanged(const std::vector<int32_t> &attributes,
43                                        const std::vector<int32_t> &values) override;
44     void NotifyNowPlayingContentChanged() override;
45     void NotifyAvailablePlayersChanged() override;
46     void NotifyAddressedPlayerChanged(int32_t playerId, int32_t uidCounter) override;
47     void NotifyUidChanged(int32_t uidCounter) override;
48     void NotifyVolumeChanged(int32_t volume) override;
49     int32_t SetDeviceAbsoluteVolume(const BluetoothRawAddress &addr, int32_t volumeLevel) override;
50     int32_t SetDeviceAbsVolumeAbility(const BluetoothRawAddress &addr, int32_t ability) override;
51     int32_t GetDeviceAbsVolumeAbility(const BluetoothRawAddress &addr, int32_t &ability) override;
52 
53 private:
54     static inline BrokerDelegator<BluetoothAvrcpTgProxy> delegator_;
55     ErrCode InnerTransact(uint32_t code, MessageOption &flags, MessageParcel &data, MessageParcel &reply);
56 };
57 }  // namespace Bluetooth
58 }  // namespace OHOS
59 #endif  // OHOS_BLUETOOTH_STANDARD_AVRCP_TG_PROXY_H