-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nm): AP scan not reports correct Wifi Security (#5491)
* Added recognition logic for wireless security Signed-off-by: pierantoniomerlino <[email protected]> * Updated network status rest provider Signed-off-by: pierantoniomerlino <[email protected]> * Added missing wifi flags Signed-off-by: pierantoniomerlino <[email protected]> * Limit wifi security to WEP/WPA/WPA2 Signed-off-by: pierantoniomerlino <[email protected]> * Added tests for new AP flags enum Signed-off-by: pierantoniomerlino <[email protected]> * Fixed versions Signed-off-by: pierantoniomerlino <[email protected]> * Adapted Network status rest tests with the new flags prop Signed-off-by: pierantoniomerlino <[email protected]> * Fixed no auth hotspots detection Signed-off-by: pierantoniomerlino <[email protected]> * Improved log message Signed-off-by: pierantoniomerlino <[email protected]> * Updated missing copyright Signed-off-by: pierantoniomerlino <[email protected]> --------- Signed-off-by: pierantoniomerlino <[email protected]>
- Loading branch information
1 parent
dac4507
commit 6e4aee8
Showing
12 changed files
with
350 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/status/wifi/WifiFlag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech | ||
******************************************************************************/ | ||
package org.eclipse.kura.net.status.wifi; | ||
|
||
/** | ||
* Flags describing the capabilities of an Access Point. | ||
* | ||
* @since 2.8 | ||
*/ | ||
public enum WifiFlag { | ||
/** None */ | ||
NONE, | ||
/** Supports authentication and encryption */ | ||
PRIVACY, | ||
/** Supports WPS */ | ||
WPS, | ||
/** Supports push-button based WPS */ | ||
WPS_PBC, | ||
/** Supports PIN based WPS */ | ||
WPS_PIN; | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
kura/org.eclipse.kura.nm/src/main/java/org/eclipse/kura/nm/enums/NM80211ApFlags.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Eurotech and/or its affiliates and others | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Eurotech | ||
*******************************************************************************/ | ||
package org.eclipse.kura.nm.enums; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.freedesktop.dbus.types.UInt32; | ||
|
||
public enum NM80211ApFlags { | ||
|
||
NM_802_11_AP_FLAGS_NONE(0x00000000), | ||
NM_802_11_AP_FLAGS_PRIVACY(0x00000001), | ||
NM_802_11_AP_FLAGS_WPS(0x00000002), | ||
NM_802_11_AP_FLAGS_WPS_PBC(0x00000004), | ||
NM_802_11_AP_FLAGS_WPS_PIN(0x00000008); | ||
|
||
private final int value; | ||
|
||
private NM80211ApFlags(int value) { | ||
this.value = value; | ||
} | ||
|
||
public static List<NM80211ApFlags> fromUInt32(UInt32 val) { | ||
int intVal = val.intValue(); | ||
|
||
if (intVal == NM80211ApFlags.NM_802_11_AP_FLAGS_NONE.value) { | ||
return Arrays.asList(NM80211ApFlags.NM_802_11_AP_FLAGS_NONE); | ||
} | ||
|
||
List<NM80211ApFlags> flags = new ArrayList<>(); | ||
|
||
for (NM80211ApFlags flag : NM80211ApFlags.values()) { | ||
if (flag == NM80211ApFlags.NM_802_11_AP_FLAGS_NONE) { | ||
continue; | ||
} | ||
|
||
if ((intVal & flag.value) == flag.value) { | ||
flags.add(flag); | ||
} | ||
} | ||
|
||
return flags; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.