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 OHOS_DCAMERA_HISYSEVENT_ADAPTER_H 17 #define OHOS_DCAMERA_HISYSEVENT_ADAPTER_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace DistributedHardware { 23 const std::string DCAMERA_INIT_FAIL = "DCAMERA_INIT_FAIL"; 24 const std::string DCAMERA_REGISTER_FAIL = "DCAMERA_REGISTER_FAIL"; 25 const std::string DCAMERA_OPT_FAIL = "DCAMERA_OPT_FAIL"; 26 27 const std::string INIT_SA_EVENT = "DCAMERA_INIT"; 28 const std::string RELEASE_SA_EVENT = "DCAMERA_EXIT"; 29 const std::string REGIST_CAMERA_EVENT = "DCAMERA_REGISTER"; 30 const std::string UNREGIST_CAMERA_EVENT = "DCAMERA_UNREGISTER"; 31 const std::string OPEN_CAMERA_EVENT = "DCAMERA_OPEN"; 32 const std::string CLOSE_CAMERA_EVENT = "DCAMERA_CLOSE"; 33 const std::string START_CAPTURE_EVENT = "DCAMERA_CAPTURE"; 34 35 enum DcameraHisyseventErrno : int32_t { 36 DCAMERA_SA_ERROR = 0, 37 DCAMERA_HDF_ERROR = 1, 38 DCAMERA_CREATE_SESSIONSVR_ERROR = 2, 39 DCAMERA_OPEN_SESSION_ERROR = 3, 40 DCAMERA_SINK_OPEN_CAM_ERROR = 4, 41 DCAMERA_ENCODE_ERROR = 5, 42 DCAMERA_DECODE_ERROR = 6, 43 }; 44 45 using EventCaptureInfo = struct _EventCaptureInfo { 46 int32_t width_; 47 int32_t height_; 48 int32_t format_; 49 bool isCapture_; 50 int32_t encodeType_; 51 int32_t type_; 52 }; 53 54 void ReportDcamerInitFail(const std::string& eventName, int32_t errCode, const std::string& errMsg); 55 void ReportRegisterCameraFail(const std::string& eventName, const std::string& devId, const std::string& dhId, 56 std::string version, const std::string& errMsg); 57 void ReportDcamerOptFail(const std::string& eventName, int32_t errCode, const std::string& errMsg); 58 59 void ReportSaEvent(const std::string& eventName, int32_t saId, const std::string& errMsg); 60 void ReportRegisterCameraEvent(const std::string& eventName, const std::string& devId, const std::string& dhId, 61 std::string version, const std::string& errMsg); 62 void ReportCameraOperaterEvent(const std::string& eventName, const std::string& devId, const std::string& dhId, 63 const std::string& errMsg); 64 void ReportStartCaptureEvent(const std::string& eventName, EventCaptureInfo& capture, const std::string& errMsg); 65 66 std::string CreateMsg(const char *format, ...); 67 } // namespace DistributedHardware 68 } // namespace OHOS 69 #endif // OHOS_DCAMERA_HISYSEVENT_ADAPTER_H