• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

port_settings_t.h

Go to the documentation of this file.
00001 /* Copyright (c) 2010, Cedrus Corporation
00002  * All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are
00006  * met:
00007  *
00008  * Redistributions of source code must retain the above copyright notice,
00009  * this list of conditions and the following disclaimer.  
00010  *
00011  * Redistributions in binary form must reproduce the above copyright
00012  * notice, this list of conditions and the following disclaimer in the
00013  * documentation and/or other materials provided with the distribution.
00014  *
00015  * Neither the name of Cedrus Corporation nor the names of its
00016  * contributors may be used to endorse or promote products derived from
00017  * this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00023  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00025  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00026  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00027  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00029  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef PORT_SETTINGS_T_H
00033 #define PORT_SETTINGS_T_H
00034 
00035 #include <string>
00036 
00037 namespace cedrus
00038 {
00046     class port_settings_t
00047     {
00048     public:
00049         enum bitparity
00050         {
00051             BITPARITY_NONE = 0,
00052             BITPARITY_ODD  = 1,
00053             BITPARITY_EVEN = 2
00054         };
00055 
00056         enum stopbits
00057         {
00058             STOP_BIT_1 = 0,
00059             STOP_BIT_2 = 1
00060         };
00061 
00062         enum bytesize
00063         {
00064             BYTESIZE_6 = 6,
00065             BYTESIZE_7 = 7,
00066             BYTESIZE_8 = 8,
00067 
00068             FIRST_BYTESIZE = BYTESIZE_6
00069         };
00070 
00071         enum handshaking
00072         {
00073             HANDSHAKE_NONE     = 0,
00074             HANDSHAKE_XON_XOFF = 1,
00075             HANDSHAKE_HARDWARE = 2,
00076         };
00077         port_settings_t() {}
00078 
00079         port_settings_t(
00080             const std::wstring &port_name,
00081             int port_speed,
00082             bytesize byte_size = BYTESIZE_8,
00083             bitparity bit_parity = BITPARITY_NONE,
00084             stopbits stop_bits = STOP_BIT_1);
00085 
00086         virtual ~port_settings_t(void);
00087 
00088         const std::wstring& port_name() const;
00089         
00090         int baud_rate() const;
00091         void baud_rate(int speed);
00092 
00093         bitparity bit_parity() const;
00094         void bit_parity(bitparity parity);
00095 
00096         bytesize byte_size() const;
00097         void byte_size(bytesize size);
00098 
00099         handshaking handshake() const;
00100         void handshake(handshaking shake);
00101 
00102         stopbits stop_bits() const;
00103         void stop_bits(stopbits bits);
00104         
00105     private:
00106         std::wstring port_name_;
00107         int baud_rate_;
00108         bytesize byte_size_;
00109         bitparity bit_parity_;
00110         stopbits stop_bits_;
00111         handshaking handshaking_;
00112     };
00113 } // namespace cedrus
00114 
00115 #endif // PORT_SETTINGS_T_H

Generated on Wed Dec 15 2010 13:17:12 for XID device library by  doxygen 1.7.2