SDK API - Worker Feedback
PLEASE NOTE: USAGE OF THIS FEATURES IS RESTRICTED AND AVAILABLE AS CLOSED BETA THROUGH OUR EARLY ACCESS PROGRAM. PLEASE FILL OUT THE REGISTRATION FORM IN ORDER TO APPLY FOR THE PROGRAM
Worker Feedback enables you to trigger the MARK feedback system profiles asynchronously to inform your worker about an event.
Disable the Default Scan Feedback on MARK
By default, MARK will play a positive feedback when a barcode-transmission is started.
This can be turned off using the Api Call scannerManager.setScannerConfig
. The call takes a PgScannerConfig
object and an
IPgConfigCallback
callback object as parameter.
The PgScannerConfig
object can be used to change the behavior of MARK - in this case, to disable the default scanning feedback.
(Code in Kotlin)
val config = PgScannerConfig(isDefaultScanAckEnabled = false)
scannerManager.setScannerConfig(config, object : IPgConfigCallback {
override fun onScannerConfigSuccess(config: PgScannerConfig) {
// everything worked
}
override fun onError(error: PgError) {
// handle the error
}
})
Trigger Feedback
To trigger a custom feedback, use the API scannerManager.triggerFeedback
. The function takes a
predefined feedback ID (PgPredefinedFeedback
) and an implementation of the IPgFeedbackCallback
callback as arguments.
After the feedback was played successfully on MARK (or in case of any errors) the IPgFeedbackCallback
will be called with the relevant information.
The PgPredefinedFeedback
ID defines the Feedback Sequence to be played (see below). Additionally, an optional feedback text can be given.
If the text is present and a ProGlove Display is connected, it will be used to display the information there as well.
val feedbackId = PgPredefinedFeedback.SPECIAL_1
scannerManager.triggerFeedback(feedbackId, 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 lights
Callback for Pressed Buttons and Double Presses
The ProGlove Connect app will send out a button press event for any physical button press an a connected Device.
Additionally it will also send out a button press if the MARK trigger is pressed twice in quick succession, like a double click on a computer mouse.
To get this, call the pgManager.subscribeToButtonPresses()
function and implement the IButtonOutput
interface.
For example, in the same onCreate
of our sample app we subscribe to the display info.
And we unsubscribe in the onDestroy
function.
override fun onCreate(savedInstanceState: Bundle?) {
//...
pgManager.subscribeToButtonPresses(this)
//...
}
override fun onDestroy() {
super.onDestroy()
pgManager.unsubscribeFromButtonPresses(this)
}
To do this, our Activity needs to implement the IButtonOutput
interface:
//
// -- IButtonOutput --
//
override fun onButtonPressed(buttonPressed: ButtonPress) {
// the button presses will come on background threads, make sure to execute this on the UI Thread
runOnUiThread {
Toast.makeText(this, "Got a button Press: ${buttonPressed.id}", Toast.LENGTH_SHORT).show()
}
}