summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice_win.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-07-18 19:43:29 +0400
committerDenis Shienkov <denis.shienkov@gmail.com>2014-07-23 14:09:52 +0200
commitf71fda5702e6f1a76cdf52401af15599cca0735c (patch)
tree38f010bee801de85dd928cb6c882360d1a20436c /src/bluetooth/qbluetoothlocaldevice_win.cpp
parentc7f99c0200e8ddf68b432735dd690525a1c54b74 (diff)
Share the native private code of QBluetoothLocalDevice
It makes sense to share the private code for QBluetoothLocalDevice with other classes. For this purpose the private class QBluetoothLocalDevicePrivate inherits from the new QBluetoothLocalDevicePrivateData class. Now QBluetoothLocalDevicePrivateData can be used by QBluetoothServiceDiscoveryAgentPrivate too. It reduces code duplication then searching for the handle of a local device with a certain address. Change-Id: I0bea137b231553364af9658d7d2a409fef4f40bb Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_win.cpp')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice_win.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_win.cpp b/src/bluetooth/qbluetoothlocaldevice_win.cpp
index 0234a95a..476e5c65 100644
--- a/src/bluetooth/qbluetoothlocaldevice_win.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice_win.cpp
@@ -222,20 +222,20 @@ void QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
QBluetoothLocalDevicePrivate::QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q,
const QBluetoothAddress &address)
- : q_ptr(q)
- , deviceHandle(NULL)
+ : QBluetoothLocalDevicePrivateData(address)
+ , q_ptr(q)
{
- initialize(address);
}
-
QBluetoothLocalDevicePrivate::~QBluetoothLocalDevicePrivate()
{
if (isValid())
::CloseHandle(deviceHandle);
}
-void QBluetoothLocalDevicePrivate::initialize(const QBluetoothAddress &address)
+QBluetoothLocalDevicePrivateData::QBluetoothLocalDevicePrivateData(
+ const QBluetoothAddress &address)
+ : deviceHandle(INVALID_HANDLE_VALUE)
{
BLUETOOTH_FIND_RADIO_PARAMS findRadioParams;
::ZeroMemory(&findRadioParams, sizeof(findRadioParams));
@@ -282,9 +282,10 @@ void QBluetoothLocalDevicePrivate::initialize(const QBluetoothAddress &address)
qCWarning(QT_BT_WINDOWS) << qt_error_string(::GetLastError());
}
-bool QBluetoothLocalDevicePrivate::isValid() const
+bool QBluetoothLocalDevicePrivateData::isValid() const
{
return deviceHandle && (deviceHandle != INVALID_HANDLE_VALUE);
}
+
QT_END_NAMESPACE