Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qlowenergycontroller_winrt.cpp File Reference

(e93b602ddbc64b3db32ce1ff483754b341c44b7e)

#include "qlowenergycontroller_winrt_p.h"
#include "qbluetoothutils_winrt_p.h"
#include <QtBluetooth/qbluetoothlocaldevice.h>
#include <QtBluetooth/QLowEnergyCharacteristicData>
#include <QtBluetooth/QLowEnergyDescriptorData>
#include <QtBluetooth/private/qbluetoothutils_winrt_p.h>
#include <QtBluetooth/QLowEnergyService>
#include <QtCore/QtEndian>
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qfunctions_winrt_p.h>
#include <QtCore/QDeadlineTimer>
#include <QtCore/qpointer.h>
#include <QtCore/QAbstractEventDispatcher>
#include <functional>
#include <type_traits>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Foundation.Metadata.h>
#include <winrt/Windows.Devices.Enumeration.h>
#include <winrt/Windows.Devices.Bluetooth.h>
#include <winrt/Windows.Devices.Bluetooth.GenericAttributeProfile.h>
#include <winrt/Windows.Storage.Streams.h>
#include <windows.devices.bluetooth.h>
#include <windows.devices.bluetooth.genericattributeprofile.h>
#include "qlowenergycontroller_winrt.moc"
Include dependency graph for qlowenergycontroller_winrt.cpp:

Go to the source code of this file.

Classes

class  QWinRTLowEnergyServiceHandler
class  QWinRTLowEnergyConnectionHandler

Namespaces

namespace  abi

Macros

#define ENUM_BITWISE_OPS(E)
#define LOG_HRESULT(hr)
#define HR(x)
#define TRY(x)
#define SAFE(x)
#define WARN_AND_CONTINUE(msg)
#define DEC_CHAR_COUNT_AND_CONTINUE(msg)
#define RETURN_SERVICE_ERROR(msg, service, error)
#define RETURN_FALSE(msg)
#define RETURN_MSG(msg)

Typedefs

using abi::BluetoothLEDevice = ABI::Windows::Devices::Bluetooth::IBluetoothLEDevice
using abi::GattSession = ABI::Windows::Devices::Bluetooth::GenericAttributeProfile::IGattSession
using GlobalCondition = std::function<bool()>

Functions

template<typename E, std::enable_if_t< std::is_enum_v< E >, int > = 0>
constexpr std::underlying_type_t< Ebitwise_and (E x, E y)
template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
constexpr T bitwise_and (T x, E y)
template<typename E, std::enable_if_t< std::is_enum_v< E >, int > = 0>
constexpr std::underlying_type_t< Ebitwise_or (E x, E y)
template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
constexpr T bitwise_or (T x, E y)
template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
constexpr T & bitwise_or_equal (T &a, const E &b)
static constexpr bool never ()
template<typename T>
static T await (IAsyncOperation< T > asyncInfo, GlobalCondition canceled=never, int timeout=5000)
template<typename T>
static T await_forever (IAsyncOperation< T > asyncInfo, GlobalCondition canceled=never)
static QByteArray byteArrayFromBuffer (IBuffer buffer, bool isWCharString=false)
static QByteArray byteArrayFromGattResult (GattReadResult gattResult, bool isWCharString=false)

Variables

QT_BEGIN_NAMESPACE typedef GattReadClientCharacteristicConfigurationDescriptorResult ClientCharConfigDescriptorResult
constexpr int timeout_infinity = -1
static constexpr qint64 kMaxConnectTimeout = 20000

Macro Definition Documentation

◆ DEC_CHAR_COUNT_AND_CONTINUE

#define DEC_CHAR_COUNT_AND_CONTINUE ( msg)
Value:
{ \
qCWarning(QT_BT_WINDOWS) << msg; \
--mCharacteristicsCountToBeDiscovered; \
continue; \
}

Definition at line 183 of file qlowenergycontroller_winrt.cpp.

◆ ENUM_BITWISE_OPS

#define ENUM_BITWISE_OPS ( E)
Value:
inline constexpr std::underlying_type_t<E> operator&(E x, E y) { return bitwise_and<E>(x, y); } \
\
template<typename T> \
inline constexpr T operator&(T x, E y) { return bitwise_and<T, E>(x, y); } \
\
template<typename T> \
inline constexpr T operator&(E x, T y) { return bitwise_and<T, E>(y, x); } \
\
inline constexpr std::underlying_type_t<E> operator|(E x, E y) { return bitwise_or<E>(x, y); } \
\
template<typename T> \
inline constexpr T operator|(T x, E y) { return bitwise_or<T, E>(x, y); } \
\
template<typename T> \
inline constexpr T operator|(E x, T y) { return bitwise_or<T, E>(y, x); } \
\
template<typename T> \
inline constexpr T &operator |=(T &a, const E &b) { return bitwise_or_equal(a, b); }
QBitArray operator&(const QBitArray &a1, const QBitArray &a2)
constexpr T & bitwise_or_equal(T &a, const E &b)
constexpr std::underlying_type_t< E > bitwise_or(E x, E y)
constexpr std::underlying_type_t< E > bitwise_and(E x, E y)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
GLboolean GLboolean GLboolean GLboolean a
GLint y
constexpr QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
Definition qurl.h:296
QUrl::FormattingOptions & operator|=(QUrl::FormattingOptions &i, QUrl::ComponentFormattingOptions f)
Definition qurl.h:304

Definition at line 86 of file qlowenergycontroller_winrt.cpp.

◆ HR

