Troubles getting channels count using Peak.Can.Basic in C#

The free CAN Software API (Application Programming Interface) for Windows®
Locked
hugues.ostermann
Posts: 3
Joined: Mon 29. Jun 2020, 13:56

Troubles getting channels count using Peak.Can.Basic in C#

Post by hugues.ostermann » Mon 29. Jun 2020, 14:09

I have troubles getting the channel count using PCANBasic.GetValue method.
Return is always the following error -> TPCANStatus.PCAN_ERROR_ILLPARAMTYPE.
Sounds like I am not using the method properly.
However, I followed the sample code examples provided in documentation.
Any clue of what goes wrong here ?

Code: Select all

            uint iChannelsCount;
            TPCANStatus stsResult;
            // preinitialize
            stsResult = PCANBasic.GetValue(PCANBasic.PCAN_NONEBUS, TPCANParameter.PCAN_ATTACHED_CHANNELS_COUNT, out iChannelsCount, sizeof(uint));
Regards,

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Troubles getting channels count using Peak.Can.Basic in C#

Post by M.Heidemann » Mon 29. Jun 2020, 14:15

Hello,

Which version of PCANBasic are your currently using?

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

hugues.ostermann
Posts: 3
Joined: Mon 29. Jun 2020, 13:56

Re: Troubles getting channels count using Peak.Can.Basic in C#

Post by hugues.ostermann » Mon 29. Jun 2020, 16:53

Hello,

Using API version 1.2.1.31

Regards,

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Troubles getting channels count using Peak.Can.Basic in C#

Post by M.Heidemann » Tue 30. Jun 2020, 08:18

Hello,

This parameter was introduced in version 4.4.0 of PCANBasic, make sure to switch to
the current version of the API -> https://www.peak-system.com/fileadmin/m ... -basic.zip

Here a link to the version history of PCANBasic:

https://www.peak-system.com/PCAN-Basic.126.0.html

This is also mentioned in the parameter documentation of PCANBasic:
ATTACHED_CHANNELS_COUNT.PNG
ATTACHED_CHANNELS_COUNT.PNG (102.39 KiB) Viewed 4389 times

Make sure to take a look at the new examples provided.


Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

hugues.ostermann
Posts: 3
Joined: Mon 29. Jun 2020, 13:56

Re: Troubles getting channels count using Peak.Can.Basic in C#

Post by hugues.ostermann » Wed 1. Jul 2020, 10:00

Hello,

Sorry, this is a common mistake.
Windows was using an older .dll than the one I expected.
Copying the version 4.4.0.288 in the root folder of my project solved the issue.

Many thanks for your help.
You can close the ticket.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Troubles getting channels count using Peak.Can.Basic in C#

Post by M.Heidemann » Wed 1. Jul 2020, 10:04

Hello,

Thank you for your feedback!

Best Regards

Marvin

-Closed-
---
Marvin Heidemann
PEAK-Support Team

Locked