ProGlove Documentation

Update scanner firmware

MarkFirmwareUpdate API enables you to track the FirmwareUpdate state. Currently, the firmware image is bundled into the SDK (SDK v1.3.0 and firmware v2.3.0), and based on the loaded configuration settings SDK will perform the update.

To track the FirmwareUpdate state, implement the PGFirmwareUpdateManagerDelegate delegate and set the PGFirmwareUpdateManager delegate property.

Example 73. Objective C
@interface ViewController ()<PGCentralManagerDelegate, PGFirmwareUpdateManagerDelegate>

@property id<PGFirmwareUpdateManager> firmwareUpdateManager;
@property PGCentralManager *central;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.central = [[PGCentralManager alloc] initWithDelegate:self enableRestoration:YES];
    self.firmwareUpdateManager = self.central.firmwareUpdateManager;
    self.firmwareUpdateManager.delegate = self;
}

@end


Example 74. Swift
class ViewController: UIViewController, PGCentralManagerDelegate, PGFirmwareUpdateManagerDelegate {
  let firmwareUpdateManager: FirmwareUpdateManager?

  override func viewDidLoad() {
    central = PGCentralManager(delegate: self, enableRestoration: true)

    firmwareUpdateManager = central.firmwareUpdateManager
    firmwareUpdateManager?.delegate = self
  }
}


Once the update is triggered you will be informed via the didStartFirmwareUpdate delegate method:

Example 75. Objective C
- (void)didStartFirmwareUpdate {
    //Firmware update started.
}


Example 76. Swift
func didStartFirmwareUpdate() {
  //Firmware update started.
}


The firmware update progress can be tracked via the didChangeFirmwareUpdateProgress delegate method:

Example 77. Objective C
- (void)didChangeFirmwareUpdateProgress:(NSInteger)percentage {
  //Current progress presented in percentage
}


Example 78. Swift
func didChangeFirmwareUpdateProgress(_ percentage: NSInteger) {
  //Current progress presented in percentage
}


Once the update has been completed, the didCompleteFirmwareUpdate delegate method will be triggered:

Example 79. Objective C
- (void)didCompleteFirmwareUpdate {
  //Fimware update completed
}


Example 80. Swift
func didCompleteFirmwareUpdate() {
  //Fimware update completed
}


 

If a firmware update fails, the didFailToUpdateFirmwareWithError delegate method will be triggered and an error object returned:

Example 81. Objective C
- (void)didFailToUpdateFirmwareWithError:(NSError * _Nullable)error {
  //Firmware update failed.
}


Example 82. Swift
func didFailToUpdateFirmwareWithError(_ error: Error?) {
  //Firmware update failed.
}