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 AUDIO_VOLUME_MANAGER_NAPI_H_ 17 #define AUDIO_VOLUME_MANAGER_NAPI_H_ 18 19 #include "napi/native_api.h" 20 #include "napi/native_node_api.h" 21 #include "audio_system_manager.h" 22 #include "audio_manager_callback_napi.h" 23 #include "audio_volume_group_manager_napi.h" 24 25 namespace OHOS { 26 namespace AudioStandard { 27 static const std::string AUDIO_VOLUME_MANAGER_NAPI_CLASS_NAME = "AudioVolumeManager"; 28 29 struct AudioVolumeManagerAsyncContext; 30 class AudioVolumeManagerNapi { 31 public: 32 AudioVolumeManagerNapi(); 33 ~AudioVolumeManagerNapi(); 34 35 static napi_value Init(napi_env env, napi_value exports); 36 static napi_value CreateVolumeManagerWrapper(napi_env env); 37 private: 38 static napi_value GetVolumeGroupInfos(napi_env env, napi_callback_info info); 39 static napi_value GetVolumeGroupManager(napi_env env, napi_callback_info info); 40 static napi_value SetRingerMode(napi_env env, napi_callback_info info); 41 static napi_value GetRingerMode(napi_env env, napi_callback_info info); 42 static napi_value SetMicrophoneMute(napi_env env, napi_callback_info info); 43 static napi_value IsMicrophoneMute(napi_env env, napi_callback_info info); 44 static napi_value On(napi_env env, napi_callback_info info); 45 46 static napi_value Construct(napi_env env, napi_callback_info info); 47 static void Destructor(napi_env env, void *nativeObject, void *finalize_hint); 48 AudioSystemManager *audioSystemMngr_; 49 50 int32_t cachedClientId_ = -1; 51 std::shared_ptr<VolumeKeyEventCallback> volumeKeyEventCallbackNapi_ = nullptr; 52 53 napi_env env_; 54 }; 55 } // namespace AudioStandard 56 } // namespace OHOS 57 #endif /* AUDIO_ROUTING_MANAGER_NAPI_H_ */ 58