Device setup API for a cross platform application

I am building a cross-platform mobile app to manage the Particle Photon and I would like to be able to connect to the SoftAP and setup the WiFi credentials and bind the device to the user.

I know about the device setup library in the Android and iOS SDK, is there an underlying API that makes these SDKs work? If so, is it documented?

I have tried connecting to the SoftAP and open 192.168.0.1 in my browser. All that does is download a file called “hello” which has a line of text that says “Soft AP Setup”. :confused:

Ideally, I would like to be able to use the SoftAP to set up the device without having to make a custom HTTP API using this: https://docs.particle.io/reference/device-os/firmware/photon/#softap-http-pages

@rakshak Welcome to Particle Community.

Ideally, I would like to be able to use the SoftAP to set up the device without having to make a custom HTTP API

You should be able to copy and use the example given in the link you have included. I started with that as the basis for the WiFi setup for all my products based upon Photon.

Could you share the entire code that you have tried that only gave you "SoftAP Setup"? We also need to know the Device OS version you are using.

Thanks for your reply :slight_smile:

Sorry, I should have been a little more clear. I meant that I would like to set up the Particle device from a mobile app without having to create a custom HTTP API.

No coding involved for this, I just put a Particle Photon in listening mode (Press and hold the 'setup' button till the led blinks blue) and then connect to the WiFI AP from the Photon and go to 192.168.0.1.

Using deviceOS@1.10.

Still don’t understand what you think is happening. Your mobile browser is accessing an HTML page at URL 192.168.0.1. served by the photon. You need to define the web pages and javascript. This will be in your photon application code. This is what is provided in the documentation - a complete working example providing a Web UI for setting up WiFi via HTTP. There is some fairly dense javascript in the example - if you want to change it then you will need to pass it through a beautifier or go to the source at github. I have changed the main screen/window and the pop-up message windows to suit my requirements but pretty much left the rest alone.

You will probably need to have some application logic around this to handle a user requesting wifi setup and then handling error and success when the web page has captured the wifi credentials - which may or may not be correct. etc.

Thanks for the clarification regarding the 192.168.0.1 URL.

What would be the best way to replicate the functionality of the Android and iOS SDKs device setup library? Is the underlying API used for these SDKs documented anywhere? That’s what I would like to use for setting up a Particle Device from a cross-platform mobile application.

I haven’t used the Android and iOS SDKs so I am not well placed to answer your question. What are you planning to use something like Xamarin? Perhaps starting from using the iOS and Android SDKs would help you learn what is going on?

Yup, i’ll be using Flutter.

I’ve started having a look at the SDKs. If I can’t find the underlying API documented, I am probably going to have to build a Flutter plugin based on the SDKs.

Thanks again for clarifying the SoftAP, I was under the impression that there was a default setup page that ships with the Particle that I could use.

1 Like

@rakshak
I am following your post.

Please update on community so that other members can also benefited.

Hosting a webpage on the photon is a waste of precious resources unless truly necessary. There is an API, and it works great. I use it for wifi network config (I extend the functionality in my user firmware to force a reset but otherwise I use it stock.

See the System Firmware Readme on SoftAp

Edit:

More specifically what I do is I host my own webapp, have users load it, and then the webapp runs the javascript to actually perform the api calls against the device. I used this example webapp, the one referenced that you could run on the photon as a basis for my own app.

Will do :slight_smile:

Thanks man, that was super useful.

PM’ing you with some questions now.