false possitives from [device checkForFirmwareUpdateAsync]

edited February 17 in Firmware
This function appears to return true the first time any given sensor is checked from any given app install.

In the app I'm building, I use a workflow that is roughly:
user picks sensor to connect to -> check if new firmware is available -> update firmware if needed -> connect to sensor

So if I connect to sensor A from my iphone the first time I connect it will tell me the firmware needs to update and it will go through the update process.  If I disconnect then reconnect with the same phone it correctly says the firmware is up to date. Now if I connect to the same sensor with a different iphone OR if I delete the app off of my phone and reinstall it then the first connection attempt will again say the firmware needs to be updated. 

I've tried to do the check for newer firmware with both checkForFirmwareUpdateWithHandler and checkForFirmwareUpdateAsync but both exhibit this behavior. 






p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #31595d}
span.s1 {font-variant-ligatures: no-common-ligatures}



Comments

  • The issue caused by calling checkForFirmwareUpdateAsync before the device has finished connecting.  By making sure you connect first all should be well.  On our end, we will make sure that calling that API on an un-connected device will return a proper error.

    Thanks!
    -Stephen
  • I am not connected at all when I always call checkForFirmwareUpdateAsync. I check for an update, update if there is one available, then connect to the device. 

    Are you saying checkForFirmwareUpdateAsync initiates a connection on its own but doesn't wait for it to finish connecting? And also that this method of connecting is faster for some reason after the initial paring between the application and device?
  • No, you need to connect to the board first, then check for firmware updates.
  • So that means that the checkForFirmwareUpdateAsync call fails anytime you call it on a non-connected sensor but that the return value of that failure changes based on whether or no you have connected before from that app? That is truly bizarre.

    And since the documentation mentions that sometimes firmware can be so old that you can't connect, apps need to have one flow for mostly up to date firmware to check for firmware updates on devices after you connect, and a separate flow to just initiate a firmware update without checking or connecting to cover the case of really old firmware?

  • Functions can fail for several reasons.  It doesn't make sense to have the task return the same error for calling the function with an unconnected board vs. being unable to retrieve the firmware file.  From the developer's perspective, all you need to do is check that task.error != nil.  

    The only time the flow will be different is handling the result of the connectAsync task.  If the task fails due to outdated firmware, update the firmware and reconnect.  Otherwise, continue to the main app code.
Sign In or Register to comment.