1 /* 2 * Copyright (c) 2024-2025 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 DEVICESTATUS_NAPI_MANAGER_H 17 #define DEVICESTATUS_NAPI_MANAGER_H 18 19 #include <string> 20 #include "pixel_map.h" 21 22 namespace OHOS { 23 namespace Msdp { 24 namespace DeviceStatus { 25 26 typedef void (*EncodeImageFunc)(std::shared_ptr<Media::PixelMap> &pixelMap, const std::string &content, 27 std::shared_ptr<Media::PixelMap> &resultPixelMap); 28 typedef void (*DecodeImageFunc)(std::shared_ptr<Media::PixelMap> &pixelMap, std::string &content); 29 30 class BoomerangAlgoManager { 31 public: BoomerangAlgoManager()32 BoomerangAlgoManager() {}; 33 ~BoomerangAlgoManager(); 34 static bool EncodeImage(std::shared_ptr<Media::PixelMap> &pixelMap, const std::string &content, 35 std::shared_ptr<Media::PixelMap> &resultPixelMap); 36 static bool DecodeImage(std::shared_ptr<Media::PixelMap> &pixelMap, std::string &content); 37 private: 38 static void *boomerangAlgoHandle_; 39 static EncodeImageFunc boomerangAlgoEncodeImageHandle_; 40 static DecodeImageFunc boomerangAlgoDecodeImageHandle_; 41 }; 42 43 class BoomerangAlgoImpl { 44 public: 45 static void EncodeImage(std::shared_ptr<Media::PixelMap> &pixelMap, const std::string &content, 46 std::shared_ptr<Media::PixelMap> &resultPixelMap); 47 static void DecodeImage(std::shared_ptr<Media::PixelMap> &pixelMap, std::string &content); 48 }; 49 } 50 } 51 } 52 #endif // DEVICESTATUS_NAPI_MANAGER_H