summaryrefslogtreecommitdiffstats
path: root/examples/bluetooth/lowenergyscanner/serviceinfo.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-07-22 11:59:27 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-07-23 15:28:49 +0200
commit199bd8306541c3987cc4aae7d7f93af31717d3b5 (patch)
tree004d9a1a034d0abc39145b79d9c4b9edda4e6502 /examples/bluetooth/lowenergyscanner/serviceinfo.cpp
parent58d1b5bdffc25f4ff22dcd00f0572c9c4fac3f88 (diff)
Detect secondary services and display service type in lowenergyscanner
QLowEnergyService::ServiceState was converted to a flag because a primary and secondary service can be included by other services. Change-Id: I425ce8e3f39ee07cccee2763b57a049a624f6178 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
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)