Photon softAP usage?

@mebrunet,

Thanks so much… this works like a champ on the first go! Just tried it out by compiling locally on a OSX with instructions on your github page.

Thanks once again. Awesome job!

btw, is this expected to be merged to develop branch on particle’s firmware repo?

@mebrunet in your README you mention that there is a limit on the size of any given file. I do not quite understand where this limit is coming from. So what if the const char [] has 5000+ bytes? I don’t see the compiler complaining about that. On the other hand, I did try to serve a 20k file and the browser does not receive it. I tried making a curl request for that specific file and I can see that the receiving speed drops to 0 not even half way into the file. And it seemed curl always received the same amount of bytes before stopping, however, that number of bytes was different when I tried getting another/different larger file.

I then tried to return a large response from a WICED_RAW_DYNAMIC_URL_CONTENT handler that I added. Once again, the browser could not receive the full response, but this time it was inconsistent. Sometimes the browser/curl WOULD receive the whole response (this time it was 8k long) and often times it would only receive a partial response as was the case earlier with the static resource.

fyi I’ve been tinkering with the develop branch.

Any ideas why I am only receiving partial responses? Where is the limit on the size of static resources coming from? Where is the limit on the size of the response from a dynamic handler coming from?

Thank you all for reading this! :smile: Hope someone has the answer…

@mebrunet
Thanks for the update. Used the new code and it works gr8 now.

I’m not sure if this is possible, but can’t you serve a REST API to do the same functionality as the SoftAP page? This way device builders can incorporate the functionality into their own apps, and fully customize the experience.

@shrike I had similar issues with loading inconsistencies, haha, that’s why I got a little hand-wavy when describing the file “size limit”. While @mdma should be able to answer this from a point of deeper understanding, I assumed that the device (or HTTP server running on the device) was just running out of memory while working with such large char arrays.

While digging deeper into the Broadcom WICED documentation and examples I noticed you could also serve sizable html/js/css resources from files (which could even be stored off-chip in separate flash memory), but they really didn’t make it clear how to do that…

@mrabie the SoftAP page is built on top of a HTTP API. See these docs.

has anyone tried softAP Page from a PC? I connected to the Photon AP and tried going to 192.168.0.1/ from Chrome and Edge and both are getting page can’t be loaded error. Still working good from iOS Chrome and Android Chrome.

I know someone already asked, but having access to this skeleton app would be wonderful :slight_smile:

If you’re looking for an entirely in-browser SoftAP app for the Photon, you can try one out here.

I made the interface using Meteor, but it all depends on a single JavaScript file (applied @brewnerd’s work in browserification, PR here) and so can be implemented using whatever JS framework you want (including none: just vanilla JS). More notes and a guide behind the implementation of this app can be found in my repo here.

Interestingly, Meteor also allows you to trivially generate Android and iOS PhoneGap apps from the existing HTML & JS, similar to what @nexxy was describing above. While I have not done so with this project, if you want to clone the repo it could immediately be used for such a purpose. It’s only a matter of using the meteor command line. You don’t even have to write any additional code! (maybe like a configuration file but I don’t think JSON counts as code).

4 Likes

@msolters have you tried this in safari yet? I have one as well, but it will only work in chrome, which means iPhone, iPad, etc isnt capable of configuring the unit without first downloading chrome.

– Edit 1 –

  • Yeah, Safari throws a bunch of XHR errors that I don’t see on Chrome, and the .configure and .connect calls never seem to even get called. Everything works right up through obtaining (or re-obtaining) the AP scan results, though.

– Edit 2 –

  • Firefox works fine.
  • Microsoft Edge (yes) works fine on the surface (no pun intended) and throws no errors, but it’s as though the .configure() and/or .connect() steps don’t actually do anything when they execute. The Photon, when power cycled, goes back to listening mode as if it never received anything despite the fact the scan results were all valid, and the configuration and connection steps both completed successfully in the JS.

Of note is the fact that all the browsers mentioned above got at least through the returning of successful scan results. I would hazard a guess that the compatibility issue with SoftAP as it stands is localized to the invocation of .configure() and/or .connect().

– Original –
Unfortunately not. I’m not sure what’s up with Safari. In my experience, Safari has some weird allergies where CORS is concerned. Once I wrangle up a Safari I will try it out. Do you see the same sort of SoftAP failure when you use @mebrunet’s approach, either served from the Photon or from a remote server?

Okay, at least now I know it’s not my JS. I’m getting a ERR_CONNECTION_REFUSED in the Chrome console when trying to get the deviceInfo.

I thought I remembered something about having to flash the firmware on the Photon but I don’t remember if that was before or after an official fix went out (after reading ~120 comments on this thread, things get a little hazy.

Anyone know if there’s a specific version/branch of firmware that the Photon needs to be running?

Thanks for the notes @msolters. Yes I have been working with @mebrunet to try and resolve, our notes can be found here Connecting to OPEN networks · Issue #1 · mebrunet/softap-setup-page · GitHub Like you I have found that most everything can scan fine, just doing the post that causes grief for safari.

BTW, I have only been playing with the remote server version, have not been able to play with the hosted on the photon stuff yet.

You need 4.4 in order to play with it.

1 Like

Thanks @anthonywebb! Got it working now.

In case anyone was interested, I’ve build a simple AngularJS wrapper for the browserified SoftAP library. We’ll be putting this on bower soon, but for anyone that wants to check it out/use it: https://bitbucket.org/mobileigniter/ngphoton/

The repo also includes a demo Ionic app that shows how the service is implemented/used. We welcome any and all feedback, as this is something I threw together in about an hour on a Saturday :slight_smile:

1 Like

@mibrad can you confirm is this is working in the safari browser? So far (to my knowledge) no one has been able to make it work in safari which is important because the default browser on iPhones and iPads (and macs) is safari, which means that users will have to download another browser before they are able to set the wifi creds on their photon.

1 Like

I hadn’t tested it outside of Chrome on my laptop (which I used for debugging the Angular package that I was writing). My focus was writing the Angular wrapper, not making sure the underlying code worked. Looking into it now.

I’ll be posting further comment/discoveries on the github issue.

Working on safari, working on safari on IOS, but compiled to ionic app it doesn’t work on IOS.

What did you do to get it to work in Safari? I tried compiling it into an Ionic app and got a few errors. There’s discussion on a github issue that might help :slight_smile:

1 Like

Hey guys, I’ve extended my attempt at a browser-based SoftAP tool to (1) automatically handle WiFi switching during the process flow, and also to be (2) guaranteed compatible by deploying the web app as a downoadeable executable via Electron. (which is a tiny Chromium).

You can read more here if you’re interested. I think the most salient benefit to anyone trying to implement seamless Photon setup in their app or product will be the wifi-control module I put together to make this work. It’s what enables programmatic WiFi control on the user’s PC via JavaScript.

9 Likes

Looks nice @msolters ! cc: @nexxy ^^