API
ttyErrors.cpp
Go to the documentation of this file.
1 /** \file ttyErrors.cpp
2  * \brief Error numbers for the tty utilities.
3  * \author Jared R. Males (jaredmales@gmail.com)
4  *
5  * \ingroup tty_files
6  */
7 
8 #include "ttyErrors.hpp"
9 
10 namespace MagAOX
11 {
12 namespace tty
13 {
14 
15 std::string ttyErrorString( int ec )
16 {
17  switch(ec)
18  {
19  case TTY_E_NOERROR:
20  return "TTY: success";
21  case TTY_E_TCGETATTR:
22  return "TTY: tcgetattr returned error";
23  case TTY_E_SETISPEED:
24  return "TTY: cfsetispeed returned error";
25  case TTY_E_SETOSPEED:
26  return "TTY: cfsetospeed returned error";
27  case TTY_E_TCSETATTR:
28  return "TTY: tcsetattr returned error";
30  return "TTY: the write poll timed out";
32  return "TTY: an error was returned by the write poll";
33  case TTY_E_ERRORONWRITE:
34  return "TTY: an error occurred writing to the file";
36  return "TTY: a timeout occurred during the write";
38  return "TTY: the read poll timed out";
40  return "TTY: an error was returned by the read poll";
41  case TTY_E_ERRORONREAD:
42  return "TTY: an error occurred reading from the file";
44  return "TTY: a timeout occurred during the read";
45  case TTY_E_NODEVNAMES:
46  return "TTY: no device names found in sys";
48  return "TTY: initializing libudev failed";
49  case TTY_E_DEVNOTFOUND:
50  return "TTY: no matching device found";
51  case TTY_E_BADBAUDRATE:
52  return "TTY: bad baud rate specified";
53 
54  case TELNET_E_GETADDR:
55  return "TTY: getaddr failed";
56  case TELNET_E_SOCKET:
57  return "TTY: socket creation failed";
58  case TELNET_E_BIND:
59  return "TTY: socket bind failed";
60  case TELNET_E_CONNECT:
61  return "TTY: socket connect failed";
63  return "TTY: failed to init telnet_t structure";
64  case TELNET_E_EHERROR:
65  return "TTY: error set in telnet event handler";
67  return "TTY: login timed out";
68  default:
69  return "TTY: unknown error code";
70  };
71 }
72 
73 } //namespace tty
74 } //namespace MagAOX
75 
76 
std::string ttyErrorString(int ec)
Get a text explanation of a TTY_E_ error code.
Definition: ttyErrors.cpp:15
Definition: dm.hpp:24
Error numbers for the tty utilities.
#define TTY_E_TCGETATTR
Definition: ttyErrors.hpp:16
#define TTY_E_SETOSPEED
Definition: ttyErrors.hpp:18
#define TTY_E_UDEVNEWFAILED
Definition: ttyErrors.hpp:29
#define TTY_E_TIMEOUTONREAD
Definition: ttyErrors.hpp:27
#define TELNET_E_BIND
Definition: ttyErrors.hpp:36
#define TTY_E_SETISPEED
Definition: ttyErrors.hpp:17
#define TTY_E_TIMEOUTONREADPOLL
Definition: ttyErrors.hpp:24
#define TTY_E_ERRORONWRITE
Definition: ttyErrors.hpp:22
#define TTY_E_ERRORONWRITEPOLL
Definition: ttyErrors.hpp:21
#define TTY_E_TCSETATTR
Definition: ttyErrors.hpp:19
#define TTY_E_ERRORONREADPOLL
Definition: ttyErrors.hpp:25
#define TTY_E_ERRORONREAD
Definition: ttyErrors.hpp:26
#define TTY_E_NODEVNAMES
Definition: ttyErrors.hpp:28
#define TTY_E_BADBAUDRATE
Definition: ttyErrors.hpp:31
#define TELNET_E_TELNETINIT
Definition: ttyErrors.hpp:38
#define TTY_E_DEVNOTFOUND
Definition: ttyErrors.hpp:30
#define TELNET_E_GETADDR
Definition: ttyErrors.hpp:34
#define TTY_E_TIMEOUTONWRITEPOLL
Definition: ttyErrors.hpp:20
#define TELNET_E_LOGINTIMEOUT
Definition: ttyErrors.hpp:40
#define TTY_E_TIMEOUTONWRITE
Definition: ttyErrors.hpp:23
#define TELNET_E_EHERROR
Definition: ttyErrors.hpp:39
#define TTY_E_NOERROR
Definition: ttyErrors.hpp:15
#define TELNET_E_CONNECT
Definition: ttyErrors.hpp:37
#define TELNET_E_SOCKET
Definition: ttyErrors.hpp:35