diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2013-09-19 20:27:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 13:36:35 +0200 |
commit | ac2edceb02a61c1d670312385b1d709417961799 (patch) | |
tree | 3195e852c3ba79890ca187fce2373d5fe9f76a99 /src/imports | |
parent | 559c648e41a5a3b33127fd3a786934bff7ecf828 (diff) |
Refactor device and service discovery errors
- Make them more consistent with other Qt modules
- Propagate the error during device discovery to the QBluetoothServiceDiscoveryAgent
Change-Id: Idcd3e0e6061b85e8b6adad248625740f3b91289a
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp | 34 | ||||
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h | 5 |
2 files changed, 6 insertions, 33 deletions
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp index 47ea4b6d..97265b4f 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp @@ -135,36 +135,13 @@ void QDeclarativeBluetoothDiscoveryModel::componentComplete() void QDeclarativeBluetoothDiscoveryModel::errorDiscovery(QBluetoothServiceDiscoveryAgent::Error error) { - switch (error) { - case QBluetoothServiceDiscoveryAgent::DeviceDiscoveryError: - d->m_error = DeviceDiscoveryError; - break; - case QBluetoothServiceDiscoveryAgent::UnknownError: - d->m_error = UnknownError; - break; - default: - d->m_error = UnknownError; - break; - } + d->m_error = static_cast<QDeclarativeBluetoothDiscoveryModel::Error>(error); emit errorChanged(); } void QDeclarativeBluetoothDiscoveryModel::errorDeviceDiscovery(QBluetoothDeviceDiscoveryAgent::Error error) { - switch (error) { - case QBluetoothDeviceDiscoveryAgent::IOFailure: - d->m_error = IOFailure; - break; - case QBluetoothDeviceDiscoveryAgent::PoweredOff: - d->m_error = PoweredOffFailure; - break; - case QBluetoothDeviceDiscoveryAgent::UnknownError: - d->m_error = UnknownError; - break; - default: - d->m_error = UnknownError; - break; - } + d->m_error = static_cast<QDeclarativeBluetoothDiscoveryModel::Error>(error); emit errorChanged(); } @@ -185,13 +162,10 @@ void QDeclarativeBluetoothDiscoveryModel::clearModel() \header \li Property \li Description \row \li \c BluetoothDiscoveryModel.NoError \li No error occurred. - \row \li \c BluetoothDiscoveryModel.IOFailure + \row \li \c BluetoothDiscoveryModel.InputOutputError \li An IO failure occurred during device discovery - \row \li \c BluetoothDiscoveryModel.PoweredOffFailure + \row \li \c BluetoothDiscoveryModel.PoweredOffError \li The bluetooth device is not powered on. - \row \li \c BluetoothDiscoveryModel.DeviceDiscoveryError - \li In order to be able to discover services a device discovery is started first. - This error indicates that a problem detected there. \row \li \c BluetoothDiscoveryModel.UnknownError \li An unknown error occurred. \endtable diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h index a675f1ce..feb1a5e1 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h +++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h @@ -89,9 +89,8 @@ public: enum Error { NoError, - IOFailure, - PoweredOffFailure, - DeviceDiscoveryError, + InputOutputError, + PoweredOffError, UnknownError }; |