1 /* 2 * Copyright (C) 2024 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 FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H 17 #define FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H 18 19 #include <memory> 20 #include <string> 21 22 #include "abs_shared_result_set.h" 23 #include "enhancement_thread_manager.h" 24 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT 25 #include "media_enhance_constants_c_api.h" 26 #include "media_enhance_handles.h" 27 #include "media_enhance_client_c_api.h" 28 #include "media_enhance_bundle_c_api.h" 29 #endif 30 31 namespace OHOS { 32 namespace Media { 33 #define EXPORT __attribute__ ((visibility ("default"))) 34 struct CloudEnhancementFileInfo { 35 int32_t fileId; 36 std::string filePath; 37 std::string displayName; 38 int32_t subtype; 39 int32_t hidden; CloudEnhancementFileInfoCloudEnhancementFileInfo40 CloudEnhancementFileInfo() : fileId(0), filePath(""), displayName(""), 41 subtype(0), hidden(0) {} CloudEnhancementFileInfoCloudEnhancementFileInfo42 CloudEnhancementFileInfo(int32_t fileId, std::string filePath, std::string displayName, 43 int32_t subtype, int32_t hidden) : fileId(fileId), filePath(filePath), 44 displayName(displayName), subtype(subtype), hidden(hidden) {} 45 }; 46 47 class EnhancementServiceCallback { 48 public: 49 EXPORT EnhancementServiceCallback(); 50 EXPORT ~EnhancementServiceCallback(); 51 52 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT 53 EXPORT static void OnSuccess(const char* photoId, MediaEnhance::MediaEnhanceBundleHandle* bundle); 54 EXPORT static void OnFailed(const char* photoId, MediaEnhance::MediaEnhanceBundleHandle* bundle); 55 EXPORT static void OnServiceReconnected(); 56 EXPORT static void DealWithSuccessedTask(CloudEnhancementThreadTask& task); 57 EXPORT static void DealWithFailedTask(CloudEnhancementThreadTask& task); 58 EXPORT static void UpdateAlbumsForCloudEnhancement(); 59 #endif 60 61 private: 62 #ifdef ABILITY_CLOUD_ENHANCEMENT_SUPPORT 63 EXPORT static int32_t SaveCloudEnhancementPhoto(std::shared_ptr<CloudEnhancementFileInfo> info, 64 CloudEnhancementThreadTask& task, std::shared_ptr<NativeRdb::Result> resultSet); 65 EXPORT static int32_t CreateCloudEnhancementPhoto(int32_t sourceFileId, 66 std::shared_ptr<CloudEnhancementFileInfo> info, std::shared_ptr<NativeRdb::Result> resultSet); 67 #endif 68 }; 69 } // namespace Media 70 } // namespace OHOS 71 #endif // FRAMEWORKS_SERVICES_MEDIA_CLOUD_ENHANCEMENT_INCLUDE_ENHANCEMENT_SERVICE_CALLBACK_H