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 132. 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 133. 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 134. Objective C
- (void)didStartFirmwareUpdate {
    //Firmware update started.
}


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


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

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


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


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

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


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


 

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

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


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