Particle Device Setup Library & gen 3 devices

Is there any word on when Particle Device Setup Library for gen 3 devices will be available on GitHub?

What exactly are you after?
AFAICT the repo you linked does contain that feature

Is the iOS equivalent for 3rd Gen. devices released yet?
I remember reading an estimated release date of sometime in Q2 of 2019 :slight_smile:
@rickkas7

I think this is something for @Raimis to answer - he’s the iOS engineer.

1 Like

@Raimis any info. is appreciated
@rickkas7

Hello, we don’t yet support integration into 3rd party apps, but the code for 3rd gen setup is part of our Tinker app repo (https://github.com/particle-iot/photon-tinker-ios). It’s REAAAAAALLY isolated, so feel free to experiment with moving that into your project. The hardest part is probably to get mbedTLSWrapper to work & compile.

I’m really not in position to provide any estimates for when that comes out as standalone lib. My assumption is that releasing that as standalone lib would limit our ability to do significant changes to how guided setup works (because then it would impact everyone using the lib) so we want to get guided setup experience as close to final as possible before making it available as a lib.

P.s. thanks @ScruffR for tagging me :slight_smile:

2 Likes

thanks for the update

1 Like

@Raimis Starting to read through the code from (https://github.com/particle-iot/photon-tinker-ios), in particular the code for 3rd gen setup, please correct me if am misunderstanding the system flow, to my understanding the following is happening when connecting to the 3rd gen device via Bluetooth and providing wifi credentials (the only part I need)

Let’s say Argon for example :slight_smile:

  1. Scan Data Matrix sticker (which I am guessing contains information for what the Argon is advertising to devices that want to connect via Bluetooth such as Name, Manufacturer Data, Service UUID).

  2. Connect to the Argon via Bluetooth using the information obtained from the Data Matrix sticker.

Where should I be looking (path/) in (https://github.com/particle-iot/photon-tinker-ios) for the Bluetooth Connection to the Particle device using the information from Data Matrix sticker? am guessing folder-root/particle-tinker/meshsetup/ble? Sorry for the (noob questions?), haven’t done iOS dev. for a while…been on the slippery slope of hardware dev. :slight_smile:

Any help is greatly appreciated as always!
@ScruffR

Oh how I wish the answer would be straight forward :slight_smile: May I ask what are you trying to achieve? Setup process for 3rd gen devices is quite complex (from code point of view).

You got the initial bits correctly - we scan sticker to get device serial & mobile secret that are used to pair with the device… but from there it gets rather complicated. We pair using BLE, but we use encrypted communication (that’s where mbedTLS comes into play). We use ProtoBuffs (https://developers.google.com/protocol-buffers/) to serialize&deserialize payloads and the message is of course in certain format when it travels over BLE. Things living in BLE folder take care of all that. MeshSetupFlowUIManager handles UI part of setup flow, MeshSetupFlowManager handles controller part of the flow.

But you should never dig this deep into the library. By design the only thing that should interest you should be creating an instance of MeshSetupFlowUIManager and displaying it in your app. If you want to run the setup with no UI at all (this would let you automate device setup), you can initiate FlowManager directly. If you go with UI, MeshSetupStyles is where all colors, font sizes & fonts live. I wouldn’t change sizes though as some of those ui’s are carefully crafted to fit on iPhone 4s / 5. If you want to skip certain steps of the setup in your app, override (or edit directly in code since you are not using this as a lib :)) delegate methods living in FlowUIManager and provide the data requested by FlowManager.

Hope this helps.

1 Like

This Def. helps!! Thank you!
I started with trying to understand the iOS BluetoothCore library. As you pointed out, things get complicated when encrypting and decrypting data (all of the iOS examples I’ve been reading assume that you can just discover the BLE device advertising (using UUID, Service/Characteristics) and establish communication without worrying about encryption.

In simplest terms, What I am trying to to achieve is just send WiFi credentials to Argon over BLE from Mobile-App since softAP is not a supported or planned feature & send Mesh credentials to Xenon over BLE from Mobile-App. Absolutely no need to go out to the particle cloud for claiming / registering devices with since the user will be adding the devices to their account under our own platform. @Raimis

Thank you for expressing interest in that. Right now mesh setup flow does not support setup without claiming, but I will make sure this management is aware of this and possibly add it on roadmap sometime soon.

What you want to do is to use guided setup flow with no UI (that’s possible), by providing custom implementation for details flow requests. To put it simply, guided setup is just a process running in the code that requests certain details it needs to proceed. Our mesh setup UI is listening for those requests (by implementing MeshSetupFlowRunnerDelegate and setting itself as delegate for setup flow) and displays different screens when that happens. Lots of possibilities there! :slight_smile:

Are you willing to do that in a customer facing app (and therefore tailored UX) or for your own use? To build customer facing app, it would require much more skill for now, but for personal use that’s quite doable. I would start by doing app that has no UI for that and runs what i call ui-less guided flow. To start that you simply have to do the following:

self.meshSetupManager = MeshSetupFlowManager(delegate: self)
self.meshSetupManager.startSetup()

MeshSetupFlowRunnerDelegate contains the list of all the details, that can ever be requested by flow manager. I assume you are familiar with delegate pattern, if not just google how it works :)… it’s really simple.

For example mesh setup flow can call method:

func meshSetupDidRequestTargetDeviceInfo(_ sender: MeshSetupStep)

To provide info for this request you would use method setTargetDeviceInfo that lives in flowManager. For now I have left the comments about expected “response” methods in source file for MeshSetupFlowRunnerDelegate. So if you open the delegate source you would see the following:

    func meshSetupDidRequestTargetDeviceInfo(_ sender: MeshSetupStep)
    //func setTargetDeviceInfo(dataMatrix: MeshSetupDataMatrix) -> MeshSetupFlowError?

    func meshSetupDidRequestToSelectEthernetStatus(_ sender: MeshSetupStep)
    //func setTargetUseEthernet(useEthernet: Bool) -> MeshSetupFlowError?

So first have all delegate methods with “fatalError()” in them, so you can learn the order in which they are called. Provide hard-coded details for each request to make app work. When you have it working the way you want with one device, you can display UI for certain requests that cannot be hardcoded (for example scanning sticker).

I’m not entirely sure how much effort it is going to take to disable claiming. But if you want to try your luck, I would start by looking into MeshSetupFlowManager and deleting StepSetClaimCode() from preflow array and StepEnsureGotClaimed() from wifiFlow. Deleting StepEnsureGotClaimed() might cause flow to stop at that point, but I’m pretty sure if you would reset your device at that point it would connect to the cloud without being claimed :slight_smile: Either that, or there might be some extra limitations on Cloud or DeviceOS side.

Hope this helps to get you started! :slight_smile:

@Raimis

I created and Andriod app and integrated the devicesetup library module but I’m only getting the option to setup a photon and not a gen 3 device. Am I missing something?

Also, where do I update the Client ID and Client Secret info?

Hello @oraclerouter. I myself only work on iOS app so I can only answer the part about 3rg generation device setup - that will be available as separate library, but it’s not out yet. Device setup library only supports Photon setup. This is true for both platforms.

Android specific questions can be answered by @jensck_particle. I hope he will answer the question about Client ID and Client Secret Info.

Got it. Thanks