diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-05-27 09:21:08 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-06-23 08:22:31 +0000 |
commit | acaab9e6425726d7a3901e6224c6e59874bc5a62 (patch) | |
tree | 443521d372c2be777626000d26d52e834a661838 /src/bluetooth | |
parent | 3acd1a5d4fc4dc501d8b0a149909511e91aafb05 (diff) |
Port from Q_ENUMS to new macro Q_ENUM
Remove Q_ENUMS in favor of the new Q_ENUM macro which provides
registration as meta enum and a debug stream operator.
Register some enums via Q_ENUM to improve debug output
and types auto-registration.
Change-Id: I31c9535a2de7da1783b4ec967612c02a57cb62ff
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth')
-rw-r--r-- | src/bluetooth/android/serveracceptancethread.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice.h | 12 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothserver.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent.h | 4 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothsocket.h | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothtransferreply.h | 4 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller.h | 6 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.h | 7 |
9 files changed, 21 insertions, 23 deletions
diff --git a/src/bluetooth/android/serveracceptancethread.cpp b/src/bluetooth/android/serveracceptancethread.cpp index 3a30cacb..c22256c9 100644 --- a/src/bluetooth/android/serveracceptancethread.cpp +++ b/src/bluetooth/android/serveracceptancethread.cpp @@ -38,8 +38,6 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID) -Q_DECLARE_METATYPE(QBluetoothServer::Error) - ServerAcceptanceThread::ServerAcceptanceThread(QObject *parent) : QObject(parent), maxPendingConnections(1) { diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent.h b/src/bluetooth/qbluetoothdevicediscoveryagent.h index 656604ac..1641f16f 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent.h +++ b/src/bluetooth/qbluetoothdevicediscoveryagent.h @@ -61,11 +61,13 @@ public: UnsupportedPlatformError, UnknownError = 100 // New errors must be added before Unknown error }; + Q_ENUM(Error) enum InquiryType { GeneralUnlimitedInquiry, LimitedInquiry }; + Q_ENUM(InquiryType) QBluetoothDeviceDiscoveryAgent(QObject *parent = 0); explicit QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index bcb39bda..4587bbf0 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h +++ b/src/bluetooth/qbluetoothlocaldevice.h @@ -49,15 +49,14 @@ class QBluetoothLocalDevicePrivate; class Q_BLUETOOTH_EXPORT QBluetoothLocalDevice : public QObject { Q_OBJECT - Q_ENUMS(Pairing) - Q_ENUMS(HostMode) - Q_ENUMS(Error) + public: enum Pairing { Unpaired, Paired, AuthorizedPaired }; + Q_ENUM(Pairing) enum HostMode { HostPoweredOff, @@ -65,12 +64,15 @@ public: HostDiscoverable, HostDiscoverableLimitedInquiry }; + Q_ENUM(HostMode) enum Error { NoError, PairingError, UnknownError = 100 }; + Q_ENUM(Error) + QBluetoothLocalDevice(QObject *parent = 0); explicit QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent = 0); virtual ~QBluetoothLocalDevice(); @@ -111,8 +113,4 @@ private: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QBluetoothLocalDevice::HostMode) -Q_DECLARE_METATYPE(QBluetoothLocalDevice::Pairing) -Q_DECLARE_METATYPE(QBluetoothLocalDevice::Error) - #endif // QBLUETOOTHLOCALDEVICE_H diff --git a/src/bluetooth/qbluetoothserver.h b/src/bluetooth/qbluetoothserver.h index 951b47f4..752780a5 100644 --- a/src/bluetooth/qbluetoothserver.h +++ b/src/bluetooth/qbluetoothserver.h @@ -62,6 +62,8 @@ public: ServiceAlreadyRegisteredError, UnsupportedProtocolError }; + Q_ENUM(Error) + QBluetoothServer(QBluetoothServiceInfo::Protocol serverType, QObject *parent = 0); ~QBluetoothServer(); diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.h b/src/bluetooth/qbluetoothservicediscoveryagent.h index d15a1d8d..cf756504 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.h +++ b/src/bluetooth/qbluetoothservicediscoveryagent.h @@ -66,11 +66,13 @@ public: //New Errors must be added after Unknown Error the space before UnknownError is reserved //for future device discovery errors }; + Q_ENUM(Error) enum DiscoveryMode { MinimalDiscovery, FullDiscovery }; + Q_ENUM(DiscoveryMode) QBluetoothServiceDiscoveryAgent(QObject *parent = 0); explicit QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent = 0); @@ -124,6 +126,4 @@ private: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QBluetoothServiceDiscoveryAgent::Error) - #endif diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h index b073ada3..0ec6a593 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h @@ -67,6 +67,7 @@ public: ClosingState = QAbstractSocket::ClosingState, ListeningState = QAbstractSocket::ListeningState }; + Q_ENUM(SocketState) enum SocketError { NoSocketError = -2, @@ -78,6 +79,7 @@ public: OperationError = QAbstractSocket::OperationError //19 //New enums (independent of QAbstractSocket) should be added from 100 onwards }; + Q_ENUM(SocketError) explicit QBluetoothSocket(QBluetoothServiceInfo::Protocol socketType, QObject *parent = 0); // create socket of type socketType QBluetoothSocket(QObject *parent = 0); // create a blank socket @@ -161,7 +163,4 @@ Q_BLUETOOTH_EXPORT QDebug operator<<(QDebug, QBluetoothSocket::SocketState); QT_END_NAMESPACE -Q_DECLARE_METATYPE(QBluetoothSocket::SocketError) -Q_DECLARE_METATYPE(QBluetoothSocket::SocketState) - #endif diff --git a/src/bluetooth/qbluetoothtransferreply.h b/src/bluetooth/qbluetoothtransferreply.h index 081b7002..428e3cd0 100644 --- a/src/bluetooth/qbluetoothtransferreply.h +++ b/src/bluetooth/qbluetoothtransferreply.h @@ -58,7 +58,7 @@ public: ResourceBusyError, SessionError }; - + Q_ENUM(TransferError) ~QBluetoothTransferReply(); @@ -96,6 +96,4 @@ private: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QBluetoothTransferReply::TransferError) - #endif // QBLUETOOTHTRANSFERREPLY_H diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index c5a4acd3..fd230238 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -55,6 +55,7 @@ public: InvalidBluetoothAdapterError, ConnectionError }; + Q_ENUM(Error) enum ControllerState { UnconnectedState = 0, @@ -64,11 +65,13 @@ public: DiscoveredState, ClosingState }; + Q_ENUM(ControllerState) enum RemoteAddressType { PublicAddress = 0, RandomAddress }; + Q_ENUM(RemoteAddressType) explicit QLowEnergyController(const QBluetoothAddress &remoteDevice, QObject *parent = 0); // TODO Qt 6 remove ctor @@ -116,7 +119,4 @@ private: QT_END_NAMESPACE -Q_DECLARE_METATYPE(QLowEnergyController::ControllerState) -Q_DECLARE_METATYPE(QLowEnergyController::Error) - #endif // QLOWENERGYCONTROLLER_H diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 8d7f8a21..dc03419d 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -50,6 +50,7 @@ public: PrimaryService = 0x0001, IncludedService = 0x0002 }; + Q_ENUM(ServiceType) Q_DECLARE_FLAGS(ServiceTypes, ServiceType) enum ServiceError { @@ -61,6 +62,7 @@ public: CharacteristicReadError, DescriptorReadError }; + Q_ENUM(ServiceError) enum ServiceState { InvalidService = 0, @@ -69,11 +71,13 @@ public: DiscoveringServices,// discoverDetails() called and running ServiceDiscovered // all details have been synchronized }; + Q_ENUM(ServiceState) enum WriteMode { WriteWithResponse = 0, WriteWithoutResponse }; + Q_ENUM(WriteMode) ~QLowEnergyService(); @@ -130,7 +134,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyService::ServiceTypes) QT_END_NAMESPACE -Q_DECLARE_METATYPE(QLowEnergyService::ServiceState) -Q_DECLARE_METATYPE(QLowEnergyService::ServiceError) - #endif // QLOWENERGYSERVICE_H |