CAN_Read and CAN_ReadFD as blocking call?
CAN_Read and CAN_ReadFD as blocking call?
Hello,
is it possible to use CAN_Read() and CAN_ReadFD() functions as blocking call in Linux and Windows using PCANBasic lib? For example like recv() function for receiving TCP/UDP packets or getchar() function for reading inserted text to command prompt.
Thank you.
Ales
is it possible to use CAN_Read() and CAN_ReadFD() functions as blocking call in Linux and Windows using PCANBasic lib? For example like recv() function for receiving TCP/UDP packets or getchar() function for reading inserted text to command prompt.
Thank you.
Ales
-
- Sales & Support
- Posts: 425
- Joined: Fri 20. Sep 2019, 13:31
Re: CAN_Read and CAN_ReadFD as blocking call?
Hello,
The PCANBasic API does not use blocking calls.
Our Linux APIs (With the exception of PCANBasic)(CAN 2.0 API / CAN FD API) do provide such functions,
you can learn more about this in the documentation for our Linux driver package, see the chapter 5 "Developer Guide" -> "CharDev Mode":
http://www.peak-system.com/fileadmin/me ... an_eng.pdf
Best Regards
Marvin
The PCANBasic API does not use blocking calls.
Our Linux APIs (With the exception of PCANBasic)(CAN 2.0 API / CAN FD API) do provide such functions,
you can learn more about this in the documentation for our Linux driver package, see the chapter 5 "Developer Guide" -> "CharDev Mode":
http://www.peak-system.com/fileadmin/me ... an_eng.pdf
Best Regards
Marvin
Re: CAN_Read and CAN_ReadFD as blocking call?
Hi,
thank you for your response. I found out, that Windows PCANBasic can use it this way normally. So problem is, that Linux PCANBasic does not support the same things as the Windows version? If yes, it would explained, that PCAN-view on Windows does not utilize processor too much, but on the Linux, it utilize one whole one thread, maybe (while(1){read(...)...}).
As I see in the Linux manual, the functions looks sometimes same as in PCANBasic API and some of them are different, why is it not like in PCANBasic API, it seems to be chaotic and it is annoying when you implement cross-platform API and you have to use you different libraries and commands for the same device.
Thank you for your response.
Ales
thank you for your response. I found out, that Windows PCANBasic can use it this way normally. So problem is, that Linux PCANBasic does not support the same things as the Windows version? If yes, it would explained, that PCAN-view on Windows does not utilize processor too much, but on the Linux, it utilize one whole one thread, maybe (while(1){read(...)...}).
As I see in the Linux manual, the functions looks sometimes same as in PCANBasic API and some of them are different, why is it not like in PCANBasic API, it seems to be chaotic and it is annoying when you implement cross-platform API and you have to use you different libraries and commands for the same device.
Thank you for your response.
Ales
-
- Sales & Support
- Posts: 425
- Joined: Fri 20. Sep 2019, 13:31
Re: CAN_Read and CAN_ReadFD as blocking call?
Hello,
What are your refering to here: "I found out, that Windows PCANBasic can use it this way normally" ?
the PCAN 2.0 API and PCAN FD API support features that PCANBasic does not. By offering PCANBasic for Linux we want to make it as easy as possible for users
to write applications for both platforms.
If you want to implement a cross platform application, i'd recommend to take a look at our Python or Java-examples for PCAN-Basic.
Best Regards
Marvin
What are your refering to here: "I found out, that Windows PCANBasic can use it this way normally" ?
You are refering to our Linux APIs? Both are completely different APIs which just happen to serve the same functionality (Using our CAN-Interfaces),"As I see in the Linux manual, the functions looks sometimes same as in PCANBasic API and some of them are different, why is it not like in PCANBasic API, it seems to be chaotic and it is annoying when you implement cross-platform API and you have to use you different libraries and commands for the same device."
the PCAN 2.0 API and PCAN FD API support features that PCANBasic does not. By offering PCANBasic for Linux we want to make it as easy as possible for users
to write applications for both platforms.
If you want to implement a cross platform application, i'd recommend to take a look at our Python or Java-examples for PCAN-Basic.
Best Regards
Marvin
Re: CAN_Read and CAN_ReadFD as blocking call?
I was trying to tell, that in Windows it is possible to use blocking call for reading for example by command:
CAN_SetValue(PCAN_USBBUS1, PCAN_RECEIVE_EVENT, &hEvent, sizeof(hEvent))
I do not understand why this does not work in Linux.
I have already implemented a cross-platform interface based on PCANBasic for Windows and Linux for commanding PCANs. I do not want to use PCANBasic for Windows, PCAN 2.0 API for CAN-HIGH, and PCAN FD API for CAN-FD, this is mad!
Why is it too simple on Windows and too complicated on Linux?
Thank you.
Ales
CAN_SetValue(PCAN_USBBUS1, PCAN_RECEIVE_EVENT, &hEvent, sizeof(hEvent))
I do not understand why this does not work in Linux.
I have already implemented a cross-platform interface based on PCANBasic for Windows and Linux for commanding PCANs. I do not want to use PCANBasic for Windows, PCAN 2.0 API for CAN-HIGH, and PCAN FD API for CAN-FD, this is mad!
Why is it too simple on Windows and too complicated on Linux?
Thank you.
Ales
-
- Sales & Support
- Posts: 425
- Joined: Fri 20. Sep 2019, 13:31
Re: CAN_Read and CAN_ReadFD as blocking call?
Hello,
Okay, this clears things up.
There is information regarding this in the PCANBasic documentation, which might went unnoticed:
The Windows Event Object does not exist on Linux, but still you can use events on Linux, the handling is different though,
for reference take a look at /libpcanbasic/examples/c++/src/pcaneventread.cpp.
For further questions feel free to contact me again.
Best Regards
Marvin
Okay, this clears things up.
There is information regarding this in the PCANBasic documentation, which might went unnoticed:
The Windows Event Object does not exist on Linux, but still you can use events on Linux, the handling is different though,
for reference take a look at /libpcanbasic/examples/c++/src/pcaneventread.cpp.
For further questions feel free to contact me again.
Best Regards
Marvin
Re: CAN_Read and CAN_ReadFD as blocking call?
Hi Marvin,
Thank you, this is exactly what I looked for.
Ales
Thank you, this is exactly what I looked for.
Ales