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()
418 virtual char const*
const line()
const throw()
421 virtual char const*
const type()
const throw()
553 virtual int num()
const throw()
557 {
return line_length_; }
582 {
return expected_; }
Bad argument error class.
ArgError(unsigned int desc_code, char const *error_type)
ArgError(unsigned int desc_code)
Argument error constructor.
BaseError(unsigned int desc_code, char const *error_type)
Hokuyo error constructor.
BaseError(BaseError const &rhs)
virtual unsigned int desc_code() const
virtual char const * error_type() const
virtual const char * what() const
BaudrateError(unsigned int baud)
Baud rate error constructor.
unsigned int baud_
Baud rate that caused the error.
unsigned int baud() const
BaudrateError(BaudrateError const &rhs)
int calculated_
Calculated checksum value.
virtual int expected() const
ChecksumError(ChecksumError const &rhs)
ChecksumError(int expected, int calculated)
Checksum error constructor.
int expected_
Expected checksum value.
virtual int calculated() const
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
CommandEchoError(char const *const cmd, char const *const echo)
Command echo error constructor.
CommandEchoError(CommandEchoError const &rhs)
virtual char const *const cmd_echo() const
Get the two-byte command echo as a non-null-terminated array.
Incorrect number of data sets read error.
Bad end step error class.
Bad firmware error class.
Insufficient bytes to calculate checksum error.
InsufficientBytesError(InsufficientBytesError const &rhs)
int line_length_
Length of the line.
InsufficientBytesError(int num, int line_length)
Insufficient bytes error constructor.
int num_
Number of bytes available.
virtual int line_length() const
Incorrect line length error.
virtual int expected() const
int expected_
The expected line length.
int length_
The received line length.
virtual int length() const
LineLengthError(int length, int expected)
Line length error constructor.
LineLengthError(LineLengthError const &rhs)
LogicError(unsigned int desc_code, char const *error_type)
LogicError(unsigned int desc_code)
Logic error constructor.
Misplaced line feed error.
Missing firmware specification error.
Invalid motor speed error class.
No destination error class.
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.
ParamEchoError(char const *const cmd)
Parameter echo error constructor.
ParamEchoError(ParamEchoError const &rhs)
ParseError(ParseError const &rhs)
virtual char const *const type() const
virtual char const *const line() const
ParseError(char const *const line, char const *const type)
Parse error constructor.
ProtocolError(unsigned int desc_code, char const *error_type)
ProtocolError(unsigned int desc_code)
Protocol error constructor.
ReadError(unsigned int desc_code)
Read error constructor.
Bad response error - may be sent in response to any command.
virtual char const *const error_code() const
Get the two-byte error code as a non-null-terminated array.
ResponseError(ResponseError const &rhs)
ResponseError(char const *const error, char const *const cmd)
Response error constructor.
virtual char const *const cmd_code() const
Get the two-byte command code as a non-null-terminated array.
RuntimeError(unsigned int desc_code, char const *error_type)
RuntimeError(unsigned int desc_code)
Runtime error constructor.
Bad response error (SCIP1 version)
virtual char error_code() const
Get the one-byte error code.
char error_
Error code as defined in SCIP2 (two bytes).
char cmd_
Command that triggered the error, from SCIP2 (two bytes).
virtual char cmd_code() const
Get the one-byte command code.
Scip1ResponseError(char error, char cmd)
Response error constructor.
Scip1ResponseError(Scip1ResponseError const &rhs)
SCIP version error class.
Bad start step error class.
virtual char const *const line() const
UnknownLineError(UnknownLineError const &rhs)
UnknownLineError(char const *const line)
Unknown line error constructor.
Unknown SCIP version error class.
UnknownScipVersionError()
Unsupported feature error class.
UnsupportedError(unsigned int desc_code)
Unsupported error constructor.
WriteError(unsigned int desc_code)
Write error constructor.
#define HOKUYOAIST_EXPORT
std::string desc_code_to_string(unsigned int code)
Translates an error description code into a string.
std::string scip2_error_to_string(char const *const error, char const *const cmd)
Translates a SCIP2 error code into a string.