1e1c44949Sopenharmony_ci/* 2e1c44949Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3e1c44949Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e1c44949Sopenharmony_ci * you may not use this file except in compliance with the License. 5e1c44949Sopenharmony_ci * You may obtain a copy of the License at 6e1c44949Sopenharmony_ci * 7e1c44949Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e1c44949Sopenharmony_ci * 9e1c44949Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e1c44949Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e1c44949Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e1c44949Sopenharmony_ci * See the License for the specific language governing permissions and 13e1c44949Sopenharmony_ci * limitations under the License. 14e1c44949Sopenharmony_ci */ 15e1c44949Sopenharmony_ci 16e1c44949Sopenharmony_ci#ifndef TELEPHONY_AUDIO_RING_H 17e1c44949Sopenharmony_ci#define TELEPHONY_AUDIO_RING_H 18e1c44949Sopenharmony_ci 19e1c44949Sopenharmony_ci#include <memory> 20e1c44949Sopenharmony_ci 21e1c44949Sopenharmony_ci#include "audio_renderer.h" 22e1c44949Sopenharmony_ci 23e1c44949Sopenharmony_ci#include "audio_player.h" 24e1c44949Sopenharmony_ci#include "audio_proxy.h" 25e1c44949Sopenharmony_ci#include "ringtone_player.h" 26e1c44949Sopenharmony_ci#include "system_sound_manager.h" 27e1c44949Sopenharmony_ci 28e1c44949Sopenharmony_cinamespace OHOS { 29e1c44949Sopenharmony_cinamespace Telephony { 30e1c44949Sopenharmony_cienum class RingState { 31e1c44949Sopenharmony_ci RINGING = 0, 32e1c44949Sopenharmony_ci STOPPED, 33e1c44949Sopenharmony_ci}; 34e1c44949Sopenharmony_ci 35e1c44949Sopenharmony_cistatic constexpr const char* RING_PLAY_THREAD = "ringPlayThread"; 36e1c44949Sopenharmony_ci 37e1c44949Sopenharmony_ci/** 38e1c44949Sopenharmony_ci * @class Ring 39e1c44949Sopenharmony_ci * plays the default or specific ringtone. 40e1c44949Sopenharmony_ci */ 41e1c44949Sopenharmony_ciclass Ring { 42e1c44949Sopenharmony_cipublic: 43e1c44949Sopenharmony_ci Ring(); 44e1c44949Sopenharmony_ci virtual ~Ring(); 45e1c44949Sopenharmony_ci void Init(); 46e1c44949Sopenharmony_ci int32_t Play(int32_t slotId); 47e1c44949Sopenharmony_ci int32_t Stop(); 48e1c44949Sopenharmony_ci void ReleaseRenderer(); 49e1c44949Sopenharmony_ci int32_t SetMute(); 50e1c44949Sopenharmony_ci 51e1c44949Sopenharmony_ciprivate: 52e1c44949Sopenharmony_ci std::mutex mutex_; 53e1c44949Sopenharmony_ci AudioPlayer *audioPlayer_ = nullptr; 54e1c44949Sopenharmony_ci std::shared_ptr<Media::SystemSoundManager> SystemSoundManager_ = nullptr; 55e1c44949Sopenharmony_ci std::shared_ptr<Media::RingtonePlayer> RingtonePlayer_ = nullptr; 56e1c44949Sopenharmony_ci int32_t defaultVolume_ = 1; 57e1c44949Sopenharmony_ci}; 58e1c44949Sopenharmony_ci} // namespace Telephony 59e1c44949Sopenharmony_ci} // namespace OHOS 60e1c44949Sopenharmony_ci#endif // TELEPHONY_AUDIO_RING_H