WiFi Connected block security output

94 views
Skip to first unread message

corganp...@gmail.com

unread,
Feb 25, 2019, 2:52:29 AM2/25/19
to Automate
The WiFi Connected block outputs a number for the "Connected network security" output variable. Does anybody know how to translate this number to the security type on the network?

Henrik "The Developer" Lindqvist

unread,
Feb 25, 2019, 2:49:41 PM2/25/19
to Automate
You can see the bit flags (values) in the Wi-Fi network scan block, i.e. 1=WPA, 2=WPA2, 4=WEP

corganp...@gmail.com

unread,
Feb 25, 2019, 3:43:07 PM2/25/19
to Automate
Thank you Henrik. So it looks like the security type should be an integer from 0-7, right? The value I'm getting is 1114115. What am I missing here?

Henrik "The Developer" Lindqvist

unread,
Feb 25, 2019, 9:32:07 PM2/25/19
to Automate
It's a bit flags, and there's other unofficial bits. To mask just the "protocol" do:
(security & 7) = 4

corganp...@gmail.com

unread,
Feb 25, 2019, 9:58:10 PM2/25/19
to Automate
Ok thank you for walking me through this. So in my case:
(security & 7) = 3
This means that WPA and WPA2 are enabled (WPA = 1, WPA2 = 2, WEP = 4) on the network, right?

Henrik "The Developer" Lindqvist

unread,
Feb 25, 2019, 11:26:10 PM2/25/19
to Automate
No, 7 (1+2+4) is to mask out the unofficial bits, 4 was for WEP:
(security & 7) = 4
for WPA:
(security & 7) = 1
for WPA2:
(security & 7) = 2


You could also do, to check for WEP:
security & 4
for WPA:
security & 1
for WPA2:
security & 2

corganp...@gmail.com

unread,
Feb 25, 2019, 11:36:49 PM2/25/19
to Automate
Ok, so what does it mean when (security & 7) = 3? This is the result I'm getting. I checked my WiFi settings and under Security it says 'WPA/WPA 2 PSK'.

Henrik "The Developer" Lindqvist

unread,
Feb 26, 2019, 1:47:55 AM2/26/19
to Automate
3 = 1+2 = WPA+WPA2

corganp...@gmail.com

unread,
Feb 26, 2019, 3:46:16 AM2/26/19
to Automate
Ok got it. Thank you for all your help, Henrik!

Automate for Android

unread,
Sep 19, 2023, 8:06:02 AM9/19/23
to Automate for Android
This should be included in the docs. 

Automate for Android

unread,
Sep 19, 2023, 8:22:37 AM9/19/23
to Automate for Android
A simple function I came up with, that gives you an array of securities:
filter(sift([null, "WPA", "WPA2", null, "WEP"], [security & 1, security & 2, security & 4]))

Henrik "The Developer" Lindqvist

unread,
Sep 20, 2023, 5:44:28 AM9/20/23
to Automate for Android
Indeed. I'll add it.

8li...@gmail.com

unread,
Sep 23, 2023, 4:16:08 AM9/23/23
to Automate for Android


ב-יום רביעי, 20 בספטמבר 2023 בשעה 12:44:28 UTC+3, Henrik "The Developer" Lindqvist כתב/ה:

Henrik "The Developer" Lindqvist

unread,
Sep 23, 2023, 4:45:29 AM9/23/23
to Automate for Android
Hmm, i don't think it's necessary there since the user can deduce them from the input argument field, as in every other block.
I usually only add explicit documentation for input argument and output variable values where there's no other way to know their values.
Reply all
Reply to author
Forward
0 new messages