Skip to main content

ProGlove documentation

Trigger blocking/unblocking

The Trigger Blocking feature allows you to block or unblock trigger inputs on the connected scanner. Blocking triggers can be useful in workflow scenarios where you need to temporarily disable scanning or certain button gestures — for example, to prevent accidental scans or user actions during specific workflow phases.

Predefined triggers

You can use the following predefined trigger types:

  • DefaultPgTrigger — represents a single click of the main button.

  • DoubleClickMainPgTrigger — represents a double click of the main button.

  • TripleClickMainPgTrigger — represents a triple click of the main button (may not be supported on all scanners).

By selectively blocking certain button gestures, you can prevent users from performing specific actions, such as scanning, triggering workflow events, or taking photos.

Trigger unblocking options

Blocked triggers can be unblocked in several ways:

  • After a specified period of time.

  • When one of the defined unblocking triggers is pressed.

  • By calling a function to manually unblock all triggers.

  • Automatically when the scanner fully disconnects.

Note

Note: If a scanner goes out of range while triggers are blocked, they will remain blocked until an unblocking event occurs. It is not recommended to block all triggers indefinitely without defining an unblocking trigger. Always provide a recovery path in case of connection loss or BLE timeout.

Default trigger blocking implementation

To send a trigger blocking command to the connected scanner, call blockPgTrigger() from the PgManager.

In the PgCommand, provide an instance of BlockPgTriggersParams, which includes the following parameters:

blockTriggers: List<PredefinedPgTrigger>

List of triggers to be blocked.

unblockByTriggers: List<PredefinedPgTrigger>

List of triggers that will unblock all currently blocked triggers. Leave empty to disable unblocking by trigger.

val durationMs: Int

Duration in milliseconds for how long the triggers remain blocked. A value of 0 or negative blocks indefinitely until the scanner disconnects, is unblocked manually, or is rebooted. (Ignored onProGlove scanners below Scanner Firmware Gen1 v2.5.0 — always blocks indefinitely.)

val blockAll: Boolean

If true, all known triggers will be blocked except those defined in unblockByTriggers.

Parameter

Description

PgCommandParams() is optional and can be used to define command queue behavior.

The result callback IPgCommandResult provides:

  • onSuccess() – called when the command completes successfully.

  • onError(error: PgError) – called if blocking fails or parameters are invalid.

Example:

PgManager.blockPgTrigger(
  command = PgCommand(
    commandData = BlockPgTriggersParams(
        // add one or all. If you want to block all triggers, set blockAll to true
        blockTriggers = listOf(
            PredefinedPgTrigger.DefaultPgTrigger,
            PredefinedPgTrigger.DoubleClickMainPgTrigger,
            PredefinedPgTrigger.TripleClickMainPgTrigger
        ),
        // add one or all, depending on what action you want to unblock your triggers
        unblockByTriggers = listOf(
            PredefinedPgTrigger.DefaultPgTrigger,
            PredefinedPgTrigger.DoubleClickMainPgTrigger,
            PredefinedPgTrigger.TripleClickMainPgTrigger
        ),
        // Time in millis, e.g. 10 seconds
        durationMs = 10000,
        // Add to true if wanted to have all triggers blocked
        blockAll = true
    ),
    commandParams = PgCommandParams()
  ),
  callback = object : IPgCommandResult {
      override fun onSuccess() {
        // Handle successful trigger block
      }
      override fun onError(error: PgError) {
        // Handle blocking error
      }
  }
)
Specific trigger blocking examples
Block all triggers indefinitely

This example blocks only the default trigger and unblocks it via a double-click gesture. The blocking is indefinite until an unblocking event occurs.

pgManager.blockPgTrigger(
    command = PgCommand(
        commandData = BlockPgTriggersParams(
            blockTriggers = listOf(PredefinedPgTrigger.DefaultPgTrigger), // list of all triggers to be blocked
            unblockByTriggers = listOf(PredefinedPgTrigger.DoubleClickMainPgTrigger), // list of all triggers that unlock the trigger
            durationMs = 0, // indefinite
            blockAll = false // flag that indicates that all triggers are blocked
        ),
        commandParams = PgCommandParams()
    ),
    callback = this // listener with callback methods
)
Block all triggers for 10 seconds

This example blocks all triggers for 10 seconds. No unblocking triggers are defined, so unblocking happens automatically after the timeout.

pgManager.blockPgTrigger(
    command = PgCommand(
        commandData = BlockPgTriggersParams(
            emptyList(),
            emptyList(),
            10000, // duration of blocking - 10 seconds
            true // flag that indicates that all triggers are blocked
        ),
        commandParams = PgCommandParams()
    ),
    callback = this // listener with callback methods
)
Unblock all triggers

This example unblocks all triggers that were previously blocked.

pgManager.blockPgTrigger(
    PgCommand(
        BlockPgTriggersParams(
            emptyList(),
            emptyList(),
            0,
            false // flag for unblocking all triggers
        )
    ),
    this // listener with callback methods
)
Best Practices
  • Always define at least one unblocking condition (timeout or trigger).

  • Avoid using indefinite blocking without recovery logic.

  • Combine trigger blocking with workflow logic to guide user behavior dynamically.

  • For critical blocking (e.g., maintenance or restricted operations), ensure the scanner can reconnect or reboot to restore defaults.