Intent API - Worker Feedback
PLEASE NOTE: THE USAGE OF THESE FEATURES IS RESTRICTED AND ONLY AVAILABLE AS CLOSED BETA THROUGH OUR EARLY ACCESS PROGRAM. PLEASE FILL OUT THE REGISTRATION FORM TO APPLY.
Worker Feedback enables you to trigger the MARK Feedback system profiles asynchronously to inform your worker about an event.
Worker Feedback commands, like all commands that trigger an action on MARK, will by default be queued in ProGlove Connect.
By providing a special flag in PgCommandParams
, this behaviour can be changed to replace the queue with this new command.
For more Information about the queueing behaviour click here
Disable the default scan Feedback on MARK
By default, MARK will play a positive Feedback when a barcode transmission is started. The default scan Feedback (green LED blinking twice) can be disabled by sending an 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)`
This setting is lost on disconnection.
Trigger Feedback
To trigger a Feedback sequence on the connected MARK:
- Action: com.proglove.api.PLAY_FEEDBACK
- Extra: Integer in com.proglove.api.extra.FEEDBACK_SEQUENCE_NAME
Currently the following Feedback sequences are available in the ProGlove Connect App:
- 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)
Example code:
val intent = Intent()
intent.setAction("com.proglove.api.PLAY_FEEDBACK")
intent.putExtra("com.proglove.api.extra.FEEDBACK_SEQUENCE_ID", 1)
sendBroadcast(intent)
PLEASE NOTE: On Android 8 or newer, this might fail because the ProGlove Connect App is not running in the Background. Please start the Pairing process using the ProGlove Connect Work App
Limitations: There is no callback if the Feedback succeeded or failed. Make sure that a MARK is connected that supports this feature and to send Feedback in reasonable intervals.
Play multiple Feedback sequences on MARK in order
Since there is no callback for Intent and therefore it is not possible to react on a "finished" sequence to start another sequence right away, there is an option 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 will be played in that order one after the other.
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.
Additionally to the above mentioned structure you can also provide a Boolean valued extra in com.proglove.api.extra.REPLACE_QUEUE, which if set to true will make this command cancel all the currently waiting commands and execute this command as soon as possible. More information can be found here
Receiving Button presses
The ProGlove Connect app will send out the following Intent if the trigger is pressed twice in quick succession, like a double click on a computer mouse. The same Intent structure will be sent out for other physical button presses on the device.
- Action: com.proglove.api.DISPLAY_BUTTON
- Extras:
- String in com.proglove.api.extra.DISPLAY_BUTTON contains the id of the pressed button
In order to receive broadcast intents the following steps are needed (code is in Kotlin):
1 Implement a broadcast receiver (in this case the class is called MessageHandler):
class MessageHandler : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
if (intent != null && intent.action == "com.proglove.api.DISPLAY_BUTTON") {
intent.getStringExtra("com.proglove.api.extra.DISPLAY_BUTTON")
}
}
}
2 define an IntentFilter filtering for the specified actions:
val messageHandler: MessageHandler = MessageHandler()
val filter = IntentFilter()
filter.addAction("com.proglove.api.DISPLAY_BUTTON")
filter.addCategory(Intent.CATEGORY_DEFAULT)
3 Somewhere where a context is available (usually an Activity's or Service's onCreate):
context.registerReceiver(messageHandler, filter)
Do not forget to unregister the receiver again, for example in onDestroy:
context.unregisterReceiver(messageHandler)