diff --git a/src/bluetooth/qbluetooth.h b/src/bluetooth/qbluetooth.h index ebe546f..f448af0 100644 --- a/src/bluetooth/qbluetooth.h +++ b/src/bluetooth/qbluetooth.h @@ -58,6 +58,7 @@ public: InputOutputError, PoweredOffError, InvalidBluetoothAdapterError, + UnsupportedPlatformError, UnknownError = 100 // New errors must be added before Unknown error }; diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h index 6e268dc..e543286 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.h +++ b/src/bluetooth/qbluetoothdeviceinfo.h @@ -36,7 +36,8 @@ #include <QtBluetooth/qbluetoothglobal.h> -#include <QtCore/QString> +#include <QtCore/qstring.h> +#include <QtCore/qmetatype.h> QT_BEGIN_NAMESPACE @@ -199,6 +200,8 @@ public: QBluetoothDeviceInfo(); QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice); + QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, + quint32 classOfDevice); QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other); ~QBluetoothDeviceInfo(); @@ -228,6 +231,9 @@ public: void setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs); QBluetoothDeviceInfo::CoreConfigurations coreConfigurations() const; + void setDeviceUuid(const QBluetoothUuid &uuid); + QBluetoothUuid deviceUuid() const; + protected: QBluetoothDeviceInfoPrivate *d_ptr; @@ -235,6 +241,11 @@ private: Q_DECLARE_PRIVATE(QBluetoothDeviceInfo) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::CoreConfigurations) +Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::ServiceClasses) + QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothDeviceInfo) + #endif diff --git a/src/bluetooth/qbluetoothglobal.h b/src/bluetooth/qbluetoothglobal.h index 9c64e24..830b23a 100644 --- a/src/bluetooth/qbluetoothglobal.h +++ b/src/bluetooth/qbluetoothglobal.h @@ -49,6 +49,9 @@ public: QBluetoothHostInfo &operator=(const QBluetoothHostInfo &other); + bool operator==(const QBluetoothHostInfo &other) const; + bool operator!=(const QBluetoothHostInfo &other) const; + QBluetoothAddress address() const; void setAddress(const QBluetoothAddress &address); @@ -62,4 +65,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothHostInfo) + #endif diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index 4a70757..bcb39bd 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h +++ b/src/bluetooth/qbluetoothlocaldevice.h @@ -103,10 +103,12 @@ Q_SIGNALS: private: QBluetoothServiceDiscoveryAgentPrivate *d_ptr; + Q_PRIVATE_SLOT(d_func(), void _q_deviceDiscovered(const QBluetoothDeviceInfo &info)) Q_PRIVATE_SLOT(d_func(), void _q_deviceDiscoveryFinished()) Q_PRIVATE_SLOT(d_func(), void _q_deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)) Q_PRIVATE_SLOT(d_func(), void _q_serviceDiscoveryFinished()) + #ifdef QT_BLUEZ_BLUETOOTH Q_PRIVATE_SLOT(d_func(), void _q_discoveredServices(QDBusPendingCallWatcher*)) Q_PRIVATE_SLOT(d_func(), void _q_createdDevice(QDBusPendingCallWatcher*)) @@ -122,4 +124,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothServiceDiscoveryAgent::Error) + #endif diff --git a/src/bluetooth/qbluetoothserviceinfo.h b/src/bluetooth/qbluetoothserviceinfo.h index 1ec1d7d..b52eaf7 100644 --- a/src/bluetooth/qbluetoothserviceinfo.h +++ b/src/bluetooth/qbluetoothserviceinfo.h @@ -46,7 +46,6 @@ QT_BEGIN_NAMESPACE class QBluetoothSocketPrivate; -class QBluetoothServiceInfo; class Q_BLUETOOTH_EXPORT QBluetoothSocket : public QIODevice { @@ -162,4 +161,7 @@ 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/qbluetoothtransfermanager.h b/src/bluetooth/qbluetoothtransfermanager.h index f252f97..6d6b031 100644 --- a/src/bluetooth/qbluetoothtransfermanager.h +++ b/src/bluetooth/qbluetoothtransfermanager.h @@ -77,7 +77,7 @@ public: UdiCPlain = 0x001D, McapControlChannel = 0x001E, McapDataChannel = 0x001F, - L2cap = 0x0100, + L2cap = 0x0100 }; enum ServiceClassUuid { @@ -166,6 +166,12 @@ public: CyclingSpeedAndCadence = 0x1816, CyclingPower = 0x1818, LocationAndNavigation = 0x1819, + EnvironmentalSensing = 0x181a, + BodyComposition = 0x181b, + UserData = 0x181c, + WeightScale = 0x181d, + BondManagement = 0x181e, + ContinuousGlucoseMonitoring = 0x181f }; enum CharacteristicType { @@ -180,21 +186,28 @@ public: DateTime = 0x2a08, DayOfWeek = 0x2a09, DayDateTime = 0x2a0a, + /* 0x2a0b not defined */ ExactTime256 = 0x2a0c, DSTOffset = 0x2a0d, TimeZone = 0x2a0e, LocalTimeInformation = 0x2a0f, + /* 0x2a10 not defined */ TimeWithDST = 0x2a11, TimeAccuracy = 0x2a12, TimeSource = 0x2a13, ReferenceTimeInformation = 0x2a14, + /* 0x2a15 not defined */ TimeUpdateControlPoint = 0x2a16, TimeUpdateState = 0x2a17, GlucoseMeasurement = 0x2a18, BatteryLevel = 0x2a19, + /* 0x2a1a not defined */ + /* 0x2a1b not defined */ TemperatureMeasurement = 0x2a1c, TemperatureType = 0x2a1d, IntermediateTemperature = 0x2a1e, + /* 0x2a1f not defined */ + /* 0x2a20 not defined */ MeasurementInterval = 0x2a21, BootKeyboardInputReport = 0x2a22, SystemID = 0x2a23, @@ -206,6 +219,11 @@ public: ManufacturerNameString = 0x2a29, IEEE1107320601RegulatoryCertificationDataList = 0x2a2a, CurrentTime = 0x2a2b, + MagneticDeclination = 0x2a2c, + /* 0x2a2d not defined */ + /* 0x2a2e not defined */ + /* 0x2a2f not defined */ + /* 0x2a30 not defined */ ScanRefresh = 0x2a31, BootKeyboardOutputReport = 0x2a32, BootMouseInputReport = 0x2a33, @@ -215,6 +233,11 @@ public: HeartRateMeasurement = 0x2a37, BodySensorLocation = 0x2a38, HeartRateControlPoint = 0x2a39, + /* 0x2a3a not defined */ + /* 0x2a3b not defined */ + /* 0x2a3c not defined */ + /* 0x2a3d not defined */ + /* 0x2a3e not defined */ AlertStatus = 0x2a3f, RingerControlPoint = 0x2a40, RingerSetting = 0x2a41, @@ -238,9 +261,19 @@ public: RSCMeasurement = 0x2a53, RSCFeature = 0x2a54, SCControlPoint = 0x2a55, + /* 0x2a56 not defined */ + /* 0x2a57 not defined */ + /* 0x2a58 not defined */ + /* 0x2a59 not defined */ + /* 0x2a5a not defined */ CSCMeasurement = 0x2a5b, CSCFeature = 0x2a5c, SensorLocation = 0x2a5d, + /* 0x2a5e not defined */ + /* 0x2a5f not defined */ + /* 0x2a60 not defined */ + /* 0x2a61 not defined */ + /* 0x2a62 not defined */ CyclingPowerMeasurement = 0x2a63, CyclingPowerVector = 0x2a64, CyclingPowerFeature = 0x2a65, @@ -250,6 +283,62 @@ public: PositionQuality = 0x2a69, LNFeature = 0x2a6a, LNControlPoint = 0x2a6b, + Elevation = 0x2a6c, + Pressure = 0x2a6d, + Temperature = 0x2a6e, + Humidity = 0x2a6f, + TrueWindSpeed = 0x2a70, + TrueWindDirection = 0x2a71, + ApparentWindSpeed = 0x2a72, + ApparentWindDirection = 0x2a73, + GustFactor = 0x2a74, + PollenConcentration = 0x2a75, + UVIndex = 0x2a76, + Irradiance = 0x2a77, + Rainfall = 0x2a78, + WindChill = 0x2a79, + HeatIndex = 0x2a7a, + DewPoint = 0x2a7b, + /* 0x2a7c not defined */ + DescriptorValueChanged = 0x2a7d, + AerobicHeartRateLowerLimit = 0x2a7e, + AerobicThreshold = 0x2a7f, + Age = 0x2a80, + AnaerobicHeartRateLowerLimit = 0x2a81, + AnaerobicHeartRateUpperLimit = 0x2a82, + AnaerobicThreshold = 0x2a83, + AerobicHeartRateUpperLimit = 0x2a84, + DateOfBirth = 0x2a85, + DateOfThresholdAssessment = 0x2a86, + EmailAddress = 0x2a87, + FatBurnHeartRateLowerLimit = 0x2a88, + FatBurnHeartRateUpperLimit = 0x2a89, + FirstName = 0x2a8a, + FiveZoneHeartRateLimits = 0x2a8b, + Gender = 0x2a8c, + HeartRateMax = 0x2a8d, + Height = 0x2a8e, + HipCircumference = 0x2a8f, + LastName = 0x2a90, + MaximumRecommendedHeartRate = 0x2a91, + RestingHeartRate = 0x2a92, + SportTypeForAerobicAnaerobicThresholds = 0x2a93, + ThreeZoneHeartRateLimits = 0x2a94, + TwoZoneHeartRateLimits = 0x2a95, + VO2Max = 0x2a96, + WaistCircumference = 0x2a97, + Weight = 0x2a98, + DatabaseChangeIncrement = 0x2a99, + UserIndex = 0x2a9a, + BodyCompositionFeature = 0x2a9b, + BodyCompositionMeasurement = 0x2a9c, + WeightMeasurement = 0x2a9d, + WeightScaleFeature = 0x2a9e, + UserControlPoint = 0x2a9f, + MagneticFluxDensity2D = 0x2aa0, + MagneticFluxDensity3D = 0x2aa1, + Language = 0x2aa2, + BarometricPressureTrend = 0x2aa3 }; enum DescriptorType { @@ -262,7 +351,12 @@ public: CharacteristicAggregateFormat = 0x2905, ValidRange = 0x2906, ExternalReportReference = 0x2907, - ReportReference = 0x2908 + ReportReference = 0x2908, + /* 0x2909 not defined */ + /* 0x290a not defined */ + EnvironmentalSensingConfiguration = 0x290b, + EnvironmentalSensingMeasurement = 0x290c, + EnvironmentalSensingTriggerSetting = 0x290d }; QBluetoothUuid(); diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h index e0ed297..4d55236 100644 --- a/src/bluetooth/qlowenergycharacteristic.h +++ b/src/bluetooth/qlowenergycharacteristic.h @@ -91,6 +91,7 @@ protected: friend class QLowEnergyService; friend class QLowEnergyControllerPrivate; + friend class QLowEnergyControllerPrivateOSX; QLowEnergyCharacteristicPrivate *data; QLowEnergyCharacteristic(QSharedPointer<QLowEnergyServicePrivate> p, QLowEnergyHandle handle); diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index 6c4be59..c5a4acd 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -36,6 +36,7 @@ #include <QtCore/QObject> #include <QtBluetooth/QBluetoothAddress> +#include <QtBluetooth/QBluetoothDeviceInfo> #include <QtBluetooth/QBluetoothUuid> #include <QtBluetooth/QLowEnergyService> @@ -51,7 +52,8 @@ public: UnknownError, UnknownRemoteDeviceError, NetworkError, - InvalidBluetoothAdapterError + InvalidBluetoothAdapterError, + ConnectionError }; enum ControllerState { @@ -60,7 +62,7 @@ public: ConnectedState, DiscoveringState, DiscoveredState, - ClosingState, + ClosingState }; enum RemoteAddressType { @@ -69,15 +71,19 @@ public: }; explicit QLowEnergyController(const QBluetoothAddress &remoteDevice, + QObject *parent = 0); // TODO Qt 6 remove ctor + explicit QLowEnergyController(const QBluetoothDeviceInfo &remoteDevice, QObject *parent = 0); explicit QLowEnergyController(const QBluetoothAddress &remoteDevice, const QBluetoothAddress &localDevice, - QObject *parent = 0); + QObject *parent = 0); // TODO Qt 6 remove ctor ~QLowEnergyController(); QBluetoothAddress localAddress() const; QBluetoothAddress remoteAddress() const; + QString remoteName() const; + ControllerState state() const; RemoteAddressType remoteAddressType() const; @@ -110,4 +116,7 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QLowEnergyController::ControllerState) +Q_DECLARE_METATYPE(QLowEnergyController::Error) + #endif // QLOWENERGYCONTROLLER_H diff --git a/src/bluetooth/qlowenergydescriptor.h b/src/bluetooth/qlowenergydescriptor.h index edbac25..8692a54 100644 --- a/src/bluetooth/qlowenergydescriptor.h +++ b/src/bluetooth/qlowenergydescriptor.h @@ -73,6 +73,7 @@ protected: friend class QLowEnergyCharacteristic; friend class QLowEnergyService; friend class QLowEnergyControllerPrivate; + friend class QLowEnergyControllerPrivateOSX; QLowEnergyDescriptorPrivate *data; QLowEnergyDescriptor(QSharedPointer<QLowEnergyServicePrivate> p, diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 903b64f..8d7f8a2 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -56,7 +56,10 @@ public: NoError = 0, OperationError, CharacteristicWriteError, - DescriptorWriteError + DescriptorWriteError, + UnknownError, + CharacteristicReadError, + DescriptorReadError }; enum ServiceState { @@ -64,7 +67,7 @@ public: DiscoveryRequired, // we know start/end handle but nothing more //TODO Rename DiscoveringServices -> DiscoveringDetails or DiscoveringService DiscoveringServices,// discoverDetails() called and running - ServiceDiscovered, // all details have been synchronized + ServiceDiscovered // all details have been synchronized }; enum WriteMode { @@ -89,11 +92,13 @@ public: ServiceError error() const; bool contains(const QLowEnergyCharacteristic &characteristic) const; + void readCharacteristic(const QLowEnergyCharacteristic &characteristic); void writeCharacteristic(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue, WriteMode mode = WriteWithResponse); bool contains(const QLowEnergyDescriptor &descriptor) const; + void readDescriptor(const QLowEnergyDescriptor &descriptor); void writeDescriptor(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue); @@ -101,8 +106,12 @@ Q_SIGNALS: void stateChanged(QLowEnergyService::ServiceState newState); void characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value); + void characteristicRead(const QLowEnergyCharacteristic &info, + const QByteArray &value); void characteristicWritten(const QLowEnergyCharacteristic &info, const QByteArray &value); + void descriptorRead(const QLowEnergyDescriptor &info, + const QByteArray &value); void descriptorWritten(const QLowEnergyDescriptor &info, const QByteArray &value); void error(QLowEnergyService::ServiceError error); @@ -117,6 +126,11 @@ private: QObject *parent = 0); }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyService::ServiceTypes) + QT_END_NAMESPACE +Q_DECLARE_METATYPE(QLowEnergyService::ServiceState) +Q_DECLARE_METATYPE(QLowEnergyService::ServiceError) + #endif // QLOWENERGYSERVICE_H
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development