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 #include "port_settings_t.h" 00033 00034 00035 cedrus::port_settings_t::port_settings_t( 00036 const std::wstring &port_name, 00037 int port_speed, 00038 bytesize byte_size, 00039 bitparity bit_parity, 00040 stopbits stop_bits) 00041 : port_name_(port_name), 00042 baud_rate_(port_speed), 00043 byte_size_(byte_size), 00044 bit_parity_(bit_parity), 00045 stop_bits_(stop_bits), 00046 handshaking_(HANDSHAKE_NONE) 00047 { 00048 } 00049 00050 00051 cedrus::port_settings_t::~port_settings_t(void) 00052 { 00053 } 00054 00055 const std::wstring& cedrus::port_settings_t::port_name() const 00056 { 00057 return port_name_; 00058 } 00059 00060 int cedrus::port_settings_t::baud_rate() const 00061 { 00062 return baud_rate_; 00063 } 00064 00065 void cedrus::port_settings_t::baud_rate(int speed) 00066 { 00067 baud_rate_ = speed; 00068 } 00069 00070 cedrus::port_settings_t::bitparity cedrus::port_settings_t::bit_parity() const 00071 { 00072 return bit_parity_; 00073 } 00074 00075 void cedrus::port_settings_t::bit_parity(bitparity parity) 00076 { 00077 bit_parity_ = parity; 00078 } 00079 00080 cedrus::port_settings_t::bytesize cedrus::port_settings_t::byte_size() const 00081 { 00082 return byte_size_; 00083 } 00084 00085 void cedrus::port_settings_t::byte_size(bytesize size) 00086 { 00087 byte_size_ = size; 00088 } 00089 00090 cedrus::port_settings_t::handshaking cedrus::port_settings_t::handshake() const 00091 { 00092 return handshaking_; 00093 } 00094 00095 void cedrus::port_settings_t::handshake(handshaking shake) 00096 { 00097 handshaking_ = shake; 00098 } 00099 00100 cedrus::port_settings_t::stopbits cedrus::port_settings_t::stop_bits() const 00101 { 00102 return stop_bits_; 00103 } 00104 00105 void cedrus::port_settings_t::stop_bits(stopbits bits) 00106 { 00107 stop_bits_ = bits; 00108 }