00001 00020 #ifndef RTC_DATAPORTSTATUS_H 00021 #define RTC_DATAPORTSTATUS_H 00022 00023 namespace RTC 00024 { 00025 class DataPortStatus 00026 { 00027 public: 00028 enum Enum 00029 { 00030 PORT_OK = 0, 00031 PORT_ERROR, 00032 BUFFER_FULL, 00033 BUFFER_EMPTY, 00034 BUFFER_TIMEOUT, 00035 SEND_FULL, 00036 SEND_TIMEOUT, 00037 RECV_EMPTY, 00038 RECV_TIMEOUT, 00039 INVALID_ARGS, 00040 PRECONDITION_NOT_MET, 00041 CONNECTION_LOST, 00042 UNKNOWN_ERROR 00043 }; 00044 00045 static const char* toString(DataPortStatus::Enum status) 00046 { 00047 const char* str[] = { 00048 "PORT_OK", 00049 "PORT_ERROR", 00050 "BUFFER_FULL", 00051 "BUFFER_EMPTY", 00052 "BUFFER_TIMEOUT", 00053 "SEND_FULL", 00054 "SEND_TIMEOUT", 00055 "RECV_EMPTY", 00056 "RECV_TIMEOUT", 00057 "INVALID_ARGS", 00058 "PRECONDITION_NOT_MET", 00059 "CONNECTION_LOST", 00060 "UNKNOWN_ERROR" 00061 }; 00062 return str[status]; 00063 } 00064 }; 00065 }; 00066 00067 #define DATAPORTSTATUS_ENUM \ 00068 typedef ::RTC::DataPortStatus::Enum ReturnCode; \ 00069 using ::RTC::DataPortStatus::PORT_OK; \ 00070 using ::RTC::DataPortStatus::PORT_ERROR; \ 00071 using ::RTC::DataPortStatus::BUFFER_FULL; \ 00072 using ::RTC::DataPortStatus::BUFFER_EMPTY; \ 00073 using ::RTC::DataPortStatus::BUFFER_TIMEOUT; \ 00074 using ::RTC::DataPortStatus::SEND_FULL; \ 00075 using ::RTC::DataPortStatus::SEND_TIMEOUT; \ 00076 using ::RTC::DataPortStatus::RECV_EMPTY; \ 00077 using ::RTC::DataPortStatus::RECV_TIMEOUT; \ 00078 using ::RTC::DataPortStatus::INVALID_ARGS; \ 00079 using ::RTC::DataPortStatus::PRECONDITION_NOT_MET; \ 00080 using ::RTC::DataPortStatus::CONNECTION_LOST; \ 00081 using ::RTC::DataPortStatus::UNKNOWN_ERROR; 00082 00083 00084 #endif // RTC_DATAPORTSTATUS_H