canbcm.cpp
Go to the documentation of this file.
3 
4 using namespace can;
5 
6 #include <iostream>
7 
8 int main(int argc, char *argv[]){
9  BCMsocket bcm;
10 
11  int extra_frames = argc - 4;
12 
13  if(extra_frames < 0){
14  std::cout << "usage: "<< argv[0] << " DEVICE PERIOD HEADER#DATA [DATA*]" << std::endl;
15  return 1;
16  }
17 
18  if(!bcm.init(argv[1])){
19  return 2;
20  }
21 
22  int num_frames = extra_frames+1;
23  Frame *frames = new Frame[num_frames];
24  Header header = frames[0] = toframe(argv[3]);
25 
26  if(extra_frames > 0){
27  for(int i=0; i< extra_frames; ++i){
28  frames[1+i] = toframe(tostring(header,true)+"#"+argv[4+i]);
29  }
30  }
31  for(int i = 0; i < num_frames; ++i){
32  std::cout << frames[i] << std::endl;
33  }
34  if(bcm.startTX(boost::chrono::duration<double>(atof(argv[2])), header, num_frames, frames)){
35  pause();
36  return 0;
37  }
38  return 4;
39 }
can::BCMsocket::startTX
bool startTX(DurationType period, Header header, size_t num, Frame *frames)
Definition: bcm.h:81
can::Frame
Definition: interface.h:62
can::tostring
std::string tostring(const Header &h, bool lc)
Definition: string.cpp:78
string.h
main
int main(int argc, char *argv[])
Definition: canbcm.cpp:8
can::BCMsocket::init
bool init(const std::string &device)
Definition: bcm.h:56
bcm.h
can
Definition: asio_base.h:11
can::toframe
Frame toframe(const std::string &s)
Definition: string.cpp:119
can::Header
Definition: interface.h:17
can::BCMsocket
Definition: bcm.h:21


socketcan_interface
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:25