5 int main(
int argc,
char** argv){
8 std::cout <<
"Usage: " << argv[0] <<
" DEVICE PERIOD_MS HEADER [OVERFLOW] [+ID*] [-ID*] [--]" << std::endl;
12 std::string can_device = argv[1];
13 int sync_ms = atoi(argv[2]);
17 std::cout <<
"header is invalid" << std::endl;
20 int sync_overflow = 0;
23 if(argc > start && argv[start][0] !=
'-' && argv[start][0] !=
'+'){
24 sync_overflow = atoi(argv[4]);
25 if(sync_overflow == 1 || sync_overflow < 0 || sync_overflow > 240){
26 std::cout <<
"sync overflow is invalid" << std::endl;
32 std::set<int> monitored, ignored;
34 for(; argc > start; ++start){
35 if(strncmp(
"--", argv[start], 2) == 0)
break;
36 int id = atoi(argv[start]);
38 if(
id > 0 &&
id < 128) monitored.insert(
id);
39 else if (id < 0 && id > -128) ignored.insert(-
id);
41 std::cout <<
"ID is invalid: " <<
id << std::endl;
48 std::cout <<
"Could not initialize CAN" << std::endl;
61 std::cout <<
"Could not initialize sync" << std::endl;