summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bluetooth/lowenergyscanner/serviceinfo.cpp')
-rw-r--r--examples/bluetooth/lowenergyscanner/serviceinfo.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/bluetooth/lowenergyscanner/serviceinfo.cpp b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
index 19b99b9f..c05422ca 100644
--- a/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
+++ b/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
@@ -64,6 +64,25 @@ QString ServiceInfo::getName() const
return m_service->serviceName();
}
+QString ServiceInfo::getType() const
+{
+ if (!m_service)
+ return QString();
+
+ QString result;
+ if (m_service->type() & QLowEnergyService::PrimaryService)
+ result += QStringLiteral("primary");
+ else
+ result += QStringLiteral("secondary");
+
+ if (m_service->type() & QLowEnergyService::IncludedService)
+ result += QStringLiteral(" included");
+
+ result.prepend('<').append('>');
+
+ return result;
+}
+
QString ServiceInfo::getUuid() const
{
if (!m_service)