1 /*
2  * Copyright (C) 2024 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_BACKUP_CONFIG_H
17 #define OHOS_WIFI_BACKUP_CONFIG_H
18 #include "wifi_msg.h"
19 
20 namespace OHOS {
21 namespace Wifi {
22 /* Backup configuration information */
23 struct WifiBackupConfig {
24     int instanceId;
25     int uid;
26     int status;
27     std::string bssid;
28     std::string userSelectBssid;
29     std::string ssid;
30     int priority;
31     bool hiddenSSID;
32     std::string keyMgmt;
33     unsigned int networkStatusHistory;
34     bool isPortal;
35     time_t lastHasInternetTime;
36     bool noInternetAccess;
37     std::string preSharedKey;
38     int wepTxKeyIndex;
39     std::string wepKeys[WEPKEYS_SIZE];
40     WifiIpConfig wifiIpConfig;
41     WifiProxyConfig wifiProxyconfig;
42     WifiPrivacyConfig wifiPrivacySetting;
WifiBackupConfigWifiBackupConfig43     WifiBackupConfig()
44     {
45         instanceId = 0;
46         uid = WIFI_INVALID_UID;
47         status = static_cast<int>(WifiDeviceConfigStatus::DISABLED);
48         priority = 0;
49         hiddenSSID = false;
50         networkStatusHistory = 0;
51         isPortal = false;
52         lastHasInternetTime = -1;
53         noInternetAccess = false;
54         wepTxKeyIndex = 0;
55         wifiPrivacySetting = WifiPrivacyConfig::RANDOMMAC;
56     }
57 };
58 
59 void ConvertBackupCfgToDeviceCfg(const WifiBackupConfig &backupCfg, WifiDeviceConfig &config);
60 
61 void ConvertDeviceCfgToBackupCfg(const WifiDeviceConfig &config, WifiBackupConfig &backupCfg);
62 
63 }  // namespace Wifi
64 }  // namespace OHOS
65 #endif  // OHOS_WIFI_BACKUP_CONFIG_H