Hello,
I'm working with PCAN-UDS and a Peak-USB device. When I connect the device, the channel condition goes from Unavailable to Available. If I disconnect it, it goes back to Unavailable.
However, if I call PCAN_Initialize on the corresponding handle, the condition becomes Occupied. I tried physically disconnecting the device from the computer, the same problem still remains.
Is there anyway to detect when the device is disconnected?
Thanks in advance!
Detect if the device goes missing?
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: Detect if the device goes missing?
the channel remains occupied because the connection will continue working, when you connect that device again (it is "reserved" for that application). If you want to check if a channel is still physically there, you need to call CAN_GetStatus periodically. If the device is plugged out, then you will get the error PCAN_ERROR_ILLHW (0x1400 - Invalid hardware handle)
BR
Marvin
BR
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
Re: Detect if the device goes missing?
Thanks for your answer. I got it.the channel remains occupied because the connection will continue working, when you connect that device again (it is "reserved" for that application). If you want to check if a channel is still physically there, you need to call CAN_GetStatus periodically. If the device is plugged out, then you will get the error PCAN_ERROR_ILLHW (0x1400 - Invalid hardware handle)
BR
Marvin