Skip to main content

ProGlove Documentation

Update scanner firmware

MarkFirmwareUpdate API enables you to track the FirmwareUpdate state. Currently, the firmware image is bundled into the SDK, 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 105. 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 106. 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 107. Objective C
- (void)didStartFirmwareUpdate {
    //Firmware update started.
}


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


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

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


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


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

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


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


 

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

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


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