1 /* 2 * Copyright (c) 2021-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 #include "dcamera_preview_callback.h" 17 18 #include "distributed_camera_constants.h" 19 #include "distributed_hardware_log.h" 20 #include "dcamera_event_cmd.h" 21 22 namespace OHOS { 23 namespace DistributedHardware { DCameraPreviewCallback(const std::shared_ptr<StateCallback> & callback)24DCameraPreviewCallback::DCameraPreviewCallback(const std::shared_ptr<StateCallback>& callback) : callback_(callback) 25 { 26 } 27 OnFrameStarted() const28void DCameraPreviewCallback::OnFrameStarted() const 29 { 30 DHLOGI("enter"); 31 } 32 OnFrameEnded(const int32_t frameCount) const33void DCameraPreviewCallback::OnFrameEnded(const int32_t frameCount) const 34 { 35 DHLOGI("enter, frameCount: %{public}d", frameCount); 36 } 37 OnError(const int32_t errorCode) const38void DCameraPreviewCallback::OnError(const int32_t errorCode) const 39 { 40 DHLOGE("enter, errorCode: %{public}d", errorCode); 41 if (callback_ == nullptr) { 42 DHLOGE("StateCallback is null"); 43 return; 44 } 45 46 std::shared_ptr<DCameraEvent> event = std::make_shared<DCameraEvent>(); 47 event->eventType_ = DCAMERA_MESSAGE; 48 event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR; 49 callback_->OnStateChanged(event); 50 } 51 OnSketchStatusDataChanged(const CameraStandard::SketchStatusData & statusData) const52void DCameraPreviewCallback::OnSketchStatusDataChanged(const CameraStandard::SketchStatusData& statusData) const 53 { 54 DHLOGI("enter"); 55 } 56 } // namespace DistributedHardware 57 } // namespace OHOS 58