ProGlove Documentation

Queueing behavior

When setting screens, requesting device information, or performing any other action on a scanner, the ConnectSDK queues the commands it will send to the device.

For example, if you quickly call, setScreen 3 times successively, the 3 screens will be displayed one after another.

You can cancel all commands currently waiting in the queue and place the next command as the first one to be executed.

Queueing behavior without replace-queue:

iOSQueue1.png

Queueing behavior with replace-queue:

iOSQueue2.png

Legend

Cx

A command triggered via SDK

Rx

A response (error or result object) to the Cx command

RCx

A command with the replace-queue flag active

ERx

An error response to Cx command

This queue is currently limited to 5 commands. If a command is triggered and there are already 5 commands waiting in the queue, the response is immediate and indicates a full queue.

SDK

When using the ConnectSDK, every command is sent via a PGCommand object, which holds the necessary command data and can hold a PGCommandParams object.

The PGCommandParams object holds the data on how this command should be processed.

To trigger the command with the replace queue flag, add a PGCommandParams object with replaceQueue set to true to the PGCommand.

This can be done by using the initializer of PGCommand.

All commands canceled while waiting in the queue for execution will result in a call back with the error with domain PGWearableApiErrorDomain and error code PGWearableApiErrorRequestCanceled of the PGWearableApiError.

Below, you can find an example of how to trigger feedback immediately, canceling all queued commands:

Example 47. Objective C
  PGCommandParams *commandParams = [[PGCommandParams alloc] init];
  commandParams.replaceQueue = YES;

  PGCommand *command = [[PGCommand alloc] init:[[PGDeviceInformationRequest alloc] init] withParams:commandParams];

  [centralManager.connectedScanner requestDeviceInformationWithDeviceInfoCommand:command completionHandler:^(PGDeviceInformation * _Nullable deviceInformation, NSError * _Nullable error) {
       // Handle response
  }];


Example 48. Swift
  PGCommandParams *commandParams = [[PGCommandParams alloc] init];
  commandParams.replaceQueue = YES;

  PGCommand *command = [[PGCommand alloc] init:[[PGDeviceInformationRequest alloc] init] withParams:commandParams];

  [centralManager.connectedScanner requestDeviceInformationWithDeviceInfoCommand:command completionHandler:^(PGDeviceInformation * _Nullable deviceInformation, NSError * _Nullable error) {
       // Handle response
  }];