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 BOOMERANG_SERVER_H 17 #define BOOMERANG_SERVER_H 18 19 #include "nocopyable.h" 20 21 #include "accesstoken_kit.h" 22 23 #include "devicestatus_manager.h" 24 #include "i_plugin.h" 25 26 namespace OHOS { 27 namespace Msdp { 28 namespace DeviceStatus { 29 class BoomerangServer { 30 public: 31 BoomerangServer(); 32 ~BoomerangServer() = default; 33 DISALLOW_COPY_AND_MOVE(BoomerangServer); 34 bool IsSystemServiceCalling(CallingContext &context); 35 bool IsSystemHAPCalling(CallingContext &context); 36 void DumpDeviceStatusSubscriber(int32_t fd) const; 37 void DumpDeviceStatusChanges(int32_t fd) const; 38 void DumpCurrentDeviceStatus(int32_t fd); 39 int32_t SubscribeCallback(CallingContext &context, int32_t type, const std::string& bundleName, 40 const sptr<IRemoteBoomerangCallback>& subCallback); 41 int32_t UnsubscribeCallback(CallingContext &context, int32_t type, const std::string& bundleName, 42 const sptr<IRemoteBoomerangCallback>& unsubCallback); 43 int32_t NotifyMetadataBindingEvent(CallingContext &context, const std::string& bundleName, 44 const sptr<IRemoteBoomerangCallback>& notifyCallback); 45 int32_t SubmitMetadata(CallingContext &context, const std::string& metaData); 46 int32_t BoomerangEncodeImage(CallingContext &context, const std::shared_ptr<Media::PixelMap>& pixelMap, 47 const std::string& metaData, const sptr<IRemoteBoomerangCallback>& encodeCallback); 48 int32_t BoomerangDecodeImage(CallingContext &context, const std::shared_ptr<Media::PixelMap>& pixelMap, 49 const sptr<IRemoteBoomerangCallback>& decodeCallback); 50 51 private: 52 Data GetCache(CallingContext &context, const Type &type); 53 void ReportSensorSysEvent(CallingContext &context, int32_t type, bool enable); 54 55 DeviceStatusManager manager_; 56 }; 57 } // namespace DeviceStatus 58 } // namespace Msdp 59 } // namespace OHOS 60 #endif // BOOMERANG_SERVER_H