Unify approach for presenting security modes across esp32 and esp8266
This commit is contained in:
		@@ -1,23 +1,26 @@
 | 
			
		||||
export const WIFI_SECURITY_WPA_TKIP = 2;
 | 
			
		||||
export const WIFI_SECURITY_WEP = 5;
 | 
			
		||||
export const WIFI_SECURITY_WPA_CCMP = 4;
 | 
			
		||||
export const WIFI_SECURITY_NONE = 7;
 | 
			
		||||
export const WIFI_SECURITY_AUTO = 8;
 | 
			
		||||
export const WIFI_AUTH_OPEN = 0;
 | 
			
		||||
export const WIFI_AUTH_WEP = 1;
 | 
			
		||||
export const WIFI_AUTH_WEP_PSK = 2;
 | 
			
		||||
export const WIFI_AUTH_WEP2_PSK = 3;
 | 
			
		||||
export const WIFI_AUTH_WPA_WPA2_PSK = 4;
 | 
			
		||||
export const WIFI_AUTH_WPA2_ENTERPRISE = 5;
 | 
			
		||||
 | 
			
		||||
export const isNetworkOpen = selectedNetwork => selectedNetwork && selectedNetwork.encryption_type === WIFI_SECURITY_NONE;
 | 
			
		||||
export const isNetworkOpen = selectedNetwork => selectedNetwork && selectedNetwork.encryption_type === WIFI_AUTH_OPEN;
 | 
			
		||||
 | 
			
		||||
export const networkSecurityMode = selectedNetwork => {
 | 
			
		||||
  switch (selectedNetwork.encryption_type){
 | 
			
		||||
    case WIFI_SECURITY_WPA_TKIP:
 | 
			
		||||
    case WIFI_SECURITY_WPA_CCMP:
 | 
			
		||||
      return "WPA";
 | 
			
		||||
    case WIFI_SECURITY_WEP:
 | 
			
		||||
    case WIFI_AUTH_WEP:
 | 
			
		||||
    case WIFI_AUTH_WEP_PSK:
 | 
			
		||||
      return "WEP";
 | 
			
		||||
    case WIFI_SECURITY_AUTO:
 | 
			
		||||
      return "Auto";
 | 
			
		||||
    case WIFI_SECURITY_NONE:
 | 
			
		||||
    case WIFI_AUTH_WEP2_PSK:
 | 
			
		||||
      return "WEP2";
 | 
			
		||||
    case WIFI_AUTH_WPA_WPA2_PSK:
 | 
			
		||||
      return "WPA/WEP2";
 | 
			
		||||
    case WIFI_AUTH_WPA2_ENTERPRISE:
 | 
			
		||||
      return "WEP2 Enterprise";      
 | 
			
		||||
    case WIFI_AUTH_OPEN:
 | 
			
		||||
      return "None";
 | 
			
		||||
    default:
 | 
			
		||||
      return "Unknown";
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user