I am trying to provision the Alexa MCU peripheral with the WiFi credentials so it's able to connect to a WiFi network automatically. I've tried the app that is currently live in the App Store (version 1.4.8) but crashes when I try to start the BLE provision.
I've also used the Swift sample code (version 1.4.3) with no result and there are some issues when it crashes as it's trying to force unwrap an optional with a nil value inside.
This is replicable using the provided Swift code sample (version 1.4.3) when trying to write the JSON value to the MCU.
I have successfully connected an iPhone to the MCU via Bluetooth and when I am writing the value I get the next error.
Error Domain=CBATTErrorDomain Code=3 "Writing is not permitted." UserInfo={NSLocalizedDescription=Writing is not permitted.}
The discovered CBCharacteristicProperties are the mask of the read (2) and write (8) properties so the discovered properties in the debugging console are shown as:
po service.characteristics!.uuid
3E9D2532-2F00-11E9-9602-A44CC81C989A
po service.characteristics!.properties
▿ CBCharacteristicProperties - rawValue : 10
I should be able to write anything into the device as I have received the correct permissions. Whenever I try to do this in the didDiscoverCharacteristicsFor delegate method I get the previous CBATTError not letting me write anything to the device.
However, I am able to read values from the MCU and the problem only shows when writing the value.
Just in case I have tried another app like LightBlue to write a sample value and connecting to the MCU in the console using the screen command to see if any error comes up but nothing shows up.
The tests have been done on the MCU running version 1.0.10 Apptype: AppA and on two iPhones: X (iOS 13.4) and 6S (iOS 13.3.1) and in both cases the same error prevents writing.
The Android app is working correctly and writes the JSON to the device without a problem. This has to be an iOS error I am not seeing with CoreBluetooth.
Hello Javier,
Hope you are doing well.
Could you please try provisioning with WIFI. Please follow the steps to section 4 in the getting started.
SLN-ALEXA-IOT: Getting Started with Alexa Voice Service | NXP
Let me know if you are having any issues with the provisioning using WIFI.
Best Regards,
Sabina
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Is it not possible to provision the WiFi credentials via Bluetooth on iOS devices? This is just to discard that part of the code and only do it with WiFi.