SerialController.h
Go to the documentation of this file.
//-----------------------------------------------------------------------------
//
// SerialController.h
//
// Cross-platform serial port handler
//
// Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
//
// SOFTWARE NOTICE AND LICENSE
//
// This file is part of OpenZWave.
//
// OpenZWave is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// OpenZWave is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenZWave. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
#ifndef _SerialController_H
#define _SerialController_H
#include <string>
#include "Defs.h"
#include "platform/Controller.h"
namespace OpenZWave
{
class Driver;
class Msg;
class SerialControllerImpl;
class SerialController: public Controller
{
friend class SerialControllerImpl;
public:
enum Parity
{
Parity_None = 0,
Parity_Odd,
Parity_Even,
Parity_Mark,
Parity_Space
};
enum StopBits
{
StopBits_One = 0,
StopBits_OneAndAHalf = 1,
StopBits_Two = 2
};
SerialController();
virtual ~SerialController();
bool SetBaud( uint32 const _baud );
bool SetParity( Parity const _parity );
bool SetStopBits( StopBits const _stopBits );
bool Open( string const& _SerialControllerName );
bool Close();
uint32 Write( uint8* _buffer, uint32 _length );
private:
uint32 m_baud;
SerialController::Parity m_parity;
SerialController::StopBits m_stopBits;
string m_serialControllerName;
SerialControllerImpl* m_pImpl; // Pointer to an object that encapsulates the platform-specific implementation of the serial port.
bool m_bOpen;
};
} // namespace OpenZWave
#endif //_SerialController_H
OpenZWave::SerialController::Open
bool Open(string const &_SerialControllerName)
Definition: SerialController.cpp:133
OpenZWave::SerialController::StopBits_One
Definition: SerialController.h:57
OpenZWave
Definition: Bitfield.h:34
OpenZWave::SerialController::Parity_None
Definition: SerialController.h:48
OpenZWave::SerialController::StopBits
StopBits
Definition: SerialController.h:55
OpenZWave::SerialController::SerialController
SerialController()
Definition: SerialController.cpp:50
OpenZWave::Controller
Definition: Controller.h:41
OpenZWave::SerialController::StopBits_Two
Definition: SerialController.h:59
OpenZWave::SerialController::Parity_Even
Definition: SerialController.h:50
Defs.h
OpenZWave::SerialController::Parity_Mark
Definition: SerialController.h:51
OpenZWave::SerialControllerImpl
Definition: windows/SerialControllerImpl.h:38
OpenZWave::SerialController::Parity
Parity
Definition: SerialController.h:46
OpenZWave::SerialController
Definition: SerialController.h:41
uint32
unsigned int uint32
Definition: Defs.h:80
OpenZWave::SerialController::Parity_Odd
Definition: SerialController.h:49
OpenZWave::SerialController::~SerialController
virtual ~SerialController()
Definition: SerialController.cpp:65
OpenZWave::SerialController::Write
uint32 Write(uint8 *_buffer, uint32 _length)
Definition: SerialController.cpp:170
OpenZWave::SerialController::SetBaud
bool SetBaud(uint32 const _baud)
Definition: SerialController.cpp:77
OpenZWave::SerialController::Close
bool Close()
Definition: SerialController.cpp:152
OpenZWave::SerialController::SetParity
bool SetParity(Parity const _parity)
Definition: SerialController.cpp:96
Controller.h
OpenZWave::SerialController::StopBits_OneAndAHalf
Definition: SerialController.h:58
OpenZWave::SerialController::SetStopBits
bool SetStopBits(StopBits const _stopBits)
Definition: SerialController.cpp:115
OpenZWave::SerialController::Parity_Space
Definition: SerialController.h:52
uint8
unsigned char uint8
Definition: Defs.h:74