• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-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 OHOS_WIFI_CONTROLLER_DEFINE_H
17 #define OHOS_WIFI_CONTROLLER_DEFINE_H
18 #include <functional>
19 
20 namespace OHOS {
21 namespace Wifi {
22 
23 #define SOFT_AP_TIME_OUT 10000
24 #define WIFI_OPEN_RETRY_MAX_COUNT 3
25 #define WIFI_OPEN_RETRY_TIMEOUT 1000
26 #define WIFI_OPEN_TIMEOUT 10000
27 #define CONCRETE_STOP_TIMEOUT 1000
28 
29 #define CMD_WIFI_TOGGLED 0x1
30 #define CMD_SOFTAP_TOGGLED 0x2
31 #define CMD_SCAN_ALWAYS_MODE_CHANGED 0x3
32 #define CMD_STA_START_FAILURE 0x4
33 #define CMD_CONCRETE_STOPPED 0x5
34 #define CMD_AP_STOPPED 0x6
35 #define CMD_AP_START_FAILURE 0x7
36 #define CMD_AP_START 0x8
37 #define CMD_AIRPLANE_TOGGLED 0x9
38 #define CMD_WIFI_TOGGLED_TIMEOUT 0xA
39 #define CMD_SEMI_WIFI_TOGGLED_TIMEOUT 0xB
40 #define CMD_AP_START_TIME 0x10
41 #define CMD_AP_STOP_TIME 0x11
42 #define CMD_OPEN_WIFI_RETRY 0x12
43 #define CMD_STA_REMOVED 0x14
44 #define CMD_CONCRETECLIENT_REMOVED 0x15
45 #define CMD_AP_REMOVED 0x16
46 #define CMD_RPT_STOPPED 0x17
47 #define CMD_RPT_START_FAILURE 0x18
48 #define CMD_P2P_STOPPED 0x19
49 
50 #define CONCRETE_CMD_START 0x101
51 #define CONCRETE_CMD_SWITCH_TO_CONNECT_MODE 0x102
52 #define CONCRETE_CMD_SWITCH_TO_SCAN_ONLY_MODE 0x103
53 #define CONCRETE_CMD_STA_STOP 0x104
54 #define CONCRETE_CMD_STA_START 0x105
55 #define CONCRETE_CMD_STOP 0x106
56 #define CONCRETE_CMD_STA_SEMI_ACTIVE 0x107
57 #define CONCRETE_CMD_SWITCH_TO_SEMI_ACTIVE_MODE 0x108
58 #define CONCRETE_CMD_STA_REMOVED 0x109
59 #define CONCRETE_CMD_RESET_STA 0x110
60 #define CONCRETE_CMD_SET_TARGET_ROLE 0x111
61 #define CONCRETE_CMD_STOP_MACHINE_RETRY 0X112
62 #define RESET_STA_TYPE_SELFCURE 1
63 
64 #define SOFTAP_CMD_START 0x201
65 #define SOFTAP_CMD_STOP 0x202
66 
67 #define MULTI_STA_CMD_START 0x301
68 #define MULTI_STA_CMD_STOP 0x302
69 #define MULTI_STA_CMD_STARTED 0x303
70 #define MULTI_STA_CMD_STOPPED 0x304
71 #define CMD_MULTI_STA_STOPPED 0x305
72 
73 #define RPT_CMD_START 0x401
74 #define RPT_CMD_STOP 0x402
75 #define RPT_CMD_ON_P2P_CLOSE 0x403
76 #define RPT_CMD_ON_GROUP_CREATED 0x404
77 #define RPT_CMD_ON_GROUP_REMOVED 0x405
78 #define RPT_CMD_ON_CREATE_RPT_GROUP_FAILED 0x406
79 #define RPT_CMD_ON_REMOVE_RPT_GROUP_TIMEOUT 0x407
80 #define RPT_CMD_ON_REMOVE_CONFLICT_GROUP_TIMEOUT 0x408
81 #define RPT_CMD_ADD_BLOCK 0x409
82 #define RPT_CMD_DEL_BLOCK 0x40A
83 #define RPT_CMD_ON_STATION_JOIN 0x40B
84 #define RPT_CMD_ON_STATION_LEAVE 0x40C
85 
86 #define STOP_WIFI_WAIT_TIME 100
87 
88 struct ConcreteModeCallback {
89     std::function<void(int)> onStopped;
90     std::function<void(int)> onStartFailure;
91     std::function<void(int)> onRemoved;
92 };
93 
94 struct SoftApModeCallback {
95     std::function<void(int)> onStopped;
96     std::function<void(int)> onStartFailure;
97 };
98 
99 struct MultiStaModeCallback {
100     std::function<void(int)> onStopped;
101     std::function<void(int)> onStartFailure;
102 };
103 
104 struct RptModeCallback {
105     std::function<void(int)> onStopped;
106     std::function<void(int)> onStartFailure;
107 };
108 
109 enum class ConcreteManagerRole {
110     ROLE_UNKNOW = -1,
111     ROLE_CLIENT_SCAN_ONLY = 0,
112     ROLE_CLIENT_STA,
113     ROLE_CLIENT_MIX_SEMI_ACTIVE,
114     ROLE_CLIENT_STA_SEMI_ACTIVE,
115 };
116 
117 enum class SoftApperateType {
118     OPEN_SOFT_AP_FAILED = 0,
119     CLOSE_SOFT_AP_FAILED = 1,
120 };
121 
122 enum class SoftApChrEventType {
123     SOFT_AP_OPEN_CNT = 0,
124     SOFT_AP_OPEN_SUC_CNT,
125     SOFT_AP_CONN_CNT,
126     SOFT_AP_CONN_SUC_CNT,
127 };
128 
129 }  // namespace Wifi
130 }  // namespace OHOS
131 #endif
132