summaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/btdiscovery.cpp')
-rw-r--r--core/btdiscovery.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp
index a37f36a92..1527be624 100644
--- a/core/btdiscovery.cpp
+++ b/core/btdiscovery.cpp
@@ -6,6 +6,7 @@
#include <QTimer>
#include <QDebug>
#include <QLoggingCategory>
+#include <QRegularExpression>
extern QMap<QString, dc_descriptor_t *> descriptorLookup;
@@ -301,6 +302,14 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
QHash<QString, QBluetoothDeviceInfo> btDeviceInfo;
+bool isBluetoothAddress(const QString &address)
+{
+ QRegularExpression re("(LE:)*([0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}|{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}})",
+ QRegularExpression::CaseInsensitiveOption);
+ QRegularExpressionMatch m = re.match(address);
+ return m.hasMatch();
+}
+
void saveBtDeviceInfo(const QString &devaddr, QBluetoothDeviceInfo deviceInfo)
{
btDeviceInfo[devaddr] = deviceInfo;