29 #ifndef HOKUYO_ERRORS_H__
30 #define HOKUYO_ERRORS_H__
35 typedef unsigned char uint8_t;
36 typedef unsigned int uint32_t;
37 #if defined(HOKUYOAIST_STATIC)
38 #define HOKUYOAIST_EXPORT
39 #elif defined(hokuyoaist_EXPORTS)
40 #define HOKUYOAIST_EXPORT __declspec(dllexport)
42 #define HOKUYOAIST_EXPORT __declspec(dllimport)
46 #define HOKUYOAIST_EXPORT
58 char const*
const cmd);
73 BaseError(
unsigned int desc_code,
char const* error_type);
78 {
return desc_code_; }
81 {
return error_type_; }
83 #if __cplusplus >= 201103L
84 virtual const char* what()
const throw();
86 virtual const char* what() throw();
174 unsigned int baud()
const throw()
177 #if __cplusplus >= 201103L
178 virtual const char* what()
const throw();
180 virtual const char* what() throw();
262 ArgError(
unsigned int desc_code,
char const* error_type)
366 calculated_(calculated)
370 calculated_(rhs.calculated())
374 {
return expected_; }
377 {
return calculated_; }
379 #if __cplusplus >= 201103L
380 virtual const char* what()
const throw();
382 virtual const char* what() throw();
423 virtual char const*
const line()
const throw()
426 #if __cplusplus >= 201103L
427 virtual const char* what()
const throw();
429 virtual const char* what() throw();
446 ParseError(
char const*
const line,
char const*
const type);
449 virtual char const*
const line()
const throw()
452 virtual char const*
const type()
const throw()
455 #if __cplusplus >= 201103L
456 virtual const char* what()
const throw();
458 virtual const char* what() throw();
490 error_[0] = error[0]; error_[1] = error[1];
491 cmd_[0] = cmd[0]; cmd_[1] = cmd[1];
510 #if __cplusplus >= 201103L
511 virtual const char* what()
const throw();
513 virtual const char* what() throw();
534 error_(error), cmd_(cmd)
549 #if __cplusplus >= 201103L
550 virtual const char* what()
const throw();
552 virtual const char* what() throw();
574 cmd_[0] = cmd[0]; cmd_[1] = cmd[1];
575 echo_[0] = echo[0]; echo_[1] = echo[1];
594 #if __cplusplus >= 201103L
595 virtual const char* what()
const throw();
597 virtual const char* what() throw();
618 cmd_[0] = cmd[0]; cmd_[1] = cmd[1];
631 #if __cplusplus >= 201103L
632 virtual const char* what()
const throw();
634 virtual const char* what() throw();
653 num_(num), line_length_(line_length)
657 line_length_(rhs.line_length())
660 virtual int num()
const throw()
664 {
return line_length_; }
666 #if __cplusplus >= 201103L
667 virtual const char* what()
const throw();
669 virtual const char* what() throw();
690 length_(length), expected_(expected)
694 expected_(rhs.expected())
701 {
return expected_; }
703 #if __cplusplus >= 201103L
704 virtual const char* what()
const throw();
706 virtual const char* what() throw();
720 #endif // HOKUYO_ERRORS_H__
ProtocolError(unsigned int desc_code)
Protocol error constructor.
RuntimeError(unsigned int desc_code, char const *error_type)
virtual char const *const error_code() const
Get the two-byte error code as a non-null-terminated array.
Incorrect line length error.
unsigned int baud() const
BaudrateError(unsigned int baud)
Baud rate error constructor.
unsigned int baud_
Baud rate that caused the error.
ArgError(unsigned int desc_code)
Argument error constructor.
int line_length_
Length of the line.
virtual int length() const
std::stringstream ss
Formatted description of the error.
unsigned int desc_code_
Description code for use with the error string table.
ParamEchoError(char const *const cmd)
Parameter echo error constructor.
int length_
The received line length.
virtual char cmd_code() const
Get the one-byte command code.
Insufficient bytes to calculate checksum error.
CommandEchoError(char const *const cmd, char const *const echo)
Command echo error constructor.
ProtocolError(unsigned int desc_code, char const *error_type)
Unknown SCIP version error class.
Bad firmware error class.
LogicError(unsigned int desc_code, char const *error_type)
LineLengthError(LineLengthError const &rhs)
Scip1ResponseError(char error, char cmd)
Response error constructor.
char cmd_
Command that triggered the error, from SCIP2 (two bytes).
Bad response error (SCIP1 version)
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
LogicError(unsigned int desc_code)
Logic error constructor.
std::string desc_code_to_string(unsigned int code)
Translates an error description code into a string.
#define HOKUYOAIST_EXPORT
ReadError(unsigned int desc_code)
Read error constructor.
ResponseError(ResponseError const &rhs)
InsufficientBytesError(int num, int line_length)
Insufficient bytes error constructor.
No destination error class.
ChecksumError(int expected, int calculated)
Checksum error constructor.
virtual int calculated() const
UnsupportedError(unsigned int desc_code)
Unsupported error constructor.
SCIP version error class.
ChecksumError(ChecksumError const &rhs)
virtual char const * error_type() const
virtual char error_code() const
Get the one-byte error code.
int calculated_
Calculated checksum value.
CommandEchoError(CommandEchoError const &rhs)
virtual char const *const line() const
int expected_
Expected checksum value.
virtual int expected() const
virtual char const *const type() const
InsufficientBytesError(InsufficientBytesError const &rhs)
Bad argument error class.
ResponseError(char const *const error, char const *const cmd)
Response error constructor.
Invalid motor speed error class.
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
RuntimeError(unsigned int desc_code)
Runtime error constructor.
WriteError(unsigned int desc_code)
Write error constructor.
virtual int expected() const
Unsupported feature error class.
UnknownScipVersionError()
Bad response error - may be sent in response to any command.
virtual unsigned int desc_code() const
int expected_
The expected line length.
BaudrateError(BaudrateError const &rhs)
Bad start step error class.
std::string scip2_error_to_string(char const *const error, char const *const cmd)
Translates a SCIP2 error code into a string.
Not a serial connection error class.
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
LineLengthError(int length, int expected)
Line length error constructor.
Incorrect number of data sets read error.
Misplaced line feed error.
virtual char const *const cmd_echo() const
Get the two-byte command echo as a non-null-terminated array.
char error_
Error code as defined in SCIP2 (two bytes).
Bad end step error class.
Missing firmware specification error.
virtual char const *const line() const
virtual int line_length() const
int num_
Number of bytes available.
Scip1ResponseError(Scip1ResponseError const &rhs)
ParamEchoError(ParamEchoError const &rhs)
ArgError(unsigned int desc_code, char const *error_type)