question

simon avatar image
simon asked trueox edited

Communication with the Mini after ICloverConnector.Sale

We have found that every so offten calling ICloverConnector.Sale() fails to returns a result from the Clover Mini when the sale is complete.

We are using the .NET 4.0.2 API, connecting to the Clover Mini via USB to the USB pay display app and have seen this on both Windows 7 & 10

Usally when a sale is started we get sevral messages from the OnDeviceActivityStart()/ OnDeviceActivityEnd() callbacks, followed by one from OnSaleResponse(). But sometimes we get nothing.

We can see in our logs that it was working up to this point without issue, with a sale going through 20-30 mins prior. The Clover connector thinks it is still connected and the sale goes thoguh the Clover OK, its just the messages have stopped.

The only time we call RemoveCloverConnectorListener() is just before disposing of the CloverConnector, and AddCloverConnectorListener() just after construction of the CloverConnector.

Has anyone else experianced this? and if so who did you solve it?


Clover Minisemi-integrationsUSB Pay Display
10 comments
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

"Usally when a sale is started we get sevral messages from the OnDeviceActivityStart()/ OnDeviceActivityEnd() callbacks, followed by one from OnSaleResponse(). But sometimes we get nothing."

To clarify, in the case where you don't get an OnSaleResponse, do you also not get the onDeviceActivityStart/End as well? Do you construct a CloverConnector per transaction (not recommended) or do you maintain a connection to the device? Can you check the logs on the device?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ commented ·

Simon, is the email associated with your community account a good contact? We have made some improvements to the USB protocol in the SDK and would like to see if you are interested in giving it a try.

0 Likes 0 ·
simon avatar image simon David Marginian ♦♦ commented ·

Yes the email on my account is a good contact and we would be happy to give it a try.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ simon commented ·

Ok, we are going to release a beta version of the SDK. It should be available on NuGet sometime tomorrow (MST).

0 Likes 0 ·
Show more comments
simon avatar image simon commented ·

No we don't get any messages from the Clover the OnDeviceActivityStart/ OnDeviceActivityEnd calls also stop. We create the CloverConnector if IsReady returns false or if we haven't created a connector yet.

In our logs we can see the connector getting created, then several successful sales throughout the day before a failed one.

Where are the logs on the device? We have tried checking Event Viewer but the logs only appear to last for an hour or two, so we have yet to catch them in time.

-1 Like -1 ·
David Marginian avatar image David Marginian ♦♦ simon commented ·

You can get the device logs via ADB - adb logcat. However, I expect the device is sending messages and you just aren't receiving them. You create the CloverConnector if IsReady returns false? You want to create a CloverConnector when your app is started and dispose of it when your app is closed. I suspect your apps management of the CloverConnector has forced your app into a state where it is no longer receiving messages.

0 Likes 0 ·
simon avatar image simon David Marginian ♦♦ commented ·

We create the connector if IsReady = false, in-case the connection was dropped at somepoint, so we can re-initialize the connection, but if you say only one connection is the way to go we'll try that and see how it goes.

I am not sure we would be able to get the log files using ADB, as it would mean going to the customers site (some times 100-200 miles away) with a laptop or installing a bunch of dev tools on the tills.

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered trueox commented
I was assuming this was a devkit since you did not specify the environment. If the connection is dropped at some point the CloverConnector will automatically connect when the connection has been re-established. You should not be creating a new Connector, and that is likely the root cause of your problem here.
2 comments
10 |2000

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

simon avatar image simon commented ·

Thanks, I'll give it a go with a single connector and see how it goes.

0 Likes 0 ·
trueox avatar image trueox simon commented ·

Simon did you manage to fix your issue? I am having the exact issue and I am using windows remote pay sdk 4.0.3.

0 Likes 0 ·
simon avatar image
simon answered David Marginian Deactivated commented
We have now moved to a single CloverConnector and put it onto a couple of sites this morning. One has already reported that it has happened again, this time he called us whilst it was still happing.

We also added a button the user could press that called RetrieveDeviceStatus with sendLastMessage set to true, in the hope this may kick it back into gear (it did not)

When it happened our software was till responsive and could make call to the clover connector, but no messages were returned ( IsReady was true on the clover connector)

I can see a payment was taken at 12:07:58 successfully, but the next payment at 14:53:43 did not get a response.

We managed to capture the event view logs for the clover and can see that after a normal payment has started there are lines that read

Exiting sendMessageSync()
Got Message:{"id":"982","method":"ACK", …
Got Message:{"id":"983","method":"TX_START_RESPONSE",…
Got Message:{"id":"984","method":"UI_STATE", …

But when this happens the Event viewer logs say nothing after Exiting sendMessageSync() for minute then it gets a new request from us RETRIEVE_DEVICE_STATUS_REQUEST

Any ideas what else could be causing this?

Update: I have noticed that between the first payment and second, there is a event log

14:13:10 - receiveMessagesThread Exception: Read failed, 0 bytes returned
14:13:10 - 4 : Terminating receiveMessagesThread
I am not sure if this is relevant or not, but it not in any other event logs we have see.

3 comments
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

Do you know if the merchant is using USB 2 or 3? If they are using 2 can you have them try 3? Have you considered using Secure Network Pay Display instead of USB pay display? HTTP is much more stable protocol for handling disconnects/reconnects, etc.

0 Likes 0 ·
simon avatar image simon commented ·

I will ask the support team to look into the USB ports and get back to you, I am not sure USB 3 is avilable on all the POS system we have out in the wild. If Secure Network Pay Display is a drop in replacement for the USB pay display, we'll look into adding an option for that.

We have been able to track this problem down to USBCloverTransport.cs, and have logged a bug report on GitHub Here with steps to replicate it.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ simon commented ·

Thanks Simon. I will create an internal issue for this and assign it to the Windows team.

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented
Simon,
Thank you for your excellent write-up. Our Windows team was able to reproduce the problem and fix it. We are planning a patch release in the coming weeks with the fix.
3 comments
10 |2000

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

simon avatar image simon commented ·

Thats great news, thanjks for the update and fast turn around :)

0 Likes 0 ·
simon avatar image simon commented ·

Hi do you have any update on when this fix will be release? It’s still causing issues for our customers.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ simon commented ·

Hi Simon, some issues were discovered with the fix unfortunately. I do not have an update other than that. I am wondering if it would be possible for you to consider looking at converting some of your merchants to Secure Network Pay Display?

0 Likes 0 ·
trueox avatar image
trueox answered trueox edited

I plugged my Clover mini (2nd Gen) into a USB 3.0 port and it does seem to be more stable.

1 comment
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

Nice, keep us posted.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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