[SailfishDevel] Get current SSID?

Slava Monich slava.monich at jolla.com
Sun Dec 1 17:58:10 UTC 2019


Hi Anton,

I would say the easiest way is to find a connman service which matches 
the following criteria:

1. "Type" property value is "wifi"
2. "State" property value is "online" or "ready"

Then the value of its "Name" property would be SSID of the AP you're 
connected to, converted to text assuming UTF-8 encoding.

Note that if SSID is not a valid UTF-8, then connman still transforms it 
into something printable but you won't be able to reconstruct the actual 
SSID out of it. In your case it probably doesn't matter that much.

This command gives you an idea what to expect from connman:

dbus-send --system --print-reply --type=method_call --dest=net.connman / 
net.connman.Manager.GetServices

libconnman-qt (https://git.sailfishos.org/mer-core/libconnman-qt) might 
simplify things a bit, but keep in mind that it's not allowed in harbour 
and isn't particularly backward compatible (i.e. if you end up using it, 
you better compile in the required pieces of it statically).

Cheers,
-Slava


> Hi list,
> 
> How would i go about getting the current SSID in an app?
> Is there even a "proper way"?
> 
> The reason i'm asking is that i'm working on (IPP) printer support as 
> promised, and i'd like to "scope" saved printers with the SSID of the 
> network that they reside on.
> No reason to look for things that aren't there and possibly leak some 
> information in the process, right?
> 
> Br,
> Anton "attah"
> 
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
> 


More information about the Devel mailing list