X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fserial.cpp;h=ec6a198bee3ac0d6d3568a9c218bac0df0f7aa4f;hp=0a5eca05c5011f83301d86d763cf0da36883f571;hb=b97d4e9f86e90254ab9edef7ee62a910f6333c78;hpb=49c1f3c3ffdf318579a809f3f800442c0c76c818 diff --git a/source/serial.cpp b/source/serial.cpp index 0a5eca0..ec6a198 100644 --- a/source/serial.cpp +++ b/source/serial.cpp @@ -205,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) @@ -272,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) @@ -336,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