Page 1 of 1

Wifi_DisconnectAP() doesn't seem to work

Posted: Fri Mar 25, 2011 9:53 pm
by JanMulder
After I call Wifi_DisconnectAP(); Wifi_AssocStatus() doesn't become ASSOCSTATUS_DISCONNECTED or ASSOCSTATUS_SEARCHING. So it basically doesn't work... What can I do to make it work?
Thanks in advance!

Re: Wifi_DisconnectAP() doesn't seem to work

Posted: Fri Mar 25, 2011 11:54 pm
by elhobbs
You could look at the connects on the AP if you have access

Re: Wifi_DisconnectAP() doesn't seem to work

Posted: Sat Mar 26, 2011 12:19 am
by JanMulder
It's about disconnecting. I'm really sure it is connected, but if I return to the menu, I want to disconnect from the access point. So first the Wifi_AssocStatus() is equal to 5 (which is connected) and after I call Wifi_DisconnectAP(); it still is 5.

Re: Wifi_DisconnectAP() doesn't seem to work

Posted: Sat Mar 26, 2011 12:24 am
by elhobbs
If you disconnect wouldn't it disappear from the list? Alternatively you could use a packet sniffer to look for disassociation packets.

Re: Wifi_DisconnectAP() doesn't seem to work

Posted: Sat Mar 26, 2011 2:21 am
by elhobbs
I took a look at the dswifi code. It does not send a disassociation packet. the function sets a flag for the arm7 to perform the disconnect - but it does not send anything (that I can tell). it sets the AID to 0 and removes the connected flag. I am a little surprised that you are seeing 5 from Wifi_AssocStatus as I would expect 6 (ASSOCSTATUS_CANNOTCONNECT) as the Wifi_DisconnectAP sets wifi_connect_state=-1 before it returns - which should cause Wifi_AssocStatus to always return ASSOCSTATUS_CANNOTCONNECT.

it looks like Wifi_AssocStatus is only really useful while trying to associate. I think WifiData->curMode would be a better indicator but it is not really exposed anywhere.

after a few minutes of inactivity the AP should drop the connection anyway. You probably need to wait a little while before trying to connect to a different AP so that the arm7 has a chance to process the disconnect request.

Re: Wifi_DisconnectAP() doesn't seem to work

Posted: Sat Mar 26, 2011 9:05 am
by JanMulder
Thanks for the help. You are right it did return 6 afterwards.