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 16 #ifndef OHOS_BLUETOOTH_STANDARD_AVRCP_TG_SERVER_H 17 #define OHOS_BLUETOOTH_STANDARD_AVRCP_TG_SERVER_H 18 19 #include <map> 20 21 #include "bluetooth_avrcp_tg_stub.h" 22 #include "bluetooth_types.h" 23 #include "if_system_ability_manager.h" 24 #include "iservice_registry.h" 25 #include "system_ability.h" 26 27 namespace OHOS { 28 namespace Bluetooth { 29 class BluetoothAvrcpTgServer : public BluetoothAvrcpTgStub { 30 public: 31 explicit BluetoothAvrcpTgServer(); 32 ~BluetoothAvrcpTgServer() override; 33 34 void RegisterObserver(const sptr<IBluetoothAvrcpTgObserver> &observer) override; 35 void UnregisterObserver(const sptr<IBluetoothAvrcpTgObserver> &observer) override; 36 void SetActiveDevice(const BluetoothRawAddress &addr) override; 37 int32_t Connect(const BluetoothRawAddress &addr) override; 38 int32_t Disconnect(const BluetoothRawAddress &addr) override; 39 std::vector<BluetoothRawAddress> GetConnectedDevices() override; 40 std::vector<BluetoothRawAddress> GetDevicesByStates(const std::vector<int32_t> &states) override; 41 int32_t GetDeviceState(const BluetoothRawAddress &addr) override; 42 void NotifyPlaybackStatusChanged(int32_t playStatus, int32_t playbackPos) override; 43 void NotifyTrackChanged(int64_t uid, int32_t playbackPos) override; 44 void NotifyTrackReachedEnd(int32_t playbackPos) override; 45 void NotifyTrackReachedStart(int32_t playbackPos) override; 46 void NotifyPlaybackPosChanged(int32_t playbackPos) override; 47 void NotifyPlayerAppSettingChanged(const std::vector<int32_t> &attributes, 48 const std::vector<int32_t> &values) override; 49 void NotifyNowPlayingContentChanged() override; 50 void NotifyAvailablePlayersChanged() override; 51 void NotifyAddressedPlayerChanged(int32_t playerId, int32_t uidCounter) override; 52 void NotifyUidChanged(int32_t uidCounter) override; 53 void NotifyVolumeChanged(int32_t volume) override; 54 55 int32_t SetDeviceAbsoluteVolume(const BluetoothRawAddress &addr, int32_t volumeLevel) override; 56 int32_t SetDeviceAbsVolumeAbility(const BluetoothRawAddress &addr, int32_t ability) override; 57 int32_t GetDeviceAbsVolumeAbility(const BluetoothRawAddress &addr, int32_t &ability) override; 58 59 private: 60 BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothAvrcpTgServer); 61 BLUETOOTH_DECLARE_IMPL(); 62 }; 63 } // namespace Bluetooth 64 } // namespace OHOS 65 #endif // OHOS_BLUETOOTH_STANDARD_AVRCP_TG_SERVER_H