1 /* 2 * Copyright (c) 2020-2021 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 GRAPHIC_LITE_LITE_WM_REQUESTOR_H 17 #define GRAPHIC_LITE_LITE_WM_REQUESTOR_H 18 19 #include "gfx_utils/geometry2d.h" 20 #include "iproxy_client.h" 21 #include "iwindows_manager.h" 22 #include "lite_win_requestor.h" 23 #include "lite_wm_type.h" 24 #include "ipc_skeleton.h" 25 26 namespace OHOS { 27 class LiteWMRequestor : public IBufferConsumerListener { 28 public: 29 static LiteWMRequestor* GetInstance(); 30 static int Callback(void* owner, int code, IpcIo* reply); 31 static int32_t WmsMsgHandler(uint32_t code, IpcIo* data, IpcIo* reply, MessageOption option); 32 static int32_t SurfaceRequestHandler(uint32_t code, IpcIo* data, IpcIo* reply, MessageOption option); 33 34 void OnBufferAvailable() override; 35 36 void ClientRegister(); 37 void GetLayerInfo(); 38 LiteWinRequestor* CreateWindow(const LiteWinConfig& config); 39 void RemoveWindow(int32_t id); 40 void GetEventData(DeviceData* data); 41 42 void Screenshot(); SetScreenshotListener(IWindowsManager::ScreenshotListener * listener)43 void SetScreenshotListener(IWindowsManager::ScreenshotListener* listener) 44 { 45 listener_ = listener; 46 } 47 48 private: 49 LiteWMRequestor(); ~LiteWMRequestor()50 ~LiteWMRequestor() {} 51 52 void ScreenShotClearup(); 53 IClientProxy* proxy_; 54 IWindowsManager::ScreenshotListener* listener_; 55 Surface* surface_; 56 SvcIdentity sid_; 57 IpcObjectStub objectStub_; 58 LiteLayerInfo layerInfo_; 59 }; 60 } // namespace OHOS 61 #endif 62