HDLC-Daemon
BaudRate.h
Go to the documentation of this file.
1 
24 #ifndef BAUD_RATE_H
25 #define BAUD_RATE_H
26 
32 class BaudRate {
33 public:
38  BaudRate(): m_CurrentBaudrateIndex(0) {}
39 
44  unsigned int GetBaudRate() const {
45  switch (m_CurrentBaudrateIndex) {
46  case 0:
47  return 9600;
48  default:
49  case 1:
50  return 115200;
51  } // switch
52  }
53 
58  void ToggleBaudRate() {
59  switch (m_CurrentBaudrateIndex) {
60  case 0:
61  m_CurrentBaudrateIndex = 1;
62  break;
63  default:
64  case 1:
65  m_CurrentBaudrateIndex = 0;
66  break;
67  } // switch
68  }
69 
70 private:
71  unsigned int m_CurrentBaudrateIndex;
72 };
73 
74 #endif // BAUD_RATE_H
BaudRate()
The constructor of BaudRate objects.
Definition: BaudRate.h:38
void ToggleBaudRate()
Iterate to another baud rate setting.
Definition: BaudRate.h:58
unsigned int GetBaudRate() const
Deliver the currently used baud rate setting.
Definition: BaudRate.h:44
Class BaudRate.
Definition: BaudRate.h:32