[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4694: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4695: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4696: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
8devices Community - View topic - Simple c(++)-Example for Windows
www.8devices.com
View unanswered posts | View active topics It is currently 16 Apr 2024, 22:36



Reply to topic  [ 3 posts ] 
 Simple c(++)-Example for Windows 
Author Message

Joined: 20 Oct 2017, 07:45
Posts: 2
I am using the CAN2USb for a long time under Linux via socket can and I have created a library / c++14 wrapper to be able to use simple functions / c++-containers (and function callbacks etc.).

Now I want to include the possibility to use the code under windows by filling code in "ifdef" blocks*.

Is there a simple basic (~20 Lines= example how to use CANAL (CAN Abstraction Layer) API
(http://www.8devices.com/media/products/ ... AL_API.pdf) ?
Unfortunately the source code of the windows test application does not help me.
(http://www.8devices.com/media/products/ ... ce_1_0.zip).


*Linux:
#include <net/if.h> // can as network layer
#include <linux/can.h> // socket can headers
#include <linux/can/raw.h> // socket can structs
...
ip link set ...
ifconfig ...
...
//read
fd_set readSet;
FD_ZERO(&readSet);
FD_SET(this->socket, &readSet);
if (select((this->socket + 1), &readSet, NULL, NULL, &timeout) >= 0)
{
if (FD_ISSET(this->socket, &readSet))
{
recvbytes = read(this->socket, &frame_rd, sizeof(struct can_frame));
// data is in frame_rd
//write
write(this->socket, frame, sizeof(struct can_frame));


20 Oct 2017, 08:03
Profile

Joined: 07 Dec 2011, 16:01
Posts: 525
Location: Lithuania
Try to look at this:
https://github.com/grodansparadis/vscp/ ... /socketcan


20 Oct 2017, 12:58
Profile

Joined: 20 Oct 2017, 07:45
Posts: 2
Thank you very much for the hint.

Actually this was much more than I was asking for. Some existing cross platform can driver for several hardware would be wonderful but I am afraid that vscp cannot do this. Although there are some “ifdefs” for Windows in https://github.com/grodansparadis/vscp/ ... ocketcan.h
it seems to me only be suited for windows – in the *cpp file there are dedicated linux systems headers. In addition wxwidget is used. I want to be able to use can with standard c++(14) only without any need of gui libraries at this level.


Thus, knowing how to use the 8-devices windows driver by having a simple basic example would be a good start.
Is it right that I have to use the CANAL (CAN Abstraction Layer) API
(http://www.8devices.com/media/products/ ... AL_API.pdf) ?


Unfortunately the source code of the windows test application does not help me.
(http://www.8devices.com/media/products/ ... ce_1_0.zip).


21 Nov 2017, 06:54
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.