From c85dcd7102fca2cde3837f36e6f27346a4564e27 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 23 Oct 2015 12:26:21 +0300 Subject: Windows: Rename variables which is the system handles Now the system handles have the 'h' prefix (e.g. hService), not to confuse with the others variables which contains the 'Handle' suffix (e.g. with the serviceHandle and so on). Change-Id: I3b79c5323bce043c93326edf6d660ea4bde8522a Reviewed-by: Alex Blasche --- src/bluetooth/qlowenergycontroller_win.cpp | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/bluetooth/qlowenergycontroller_win.cpp') diff --git a/src/bluetooth/qlowenergycontroller_win.cpp b/src/bluetooth/qlowenergycontroller_win.cpp index f85b507f..ee488e6f 100644 --- a/src/bluetooth/qlowenergycontroller_win.cpp +++ b/src/bluetooth/qlowenergycontroller_win.cpp @@ -145,7 +145,7 @@ static HANDLE openSystemDevice( shareMode |= FILE_SHARE_WRITE; } - const HANDLE serviceHandle = ::CreateFile( + const HANDLE hDevice = ::CreateFile( reinterpret_cast(systemPath.utf16()), desiredAccess, shareMode, @@ -154,9 +154,9 @@ static HANDLE openSystemDevice( 0, NULL); - *systemErrorCode = (INVALID_HANDLE_VALUE == serviceHandle) + *systemErrorCode = (INVALID_HANDLE_VALUE == hDevice) ? ::GetLastError() : NO_ERROR; - return serviceHandle; + return hDevice; } static HANDLE openSystemService( @@ -177,14 +177,14 @@ static HANDLE openSystemService( return hService; } -static void closeSystemDevice(HANDLE deviceHandle) +static void closeSystemDevice(HANDLE hDevice) { - if (deviceHandle && deviceHandle != INVALID_HANDLE_VALUE) - ::CloseHandle(deviceHandle); + if (hDevice && hDevice != INVALID_HANDLE_VALUE) + ::CloseHandle(hDevice); } static QVector enumeratePrimaryGattServices( - HANDLE deviceHandle, int *systemErrorCode) + HANDLE hDevice, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; @@ -195,7 +195,7 @@ static QVector enumeratePrimaryGattServices( USHORT servicesCount = 0; forever { const HRESULT hr = ::BluetoothGATTGetServices( - deviceHandle, + hDevice, servicesCount, foundServices.isEmpty() ? NULL : &foundServices[0], &servicesCount, @@ -214,7 +214,7 @@ static QVector enumeratePrimaryGattServices( } static QVector enumerateGattCharacteristics( - HANDLE serviceHandle, PBTH_LE_GATT_SERVICE gattService, int *systemErrorCode) + HANDLE hService, PBTH_LE_GATT_SERVICE gattService, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; @@ -225,7 +225,7 @@ static QVector enumerateGattCharacteristics( USHORT characteristicsCount = 0; forever { const HRESULT hr = ::BluetoothGATTGetCharacteristics( - serviceHandle, + hService, gattService, characteristicsCount, foundCharacteristics.isEmpty() ? NULL : &foundCharacteristics[0], @@ -245,7 +245,7 @@ static QVector enumerateGattCharacteristics( } static QByteArray getGattCharacteristicValue( - HANDLE serviceHandle, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, int *systemErrorCode) + HANDLE hService, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; @@ -256,7 +256,7 @@ static QByteArray getGattCharacteristicValue( USHORT valueBufferSize = 0; forever { const HRESULT hr = ::BluetoothGATTGetCharacteristicValue( - serviceHandle, + hService, gattCharacteristic, valueBufferSize, valueBuffer.isEmpty() ? NULL : reinterpret_cast(valueBuffer.data()), @@ -279,7 +279,7 @@ static QByteArray getGattCharacteristicValue( } static QVector enumerateGattDescriptors( - HANDLE serviceHandle, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, int *systemErrorCode) + HANDLE hService, PBTH_LE_GATT_CHARACTERISTIC gattCharacteristic, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; @@ -290,7 +290,7 @@ static QVector enumerateGattDescriptors( USHORT descriptorsCount = 0; forever { const HRESULT hr = ::BluetoothGATTGetDescriptors( - serviceHandle, + hService, gattCharacteristic, descriptorsCount, foundDescriptors.isEmpty() ? NULL : &foundDescriptors[0], @@ -310,7 +310,7 @@ static QVector enumerateGattDescriptors( } static QByteArray getGattDescriptorValue( - HANDLE serviceHandle, PBTH_LE_GATT_DESCRIPTOR gattDescriptor, int *systemErrorCode) + HANDLE hService, PBTH_LE_GATT_DESCRIPTOR gattDescriptor, int *systemErrorCode) { if (!gattFunctionsResolved) { *systemErrorCode = ERROR_NOT_SUPPORTED; @@ -321,7 +321,7 @@ static QByteArray getGattDescriptorValue( USHORT valueBufferSize = 0; forever { const HRESULT hr = ::BluetoothGATTGetDescriptorValue( - serviceHandle, + hService, gattDescriptor, valueBufferSize, valueBuffer.isEmpty() ? NULL : reinterpret_cast(valueBuffer.data()), @@ -417,7 +417,7 @@ void QLowEnergyControllerPrivate::discoverServices() { int systemErrorCode = NO_ERROR; - const HANDLE deviceHandle = openSystemDevice( + const HANDLE hDevice = openSystemDevice( deviceSystemPath, QIODevice::ReadOnly, &systemErrorCode); if (systemErrorCode != NO_ERROR) { @@ -428,9 +428,9 @@ void QLowEnergyControllerPrivate::discoverServices() } const QVector foundServices = - enumeratePrimaryGattServices(deviceHandle, &systemErrorCode); + enumeratePrimaryGattServices(hDevice, &systemErrorCode); - closeSystemDevice(deviceHandle); + closeSystemDevice(hDevice); if (systemErrorCode != NO_ERROR) { qCWarning(QT_BT_WINDOWS) << qt_error_string(systemErrorCode); -- cgit v1.2.3