question

Dyego Costa avatar image
Dyego Costa asked hammer answered

Is there any listener on ICloverConnectorListener to handle timeout on the device?

I'm working with the ICloverConnector and ICloverConnectorListener and I don't see a way react to timeout on the device.

For instance, I use the ICloverConnector#sale(request) to send a sale to the device and if I don't do anything the device will show a message "Transaction failed: Timed out", with a OK button.

Is there any event triggered when that happened? I'd like to be able to cancel the transaction if that happens so my remote app doesn't get stuck waiting for the Clover device.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

hammer avatar image
hammer answered

There is not a specific callback, but there is an indication of the activity. If you implement the ICloverConnectorListener.onDeviceActivityStart and ICloverConnectorListener.onDeviceActivityEnd, you can listen for deviceEvents. The device event you would want would be DeviceEventState.getEventState() === DeviceEventState.TIMED_OUT. If you wanted to display the 'OK' button to the user, you could listen for this event on the onDeviceActivityStart, display the button and send a ICloverConnector.prototype.invokeInputOption with the OK button to the device (Note: you can get the inputoption from the deviceEvent). Keep in mind that you will receive the event again in the onDeviceActivityEnd once the OK button is pressed on the mini or by sending the buttonpress to the device using the connector.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community