• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OHOS_DISTRIBUTED_HARDWARE_IMPL_UTILS_H
17 #define OHOS_DISTRIBUTED_HARDWARE_IMPL_UTILS_H
18 
19 #include <unordered_map>
20 
21 #include "device_type.h"
22 #include "constants.h"
23 
24 namespace OHOS {
25 namespace DistributedHardware {
26 enum class TaskType : int32_t {
27     UNKNOWN = 0,
28     ENABLE = 1,
29     DISABLE = 2,
30     ON_LINE = 3,
31     OFF_LINE = 4
32 };
33 
34 enum class TaskStep : int32_t {
35     DO_ENABLE = 1,
36     DO_DISABLE = 2,
37     SYNC_ONLINE_INFO = 3,
38     REGISTER_ONLINE_DISTRIBUTED_HARDWARE = 4,
39     UNREGISTER_OFFLINE_DISTRIBUTED_HARDWARE = 5,
40     CLEAR_OFFLINE_INFO = 6,
41     WAIT_UNREGISTGER_COMPLETE = 7
42 };
43 
44 enum class TaskState : int32_t {
45     INIT = 0,
46     RUNNING = 1,
47     SUCCESS = 2,
48     FAIL = 3
49 };
50 
51 struct CompVersion {
52     std::string name;
53     DHType dhType;
54     std::string handlerVersion;
55     std::string sourceVersion;
56     std::string sinkVersion;
57 };
58 
59 struct DHVersion {
60     std::string uuid;
61     std::string dhVersion;
62     std::unordered_map<DHType, CompVersion> compVersions;
63 };
64 
65 struct TaskParam {
66     std::string networkId;
67     std::string uuid;
68     std::string dhId;
69     DHType dhType;
70 };
71 
72 struct TaskDump {
73     std::string id;
74     TaskType taskType;
75     TaskParam taskParm;
76     TaskState taskState;
77     std::vector<TaskStep> taskSteps;
78 };
79 } // namespace DistributedHardware
80 } // namespace OHOS
81 #endif
82