1 /* 2 * Copyright (c) 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 HDI_VIDEO_LAYER_STUB_V1_0_H 17 #define HDI_VIDEO_LAYER_STUB_V1_0_H 18 19 #include <iremote_stub.h> 20 #include <message_parcel.h> 21 #include <message_option.h> 22 #include <string> 23 24 #include "idisplay_layer.h" 25 #include "video_layer_service.h" 26 27 namespace OHOS { 28 namespace HDI { 29 namespace Display { 30 namespace V1_0 { 31 enum { 32 CMD_DISPLAY_LAYER_INIT_DISPLAY = 0, 33 CMD_DISPLAY_LAYER_DEINIT_DISPLAY, 34 CMD_DISPLAY_LAYER_GET_DISPLAY_INFO, 35 CMD_DISPLAY_LAYER_CREATE_LAYER, 36 CMD_DISPLAY_LAYER_CLOSE_LAYER, 37 CMD_DISPLAY_LAYER_SET_LAYER_VISIBLE, 38 CMD_DISPLAY_LAYER_GET_LAYER_VISIBLE_STATE, 39 CMD_DISPLAY_LAYER_SET_LAYER_RECT, 40 CMD_DISPLAY_LAYER_GET_LAYER_RECT, 41 CMD_DISPLAY_LAYER_SET_LAYER_ZORDER, 42 CMD_DISPLAY_LAYER_GET_LAYER_ZORDER, 43 CMD_DISPLAY_LAYER_SET_TRANSFORM_MODE, 44 CMD_DISPLAY_LAYER_SET_LAYER_BUFFER, 45 }; 46 47 class VideoLayerStub { 48 public: 49 VideoLayerStub(); ~VideoLayerStub()50 virtual ~VideoLayerStub() {} 51 52 DispErrCode Init(); 53 int32_t LayerStubInitDisplay(MessageParcel& data, MessageParcel& reply, MessageOption& option); 54 int32_t LayerStubDeinitDisplay(MessageParcel& data, MessageParcel& reply, MessageOption& option); 55 int32_t LayerStubGetDisplayInfo(MessageParcel& data, MessageParcel& reply, MessageOption& option); 56 int32_t LayerStubCreateLayer(MessageParcel& data, MessageParcel& reply, MessageOption& option); 57 int32_t LayerStubCloseLayer(MessageParcel& data, MessageParcel& reply, MessageOption& option); 58 int32_t LayerStubSetLayerVisible(MessageParcel& data, MessageParcel& reply, MessageOption& option); 59 int32_t LayerStubGetLayerVisibleState(MessageParcel& data, MessageParcel& reply, MessageOption& option); 60 int32_t LayerStubSetLayerRect(MessageParcel& data, MessageParcel& reply, MessageOption& option); 61 int32_t LayerStubGetLayerRect(MessageParcel& data, MessageParcel& reply, MessageOption& option); 62 int32_t LayerStubSetLayerZorder(MessageParcel& data, MessageParcel& reply, MessageOption& option); 63 int32_t LayerStubGetLayerZorder(MessageParcel& data, MessageParcel& reply, MessageOption& option); 64 int32_t LayerStubSetLayerTransformMode(MessageParcel& data, MessageParcel& reply, MessageOption& option); 65 int32_t LayerStubSetLayerBuffer(MessageParcel& data, MessageParcel& reply, MessageOption& option); 66 int32_t LayerStubOnRemoteRequest(int cmdId, MessageParcel& data, MessageParcel& reply, MessageOption& option); GetDescriptor()67 static inline const std::u16string &GetDescriptor() 68 { 69 return metaDescriptor_; 70 } 71 72 private: 73 static inline const std::u16string metaDescriptor_ = u"HDI.DISPLAY.LAYER.V1_0"; 74 std::shared_ptr<VideoLayerService> layerService_ = nullptr; 75 }; 76 } // namespace V1_0 77 } // namespace Display 78 } // namespace HDI 79 } // namespace OHOS 80 81 void *LayerStubInstance(); 82 void DestroyLayerStub(void *obj); 83 int32_t LayerServiceOnRemoteRequest(void *stub, int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply); 84 85 #endif // HDI_VIDEO_LAYER_STUB_V1_0_H