Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _CDLCOMEXCEPTIONS_H_
00014 #define _CDLCOMEXCEPTIONS_H_
00015
00016 #include "common/exception.h"
00017 #include <string>
00018
00020 enum{
00021 ERR_FAILED = -1,
00022 ERR_INVALID_ARGUMENT = -2,
00023 ERR_STATE_MISMATCH = -3,
00024 ERR_TYPE_MISMATCH = -4,
00025 ERR_RANGE_MISMATCH = -5,
00026 ERR_AXIS_HEARTBEAT = -6,
00027 ERR_AXIS_OPERATIONAL = -7,
00028 ERR_AXIS_MOVE = -8,
00029 ERR_AXIS_MOVE_POLY = -9,
00030 ERR_AXIS_COLLISION = -10,
00031 ERR_AXIS_ANY = -11,
00032 ERR_CRC = -12,
00033 ERR_PERIPHERAL = -13,
00034 ERR_MESSAGE = 192,
00035 ERR_MESSAGE_STRING = 193
00036 };
00037
00042
00047 class CannotOpenPortException : public Exception {
00048 public:
00049 CannotOpenPortException(const std::string & port, const std::string os_msg) throw ():
00050 Exception("Cannot open port '" + port + "': " + os_msg, -10) {}
00051 };
00052
00056 class CannotGetSetPortAttributesException : public Exception {
00057 public:
00058 CannotGetSetPortAttributesException(const std::string & port) throw ():
00059 Exception("Cannot get/set attributes on '" + port + "'", -11) {}
00060 };
00061
00065 class PortNotOpenException : public Exception {
00066 public:
00067 PortNotOpenException(const std::string & port) throw ():
00068 Exception("Port '" + port + "' not open", -12) {}
00069 };
00070
00075 class DeviceReadException : public Exception {
00076 public:
00077 DeviceReadException(const std::string & port, const std::string os_msg) throw ():
00078 Exception("Read failure on port '" + port + "': " + os_msg, -13) {}
00079 };
00080
00085 class DeviceWriteException : public Exception {
00086 public:
00087 DeviceWriteException(const std::string & port, const std::string os_msg) throw ():
00088 Exception("Write failure on port '" + port + "': " + os_msg, -14) {}
00089 };
00090
00094 class ReadWriteNotCompleteException : public Exception {
00095 public:
00096 ReadWriteNotCompleteException(const std::string & errstr, const int error_number) throw ():
00097 Exception(errstr, error_number) {}
00098 };
00099
00103 class WriteNotCompleteException : public ReadWriteNotCompleteException {
00104 public:
00105 WriteNotCompleteException(const std::string & port) throw ():
00106 ReadWriteNotCompleteException("Cannot write all date to '" + port + "'", -15) {}
00107 };
00108
00112 class ReadNotCompleteException : public ReadWriteNotCompleteException {
00113 public:
00114 ReadNotCompleteException(const std::string & port) throw ():
00115 ReadWriteNotCompleteException("Cannot read all data from '" + port + "'", -16) {}
00116 };
00117
00121 class ErrorException : public Exception {
00122 public:
00123 ErrorException(const std::string &error) throw ():
00124 Exception(error, -20) {}
00125 };
00126
00130
00131 #endif