Skip to main content

ProGlove Documentation

Worker feedback - SDK/Intent API

The Worker Feedback feature enables you to trigger your scanner’s feedback profiles asynchronously to inform your worker about an event.

Worker Feedback commands, like all commands that trigger an action on a scanner, are queued in the Insight Mobile app by default.

Providing a Boolean valued extra com.proglove.api.extra.REPLACE_QUEUE or a special flag in PgCommandParams, can change this behavior and replace the queue with the new command.

To learn more, see Command queueing in Insight Mobile.

To integrate the Worker Feedback feature via Intent or SDK API, test the API with an existing app, or build out the feature’s functionalities yourself, check out the Sample app’s code in our GitHub repository.

Trigger feedback using SDK

To trigger custom feedback, use the API pgManager.triggerFeedback. The function takes a predefined feedback ID (PgPredefinedFeedback) wrapped in a PgCommand and an implementation of the IPgFeedbackCallback callback as arguments.

After feedback is successfully triggered on the scanner (or in case of any errors) the IPgFeedbackCallback is called with the relevant information.

The PgPredefinedFeedback ID defines the feedback sequence to be played. The convenience function PgPredefinedFeedback.toComamnd() used here to wrap PgPredefinedFeedback optionally takes a PgCommandParams object, which gives additional control over how the command is executed.

For now we only support the replaceQueue flag here, which, if set to true, cancels all the commands currently in the queue and adds itself as the first element.

To learn more, see Command queueing in Insight Mobile.

Example 69. SDK
 val feedbackId = PgPredefinedFeedback.SPECIAL_1
 pgManager.triggerFeedback(feedbackId.toCommand(), object : IPgFeedbackCallback {
    override fun onSuccess() {
    // everything worked
    }

    override fun onError(error: PgError) {
    // handle the error
    }
})


Possible feedback IDs are:

  • PgPredefinedFeedback.SUCCESS - Positive feedback (ACK) - green

  • PgPredefinedFeedback.ERROR - Negative feedback (NACK) - red

  • PgPredefinedFeedback.SPECIAL_1 - Special feedback 1 - yellow

Note

Starting with MARK firmware v2.0.0, feedback triggered this way temporarily overwrites the scanner’s global feedback settings. For example, the sequences mentioned above play the sound even though the scanner is configured to be silent.

Trigger feedback with setting the screen

If you are using a MARK Display with Worker feedback, we suggest you follow this order to get the best behavior:

  1. Set the screen

  2. Send the feedback command

You do not have to wait for the setScreen command to return before sending the feedback command. The commands are queued automatically and feedback is triggered immediately after the screen is set.

Do not use the replace queue flag as that could cancel the sequence. Make sure not to send feedback before setting the screen. In that case, the screen is only set after feedback is completed which is not ideal.

Trigger feedback using SDK

To trigger custom feedback, use the API pgManager.triggerFeedback. The function takes a predefined feedback ID (PgPredefinedFeedback) wrapped in a PgCommand and an implementation of the IPgFeedbackCallback callback as arguments.

After feedback is successfully triggered on the scanner (or in case of any errors) the IPgFeedbackCallback is called with the relevant information.

The PgPredefinedFeedback ID defines the feedback sequence to be played. The convenience function PgPredefinedFeedback.toComamnd() used here to wrap PgPredefinedFeedback optionally takes a PgCommandParams object, which gives additional control over how the command is executed.

For now we only support the replaceQueue flag here, which, if set to true, cancels all the commands currently in the queue and adds itself as the first element.

To learn more, see Command queueing in Insight Mobile.

Example 70. SDK
 val feedbackId = PgPredefinedFeedback.SPECIAL_1
 pgManager.triggerFeedback(feedbackId.toCommand(), object : IPgFeedbackCallback {
    override fun onSuccess() {
    // everything worked
    }

    override fun onError(error: PgError) {
    // handle the error
    }
})


Possible feedback IDs are:

  • PgPredefinedFeedback.SUCCESS - Positive feedback (ACK) - green

  • PgPredefinedFeedback.ERROR - Negative feedback (NACK) - red

  • PgPredefinedFeedback.SPECIAL_1 - Special feedback 1 - yellow

Note

Starting with MARK firmware v2.0.0, feedback triggered this way temporarily overwrites the scanner’s global feedback settings. For example, the sequences mentioned above play the sound even though the scanner is configured to be silent.

