TaifunWifi extension - can't change which SSID is connected

131 views
Skip to first unread message

Andy Timmons

unread,
Sep 5, 2017, 3:42:55 PM9/5/17
to MIT App Inventor Forum
This is what I'm trying to accomplish:

I'm using a NodeMCU to create a soft AP which hosts one page of HTML. All that page contains is a latitude and longitude fed in from a GPS module attached to the NodeMCU.

I'm trying to create an app in AI2 that, on the click of a button:
  • saves the current SSID to a text box;
  • disconnects the current SSID and connects to the AP created by the NodeMCU;
  • opens the 192.168.4.1 page and scrapes the latitude and longitude into a text box;
  • disconnects from the NodeMCU AP SSID;
  • re-connects the old saved SSID (if possible, although as all this activity will take place in the middle of the countryside, it's unlikely to be any use at the time); and
  • opens Google maps and drops a pin on the scraped latitude and longitude.

Everything works ok except for the disconnecting and connecting from and to the SSIDs.

I've tried using the disable (to disconnect the current SSID) and then enable and ConnectSSID blocks, but they don't work as I expected.  I tried putting a few seconds delay in at various places to see if that would help, but it didn't.

I've tried not disabling and enabling before I use ConnectSSID, but that didn't help either.

I've also seen the bit on the TaifunWifi Extensions page that says: 'Required permissions: android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE, android.permission.ACCESS_COARSE_LOCATION', which might be the answer, but which I don't understand.  I assumed that, as you have to build the app before you can use it, these permissions would be set automatically.

I suspect I'm completely misunderstanding something elementary, so would appreciate any help, advice or suggestions you might have.

Thanks for your time.


Andy

Abraham Getzler

unread,
Sep 5, 2017, 6:07:32 PM9/5/17
to MIT App Inventor Forum
You will have to add some logging to your app to see where it is
hanging.  

Also, all those sequential processes will need their own
input and output queues, to pass jobs and data from one
phase to the next, like a Japanese Kanban system
(but simpler)

No loops or waits should be needed.

Here's a sample app with logging and three levels of work queue



Taifun

unread,
Sep 6, 2017, 1:54:15 PM9/6/17
to mitappinv...@googlegroups.com
I've tried using the disable (to disconnect the current SSID) and then enable and ConnectSSID blocks, but they don't work as I expected. 
you might want to read the documentation https://puravidaapps.com/wifi.php..
the disable method will disable the WiFi and the enable method will enable it again

to connect to another SSID, just use the ConnectSSID method
you also might want to read the documentation again to realize, that you have to build the project to be able to use that method...

Taifun

Andy Timmons

unread,
Sep 6, 2017, 3:04:01 PM9/6/17
to MIT App Inventor Forum
Taifun, thanks for the help.

Sadly the link to the documentation you gave ends with a 404.

However, as I said in my original post, I tried using the ConnectSSID method on its own, but that didn't work.

And I know you have to build the project, as I wouldn't have been able to test it otherwise, would I?



Andy

Taifun

unread,
Sep 6, 2017, 3:22:19 PM9/6/17
to MIT App Inventor Forum
link now corrected, try again https://puravidaapps.com/wifi.php
Taifun
Reply all
Reply to author
Forward
0 new messages