I developed a software based on Blinky. I have been trying to add DFU to the current iOS app which is working properly to be like the Android app.
As I did in Android, the connection is established between phone and nRF52840 using BLS service. DFU will be manually triggered in case the firmware needs to be updated. I used the following code to start DFU :
let path = Bundle.main.path(forResource: "file1" , ofType: "zip") let url = NSURL.fileURL(withPath: path!) let selectedFirmware = DFUFirmware(urlToZipFile: url) let initiator = DFUServiceInitiator(queue: DispatchQueue(label: "Other")) initiator.forceDfu = true//false // default false initiator.logger = self as? LoggerDelegate // - to get log info initiator.delegate = self // - to be informed about current state and errors initiator.progressDelegate = self // - to show progress bar if let peripheralDFU = self?.blinkyPeripheral.getPeripheral { initiator.with(firmware: selectedFirmware!).start(target: peripheralDFU) }
As soon as it runs, it disconnects from the blinky and it fails to initialise the DFUc process. Here is the terminal:
Connecting to Blinky device...
Connected to Blinky
Discovering LED Button service...
LED Button service found
Discovering LED and Button characteristrics...
Button characteristic found
LED characteristic found
Enabling notifications for characteristic...
Button notifications enabled
Writing LED value (with response)...
Data Rec: 0 46 29 0 0
Writing LED value (with response)...
Writing LED value (with response)...
Writing LED value (with response)...
Writing LED value (with response)...
Writing LED value (with response)...
Data Rec: 0 48 29 0 0
Data Rec: 0 49 29 0 0
Data Rec: 0 50 29 0 0
Data Rec: 0 51 29 0 0
Data Rec: 0 52 29 0 0
Data Rec: 0 53 29 0 0
Data Rec: 0 54 29 0 0
Data Rec: 0 55 29 0 0
Data Rec: 0 56 29 0 0
Data Rec: 0 57 29 0 0
Data Rec: 0 58 29 0 0
Connecting
Starting
Enabling DFU Mode
Blinky disconnected
Connecting
Starting
Enabling DFU Mode
Connecting
Starting
Enabling DFU Mode