private void checkFirmwareVersion ( ) { Log . i ( TAG , "Checking Firmware version..." ) ; setState ( OADState . CHECKING_FW_VERSION ) ; mGattClient . getDeviceProfile ( ) . getFirmwareVersion ( new DeviceProfile . VersionCallback ( ) { @ Override public void onComplete ( String version ) { // Check the Bean version against the Bundle version boolean updateNeeded = needsUpdate ( firmwareBundle . version ( ) , version ) ; if ( updateNeeded && oadApproval . isApproved ( ) ) { // Needs update and client has approved, keep the update going startOfferingImages ( ) ; } else if ( updateNeeded && ! oadApproval . isApproved ( ) ) { // Needs update but client has not approved, ask for approval watchdog . pause ( ) ; oadListener . updateRequired ( true ) ; } else if ( ! updateNeeded && ! oadApproval . isApproved ( ) ) { // Does not need update and the client has never approved. This means // no update is required, and no firmware update ever occurred finishNoUpdateOccurred ( ) ; oadListener . updateRequired ( false ) ; } else if ( ! updateNeeded && oadApproval . isApproved ( ) ) { // Does not need update, and the client has approved. This means that // the firmware process actually took place, and completed finishUpdateOccurred ( ) ; } else { Log . w ( TAG , "Unexpected OAD Condition!" ) ; } } } ) ; }
Check the Beans FW version to determine if an update is required