summaryrefslogtreecommitdiff
path: root/src/serialport/qserialportinfo_wince.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-05-05 17:43:54 +0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-20 20:26:03 +0200
commitd27ce6689855550ff89c5f84d38bded3c3da1dca (patch)
treec2d39ee4dc2fe05a3e7313d92278dc54cb07c136 /src/serialport/qserialportinfo_wince.cpp
parentc74b2e2336662c9f0b5fb01b979b93ea0b99803d (diff)
downloadqtserialport-d27ce6689855550ff89c5f84d38bded3c3da1dca.tar.gz
Move the WinCE implementation into separate module
WinCE implementation was mixed a common code with the Win32 implementation that caused some problems with maintenance. More correct decision is moving a common code which was used in *win.cpp into *wince.cpp module without modifications. Now the Win32 and the WinCE implementation are independent from each other. Tested build with Qt5 on "win32-msvc2012" and then with Qt4 on "wincewm50pocket-msvc2008" configurations. Change-Id: I63f687468beffa9a75b534a4fbe536b854b12210 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialportinfo_wince.cpp')
-rw-r--r--src/serialport/qserialportinfo_wince.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/serialport/qserialportinfo_wince.cpp b/src/serialport/qserialportinfo_wince.cpp
index 27ecb28..a44b99d 100644
--- a/src/serialport/qserialportinfo_wince.cpp
+++ b/src/serialport/qserialportinfo_wince.cpp
@@ -43,7 +43,7 @@
#include "qserialportinfo.h"
#include "qserialportinfo_p.h"
-#include "qserialport_win_p.h"
+#include "qserialport_wince_p.h"
#include <QtCore/qstringlist.h>
@@ -128,4 +128,37 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
return serialPortInfoList;
}
+QList<qint32> QSerialPortInfo::standardBaudRates()
+{
+ return QSerialPortPrivate::standardBaudRates();
+}
+
+bool QSerialPortInfo::isBusy() const
+{
+ const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()),
+ GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+
+ if (handle == INVALID_HANDLE_VALUE) {
+ if (::GetLastError() == ERROR_ACCESS_DENIED)
+ return true;
+ } else {
+ ::CloseHandle(handle);
+ }
+ return false;
+}
+
+bool QSerialPortInfo::isValid() const
+{
+ const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()),
+ GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+
+ if (handle == INVALID_HANDLE_VALUE) {
+ if (::GetLastError() != ERROR_ACCESS_DENIED)
+ return false;
+ } else {
+ ::CloseHandle(handle);
+ }
+ return true;
+}
+
QT_END_NAMESPACE