1 /* 2 * Copyright (c) 2023 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 VIRTUAL_KEYBOARD_BUILDER_H 17 #define VIRTUAL_KEYBOARD_BUILDER_H 18 19 #include <nlohmann/json.hpp> 20 21 #include "virtual_device_builder.h" 22 23 namespace OHOS { 24 namespace Msdp { 25 namespace DeviceStatus { 26 class VirtualKeyboardBuilder final : public VirtualDeviceBuilder { 27 public: 28 VirtualKeyboardBuilder(); 29 ~VirtualKeyboardBuilder() = default; 30 DISALLOW_COPY_AND_MOVE(VirtualKeyboardBuilder); 31 32 static std::string GetDeviceName(); 33 static void ShowUsage(); 34 static void Mount(); 35 static void Unmount(); 36 static void Clone(); 37 static void Act(int32_t argc, char *argv[]); 38 39 private: 40 static void ReadDownAction(); 41 static void ReadUpAction(); 42 static void ReadActions(const char *path); 43 static void ReadModel(const nlohmann::json &model, int32_t level); 44 static void ReadAction(const nlohmann::json &model); 45 static void HandleDown(const nlohmann::json &model); 46 static void HandleUp(const nlohmann::json &model); 47 static void HandleWait(const nlohmann::json &model); 48 static void ReadRawInput(const char *path); 49 static void ReadRawModel(const nlohmann::json &model, int32_t level); 50 static void ReadRawData(const nlohmann::json &model); 51 }; 52 } // namespace DeviceStatus 53 } // namespace Msdp 54 } // namespace OHOS 55 #endif //VIRTUAL_KEYBOARD_BUILDER_H