#define HR ( x)
Value:
std::invoke([&]() { \
try { \
x; \
} catch (hresult_error const &e) { \
LOG_HRESULT(e.code()) << "/*" << #x << "*/"; \
return e.code(); \
} \
return hresult{ S_OK } ; \
})

Definition at line 145 of file qlowenergycontroller_winrt.cpp.

◆ LOG_HRESULT

#define LOG_HRESULT ( hr)
Value:
qCWarning(QT_BT_WINDOWS) << "HRESULT:" << quint32(hr)
#define qCWarning(category,...)
unsigned int quint32
Definition qtypes.h:55

Definition at line 143 of file qlowenergycontroller_winrt.cpp.

◆ RETURN_FALSE

#define RETURN_FALSE ( msg)
Value:
{ \
qErrnoWarning(msg); \
return false; \
}

Definition at line 197 of file qlowenergycontroller_winrt.cpp.

◆ RETURN_MSG

#define RETURN_MSG ( msg)
Value:
{ \
qErrnoWarning(msg); \
return; \
}

Definition at line 203 of file qlowenergycontroller_winrt.cpp.

◆ RETURN_SERVICE_ERROR

#define RETURN_SERVICE_ERROR ( msg,
service,
error )
Value:
{ \
qCDebug(QT_BT_WINDOWS) << msg; \
service->setError(error); \
return; \
}
DBusConnection const char DBusError * error

Definition at line 190 of file qlowenergycontroller_winrt.cpp.

◆ SAFE

#define SAFE ( x)
Value:
std::invoke([&]() { \
try { \
return(x); \
} catch (hresult_error const &e) { \
LOG_HRESULT(e.code()) << "/*" << #x << "*/"; \
return decltype(x)(0); \
} \
})

Definition at line 167 of file qlowenergycontroller_winrt.cpp.

◆ TRY

#define TRY ( x)
Value:
std::invoke([&]() { \
try { \
x; \
} catch (hresult_error const &e) { \
LOG_HRESULT(e.code()) << "/*" << #x << "*/"; \
return false; \
} \
return true; \
})

Definition at line 156 of file qlowenergycontroller_winrt.cpp.

◆ WARN_AND_CONTINUE

#define WARN_AND_CONTINUE ( msg)
Value:
{ \
qCWarning(QT_BT_WINDOWS) << msg; \
continue; \
}

Definition at line 177 of file qlowenergycontroller_winrt.cpp.

Typedef Documentation

◆ GlobalCondition

typedef std::function< bool()> GlobalCondition = std::function<bool()>

Definition at line 112 of file qlowenergycontroller_winrt.cpp.

Function Documentation

◆ await()

template<typename T>
T await ( IAsyncOperation< T > asyncInfo,
GlobalCondition canceled = never,
int timeout = 5000 )
static

Definition at line 116 of file qlowenergycontroller_winrt.cpp.

◆ await_forever()

template<typename T>
T await_forever ( IAsyncOperation< T > asyncInfo,
GlobalCondition canceled = never )
inlinestatic

Definition at line 138 of file qlowenergycontroller_winrt.cpp.

References timeout_infinity.

◆ bitwise_and() [1/2]

template<typename E, std::enable_if_t< std::is_enum_v< E >, int > = 0>
std::underlying_type_t< E > bitwise_and ( E x,
E y )
inlineconstexpr

Definition at line 52 of file qlowenergycontroller_winrt.cpp.

◆ bitwise_and() [2/2]

template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
T bitwise_and ( T x,
E y )
inlineconstexpr

Definition at line 59 of file qlowenergycontroller_winrt.cpp.

◆ bitwise_or() [1/2]

template<typename E, std::enable_if_t< std::is_enum_v< E >, int > = 0>
std::underlying_type_t< E > bitwise_or ( E x,
E y )
inlineconstexpr

Definition at line 66 of file qlowenergycontroller_winrt.cpp.

◆ bitwise_or() [2/2]

template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
T bitwise_or ( T x,
E y )
inlineconstexpr

Definition at line 73 of file qlowenergycontroller_winrt.cpp.

◆ bitwise_or_equal()

template<typename T, typename E, std::enable_if_t< std::conjunction_v< std::is_integral< T >, std::is_enum< E > >, int > = 0>
T & bitwise_or_equal ( T & a,
const E & b )
inlineconstexpr

Definition at line 80 of file qlowenergycontroller_winrt.cpp.

◆ byteArrayFromBuffer()

QByteArray byteArrayFromBuffer ( IBuffer buffer,
bool isWCharString = false )
static

Definition at line 214 of file qlowenergycontroller_winrt.cpp.

◆ byteArrayFromGattResult()

QByteArray byteArrayFromGattResult ( GattReadResult gattResult,
bool isWCharString = false )
static

Definition at line 231 of file qlowenergycontroller_winrt.cpp.

◆ never()

constexpr bool never ( )
staticconstexpr

Definition at line 113 of file qlowenergycontroller_winrt.cpp.

Variable Documentation

◆ ClientCharConfigDescriptorResult

QT_BEGIN_NAMESPACE typedef GattReadClientCharacteristicConfigurationDescriptorResult ClientCharConfigDescriptorResult

Definition at line 110 of file qlowenergycontroller_winrt.cpp.

◆ kMaxConnectTimeout

constexpr qint64 kMaxConnectTimeout = 20000
staticconstexpr

Definition at line 212 of file qlowenergycontroller_winrt.cpp.

◆ timeout_infinity

int timeout_infinity = -1
constexpr

Definition at line 135 of file qlowenergycontroller_winrt.cpp.

Referenced by await_forever().