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 CJ_AUDIO_HAPTIC_MANAGER_H 17 #define CJ_AUDIO_HAPTIC_MANAGER_H 18 19 #include <cstdint> 20 #include "audio_haptic_manager.h" 21 #include "audio_info.h" 22 #include "cj_lambda.h" 23 #include "cj_common_ffi.h" 24 25 namespace OHOS { 26 namespace Media { 27 28 class CjAudioHapticManager : public OHOS::FFI::FFIData { 29 DECL_TYPE(CjAudioHapticManager, OHOS::FFI::FFIData) 30 public: 31 CjAudioHapticManager(); 32 ~CjAudioHapticManager(); 33 34 int32_t RegisterSource(const char* audioUri, const char* hapticUri, int32_t& resId); 35 int32_t UnregisterSource(int32_t id); 36 int32_t SetAudioLatencyMode(int32_t id, int32_t latencyMode); 37 int32_t SetStreamUsage(int32_t id, int32_t streamUsage); 38 int64_t CreatePlayer(int32_t id, bool muteAudio, bool muteHaptics, int32_t &errCode); 39 40 private: 41 static bool IsLegalAudioLatencyMode(int32_t latencyMode); 42 static bool IsLegalAudioStreamUsage(int32_t streamUsage); 43 44 std::shared_ptr<AudioHapticManager> audioHapticMgrClient_ = nullptr; 45 }; 46 47 } // namespace Media 48 } // namespace OHOS 49 50 #endif // CJ_AUDIO_HAPTIC_MANAGER_H 51