Photon SoftAP using PhoneGap

as per MOBILE SDK Update? we should have seen a Phonegap support for SoftAP and the SDK as well by March 2015. Did I miss it? I don’t see any mention of phonegap in the docs.

Good question @krazineurons. The further we got into the implementation of the mobile SDKs, the clearer it became that there would always need to be native code and that the Phonegap layer was getting smaller and smaller. In the end, for the release of the mobile SDKs, we found that there was no need for it and it provided little extra value.

Fast forward to now. We’re currently expanding the ways in which you can set up a Photon from only through a bare TCP socket to include a similar HTTP protocol. This will enable us to set up a Photon in a web browser rather than needing OS-level capabilities.

There’s some discussion here if you’re interested in history & context:

The javascript library enabling the browser-based setup is here:

The HTTP setup flow already exists in firmware, though there are still bugs. @nexxy has been building out that javascript setup client library.

2 Likes

Hey @krazineurons,

I am more than happy to help if you have questions regarding the use of PhoneGap/Cordova with our softap-setup-js library (or other methods of configuring your device(s) via the web for that matter).

We’re currently discussing how to make the next version the most compatible with various use cases, so if you have anything you’d like to add please feel free to join the discourse: https://github.com/spark/softap-setup-js/pull/2 (kudos to @louis_ for getting the ball rolling on this one).

Thanks!
— nexxy

3 Likes

Hi @nexxy and @christine

Any chance for an example Phonegap App to set a clients Wifi credentials. The present procedure with the Particle App is fine for my Robotics Class, but much to hard for a client to do the multiple steps to setup my required .ino file.

We would fully setup each photon and then clear all wifi credentials. The client would be given the Access_token and the Device_ID. The client then only needs to setup their home wifi. Any ideas about the absolutely easiest way to do this using Phonegap?

Jeremy

@rocksetta,

Have you taken a look at this sweet app developed by @msolters? It might be a good starting place for you!

OMG! @nexxy, @christine and @msolters That is amazing! I am reasonably good at Phonegap (~5 years teaching it) but know nothing about meteor, so I opened it on the free cloud9 website http://c9.io

Not knowing anything about meteor I then opened a terminal and typed

meteor 

and hit enter. The service installed some stuff and then gave me an error. So I then googled a bit and typed

meteor --port $IP:$PORT

The service gave me my URL, which I then loaded on my Android device.

(Note: This will probably work from any desktop or laptop browser with Wifi capability!)

Set my photon onto flashing blue (3 seconds left button, usb connection facing up) and then the amazing bit of software worked, I could see the device, change my wifi to connect to it, and then I could set my wifi credentials. I have not gone farther since this photon is already setup, but I am so impressed. Plus it took longer to write this message than to actually run the program :smile: .

Well done guys.

P.S. free cloud9 deactivates in 24 hours. You have to open a new terminal and type

meteor --port $IP:$PORT

Great for teaching. I think it is ~$5/month to have it activated permanently.

Afterthought: Doesn’t this replace the Particle App for connection at least and shouldn’t a link to a webpage like this be accessible from the main http://particle.io page @bryce ?

2 Likes

Hi @rocksetta, let me give you some implementation notes that will hopefully help you in your teaching.

Meteor comes with a lot of features.

  1. Deployment: You can deploy any Meteor app to a permanent URL by using meteor deploy foobar.meteor.com. For example, this app is already hosted at http://photonsoftap.meteor.com. This service is free from Meteor. You can repeat this command to push updates to your app as well, as you change the source.
  2. Mobile: Meteor apps can likewise by deployed as iOS and Android apps, by using commands such as meteor run android-device and meteor run ios-device with a matching device connected to your computer. There are a few dependencies needed, for the complete step-by-step see the official guide.
  3. Native: As you may have noted, this app also contains extra OS-specific code that you can use if you are running the app as a local clone on your own computer. This allows Photons to be automatically detected and WiFi switching to take place automatically. It also allows the entire app to be immediately deployed as an .exe, .app, or linux executable.
3 Likes

@msolters, your photon SoftAP app is truly great! Only trouble I had on Win 7 was due to Norton Internet Security. Had to go to Norton’s Settings/Firewall/Network Trust and give the photon "full trust. "