Code Example/Resources to implement AccessorySetupKit on Embedded Devices such as ESP32/RaspberryPI for Matter type applications

Hello,

Currently we have the sample project from WWDC2024 as an example on how to do it as a live example but only as a simulated project on the Accessory end. The example is good but being implemented a rich platform like iOS or iPadOS, the rich stack of APIs are provided. Embedded devices such as the ESP32/RaspberryPI do not have this rich API stack, such as CoreBluetooth and so on, so a mirror stack of API/functions must be implemented to give the equal experience.

Are there any examples or design/technical guidelines for the Accessory end to implement AccessorySetupKit on embedded devices. (Like a list of technical requirements or checklist of functions/implementations/services we can go through on a ESP32/RapberryPI) to ensure that the Accessory has all the needed code/technical implementations with AccessorySetupKit for both Bluetooth and WiFi support, especially on the Bluetooth end.

Best to have an ESP32 project, implemented in Embedded Swift but at least a checklist (of items/situations/error handling) to confirm that it works.

Hello.

Apple provides generic accessory development guidelines here

In general, AccessorySetupKit requires a device to be able to advertise according to the Bluetooth or WifiAware specs. For Bluetooth, you will need to advertise a specific service UUID, or service data, or manufacturer payload with specific information for your accessory, and then you will be able to program those into AccessorySetupKit on iOS to be able to set it up.

What I am looking for is like a checklist like

For Bluetooth example

  1. Bluetooth min version required on Accessory (For example 2.0)
  2. Service UUID must be similar
  3. Error handling routines that must be implemented (or should be implemented)
  4. Exceptions that must be handled (Like power lost or reconnection attempts)

AccessorySetupKit is mainly design to work with existing Bluetooth low energy devices implementing BT Spec starting with 4.0. Apple has published numerous resources about best practices over the years with CoreBluetooth dedicated videos and the accessory setup guidelines I linked above. For the power lost concern - please clarify where the power loss occurs - accessory side or iOS side ? In any case, AccessorySetupKit is only used for the initial setup, after that you use the existing CoreBluetooth API to scan and connect with the accessory, use GATT or LE L2CAP to exchange data.

Code Example/Resources to implement AccessorySetupKit on Embedded Devices such as ESP32/RaspberryPI for Matter type applications
 
 
Q