HeliPort icon indicating copy to clipboard operation
HeliPort copied to clipboard

Auto join to networks whenever not connected

Open averycblack opened this issue 5 years ago • 10 comments

Whenever HeliPort gets scanned networks, it'll compare them with stored networks and autoconnect if it matches a stored network. It will only do this when not connected.

I did move the network updates over to the same timer that updates the status, as it made it a little easier to get the scanned networks without calling scanNetwork again. Though, this can be changed back

averycblack avatar Jul 26 '20 01:07 averycblack

I think having status with a shorter period as stand alone would be better because if you set the wifi as off, all the other methods would still be able to connect because the status won't be updated until 5 seconds later.

erikbdev avatar Jul 26 '20 02:07 erikbdev

As @ErrorErrorError mentioned, status updating needs a shorter period. And I suspect trying to connect saved networks all the time will interrupt and cause conflicts with the manual connecting, because the status will shift several times amid the connecting process.

Goshin avatar Jul 26 '20 09:07 Goshin

As @ErrorErrorError mentioned, status updating needs a shorter period. And I suspect trying to connect saved networks all the time will interrupt and cause conflicts with the manual connecting, because the status will shift several times amid the connecting process.

Looks like it will only reconnect to networks that are already saved and that have the auto join checked, not just any network saved

erikbdev avatar Jul 26 '20 10:07 erikbdev

The update right now updates status before updating networks and connecting - so I don't think there will be issues with auto join messing with a user manually joining before autojoin does. Additionally, autojoin is more likely to join before a user is able to open the wifi panel anyway if coming out of sleep and putting in a password and stuff. Autojoin will only attempt to connect to networks which are currently returned from scanning and are saved off in the keychain. Though there is the concern of a user attempting to connect after autojoin has started connecting, though 5 seconds is a short window for this to happen. I'll see what I can do about that I guess

averycblack avatar Jul 26 '20 16:07 averycblack

I meant a connecting attempt in itlwm might last like 10~15s, so "autojoin" can happen in the middle of this. Also, what if people just want to keep disconnected?

Goshin avatar Jul 26 '20 16:07 Goshin

The state during a connection attempt shouldn't be init as far as I know - it'd likely be auth unless I'm missing something. If a user wants to stay disconnected, pressing disconnect disables autojoin for that one network so it won't automatically reconnect to that network.

averycblack avatar Jul 26 '20 16:07 averycblack

I think we should wait until authentication is fully implemented in itlwm, so we can at least know when it's actually authenticating/associating, and if that's so we could have a Boolean when autoconnect was active or something that notifies that auto connect made an attempt to connect so when the user decides to connect to a network we can intercept that connection. Or the other way around, check if there was an attempt to manually connect and not autoconnect in the meantime.

Well I think it will all depend once itlwm auth is implemented, and just an idea :p

erikbdev avatar Jul 26 '20 17:07 erikbdev

According to zxystd, the driver might crash in the connecting phase, then it will reload the firmware and re-initialize the hardware, therefore an 'init' state could show up when connecting. It would be a better solution to get the result from itlwm side when trying to connect a network, but currently it is not yet implemented in itlwm.

Goshin avatar Jul 26 '20 17:07 Goshin

It's likely better to wait until such an API is put in then, at which point this PR can be reworked to use it.

averycblack avatar Jul 26 '20 17:07 averycblack

Also, what if people just want to keep disconnected?

Giving a user the option on when and how to connect is a good idea

Thank you all for the Great Work you've done ✔

ianmubangizi avatar Jul 25 '21 03:07 ianmubangizi