• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2025 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 CORE_SERVICE_HANDLER_H
17 #define CORE_SERVICE_HANDLER_H
18 
19 #include <sstream>
20 #include <map>
21 #include <mutex>
22 #include <vector>
23 
24 #include "icore_service_provider_ipc.h"
25 #include "audio_service_enum.h"
26 
27 namespace OHOS {
28 namespace AudioStandard {
29 class CoreServiceHandler {
30 public:
31     static CoreServiceHandler& GetInstance();
32 
33     ~CoreServiceHandler();
34 
35     // would be called only once
36     int32_t ConfigCoreServiceProvider(const sptr<ICoreServiceProviderIpc> policyProvider);
37 
38     int32_t ReloadCaptureSession(uint32_t sessionId, SessionOperation operation);
39     int32_t UpdateSessionOperation(uint32_t sessionId, SessionOperation operation,
40         SessionOperationMsg opMsg = SESSION_OP_MSG_DEFAULT);
41     int32_t SetDefaultOutputDevice(
42         const DeviceType defaultOutputDevice, const uint32_t sessionID, const StreamUsage streamUsage, bool isRunning,
43         bool skipForce = false);
44     std::string GetAdapterNameBySessionId(uint32_t sessionId);
45     int32_t GetProcessDeviceInfoBySessionId(uint32_t sessionId, AudioDeviceDescriptor &deviceInfo,
46         AudioStreamInfo &streamInfo, bool isReloadProcess);
47     uint32_t GenerateSessionId();
48     int32_t SetWakeUpAudioCapturerFromAudioServer(const AudioProcessConfig &config);
49 private:
50     CoreServiceHandler();
51     sptr<ICoreServiceProviderIpc> iCoreServiceProvider_ = nullptr;
52 };
53 } // namespace AudioStandard
54 } // namespace OHOS
55 #endif // CORE_SERVICE_HANDLER_H
56