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 virtual const char* what()
const throw();
87 unsigned int desc_code_;
90 std::
string error_str_;
167 unsigned int baud()
const throw()
249 ArgError(
unsigned int desc_code,
char const* error_type)
355 {
return expected_; }
358 {
return calculated_; }
398 virtual char const*
const line()
const throw()
415 ParseError(
char const*
const line,
char const*
const type);
418 virtual char const*
const line()
const throw()
421 virtual char const*
const type()
const throw()
450 ResponseError(
char const*
const error,
char const*
const cmd);
553 virtual int num()
const throw()
557 {
return line_length_; }
582 {
return expected_; }
595 #endif // HOKUYO_ERRORS_H__
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
ProtocolError(unsigned int desc_code)
Protocol error constructor.
virtual int line_length() const
RuntimeError(unsigned int desc_code, char const *error_type)
Incorrect line length error.
unsigned int baud_
Baud rate that caused the error.
virtual char const *const cmd_echo() const
Get the two-byte command echo as a non-null-terminated array.
ArgError(unsigned int desc_code)
Argument error constructor.
int line_length_
Length of the line.
virtual unsigned int desc_code() const
virtual char const *const line() const
int length_
The received line length.
Insufficient bytes to calculate checksum error.
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)
char cmd_
Command that triggered the error, from SCIP2 (two bytes).
Bad response error (SCIP1 version)
virtual char const *const line() const
LogicError(unsigned int desc_code)
Logic error constructor.
virtual int length() const
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.
No destination error class.
virtual char const *const error_code() const
Get the two-byte error code as a non-null-terminated array.
UnsupportedError(unsigned int desc_code)
Unsupported error constructor.
virtual char cmd_code() const
Get the one-byte command code.
SCIP version error class.
int calculated_
Calculated checksum value.
int expected_
Expected checksum value.
Bad argument error class.
virtual int calculated() const
Invalid motor speed error class.
RuntimeError(unsigned int desc_code)
Runtime error constructor.
virtual int expected() const
WriteError(unsigned int desc_code)
Write error constructor.
Unsupported feature error class.
UnknownScipVersionError()
Bad response error - may be sent in response to any command.
int expected_
The expected line length.
Bad start step error class.
virtual char error_code() const
Get the one-byte error code.
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
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.
Incorrect number of data sets read error.
Misplaced line feed error.
char error_
Error code as defined in SCIP2 (two bytes).
Bad end step error class.
Missing firmware specification error.
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
virtual char const * error_type() const
virtual char const *const type() const
int num_
Number of bytes available.
virtual int expected() const
unsigned int baud() const
ArgError(unsigned int desc_code, char const *error_type)