1 /* 2 * Copyright (c) 2023 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 #ifndef NAPI_AUDIO_INTERRUPT_MANAGER_H 16 #define NAPI_AUDIO_INTERRUPT_MANAGER_H 17 18 #include <iostream> 19 #include <map> 20 #include <vector> 21 #include "napi/native_api.h" 22 #include "napi/native_node_api.h" 23 #include "napi_async_work.h" 24 #include "audio_system_manager.h" 25 26 namespace OHOS { 27 namespace AudioStandard { 28 const std::string AUDIO_INTERRUPT_MANAGER_NAPI_CLASS_NAME = "AudioInterruptManager"; 29 30 class NapiAudioInterruptManager { 31 public: 32 NapiAudioInterruptManager(); 33 ~NapiAudioInterruptManager(); 34 35 static napi_value Init(napi_env env, napi_value exports); 36 static napi_value CreateInterruptManagerWrapper(napi_env env); 37 38 private: 39 struct AudioInterruptManagerAsyncContext : public ContextBase { 40 int32_t deviceFlag; 41 bool bArgTransFlag = true; 42 int32_t groupId; 43 std::string networkId; 44 }; 45 46 static napi_value Construct(napi_env env, napi_callback_info info); 47 static void Destructor(napi_env env, void *nativeObject, void *finalizeHint); 48 AudioSystemManager *audioSystemMngr_; 49 50 napi_env env_; 51 }; 52 } // namespace AudioStandard 53 } // namespace OHOS 54 #endif /* NAPI_AUDIO_INTERRUPT_MANAGER_H */ 55