Skip to main content

VCI4 device disconnection detection

Answered

Comments

3 comments

  • Official comment
    Andreas Stobe

    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

     

  • Jimmy Hannon

    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
    Jimmy

    0
  • Andreas Stobe

    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
    Andreas

    0

Please sign in to leave a comment.