1 /* 2 * Copyright (c) 2023-2023 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_IDEFERRED_PHOTO_PROCESSING_SESSION_CALLBACK_H 17 #define OHOS_IDEFERRED_PHOTO_PROCESSING_SESSION_CALLBACK_H 18 19 #include "iremote_broker.h" 20 #include "ipc_file_descriptor.h" 21 #include "basic_definitions.h" 22 namespace OHOS::Media { 23 class Picture; 24 } 25 namespace OHOS { 26 namespace CameraStandard { 27 namespace DeferredProcessing { 28 enum ErrorCode { 29 // session specific error code 30 ERROR_SESSION_SYNC_NEEDED = 0, 31 ERROR_SESSION_NOT_READY_TEMPORARILY = 1, 32 33 // process error code 34 ERROR_IMAGE_PROC_INVALID_PHOTO_ID = 2, 35 ERROR_IMAGE_PROC_FAILED = 3, 36 ERROR_IMAGE_PROC_TIMEOUT = 4, 37 ERROR_IMAGE_PROC_ABNORMAL = 5, 38 ERROR_IMAGE_PROC_INTERRUPTED = 6, 39 40 ERROR_VIDEO_PROC_INVALID_VIDEO_ID = 7, 41 ERROR_VIDEO_PROC_FAILED = 8, 42 ERROR_VIDEO_PROC_TIMEOUT = 9, 43 ERROR_VIDEO_PROC_INTERRUPTED = 10, 44 }; 45 46 enum StatusCode { 47 SESSION_STATE_IDLE = 0, 48 SESSION_STATE_RUNNALBE, 49 SESSION_STATE_RUNNING, 50 SESSION_STATE_SUSPENDED, 51 }; 52 53 class IDeferredPhotoProcessingSessionCallback : public IRemoteBroker { 54 public: 55 virtual int32_t OnProcessImageDone(const std::string &imageId, std::shared_ptr<Media::Picture> picture, 56 bool isCloudEnhancementAvailable) = 0; 57 virtual int32_t OnDeliveryLowQualityImage(const std::string &imageId, std::shared_ptr<Media::Picture> picture) = 0; 58 virtual int32_t OnProcessImageDone(const std::string &imageId, sptr<IPCFileDescriptor> ipcFd, const long bytes, 59 bool isCloudEnhancementAvailable) = 0; 60 virtual int32_t OnError(const std::string &imageId, const ErrorCode errorCode) = 0; 61 virtual int32_t OnStateChanged(const StatusCode status) = 0; 62 DECLARE_INTERFACE_DESCRIPTOR(u"IDeferredPhotoProcessingSessionCallback"); 63 }; 64 } // namespace DeferredProcessing 65 } // namespace CameraStandard 66 } // namespace OHOS 67 #endif // OHOS_IDEFERRED_PHOTO_PROCESSING_SESSION_CALLBACK_H