OpenZWave Library  1.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SerialController.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // SerialController.h
4 //
5 // Cross-platform serial port handler
6 //
7 // Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
8 //
9 // SOFTWARE NOTICE AND LICENSE
10 //
11 // This file is part of OpenZWave.
12 //
13 // OpenZWave is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU Lesser General Public License as published
15 // by the Free Software Foundation, either version 3 of the License,
16 // or (at your option) any later version.
17 //
18 // OpenZWave is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public License
24 // along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
25 //
26 //-----------------------------------------------------------------------------
27 
28 #ifndef _SerialController_H
29 #define _SerialController_H
30 
31 #include <string>
32 #include "Defs.h"
33 #include "platform/Controller.h"
34 
35 namespace OpenZWave
36 {
37  class Driver;
38  class Msg;
39  class SerialControllerImpl;
40 
42  {
43  friend class SerialControllerImpl;
44 
45  public:
46  enum Parity
47  {
53  };
54 
55  enum StopBits
56  {
60  };
61 
67 
72  virtual ~SerialController();
73 
80  bool SetBaud( uint32 const _baud );
81 
88  bool SetParity( Parity const _parity );
89 
96  bool SetStopBits( StopBits const _stopBits );
97 
105  bool Open( string const& _SerialControllerName );
106 
113  bool Close();
114 
123  uint32 Write( uint8* _buffer, uint32 _length );
124 
125  private:
126  uint32 m_baud;
127  SerialController::Parity m_parity;
128  SerialController::StopBits m_stopBits;
129  string m_serialControllerName;
130 
131  SerialControllerImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the serial port.
132  bool m_bOpen;
133  };
134 
135 } // namespace OpenZWave
136 
137 #endif //_SerialController_H
138 
bool Open(string const &_SerialControllerName)
Definition: SerialController.cpp:131
Definition: SerialController.h:57
Definition: Bitfield.h:34
Definition: SerialController.h:48
StopBits
Definition: SerialController.h:55
SerialController()
Definition: SerialController.cpp:48
Definition: Controller.h:41
Definition: SerialController.h:59
Definition: SerialController.h:50
Definition: SerialController.h:51
Definition: SerialControllerImpl.h:38
Parity
Definition: SerialController.h:46
Definition: SerialController.h:41
unsigned int uint32
Definition: Defs.h:69
Definition: SerialController.h:49
virtual ~SerialController()
Definition: SerialController.cpp:63
uint32 Write(uint8 *_buffer, uint32 _length)
Definition: SerialController.cpp:168
bool SetBaud(uint32 const _baud)
Definition: SerialController.cpp:75
bool Close()
Definition: SerialController.cpp:150
bool SetParity(Parity const _parity)
Definition: SerialController.cpp:94
Definition: SerialController.h:58
bool SetStopBits(StopBits const _stopBits)
Definition: SerialController.cpp:113
Definition: SerialController.h:52
unsigned char uint8
Definition: Defs.h:63