Specify WiFi password for ASDiscoveryDescriptor?

Hello,

I am looking into the newly announced Accessory Setup Kit and I'd like to replace my manual WiFi connection setup with it, but I cannot find a way how to specify WiFi password when configuring ASDiscoveryDescriptor, only ssid or ssidPrefix can be specified?

Is it really not possible to connect to WiFi with password with this new framework? That kind of makes it unusable for my use case :( Since the accessory has password.

Answered by DTS Engineer in 792954022

If you read to the end of "Discovering and configuring accessories", it ends by saying:

Use this information to connect to the accessory — using Core Bluetooth for Bluetooth or Network Extension for Wi-Fi — and begin your device-specific setup process....

The system already has APIs that manage all of the complexity of bus specific pairing and we didn't want to reinvent all of that work. What AccessorySetupKit provides is a mechanism for discovering and managing a persistant relationship between your app and a specific accessory, which then streamlines the flow of those other APIs. The other APIs then handle the actual connection process. For WiFi, that class is NEHotspotConfiguration, which handle password authentication among many others.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

If you read to the end of "Discovering and configuring accessories", it ends by saying:

Use this information to connect to the accessory — using Core Bluetooth for Bluetooth or Network Extension for Wi-Fi — and begin your device-specific setup process....

The system already has APIs that manage all of the complexity of bus specific pairing and we didn't want to reinvent all of that work. What AccessorySetupKit provides is a mechanism for discovering and managing a persistant relationship between your app and a specific accessory, which then streamlines the flow of those other APIs. The other APIs then handle the actual connection process. For WiFi, that class is NEHotspotConfiguration, which handle password authentication among many others.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

I read that, but my understanding was that this API is supposed to replace the entire pairing process and connecting to WiFi network with password is (at least in my opinion) part of the initial process.

Following on that, I too am interested in using the new Framework for my UI.

I'm currently using an MFi EAAccessoryBrowser setup, is there no way to use the ExternalAccessory framework with AccessorySetupKit in a "streamlined" way ?

I read that, but my understanding was that this API is supposed to replace the entire pairing process and connecting to WiFi network with password is (at least in my opinion) part of the initial process.

No, that's not how the API works. The WWDC session primarily focuses on bluetooth, but it does explain how the framework is designed to operate and how the roles are separated between or frameworks.

One thing that might explain the confusion here is this section very early in the presentation:

"With just one tap, the accessory is securely paired with your app and ready to use. This one tap will allow access to both Bluetooth and Wi-Fi from your accessory, if it supports both."

What's being described there is what the user's overall experience of the API was, NOT the architectural scope of the API. The technical layering is better described later:

"Now, to use an accessory with your app, there are 3 steps: discovery of the accessory, authorization to use the accessory, and communication with the accessory. AccessorySetupKit takes care of discovery and authorization, while the communication is still handled with CoreBluetooth and NetworkExtension just like previous versions of iOS."

In this context, "NetworkExtension" really means "NEHotspotConfigurationManager". Also, just so this is the clear, the big benefit of this flow for a WiFi accessory is that it means your app will be able to automatically reconnect to it's paired accessory without any additional user interaction. That's a huge improvement to NEHotspotConfigurationManager.

Following on that, I too am interested in using the new Framework for my UI.

I'm currently using an MFi EAAccessoryBrowser setup, is there no way to use the ExternalAccessory framework with AccessorySetupKit in a "streamlined" way ?

I don't believe that's currently possible, but it would definitely be worth filing an enhancement request asking for it to be supported.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Okay, thanks. Guess I will have to stay with my current solution.

My use case is that I am temporarily connecting to accessory which has different WiFi password each time that gets generated once the user initiates the setup on the accessory.

My hope was that this picker would give me "completion" so I would know for sure when accessory is connected...

Okay, thanks. Guess I will have to stay with my current solution.

My use case is that I am temporarily connecting to accessory which has different WiFi password each time that gets generated once the user initiates the setup on the accessory.

How does your app get the new WiFi password? One of the main reason Accessory Setup Kit was architected this way was so that the apps pairing relationship with an accessory WASN'T artificially tied to the system having the credentials for that accessory.

I'm not sure what your current solution is, but I haven't seen a scenario yet where Accessory Setup Kit didn't improve the situation to at least some degree. For example, even if the password changes on every connection attempt and the user has to manually enter it each time, integrating Accessory Setup Kit means removes the additional "Are you sure?" dialog required today.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Thanks for the additional details.

I guess my imagined use case is really outside the intended ones.

My app connects to Nintendo Switch game console, which requires the user to initiate the connection on the Switch. The console then presents a QR code with WiFi network info (including the password which is different each time). So my app scans the code and uses the NEHotspotConfigurationManager to initiate the connection.

My idea was to present the new "picker" after the QR code is scanned.

Specify WiFi password for ASDiscoveryDescriptor?
 
 
Q