16 #ifndef RLCANOPENTYPES 17 #define RLCANOPENTYPES 55 for (
int i=0; i<247; i++){
90 switch(_canopentype) {
127 switch(_deamontype) {
128 case RL_INT:
return 0x0007;
141 case RL_PDO:
return 0x000E;
237 while ((_value[i] !=
'\0')&&(i<247)){
249 char* outstring =
new char[247];
251 while ((
t_string[i] !=
'\0')&&(i<247)){
265 fprintf(stderr,
"ERROR! set_buffer: INDEX OUT OF RANGE!\n");
277 fprintf(stderr,
"ERROR! get_buffer: INDEX OUT OF RANGE!\n");
366 for (
int i=0; i<246; i++){
378 rlDebugPrintf(
"Warning! %s invalid type! current data type is: %s \n" 379 , usrTypeStr, curTypeStr);
386 char* typestr =
new char[12];
388 case RL_INT: strncpy(typestr,
"RL_INT ", 12);
break;
389 case RL_FLOAT: strncpy(typestr,
"RL_FLOAT ", 12);
break;
390 case RL_DOUBLE: strncpy(typestr,
"RL_DOUBLE ", 12);
break;
391 case RL_SHORT: strncpy(typestr,
"RL_SHORT ", 12);
break;
392 case RL_USHORT: strncpy(typestr,
"RL_USHORT ", 12);
break;
393 case RL_LONGLONG: strncpy(typestr,
"RL_LONGLONG ", 12);
break;
394 case RL_STRING: strncpy(typestr,
"RL_STRING ", 12);
break;
395 case RL_BUFFER: strncpy(typestr,
"RL_BUFFER ", 12);
break;
396 case RL_UCHAR: strncpy(typestr,
"RL_UCHAR ", 12);
break;
397 case RL_BOOL: strncpy(typestr,
"RL_BOOL ", 12);
break;
398 case RL_LONG: strncpy(typestr,
"RL_LONG ", 12);
break;
399 case RL_ULONG: strncpy(typestr,
"RL_ULONG ", 12);
break;
400 case RL_ULONGLONG: strncpy(typestr,
"RL_ULONGLONG", 12);
break;
401 case RL_PDO: strncpy(typestr,
"RL_PDO ", 12);
break;
402 case RL_NODESTATE: strncpy(typestr,
"RL_NODESTATE", 12);
break;
403 case RL_NOTYPE: strncpy(typestr,
"RL_NOTYPE ", 12);
break;
404 default: strncpy(typestr,
"UNDEFINED ", 12);
417 char* errstr =
new char[25];
419 case 0: strncpy(errstr,
"ERRCODE_NOERROR ", 25);
break;
420 case -1: strncpy(errstr,
" ", 25);
break;
421 case -2: strncpy(errstr,
"ERRCODE_INVALID_NODEID", 25);
break;
422 case -3: strncpy(errstr,
"ERRCODE_INVALID_PDOID ", 25);
break;
423 case -4: strncpy(errstr,
"ERRCODE_PDOSND_FAIL ", 25);
break;
424 case -5: strncpy(errstr,
"ERRCODE_INVALID_MAPID ", 25);
break;
425 case -6: strncpy(errstr,
"ERRCODE_INVALID_RLTYPE", 25);
break;
426 case -7: strncpy(errstr,
"ERRCODE_PDORCV_FAIL ", 25);
break;
427 default: strncpy(errstr,
"ERRCODE_MSGF ", 25);
break;
435 for (
int i=0; i<8; i++){
443 for (
int i=0; i<8; i++){
453 for (
int i=0; i<247; i++){
472 for (
int i=0; i<247; i++){
481 unsigned char _bEmcyBuffOverflow,
482 unsigned char _bPrmFault,
483 unsigned char _bGuardActive ,
484 unsigned char _bDeactivated)
511 bool &_bEmcyBuffOverflow,
575 switch (_canopentype){
642 default :
return false;
650 switch (_canopentype){
659 default :
return false;
int rlDebugPrintf(const char *format,...)
void set_bool(bool _value)
sets type to RL_BOOL and stores passed parameter data in databuffer
void set_CanOpenType(int _type)
recieves an CANopen typenumber and returns appropiate RL-Type
float get_float()
returns databuffer-content as float type.
void set_int(int _value)
sets type to RL_INT and stores passed parameter data in databuffer
void set_longlong(long int _value)
sets type to RL_LONGLONG and stores passed parameter data in databuffer
the IPCMSGSTRUCT is the transfer buffer which is send trough TCP sockets
void set_nodeerror(unsigned char _nodeerror)
double get_double()
returns databuffer-content as double type.
unsigned long int t_ulonglong
void set_DaemonType(rl_types _type)
alternative setter receives integer typenumber
unsigned char get_nodeerror()
returns actual node error
void set_uchar(unsigned char _value)
sets type to RL_UCHAR and stores passed parameter data in databuffer
void getIpcMsg(IPCMSGSTRUCT _myIpcMsg)
overwrites all data with IPCMSGSTRUCT data
class to handle CANopen types
bool get_nodestateFlags(bool &_bNodeNoResponse, bool &_bEmcyBuffOverflow, bool &_bPrmFault, bool &_bGuardActive, bool &_bDeactivated)
void set_ulonglong(unsigned long int _value)
sets type to RL_ULONGLONG and stores passed parameter data in databuffer
static int canOpenType2DeamonType(int _canopentype)
Function for typenumber conversion.
long get_rlmsgerr()
returns current errnumber
unsigned long int get_ulonglong()
returns databuffer-content as unsigned long long type
bool get_nodestateFlag_GuardActive()
void pdobuf2buf()
exchange bytes 0-7 from pdobuffer to databuffer
int get_DaemonType()
returns current of data stored in databuffer
bool get_nodestateFlag_PrmFault()
bool get_bool()
returns databuffer-content as bool type
long int get_longlong()
returns databuffer-content as long long type
void set_ushort(unsigned short _value)
sets type to RL_USHORT and stores passed parameter data in databuffer
unsigned long get_ulong()
returns databuffer-content as unsigned long type
char * type2str(int _typenr)
returns a pointer to a new 12 character string containing the name of the type
unsigned char get_uchar()
returns databuffer-content as uchar type
int get_CanOpenType()
returns the current type converted to CANopen typenumber
unsigned char t_databytes[247]
void set_rlmsgerr(long _errnr)
sets the errornumber. refer private varibale rlmsgerr for details
void buf2pdobuf()
exchange bytes 0-7 from databuffer to pdobuffer
void clearBuffer()
sets all bytes in databuffer to zero
int getLength()
returns number of bytes used for current type
void rlMsgErrOut()
prints MsgErrStr to StdOut
int get_int()
returns databuffer-content as integer type.
int get_CanOpenTypeLength(int _canopentype)
bool get_nodestateFlag_EmcyBuffOverflow()
unsigned char get_nodestate()
returns the nodestate. refer code numbers above
unsigned short get_ushort()
returns databuffer-content as short type
void set_ulong(unsigned long _value)
sets type to RL_ULONG and stores passed parameter data in databuffer
unsigned char pdobuffer[8]
external buffer for pdotransfer
void set_double(double _value)
sets type to RL_DOUBLE and stores passed parameter data in databuffer
void set_string(const char *_value)
IPCMSGSTRUCT createIpcMsg()
returns a IPCMSGSTRUCT filled with current object data
rlCanOpenTypes()
Constructor initializes with RL_NOTYPE.
char * get_string()
creates string filled with databuffer-content and returns a pointer
unsigned char get_buffer(int _index)
returns 1 byte from databuffer
void set_nodestateFlags(unsigned char _bNodeNoResponse, unsigned char _bEmcyBuffOverflow, unsigned char _bPrmFault, unsigned char _bGuardActive, unsigned char _bDeactivated)
sets type to RL_NODESTATE. Stores flag-data received from the device.
bool translate_CanOpenType(int _canopentype)
static int deamonType2CanOpenType(int _deamontype)
Function for typenumber conversion.
void set_float(float _value)
sets type to RL_FLOAT and stores passed parameter data in databuffer
void set_buffer(int _index, unsigned char _databyte)
transfer raw data into the databuffer
long get_long()
returns databuffer-content as long type
short get_short()
returns databuffer-content as short type
bool get_nodestateFlag_Deactivated()
rlCanOpenTypes & operator=(rlCanOpenTypes &cp)
copies all data from right object into left object
bool get_nodestateFlag_NoResponse()
read particular nodestade with the following functions
struct rlCanOpenTypes::@0::@2 bNodeFlagState
void invalidTypeError(int _typenr)
produce an invalid-type-warning to stdout. used by nearly all getter functions
void set_short(short _value)
sets type to RL_SHORT and stores passed parameter data in databuffer
void set_long(long _value)
sets type to RL_LONG and stores passed parameter data in databuffer
void set_nodestate(unsigned char _nodestate)
sets current state of node.