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_INPUTMETHOD_CONTROLLER_INCLUDE_SYSTEM_CMD_CHANNEL_STUB_H 17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_SYSTEM_CMD_CHANNEL_STUB_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "i_system_cmd_channel.h" 23 #include "iremote_stub.h" 24 #include "message_handler.h" 25 #include "message_option.h" 26 #include "message_parcel.h" 27 #include "nocopyable.h" 28 #include "refbase.h" 29 30 namespace OHOS { 31 namespace MiscServices { 32 class SystemCmdChannelStub : public IRemoteStub<ISystemCmdChannel> { 33 public: 34 DISALLOW_COPY_AND_MOVE(SystemCmdChannelStub); 35 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 36 SystemCmdChannelStub(); 37 ~SystemCmdChannelStub(); 38 int32_t SendPrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand) override; 39 int32_t NotifyPanelStatus(const SysPanelStatus &sysPanelStatus) override; 40 41 private: 42 int32_t NotifyPanelStatusOnRemote(MessageParcel &data, MessageParcel &reply); 43 int32_t SendPrivateCommandOnRemote(MessageParcel &data, MessageParcel &reply); 44 using RequestHandler = int32_t (SystemCmdChannelStub::*)(MessageParcel &, MessageParcel &); 45 static constexpr RequestHandler HANDLERS[SYSTEM_CMD_END] = { 46 [SEND_PRIVATE_COMMAND] = &SystemCmdChannelStub::SendPrivateCommandOnRemote, 47 [SHOULD_SYSTEM_PANEL_SHOW] = &SystemCmdChannelStub::NotifyPanelStatusOnRemote, 48 }; 49 }; 50 } // namespace MiscServices 51 } // namespace OHOS 52 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_SYSTEM_CMD_CHANNEL_STUB_H