5 ms·
Can someone give a short explaination as to how it works in the backend? The QR code contains username and password. But how does my phone's QR scanner know tha
by seesawtron 6y ago
Can someone give a short explaination as to how it works in the backend? The QR code contains username and password. But how does my phone's QR scanner know that its an SSID/pw and eventually connects to the network?
- macintux 6y agoSee this comment: https://news.ycombinator.com/item?id=23371188 https://news.ycombinator.com/item?id=23371188 Presumably the camera app recognizes “WIFI:” as a protocol string and passes the details along to the system settings.
- seesawtron 6y agoYes I saw, that is what the QR code contains (username and password of the WIFI). But I do not understand what my phone does when it sees that. There are tons of dubmbed-down articles on "how-to" instructions but none explaining the backend stuff happening on my phone's side. Also found qifi.org that does a similar thing.
- daveevad 6y agoit sounds to me like it's a custom url scheme built into ios. https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app https://developer.apple.com/documentation/uikit/inter-proces...
- kevin_thibedeau 6y agoIt's vCard, not URL.
- est31 6y agoThe Zxing barcode scanner app does it this way: This [0] is the dispatch code. If it detects WIFI as type, it passes it to a WifiConfigManager [1] which then talks to Android's WifiManager API. On the back end, the addOrUpdateNetwork function of WifiManager [3] calls the method with the same name of IWifiManager [4]. That class has a channel to a WifiStateMachine [5] which sends a message with the command CMD_ADD_OR_UPDATE_NETWORK. It's handled in the same file (but I suppose it's in a different process, now a privileged system process), and calls the addOrUpdateNetwork function of WifiConfigStore [6]. The WifiConfigStore stores its config into a wpa_supplicant compatible file. The file is then passed to the wpa_supplicant service, which is also present on other Linux distros like the GNU/Linux ones, although here the config file is built by a dedicated NetworkManager service (also, some intel folks are building a replacement IIRC). wpa_supplicant is a privileged service that talks to the WiFi card drivers. [0]: https://github.com/zxing/zxing/blob/0cf3b9be71680f50c90a71ca26ce0d33664b0dd6/android/src/com/google/zxing/client/android/result/ResultHandlerFactory.java https://github.com/zxing/zxing/blob/0cf3b9be71680f50c90a71ca... [1]: https://github.com/zxing/zxing/blob/0b9b39a74fb3d7b010fb2979c14666258d255789/android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java https://github.com/zxing/zxing/blob/0b9b39a74fb3d7b010fb2979... [2]: https://developer.android.com/reference/android/net/wifi/WifiManager https://developer.android.com/reference/android/net/wifi/Wif... [3]: https://android.googlesource.com/platform/frameworks/base/+/50dd1eaaeb67a41d2b5355b532cdb8abce31eebc/wifi/java/android/net/wifi/WifiManager.java https://android.googlesource.com/platform/frameworks/base/+/... [4]: https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/a15a2ee69156fa6fff09c0dd9b8182cb8fafde1c/service/java/com/android/server/wifi/WifiServiceImpl.java#829 https://android.googlesource.com/platform/frameworks/opt/net... [5]: https://android.googlesource.com/platform/frameworks/base/+/a029ea1/wifi/java/android/net/wifi/WifiStateMachine.java#1407 https://android.googlesource.com/platform/frameworks/base/+/... [6]: https://android.googlesource.com/platform/frameworks/opt/net/wifi/+/cd84f31168f7d3cac6d548aa295a479cc693b89b/service/java/com/android/server/wifi/WifiConfigStore.java#935 https://android.googlesource.com/platform/frameworks/opt/net...