• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 INPUT_DISPLAY_BIND_HELPER_H
17 #define INPUT_DISPLAY_BIND_HELPER_H
18 
19 #include <cstdint>
20 #include <memory>
21 #include <set>
22 #include <string>
23 
24 #include "window_info.h"
25 
26 namespace OHOS {
27 namespace MMI {
28 class BindInfos;
29 class InputDisplayBindHelper {
30 public:
31     InputDisplayBindHelper(const std::string bindCfgFile);
32     std::string GetBindDisplayNameByInputDevice(int32_t inputDeviceId) const;
33     void AddInputDevice(int32_t id, const std::string &name);
34     void RemoveInputDevice(int32_t id);
35     bool IsDisplayAdd(int32_t id, const std::string &name);
36     std::set<std::pair<int32_t, std::string>> GetDisplayIdNames() const;
37     void AddDisplay(int32_t id, const std::string &name);
38     void RemoveDisplay(int32_t id);
39     void Load();
40     std::string Dumps() const;
41     void Store();
42     int32_t GetDisplayBindInfo(DisplayBindInfos &infos);
43     int32_t SetDisplayBind(int32_t deviceId, int32_t displayId, std::string &msg);
44 
45 private:
46     const std::string fileName_;
47     std::shared_ptr<BindInfos> infos_;
48     std::shared_ptr<BindInfos> configFileInfos_;
49 };
50 } // namespace MMI
51 } // namespace OHOS
52 #endif // INPUT_DISPLAY_BIND_HELPER_H