X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fserial.cpp;h=ec6a198bee3ac0d6d3568a9c218bac0df0f7aa4f;hp=1aedd410eefa4e2e0e4d40638fefdc1ad4e87b81;hb=b97d4e9f86e90254ab9edef7ee62a910f6333c78;hpb=48926b1ed17db1fed149f89140ea99f6d968adc2 diff --git a/source/serial.cpp b/source/serial.cpp index 1aedd41..ec6a198 100644 --- a/source/serial.cpp +++ b/source/serial.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspio -Copyright © 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifdef WIN32 #include #else @@ -212,6 +205,15 @@ Serial::~Serial() close(); } +void Serial::close() +{ +#ifdef WIN32 + CloseHandle(handle); +#else + ::close(handle); +#endif +} + void Serial::set_block(bool b) { if(b) @@ -279,24 +281,6 @@ void Serial::set_parameters(const string ¶ms) set_state(handle, state); } -Handle Serial::get_event_handle() -{ -#ifdef WIN32 - throw Exception("Serial port events not supported on win32 yet"); -#else - return handle; -#endif -} - -void Serial::close() -{ -#ifdef WIN32 - CloseHandle(handle); -#else - ::close(handle); -#endif -} - unsigned Serial::do_write(const char *buf, unsigned size) { if(size==0) @@ -343,5 +327,14 @@ unsigned Serial::do_read(char *buf, unsigned size) return ret; } +Handle Serial::get_event_handle() +{ +#ifdef WIN32 + throw Exception("Serial port events not supported on win32 yet"); +#else + return handle; +#endif +} + } // namespace IO } // namespace Msp