VCI4 device disconnection detection
AnsweredHello,
I am developing a .Net interface using the Vci4 driver. The device is the Ixxat CAN@Net NT 420. I would like to be able to detect the disconnection of the device. For example when the power to the device is down or the ethernet connection is interrupted. When the controller is started and communicating nothing specifics happens when disconnected. Reconnecting the device does not restart receiving of messages. On the Vci4 contracts i cannot find an event that is triggered when the connection is lost. Also no specific CAN message (Info, Status, Error, ...) is returned in that case.
Any advice on how to detect these situations?
Thank you.
Regards,
Jimmy Hannon
-
Official comment
Dear Jimmy,
You can monitor the changes in the device list using AutoResetEvent or ManualResetEvent object
as described in the §4.1 in the VCI-DotNetSoftwareDesignGuide.pdf
See c:\Program Files\HMS\Ixxat VCI\Manual\VCI-DotNetSoftwareDesignGuide_en.pdf
Create the event:protected AutoResetEvent mInterfaceChangeEvent = new AutoResetEvent(false);
Assign the event:
IVciDeviceManager deviceManager = VciServer.Instance().DeviceManager;
mVciDeviceList = deviceManager.GetDeviceList();
deviceManager.Dispose();
mVciDeviceList.AssignEvent(mInterfaceChangeEvent);Wait for the event in a thread function:
protected void InterfaceChangeThread()
{
while (!mInterfaceThreadShouldStop)
{
mInterfaceChangeEvent.WaitOne(Timeout.Infinite, true)
if (!mInterfaceThreadShouldStop)
{
// check which interface has changed
}
}
}After the disconnection the CAN@net NT has to be re-connected and re-initialized.
Best regards
Andreas -
Dear Andreas,
That helped me in the right direction and I got it working. You are correct, it is mentioned in the manual.
Thank you for the quick reply and help!
Best regards
Jimmy0 -
Dear Jimmy,
Thank you very much for your feedback!
Please do not hesitate to ask us if you have any further technical questions.
Best regards
Andreas0
Please sign in to leave a comment.
Comments
3 comments