Go to the documentation of this file.
46 #if ! WITH_ESD_CAN && ! WITH_PEAK_CAN
47 # error "At least support for ESD-CAN or PEAK-CAN must be enabled to compile cancat"
64 char const*
__help__ =
"Send data from command line via ESD or PEAK CAN and display replies until CTRL-C is pressed.";
66 char const*
__author__ =
"Dirk Osswald: dirk.osswald@de.schunk.com";
67 char const*
__url__ =
"http://www.schunk.com";
68 char const*
__version__ =
"$Id: cancat.cpp 9739 2013-02-04 15:39:29Z Osswald2 $";
74 int main(
int argc,
char** argv )
78 cSDHOptions options(
"general sdhcom_common sdhcom_esdcan sdhcom_peakcan sdhcom_cancommon" );
110 char const* sep =
"";
113 strncat( buffer, argv[
optind++ ], 511 );
114 strncat( buffer, sep, 511 );
117 strncat( buffer,
"\r\n", 511 );
119 dbg <<
"Sending String \"" << buffer <<
"\" via CAN\n";
122 canserial->
write( buffer, strlen( buffer ) );
127 if ( 1 == canserial->
Read( &reply, 1,
long(options.
timeout*1E6),
false ) )
128 printf(
"%c", reply );
136 cerr <<
"cancat main(): Caught exception from SDHLibrary: " << e->
what() <<
". Giving up!\n";
141 cerr <<
"cancat main(): caught unexpected exception!\n";
#define USING_NAMESPACE_SDH
Base class for exceptions in the SDHLibrary-CPP.
Low-level communication class to access a serial port.
unsigned long can_baudrate
Implementation of a class to parse common SDH related command line options.
int main(int argc, char **argv)
Low-level communication class to access a CAN port from company PEAK (http://www.peak-system....
This file contains interface and implementation of class #SDH::cDBG, a class for colorfull debug mess...
static char const * GetLibraryRelease(void)
char const * __copyright__
class for command line option parsing holding option parsing results
Interface of class #SDH::cCANSerial_ESD, class to access CAN bus via ESD card on cygwin/linux.
A class to print colored debug messages.
virtual void Open(void)=0
Open rs232 port port.
virtual ssize_t Read(void *data, ssize_t size, long timeout_us, bool return_on_less_data)=0
virtual int write(char const *ptr, int len=0)=0
Write data to a previously opened port.
This file contains settings to make the SDHLibrary compile on differen systems:
static char const * GetLibraryName(void)
USING_NAMESPACE_SDH NAMESPACE_SDH_START std::ostream * g_sdh_debug_log
This file contains the interface to class #SDH::cSDH, the end user class to access the SDH from a PC.
Low-level communication class to access a CAN port from company ESD (http://www.esd....
virtual const char * what() const
cDBG dbg
A stream object to print colored debug messages.
int Parse(int argc, char **argv, char const *helptext, char const *progname, char const *version, char const *libname, char const *librelease)
Interface of auxilliary utility functions for SDHLibrary-CPP.
char sdh_canpeak_device[MAX_DEV_LENGTH]
Interface of class #SDH::cCANSerial_PEAK, class to access CAN bus via PEAK card on cygwin/linux.
sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58