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 5000 27 28 #define CMD_WIFI_TOGGLED 0x1 29 #define CMD_SOFTAP_TOGGLED 0x2 30 #define CMD_SCAN_ALWAYS_MODE_CHANGED 0x3 31 #define CMD_STA_START_FAILURE 0x4 32 #define CMD_CONCRETE_STOPPED 0x5 33 #define CMD_AP_STOPPED 0x6 34 #define CMD_AP_START_FAILURE 0x7 35 #define CMD_AP_START 0x8 36 #define CMD_AIRPLANE_TOGGLED 0x9 37 #define CMD_WIFI_TOGGLED_TIMEOUT 0xA 38 #define CMD_SEMI_WIFI_TOGGLED_TIMEOUT 0xB 39 #define CMD_AP_START_TIME 0x10 40 #define CMD_AP_STOP_TIME 0x11 41 #define CMD_OPEN_WIFI_RETRY 0x12 42 #define CMD_STA_REMOVED 0x14 43 #define CMD_CONCRETECLIENT_REMOVED 0x15 44 #define CMD_AP_REMOVED 0x16 45 46 #define CONCRETE_CMD_START 0x101 47 #define CONCRETE_CMD_SWITCH_TO_CONNECT_MODE 0x102 48 #define CONCRETE_CMD_SWITCH_TO_SCAN_ONLY_MODE 0x103 49 #define CONCRETE_CMD_STA_STOP 0x104 50 #define CONCRETE_CMD_STA_START 0x105 51 #define CONCRETE_CMD_STOP 0x106 52 #define CONCRETE_CMD_STA_SEMI_ACTIVE 0x107 53 #define CONCRETE_CMD_SWITCH_TO_SEMI_ACTIVE_MODE 0x108 54 #define CONCRETE_CMD_STA_REMOVED 0x109 55 56 #define SOFTAP_CMD_START 0x201 57 #define SOFTAP_CMD_STOP 0x202 58 59 #define MULTI_STA_CMD_START 0x301 60 #define MULTI_STA_CMD_STOP 0x302 61 #define MULTI_STA_CMD_STARTED 0x303 62 #define MULTI_STA_CMD_STOPPED 0x304 63 #define CMD_MULTI_STA_STOPPED 0x305 64 65 #define STOP_WIFI_WAIT_TIME 100 66 67 struct ConcreteModeCallback { 68 std::function<void(int)> onStopped; 69 std::function<void(int)> onStartFailure; 70 std::function<void(int)> onRemoved; 71 }; 72 73 struct SoftApModeCallback { 74 std::function<void(int)> onStopped; 75 std::function<void(int)> onStartFailure; 76 }; 77 78 struct MultiStaModeCallback { 79 std::function<void(int)> onStopped; 80 std::function<void(int)> onStartFailure; 81 }; 82 83 enum class ConcreteManagerRole { 84 ROLE_UNKNOW = -1, 85 ROLE_CLIENT_SCAN_ONLY = 0, 86 ROLE_CLIENT_STA, 87 ROLE_CLIENT_MIX_SEMI_ACTIVE, 88 ROLE_CLIENT_STA_SEMI_ACTIVE, 89 }; 90 91 enum class SoftApperateType { 92 OPEN_SOFT_AP_FAILED = 0, 93 CLOSE_SOFT_AP_FAILED = 1, 94 }; 95 96 } // namespace Wifi 97 } // namespace OHOS 98 #endif 99