Closed Crudough closed 3 years ago
Hello,
Regarding why the state goes to .connecting
, each client (CBCentralManager
) may connect to a device separately and they are not aware of each other. The OS system manages the physical connection, but informs clients as if they were the only client connected, to some degree. The state changes to connecting
even before anything starts:
https://github.com/NordicSemiconductor/IOS-DFU-Library/blob/8f935c6516969a874d8c2c01f4fdc4188c3d9910/iOSDFULibrary/Classes/Implementation/DFUSelector/DFUServiceSelector.swift#L69-L74
Could you debug why you don't get logger events, and where the process actually stops? This method should be called
https://github.com/NordicSemiconductor/IOS-DFU-Library/blob/8f935c6516969a874d8c2c01f4fdc4188c3d9910/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift#L158-L175 and the state should be .connected
, of the connect()
method should be called.
As you don't get Connected to NAME
log, I guess it starts to connect, but than you should get this log:
https://github.com/NordicSemiconductor/IOS-DFU-Library/blob/8f935c6516969a874d8c2c01f4fdc4188c3d9910/iOSDFULibrary/Classes/Implementation/GenericDFU/DFUPeripheral.swift#L475-L480
@philips77 I've stepped through and it seems that it's not picking up the logger peripheral in LoggerHelper.swift.
The logger.X calls happen but the Logger Helper cannot resolve the logger - the if let logger = logger
does not execute. As far as I'm aware I believe I am connecting the delegate correctly.
As additional information. Right before the code snippet for the DFUServiceSelector.swift file that you've included, in the init, I can confirm that it is indeed my logger where it is referenced as initiator.logger
.
Also, I've confirmed that the logger delegate between the self.initiator.logger = self
line in my code snippet above and the logger in the init for the LoggerHelper are the same object. I'm not aware of any but is there a configuration flag or setting in either the code or Xcode to enable the logging?
I've updated the issue above to include the full logs while the code is stepped through. @philips77 Is it possible that a delay is needed?
To leave a trail and hints for anyone else that may be stuck with this issue. I've found that this seems to be a timing issue. Initially I was instantiating a DFUManager
from my code snippet in my original description then immediately starting the DFU process. I've since changed the architecture to instantiate the DFUManager in an .onAppear
closure and waiting until a second action (button) to start the DFUProcess itself. It appears that this is logging correctly now!
@philips77 I will leave this open for a day or two if you are able to clarify why this might be the case. Thank you for all the help!
DFU Bootloader version (please complete the following information):
Device information (please complete the following information):
Your question I only get logs in my Xcode console if I step through the program which, correctly, results in a connection timeout for the DFU process. I can confirm that a DFU indeed takes place and am using the CPU usage as the indicator that the process is done. I only receive one "Connecting" log initially when I prompt the DFU but nothing after that. I've included some code snippets below and the "Connecting" log.
I've tried using different queues for each delegate but no change in behaviour was observed.
Code & Logs Code Snippet
Sample Logs When running uninterrupted.
When being stepped through