From fb0a93c51b704b393e9dfb4eb44d2fde7983ae30 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Fri, 17 Jun 2022 14:55:14 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/include/utils/constants.h | 3 +++ .../hdi_impl/src/dcamera_device/dcamera_device.cpp | 9 ++++----- common/include/constants/distributed_camera_constants.h | 3 +++ .../client/src/callback/dcamera_input_callback.cpp | 2 +- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 6 +++++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/camera_hdf/hdi_impl/include/utils/constants.h b/camera_hdf/hdi_impl/include/utils/constants.h index fd3b6928..ed243a89 100644 --- a/camera_hdf/hdi_impl/include/utils/constants.h +++ b/camera_hdf/hdi_impl/include/utils/constants.h @@ -83,6 +83,9 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, + DCAMERA_EVENT_DEVICE_PREEMPT = -9, + DCAMERA_EVENT_DEVICE_IN_USE = -10, + DCAMERA_EVENT_NO_PERMISSION = -11, } DCameraEventResult; enum DCameraBufferUsage : uint64_t { diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index f1348a29..9385da64 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -400,7 +400,10 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) NotifyStartCaptureError(); break; } - case DCameraEventResult::DCAMERA_EVENT_CAMERA_ERROR: { + case DCameraEventResult::DCAMERA_EVENT_CAMERA_ERROR: + case DCameraEventResult::DCAMERA_EVENT_DEVICE_PREEMPT: + case DCameraEventResult::DCAMERA_EVENT_DEVICE_IN_USE: + case DCameraEventResult::DCAMERA_EVENT_NO_PERMISSION: { NotifyCameraError(event); break; } @@ -427,10 +430,6 @@ void DCameraDevice::NotifyStartCaptureError() void DCameraDevice::NotifyCameraError(const std::shared_ptr &event) { - std::shared_ptr dCameraHost = DCameraHost::GetInstance(); - if (dCameraHost != nullptr) { - dCameraHost->NotifyDCameraStatus(dhBase_, event->result_); - } if (dCameraDeviceCallback_ != nullptr) { dCameraDeviceCallback_->OnError(ErrorType::REQUEST_TIMEOUT, 0); Close(); diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index eddb2f5b..90d7acde 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -58,6 +58,9 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, + DCAMERA_EVENT_DEVICE_PREEMPT = -9, + DCAMERA_EVENT_DEVICE_IN_USE = -10, + DCAMERA_EVENT_NO_PERMISSION = -11, } DCameraEventResult; typedef enum { diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index 8d980fd5..0f767f22 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -34,7 +34,7 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_EVENT_DEVICE_PREEMPT; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 9501728a..c205952a 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -309,7 +309,11 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", GetAnonyString(dhId_).c_str(), event->eventResult_); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); + if (event->eventResult_ == DCAMERA_EVENT_DEVICE_PREEMPT) { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted")); + } else { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); + } } void DCameraSinkController::OnMetadataResult() -- Gitee From f40ba54f1c467f1cbb53fb26e0c99425c70bdc85 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 20 Jun 2022 14:15:05 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/include/utils/constants.h | 7 ++--- .../src/dcamera_device/dcamera_device.cpp | 1 + .../constants/distributed_camera_constants.h | 22 +++++++++++++--- .../src/callback/dcamera_photo_callback.cpp | 2 +- .../src/callback/dcamera_preview_callback.cpp | 2 +- .../src/callback/dcamera_session_callback.cpp | 2 +- .../src/callback/dcamera_video_callback.cpp | 2 +- .../dcamera_sink_controller.h | 1 + .../dcamera_sink_controller.cpp | 26 +++++++++++++++---- 9 files changed, 50 insertions(+), 15 deletions(-) diff --git a/camera_hdf/hdi_impl/include/utils/constants.h b/camera_hdf/hdi_impl/include/utils/constants.h index ed243a89..b022c0e2 100644 --- a/camera_hdf/hdi_impl/include/utils/constants.h +++ b/camera_hdf/hdi_impl/include/utils/constants.h @@ -83,9 +83,10 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, - DCAMERA_EVENT_DEVICE_PREEMPT = -9, - DCAMERA_EVENT_DEVICE_IN_USE = -10, - DCAMERA_EVENT_NO_PERMISSION = -11, + DCAMERA_EVENT_DEVICE_ERROR = -9, + DCAMERA_EVENT_DEVICE_PREEMPT = -10, + DCAMERA_EVENT_DEVICE_IN_USE = -11, + DCAMERA_EVENT_NO_PERMISSION = -12, } DCameraEventResult; enum DCameraBufferUsage : uint64_t { diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 9385da64..22a02673 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -401,6 +401,7 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) break; } case DCameraEventResult::DCAMERA_EVENT_CAMERA_ERROR: + case DCameraEventResult::DCAMERA_EVENT_DEVICE_ERROR: case DCameraEventResult::DCAMERA_EVENT_DEVICE_PREEMPT: case DCameraEventResult::DCAMERA_EVENT_DEVICE_IN_USE: case DCameraEventResult::DCAMERA_EVENT_NO_PERMISSION: { diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index 90d7acde..64754490 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -58,11 +58,27 @@ typedef enum { DCAMERA_EVENT_START_CAPTURE_ERROR = -6, DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, - DCAMERA_EVENT_DEVICE_PREEMPT = -9, - DCAMERA_EVENT_DEVICE_IN_USE = -10, - DCAMERA_EVENT_NO_PERMISSION = -11, + DCAMERA_EVENT_DEVICE_ERROR = -9, + DCAMERA_EVENT_DEVICE_PREEMPT = -10, + DCAMERA_EVENT_DEVICE_IN_USE = -11, + DCAMERA_EVENT_NO_PERMISSION = -12, } DCameraEventResult; +typedef enum { + CAMERA_OK = 0, + CAMERA_ALLOC_ERROR, + CAMERA_INVALID_ARG, + CAMERA_UNSUPPORTED, + CAMERA_DEVICE_BUSY, + CAMERA_DEVICE_CLOSED, + CAMERA_DEVICE_REQUEST_TIMEOUT, + CAMERA_STREAM_BUFFER_LOST, + CAMERA_INVALID_SESSION_CFG, + CAMERA_CAPTURE_LIMIT_EXCEED, + CAMERA_INVALID_STATE, + CAMERA_UNKNOWN_ERROR +} CameraServiceError; + typedef enum { OHOS_CAMERA_FORMAT_INVALID = 0, OHOS_CAMERA_FORMAT_RGBA_8888, diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp index 1ad5ca50..e95a2945 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp @@ -49,7 +49,7 @@ void DCameraPhotoCallback::OnCaptureError(const int32_t captureId, const int32_t std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp index 06aeef65..c3982972 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp @@ -44,7 +44,7 @@ void DCameraPreviewCallback::OnError(const int32_t errorCode) const std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp index a1b1aee6..38b6d3c3 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp @@ -34,7 +34,7 @@ void DCameraSessionCallback::OnError(int32_t errorCode) std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp index 2e938fa9..6096bb82 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp @@ -44,7 +44,7 @@ void DCameraVideoCallback::OnError(const int32_t errorCode) const std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_CAMERA_ERROR; + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware diff --git a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h index 6b759e6f..c111dae7 100644 --- a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h +++ b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h @@ -63,6 +63,7 @@ private: int32_t DCameraNotifyInner(int32_t type, int32_t result, std::string content); int32_t HandleReceivedData(std::shared_ptr& dataBuffer); void PostAuthorization(std::vector>& captureInfos); + void DCameraErrorNotifyInner(const int32_t errorType); bool isInit_; int32_t sessionState_; diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index c205952a..a9ab1e11 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -79,7 +79,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("operator stop capture failed")); + DCameraErrorNotifyInner(ret); return ret; } @@ -87,7 +87,7 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture output stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("output stop capture failed")); + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("output stop capture failed")); return ret; } @@ -312,7 +312,7 @@ void DCameraSinkController::OnStateChanged(std::shared_ptr& event) if (event->eventResult_ == DCAMERA_EVENT_DEVICE_PREEMPT) { DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted")); } else { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_CAMERA_ERROR, std::string("camera error")); + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); } } @@ -391,7 +391,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector event = std::make_shared(); -- Gitee From 4d3aea3c19e3a4acdedd57e088d91e5abef3486a Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 20 Jun 2022 14:22:19 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../dcamera_sink_controller.cpp | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index a9ab1e11..a23fc10e 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -79,7 +79,18 @@ int32_t DCameraSinkController::StopCapture() if (ret != DCAMERA_OK) { DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); - DCameraErrorNotifyInner(ret); + switch (ret) { + case CameraServiceError::CAMERA_ALLOC_ERROR: { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_NO_PERMISSION, std::string("operator start capture permission denial.")); + break; + } + case CameraServiceError::CAMERA_DEVICE_BUSY: { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_IN_USE, std::string("operator start capture in used.")); + break; + } + default: + break; + } return ret; } @@ -399,18 +410,7 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector Date: Mon, 20 Jun 2022 14:50:48 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../dcamera_sink_controller.cpp | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index a23fc10e..262f98f2 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -80,16 +80,18 @@ int32_t DCameraSinkController::StopCapture() DHLOGE("DCameraSinkController::StopCapture client stop capture failed, dhId: %s, ret: %d", GetAnonyString(dhId_).c_str(), ret); switch (ret) { - case CameraServiceError::CAMERA_ALLOC_ERROR: { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_NO_PERMISSION, std::string("operator start capture permission denial.")); - break; - } - case CameraServiceError::CAMERA_DEVICE_BUSY: { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_IN_USE, std::string("operator start capture in used.")); - break; - } - default: - break; + case CameraServiceError::CAMERA_ALLOC_ERROR: { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_NO_PERMISSION, + std::string("operator start capture permission denial.")); + break; + } + case CameraServiceError::CAMERA_DEVICE_BUSY: { + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_IN_USE, + std::string("operator start capture in used.")); + break; + } + default: + break; } return ret; } @@ -411,16 +413,18 @@ int32_t DCameraSinkController::StartCaptureInner(std::vector Date: Mon, 27 Jun 2022 10:40:18 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../include/dcamera_device/dcamera_device.h | 3 +- .../src/dcamera_device/dcamera_device.cpp | 50 +++++++++++-------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h b/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h index ecf84d17..3c2d71b8 100644 --- a/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h +++ b/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h @@ -63,7 +63,8 @@ private: DCamRetCode CreateDStreamOperator(); std::string GenerateCameraId(const DHBase &dhBase); void NotifyStartCaptureError(); - void NotifyCameraError(const std::shared_ptr &event); + void NotifyCameraError(const std::shared_ptr &event, const ErrorType type); + void IsOpenSessFailedState(bool state); private: bool isOpened_; std::string dCameraId_; diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 22a02673..4c5b102b 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -373,26 +373,15 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) } switch (event->result_) { case DCameraEventResult::DCAMERA_EVENT_CHANNEL_CONNECTED: { - { - unique_lock lock(isOpenSessFailedlock_); - isOpenSessFailed_ = false; - } - openSessCV_.notify_one(); + IsOpenSessFailedStatus(false); break; } case DCameraEventResult::DCAMERA_EVENT_OPEN_CHANNEL_ERROR: { - { - unique_lock lock(isOpenSessFailedlock_); - isOpenSessFailed_ = true; - } - openSessCV_.notify_one(); + IsOpenSessFailedStatus(true); break; } case DCameraEventResult::DCAMERA_EVENT_CHANNEL_DISCONNECTED: { - if (dCameraDeviceCallback_ != nullptr) { - dCameraDeviceCallback_->OnError(ErrorType::FATAL_ERROR, 0); - Close(); - } + NotifyCameraError(event, ErrorType::DEVICE_DISCONNECT); break; } case DCameraEventResult::DCAMERA_EVENT_CONFIG_STREAMS_ERROR: @@ -400,12 +389,20 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) NotifyStartCaptureError(); break; } - case DCameraEventResult::DCAMERA_EVENT_CAMERA_ERROR: - case DCameraEventResult::DCAMERA_EVENT_DEVICE_ERROR: - case DCameraEventResult::DCAMERA_EVENT_DEVICE_PREEMPT: - case DCameraEventResult::DCAMERA_EVENT_DEVICE_IN_USE: + case DCameraEventResult::DCAMERA_EVENT_DEVICE_ERROR: { + NotifyCameraError(event, ErrorType::DRIVER_ERROR); + break; + } + case DCameraEventResult::DCAMERA_EVENT_DEVICE_PREEMPT: { + NotifyCameraError(event, ErrorType::DEVICE_PREEMPT); + break; + } + case DCameraEventResult::DCAMERA_EVENT_DEVICE_IN_USE: { + NotifyCameraError(event, ErrorType::DCAMERA_ERROR_BEGIN); + break; + } case DCameraEventResult::DCAMERA_EVENT_NO_PERMISSION: { - NotifyCameraError(event); + NotifyCameraError(event, ErrorType::DCAMERA_ERROR_NO_PERMISSION); break; } default: @@ -414,6 +411,15 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) return SUCCESS; } +void IsOpenSessFailedState(bool state) +{ + { + unique_lock lock(isOpenSessFailedlock_); + isOpenSessFailed_ = status; + } + openSessCV_.notify_one(); +} + void DCameraDevice::NotifyStartCaptureError() { if (dCameraDeviceCallback_ != nullptr) { @@ -429,10 +435,12 @@ void DCameraDevice::NotifyStartCaptureError() } } -void DCameraDevice::NotifyCameraError(const std::shared_ptr &event) +void DCameraDevice::NotifyCameraError(const std::shared_ptr &event, const ErrorType type) { + DHLOGI("DCameraDevice::NotifyCameraError for event type = %d, result = %d, content = %s, errorType, type = %d.", + event->type_, event->result_, event->content_.c_str(), type); if (dCameraDeviceCallback_ != nullptr) { - dCameraDeviceCallback_->OnError(ErrorType::REQUEST_TIMEOUT, 0); + dCameraDeviceCallback_->OnError(type, 0); Close(); } } -- Gitee From 40a93991d55e92ca8b788fb76a3fe9afe234a745 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 27 Jun 2022 10:45:16 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 4c5b102b..3a562cfd 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -438,7 +438,7 @@ void DCameraDevice::NotifyStartCaptureError() void DCameraDevice::NotifyCameraError(const std::shared_ptr &event, const ErrorType type) { DHLOGI("DCameraDevice::NotifyCameraError for event type = %d, result = %d, content = %s, errorType, type = %d.", - event->type_, event->result_, event->content_.c_str(), type); + event->type_, event->result_, event->content_.c_str(), type); if (dCameraDeviceCallback_ != nullptr) { dCameraDeviceCallback_->OnError(type, 0); Close(); -- Gitee From 90ea7db22f1174451fee15906d99d7a00447a759 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 27 Jun 2022 11:13:21 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp | 4 +--- .../client/src/callback/dcamera_input_callback.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 3a562cfd..94a3f28b 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -411,7 +411,7 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) return SUCCESS; } -void IsOpenSessFailedState(bool state) +void DCameraDevice::IsOpenSessFailedState(bool state) { { unique_lock lock(isOpenSessFailedlock_); @@ -437,8 +437,6 @@ void DCameraDevice::NotifyStartCaptureError() void DCameraDevice::NotifyCameraError(const std::shared_ptr &event, const ErrorType type) { - DHLOGI("DCameraDevice::NotifyCameraError for event type = %d, result = %d, content = %s, errorType, type = %d.", - event->type_, event->result_, event->content_.c_str(), type); if (dCameraDeviceCallback_ != nullptr) { dCameraDeviceCallback_->OnError(type, 0); Close(); diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index 0f767f22..379e1942 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -34,7 +34,7 @@ void DCameraInputCallback::OnError(const int32_t errorType, const int32_t errorM std::shared_ptr event = std::make_shared(); event->eventType_ = DCAMERA_MESSAGE; - event->eventResult_ = DCAMERA_EVENT_DEVICE_PREEMPT; + event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; callback_->OnStateChanged(event); } } // namespace DistributedHardware -- Gitee From 3c20a0b53ab3702ab0aad3feb8ade1b9c191d27f Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 27 Jun 2022 11:27:57 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 94a3f28b..18583e24 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -415,7 +415,7 @@ void DCameraDevice::IsOpenSessFailedState(bool state) { { unique_lock lock(isOpenSessFailedlock_); - isOpenSessFailed_ = status; + isOpenSessFailed_ = state; } openSessCV_.notify_one(); } -- Gitee From e9ecdb50313b0bc273b1fb17a2263413a5e77ca9 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 27 Jun 2022 11:37:06 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 18583e24..a6540859 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -373,11 +373,11 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) } switch (event->result_) { case DCameraEventResult::DCAMERA_EVENT_CHANNEL_CONNECTED: { - IsOpenSessFailedStatus(false); + IsOpenSessFailedState(false); break; } case DCameraEventResult::DCAMERA_EVENT_OPEN_CHANNEL_ERROR: { - IsOpenSessFailedStatus(true); + IsOpenSessFailedState(true); break; } case DCameraEventResult::DCAMERA_EVENT_CHANNEL_DISCONNECTED: { -- Gitee From 0d52fdf7abbd90adf3db1b6a7e22075563d66c61 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Mon, 27 Jun 2022 18:39:32 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../include/dcamera_device/dcamera_device.h | 2 +- .../src/dcamera_device/dcamera_device.cpp | 2 +- .../constants/distributed_camera_errno.h | 2 ++ .../client/src/dcamera_client.cpp | 11 ++++++ .../client/src/dcamera_client_common.cpp | 16 +++++++-- .../dcamera_sink_controller.cpp | 34 ++++--------------- 6 files changed, 35 insertions(+), 32 deletions(-) diff --git a/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h b/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h index 3c2d71b8..64e08ee9 100644 --- a/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h +++ b/camera_hdf/hdi_impl/include/dcamera_device/dcamera_device.h @@ -63,7 +63,7 @@ private: DCamRetCode CreateDStreamOperator(); std::string GenerateCameraId(const DHBase &dhBase); void NotifyStartCaptureError(); - void NotifyCameraError(const std::shared_ptr &event, const ErrorType type); + void NotifyCameraError(const ErrorType type); void IsOpenSessFailedState(bool state); private: bool isOpened_; diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index a6540859..4c47bf5e 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -435,7 +435,7 @@ void DCameraDevice::NotifyStartCaptureError() } } -void DCameraDevice::NotifyCameraError(const std::shared_ptr &event, const ErrorType type) +void DCameraDevice::NotifyCameraError(const ErrorType type) { if (dCameraDeviceCallback_ != nullptr) { dCameraDeviceCallback_->OnError(type, 0); diff --git a/common/include/constants/distributed_camera_errno.h b/common/include/constants/distributed_camera_errno.h index 0a1f7e99..81ac1d00 100644 --- a/common/include/constants/distributed_camera_errno.h +++ b/common/include/constants/distributed_camera_errno.h @@ -33,6 +33,8 @@ namespace DistributedHardware { DCAMERA_INDEX_OVERFLOW = -11, DCAMERA_REGIST_HAL_FAILED = -12, DCAMERA_UNREGIST_HAL_FAILED = -13, + DCAMERA_ALLOC_ERROR = -14, + DCAMERA_DEVICE_BUSY = -15, }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index 86e22ebd..ee894377 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -17,6 +17,7 @@ #include #include "anonymous_string.h" +#include "camera_util.h" #include "camera_metadata_operator.h" #include "dcamera_input_callback.h" #include "dcamera_manager_callback.h" @@ -125,6 +126,11 @@ int32_t DCameraClient::StartCapture(std::vector Date: Tue, 28 Jun 2022 08:57:06 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../hdi_impl/src/dcamera_device/dcamera_device.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp index 4c47bf5e..22c69cff 100644 --- a/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp +++ b/camera_hdf/hdi_impl/src/dcamera_device/dcamera_device.cpp @@ -381,7 +381,7 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) break; } case DCameraEventResult::DCAMERA_EVENT_CHANNEL_DISCONNECTED: { - NotifyCameraError(event, ErrorType::DEVICE_DISCONNECT); + NotifyCameraError(ErrorType::DEVICE_DISCONNECT); break; } case DCameraEventResult::DCAMERA_EVENT_CONFIG_STREAMS_ERROR: @@ -390,19 +390,19 @@ DCamRetCode DCameraDevice::Notify(const std::shared_ptr &event) break; } case DCameraEventResult::DCAMERA_EVENT_DEVICE_ERROR: { - NotifyCameraError(event, ErrorType::DRIVER_ERROR); + NotifyCameraError(ErrorType::DRIVER_ERROR); break; } case DCameraEventResult::DCAMERA_EVENT_DEVICE_PREEMPT: { - NotifyCameraError(event, ErrorType::DEVICE_PREEMPT); + NotifyCameraError(ErrorType::DEVICE_PREEMPT); break; } case DCameraEventResult::DCAMERA_EVENT_DEVICE_IN_USE: { - NotifyCameraError(event, ErrorType::DCAMERA_ERROR_BEGIN); + NotifyCameraError(ErrorType::DCAMERA_ERROR_DEVICE_IN_USE); break; } case DCameraEventResult::DCAMERA_EVENT_NO_PERMISSION: { - NotifyCameraError(event, ErrorType::DCAMERA_ERROR_NO_PERMISSION); + NotifyCameraError(ErrorType::DCAMERA_ERROR_NO_PERMISSION); break; } default: -- Gitee From ab8efb107f24d4c3a29f4e1a5eff4b49547c99f5 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 08:59:23 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../constants/distributed_camera_constants.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index 64754490..456c74b7 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -64,21 +64,6 @@ typedef enum { DCAMERA_EVENT_NO_PERMISSION = -12, } DCameraEventResult; -typedef enum { - CAMERA_OK = 0, - CAMERA_ALLOC_ERROR, - CAMERA_INVALID_ARG, - CAMERA_UNSUPPORTED, - CAMERA_DEVICE_BUSY, - CAMERA_DEVICE_CLOSED, - CAMERA_DEVICE_REQUEST_TIMEOUT, - CAMERA_STREAM_BUFFER_LOST, - CAMERA_INVALID_SESSION_CFG, - CAMERA_CAPTURE_LIMIT_EXCEED, - CAMERA_INVALID_STATE, - CAMERA_UNKNOWN_ERROR -} CameraServiceError; - typedef enum { OHOS_CAMERA_FORMAT_INVALID = 0, OHOS_CAMERA_FORMAT_RGBA_8888, -- Gitee From e7de81d5d0a97e696e648dd993555190ab2b7c36 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 09:02:13 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraoperator/client/src/dcamera_client_common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 242a37d2..4d3f5e56 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -123,7 +123,7 @@ int32_t DCameraClient::StartCapture(std::vector Date: Tue, 28 Jun 2022 14:01:52 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- common/include/constants/distributed_camera_errno.h | 2 +- .../client/src/callback/dcamera_input_callback.cpp | 2 +- .../client/src/callback/dcamera_photo_callback.cpp | 2 +- .../client/src/callback/dcamera_preview_callback.cpp | 2 +- .../client/src/callback/dcamera_video_callback.cpp | 2 +- .../cameraoperator/client/src/dcamera_client.cpp | 10 +++++----- .../client/src/dcamera_client_common.cpp | 10 +++++----- services/cameraservice/cameraoperator/handler/BUILD.gn | 4 +++- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common/include/constants/distributed_camera_errno.h b/common/include/constants/distributed_camera_errno.h index 81ac1d00..1e2929ee 100644 --- a/common/include/constants/distributed_camera_errno.h +++ b/common/include/constants/distributed_camera_errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp index 379e1942..f94f7ef4 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_input_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp index e95a2945..bd0cc0e3 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_photo_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp index c3982972..730a35a3 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_preview_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp index 6096bb82..a94acd62 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_video_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index ee894377..63be4160 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -126,9 +126,9 @@ int32_t DCameraClient::StartCapture(std::vector Date: Tue, 28 Jun 2022 14:10:58 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../include/constants/distributed_camera_constants.h | 2 +- services/cameraservice/cameraoperator/client/BUILD.gn | 6 ++++-- .../client/src/callback/dcamera_session_callback.cpp | 2 +- services/cameraservice/cameraoperator/handler/BUILD.gn | 4 +--- .../distributedcameramgr/dcamera_sink_controller.h | 1 - .../distributedcameramgr/dcamera_sink_controller.cpp | 10 +++------- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/common/include/constants/distributed_camera_constants.h b/common/include/constants/distributed_camera_constants.h index 456c74b7..bf517f2f 100644 --- a/common/include/constants/distributed_camera_constants.h +++ b/common/include/constants/distributed_camera_constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/client/BUILD.gn b/services/cameraservice/cameraoperator/client/BUILD.gn index f897ca21..ff075702 100644 --- a/services/cameraservice/cameraoperator/client/BUILD.gn +++ b/services/cameraservice/cameraoperator/client/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -18,7 +18,9 @@ import( ohos_shared_library("distributed_camera_client") { include_dirs = [ - "//drivers/peripheral/camera/interfaces/metadata/include", + "${camera_hdf_path}/camera/interfaces/metadata/include", + "${camera_hdf_path}/camera/interfaces/include", + "${camera_hdf_path}/camera/interfaces/hdi_ipc", "//utils/native/base/include", "//utils/system/safwk/native/include", "${graphicstandard_path}/frameworks/surface/include", diff --git a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp index 38b6d3c3..8785bcc1 100644 --- a/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp +++ b/services/cameraservice/cameraoperator/client/src/callback/dcamera_session_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/services/cameraservice/cameraoperator/handler/BUILD.gn b/services/cameraservice/cameraoperator/handler/BUILD.gn index 89e17bf5..bdd959e2 100644 --- a/services/cameraservice/cameraoperator/handler/BUILD.gn +++ b/services/cameraservice/cameraoperator/handler/BUILD.gn @@ -18,9 +18,7 @@ import( ohos_shared_library("distributed_camera_handler") { include_dirs = [ - "${camera_hdf_path}/camera/interfaces/metadata/include", - "${camera_hdf_path}/camera/interfaces/include", - "${camera_hdf_path}/camera/interfaces/hdi_ipc", + "//drivers/peripheral/camera/interfaces/metadata/include", "//third_party/jsoncpp/include", "//utils/native/base/include", "//utils/system/safwk/native/include", diff --git a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h index c111dae7..6b759e6f 100644 --- a/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h +++ b/services/cameraservice/sinkservice/include/distributedcameramgr/dcamera_sink_controller.h @@ -63,7 +63,6 @@ private: int32_t DCameraNotifyInner(int32_t type, int32_t result, std::string content); int32_t HandleReceivedData(std::shared_ptr& dataBuffer); void PostAuthorization(std::vector>& captureInfos); - void DCameraErrorNotifyInner(const int32_t errorType); bool isInit_; int32_t sessionState_; diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index 40cb0170..2e993c73 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -308,12 +308,8 @@ void DCameraSinkController::OnEvent(DCameraPostAuthorizationEvent& event) void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", - GetAnonyString(dhId_).c_str(), event->eventResult_); - if (event->eventResult_ == DCAMERA_EVENT_DEVICE_PREEMPT) { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_PREEMPT, std::string("camera preempted")); - } else { - DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); - } + GetAnonyString(dhId_).c_str(), event->eventResult_); + DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); } void DCameraSinkController::OnMetadataResult() -- Gitee From f160090a36cecf8e7b25d90e169c0c951142a6b2 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 14:23:09 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraoperator/client/src/dcamera_client_common.cpp | 3 ++- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 57b5d39f..d8513f7d 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -140,7 +140,8 @@ int32_t DCameraClient::StartCapture(std::vector& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", - GetAnonyString(dhId_).c_str(), event->eventResult_); + GetAnonyString(dhId_).c_str(), event->eventResult_); DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); } -- Gitee From 5db0893ecdcc1039710c91efc699306480a76d53 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 14:32:41 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraoperator/client/src/dcamera_client_common.cpp | 2 +- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index d8513f7d..0c55e856 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -124,7 +124,7 @@ int32_t DCameraClient::StartCapture(std::vector& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", - GetAnonyString(dhId_).c_str(), event->eventResult_); + GetAnonyString(dhId_).c_str(), event->eventResult_); DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); } -- Gitee From f771dca905342433bd60fbd2499f6667b73960a7 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 14:34:30 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../src/distributedcameramgr/dcamera_sink_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp index b916d302..9790a319 100644 --- a/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp +++ b/services/cameraservice/sinkservice/src/distributedcameramgr/dcamera_sink_controller.cpp @@ -308,7 +308,7 @@ void DCameraSinkController::OnEvent(DCameraPostAuthorizationEvent& event) void DCameraSinkController::OnStateChanged(std::shared_ptr& event) { DHLOGI("DCameraSinkController::OnStateChanged dhId: %s, result: %d", - GetAnonyString(dhId_).c_str(), event->eventResult_); + GetAnonyString(dhId_).c_str(), event->eventResult_); DCameraNotifyInner(DCAMERA_MESSAGE, DCAMERA_EVENT_DEVICE_ERROR, std::string("camera error")); } -- Gitee From 26549bf1e85cd52e8ab12c7194bff8142dffe0b1 Mon Sep 17 00:00:00 2001 From: wangchaole Date: Tue, 28 Jun 2022 14:40:19 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraoperator/client/src/dcamera_client_common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 0c55e856..1715abba 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -124,7 +124,7 @@ int32_t DCameraClient::StartCapture(std::vector Date: Tue, 28 Jun 2022 14:41:52 +0800 Subject: [PATCH 20/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../cameraoperator/client/src/dcamera_client_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp index 1715abba..56af26ad 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client_common.cpp @@ -124,7 +124,7 @@ int32_t DCameraClient::StartCapture(std::vector Date: Tue, 28 Jun 2022 20:20:14 +0800 Subject: [PATCH 21/21] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8F=E7=9B=B8?= =?UTF-8?q?=E6=9C=BA=E8=B0=83=E6=95=B4=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangchaole --- .../client/include/dcamera_client.h | 1 + .../client/src/dcamera_client.cpp | 24 +++++++++---------- .../client/src/dcamera_client_common.cpp | 24 +++++++++---------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/services/cameraservice/cameraoperator/client/include/dcamera_client.h b/services/cameraservice/cameraoperator/client/include/dcamera_client.h index 712d7544..c6c37169 100644 --- a/services/cameraservice/cameraoperator/client/include/dcamera_client.h +++ b/services/cameraservice/cameraoperator/client/include/dcamera_client.h @@ -57,6 +57,7 @@ private: int32_t StartVideoOutput(); void SetQualityAndGpsLocation(const std::shared_ptr& cameraMetadata, std::shared_ptr& photoCaptureSettings); + int32_t CameraServiceErrorType(const int32_T errorType); bool isInit_; std::string cameraId_; diff --git a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp index 63be4160..1336744d 100644 --- a/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp +++ b/services/cameraservice/cameraoperator/client/src/dcamera_client.cpp @@ -126,12 +126,7 @@ int32_t DCameraClient::StartCapture(std::vector