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 OHOS_DISTRIBUTED_CAMERA_COMMON_INCLUDE_UTILS_DCAMERA_RADAR_H 17 #define OHOS_DISTRIBUTED_CAMERA_COMMON_INCLUDE_UTILS_DCAMERA_RADAR_H 18 19 #include <cstdint> 20 #include <chrono> 21 #include <string> 22 #include <vector> 23 24 #include "single_instance.h" 25 26 namespace OHOS { 27 namespace DistributedHardware { 28 const std::string ORG_PKG_NAME = "ohos.dhardware.dcamera"; 29 const std::string DSOFTBUS_PKG_NAME = "dsoftbus"; 30 const std::string ORG_PKG = "ORG_PKG"; 31 const std::string FUNC = "FUNC"; 32 const std::string BIZ_SCENE = "BIZ_SCENE"; 33 const std::string BIZ_STAGE = "BIZ_STAGE"; 34 const std::string STAGE_RES = "STAGE_RES"; 35 const std::string BIZ_STATE = "BIZ_STATE"; 36 const std::string TO_CALL_PKG = "TO_CALL_PKG"; 37 const std::string HOST_PKG = "HOST_PKG"; 38 const std::string ERROR_CODE = "ERROR_CODE"; 39 const std::string DISTRIBUTED_CAMERA_BEHAVIOR = "DISTRIBUTED_CAMERA_BEHAVIOR"; 40 constexpr char DISTRIBUTED_CAMERA[] = "DISTCAMERA"; 41 42 enum class BizScene : int32_t { 43 CAMERA_INIT = 1, 44 CAMERA_OPEN = 2, 45 CAMERA_CLOSE = 3, 46 CAMERA_UNINIT = 4, 47 }; 48 49 enum class StageRes : int32_t { 50 STAGE_IDLE = 0, 51 STAGE_SUCC = 1, 52 STAGE_FAIL = 2, 53 STAGE_CANCEL = 3, 54 STAGE_UNKNOW = 4, 55 }; 56 57 enum class BizState : int32_t { 58 BIZ_STATE_START = 1, 59 BIZ_STATE_END = 2, 60 }; 61 62 enum class CameraInit : int32_t { 63 SERVICE_INIT = 1, 64 SOURCE_CAMERA_INIT = 2, 65 LOAD_HDF_DRIVER = 3, 66 }; 67 68 enum class CameraOpen : int32_t { 69 OPEN_CAMERA = 1, 70 OPEN_CHANNEL = 2, 71 CONFIG_STREAMS = 3, 72 OPEN_DATA_CHANNEL = 4, 73 INIT_DECODE = 5, 74 START_CAPTURE = 6, 75 }; 76 77 enum class CameraClose : int32_t { 78 STOP_CAPTURE = 1, 79 RELEASE_STREAM = 2, 80 CLOSE_CAMERA = 3, 81 }; 82 83 enum class CameraUnInit : int32_t { 84 UNLOAD_HDF_DRIVER = 1, 85 SERVICE_RELEASE = 2, 86 }; 87 88 class DcameraRadar { 89 DECLARE_SINGLE_INSTANCE(DcameraRadar); 90 public: 91 bool ReportDcameraInit(const std::string& func, CameraInit bizStage, BizState bizState, int32_t errCode); 92 bool ReportDcameraInitProgress(const std::string& func, CameraInit bizStage, int32_t errCode); 93 bool ReportDcameraOpen(const std::string& func, CameraOpen bizStage, BizState bizState, int32_t errCode); 94 bool ReportDcameraOpenProgress(const std::string& func, CameraOpen bizStage, int32_t errCode); 95 bool ReportDcameraClose(const std::string& func, CameraClose bizStage, BizState bizState, int32_t errCode); 96 bool ReportDcameraCloseProgress(const std::string& func, CameraClose bizStage, int32_t errCode); 97 bool ReportDcameraUnInit(const std::string& func, CameraUnInit bizStage, BizState bizState, int32_t errCode); 98 }; 99 } // namespace DistributedHardware 100 } // namespace OHOS 101 #endif // OHOS_DISTRIBUTED_CAMERA_COMMON_INCLUDE_UTILS_DCAMERA_RADAR_H