Trigger feedback with setting the screen

If you are using a MARK Display with Worker feedback, we suggest you follow this order to get the best behavior:

  1. Set the screen

  2. Send the feedback command

You do not have to wait for the setScreen command to return before sending the feedback command. The commands are queued automatically and feedback is triggered immediately after the screen is set.

Do not use the replace queue flag as that could cancel the sequence. Make sure not to send feedback before setting the screen. In that case, the screen is only set after feedback is completed which is not ideal.

Trigger feedback using Intent

To trigger a feedback sequence on the connected scanner, send and Intent with the following:

  • Action: com.proglove.api.PLAY_FEEDBACK

  • Extra: Integer in com.proglove.api.extra.FEEDBACK_SEQUENCE_ID

Currently, Insight Mobile supports the the following ffeedback sequences:

  • ID 1 - Positive feedback (ACK)

  • ID 2 - Negative feedback (NACK)

  • ID 3 - Special feedback 1 (Yellow)

  • ID 4 - Special feedback 2 (Purple)

  • ID 5 - Special feedback 3 (Cyan)

Note

Starting with MARK firmware v2.0.0, feedback triggered this way temporarily overwrites the scanner’s global feedback settings. For example, the sequences mentioned above play the sound even though the scanner is configured to be silent.

Example 71. Intent
val intent = Intent()
intent.setAction("com.proglove.api.PLAY_FEEDBACK")
intent.putExtra("com.proglove.api.extra.FEEDBACK_SEQUENCE_ID", 1)
sendBroadcast(intent)


Note

On Android 8 or higher, this may fail because the Insight Mobile is not running in the background. Please use the Insight Mobile app to start the pairing process.

Limitations

There is no callback if the feedback succeeds or fails. Make sure that the connected scanner supports this feature and to send feedback in reasonable intervals.

Disable default scan feedback

By default, the scanner returns positive feedback when a barcode transmission is started. The default scan feedback (green LED blinking twice) can be disabled/enabled by calling using SDK API call or sending an Intent.

To disable the default scan feedback using SDK, use the API call pgManager.setScannerConfig. The call takes a PgScannerConfig object and an IPgConfigCallback callback object as parameter.

You can use the PgScannerConfig object to change the scanner’s bahavior - in this case, to disable the default scanning feedback (code below in KOTLIN).

To disable the default scan feedback using Intent, send an Intent with the action com.proglove.api.SET_CONFIG and a bundle-typed extra com.proglove.api.extra.CONFIG_BUNDLE containing the scanner’s configuration.

This setting is lost when disconnected.

Example 72. SDK
val config = PgScannerConfig(isDefaultScanAckEnabled = false)

pgManager.setScannerConfig(config, object : IPgConfigCallback {
    override fun onScannerConfigSuccess(config: PgScannerConfig) {
        // everything worked
    }

    override fun onError(error: PgError) {
        // handle the error
    }
})


Example 73. Intent
val intent = Intent()
intent.action = "com.proglove.api.SET_CONFIG"
val bundle = Bundle()
bundle.putBoolean("com.proglove.api.extra.config.DEFAULT_SCAN_FEEDBACK_ENABLED", false)
intent.putExtra("com.proglove.api.extra.CONFIG_BUNDLE", bundle)

sendBroadcast(intent)` 


Play multiple feedback sequences using Intent

Since there is no callback for Intent, it is impossible to react upon a finished sequence to start another one right away.

Intent API allows you to play multiple sequences with one Intent.

If an intArray is provided as extra com.proglove.api.extra.FEEDBACK_SEQUENCES_IN_ORDER, the feedback sequences in that array are conducted in that order one after another.

Example 74. Intent
val intent = Intent()
intent.setAction("com.proglove.api.PLAY_FEEDBACK")
intent.putExtra("com.proglove.api.extra.FEEDBACK_SEQUENCES_IN_ORDER", [4, 4, 4])
sendBroadcast(intent)


When multiple sequences are provided, the extra com.proglove.api.extra.FEEDBACK_SEQUENCE_ID is ignored.

Besides the above structure, you can also provide a Boolean valued extra in com.proglove.api.extra.REPLACE_QUEUE, which, if set to true, makes this command cancel all currently waiting commands and executes this command as soon as possible.

To learn more, see Command queueing in Insight Mobile.