CAN_SetDeviceName

CAN Development Packages for Windows®
Post Reply
rampinia
Posts: 25
Joined: Sat 5. Mar 2011, 11:37

CAN_SetDeviceName

Post by rampinia » Fri 31. Jul 2015, 15:43

Hello,

My software connect to multiple net simultaneously.
4 net on PCAN_PCI driver and 1 net on PCAN-VIRTUAL.

I'm able to open all the connection without any error by doing call to CAN_SetDeviceName.

But if I connect to the virtual driver last I'm not able to read/write/remove client from the PCA_PCI driver.

My understanding was that once the connection to a net was established no need to switch between driver. Is that different? Do I have to switch between driver according to the network? How does PCAN_Status manage multiple connection on multiple driver?

How to manage such scenario?

Thanks,

Andrea R.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN_SetDeviceName

Post by M.Maidhof » Fri 31. Jul 2015, 16:21

Hello,

please note, that you switch the canapi2.dll to a different device with that CAN_SetDeviceName API call. All handles (client-, hardware-, net-handles) which you already configured on the one device will not be available on the other device. All handles will be managed by the device driver, and not by the dll.

So you have to call CAN_SetDeviceName on each API call, when you want to use two different devices at the same time (Virtual and PCI).

regards

Michael

rampinia
Posts: 25
Joined: Sat 5. Mar 2011, 11:37

Re: CAN_SetDeviceName

Post by rampinia » Sun 2. Aug 2015, 09:09

Do you mean that I can do code like below and call it in a loop?

CAN_SetDeviceName('pcan_virtual');
Ret = CAN_read(....);

CAN_SetDeviceName('pcan_pci');
Ret = CAN_read(...);

Thanks

Andrea R.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: CAN_SetDeviceName

Post by M.Maidhof » Mon 3. Aug 2015, 13:41

Hi,

yes, this will be possible. Note that you have to use the handles, depending on your driver than.

regards

Michael

Post Reply