Handling removal of PCAN-USB

The free CAN Software API (Application Programming Interface) for Windows®

Handling removal of PCAN-USB

Postby lignin » Wed 28. Jun 2017, 15:42

I want to show can connection status in my application ?
But I can not handle removal of PCAN-Usb device ?
So Do you have any ideas about this problem ?
Thanks
lignin
 
Posts: 2
Joined: Wed 28. Jun 2017, 15:38

Re: Handling removal of PCAN-USB

Postby U.Wilhelm » Wed 28. Jun 2017, 17:16

Please send us detailed information what exact you want to do with which HW from us.
We cant see any info of used hardware type, used OS, used interface DLL, used development environment etc.
without these minimum information we could not help....sorry....
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------
User avatar
U.Wilhelm
Sales & Support
Sales & Support
 
Posts: 1036
Joined: Fri 10. Sep 2010, 18:34
Location: Darmstadt

Re: Handling removal of PCAN-USB

Postby lignin » Wed 28. Jun 2017, 18:36

I apologize for the unclear question.
* I am using PCAN-USB in my project.
* My operating system is windows 8.
* I am writing code with C# in Visual Studio 2013.
* I am using PCANBasic.dll.

In my application, I am communicating with another device. I am showing connection status to the user.
I want to inform the user and stop communicating with device, if PCAN-USB is removed accidentaly.
So How can ı do this ?
lignin
 
Posts: 2
Joined: Wed 28. Jun 2017, 15:38

Re: Handling removal of PCAN-USB

Postby U.Wilhelm » Thu 29. Jun 2017, 07:51

The easy way is to use a simple Timer with a low resolution (500ms to 1Second) and call in this callback the Function CAN_GetStatus( HW_Handle). If you get the return Value PCAN_ERROR_ILLHW (0x01400) the Device was unplugged. If the device is still pluged to the PC, you have the latest Controller Status to show for example in a status line. For more info please see the PCAN-Basic Online Help File - Methods - GetStatus.
--------------------------------
PEAK-System Technik
Technical Support Team
support@peak-system.com
-------------------------------
User avatar
U.Wilhelm
Sales & Support
Sales & Support
 
Posts: 1036
Joined: Fri 10. Sep 2010, 18:34
Location: Darmstadt


Return to PCAN-Basic



This website uses cookies for analytics, for logins to the online shop and the forum, and for the handling of an order. By browsing this website you agree to the use of cookies. Detailed information on their use can be found in our privacy policy.

OKPrivacy Policy