Function to grab device ID over Soft AP

Hi everyone,

I’m working on building beyond the basic setup iOS example app for the first time, and trying to figure out how to implement some new device inspection features for my users. I’m not very experienced with Swift/iOS development, so looking for some help. Here’s what I’m trying to do:

  1. After a device has already been set up, allow a user to reconnect to particle device over SoftAP.
  2. Don’t try to re-set up Wi-Fi, but instead just grab the device id and save it as a variable
  3. Have the photon reconnect to it’s known Wi-Fi network
  4. Display this device ID to the user, and allow them to call functions that are exposed on that device

Are there any guides or examples people have seen on implementing something like this? Any functions already built into the SDK that I’m missing? Or am I going about this the wrong way?

Thanks!

I can provide a few hints.

Of course you can only connect to the SoftAP when in listening mode (blinking dark blue).

Once you connect to the SoftAP Wi-Fi network (Photon-XXXX), you can get this URL to get the device ID:

$ curl http://192.168.0.1/device-id
{"id":"3B0021001747353236343033","c":"1"}

Beware of the device ID that is returned by this call. It uses uppercase letters for the a-f, but many of the APIs expect the letters to be lowercase.

To connect back to Wi-Fi you can do this:

$ curl -X POST http://192.168.0.1/connect-ap -d '{"idx":0}'
1 Like

Sorry to ask, but do you know the rest of the softAP endpoints? Just curious.

Thanks @rickkas7! That’s a helpful start.

@nrobinson2000 - if you’re asking me, I do not know. @rickkas7 might, though… if so could you point to any documentation that lists softAP endpoints like what you just listed?

As far as I know the SoftAP endpoints are undocumented, but I figured out the major ones from reading the firmware source and the iOS device setup SDK source when I wrote the manual photon claiming guide:

3 Likes