summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_android.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2017-11-02 16:25:17 +0100
committerAlex Blasche <alexander.blasche@qt.io>2017-11-03 13:09:16 +0000
commit770c06092a493417ddf2a3e5555e06fe0f788bc0 (patch)
treed66f7a999d33cad122f83660a2b2896548294c2c /src/bluetooth/qlowenergycontroller_android.cpp
parent284da0e67a59879c71691a893c65da0f581a023d (diff)
Merge all QLEConrollerPrivate::addServiceHelper() implementation
Change-Id: Id346f2f98e63c5c7ea9e2cd3fb7e68e4573ac1e5 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_android.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index 592f6c70..8dccb859 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -1258,55 +1258,4 @@ void QLowEnergyControllerPrivateAndroid::addToGenericAttributeList(const QLowEne
service->androidService.object());
}
-QLowEnergyService *QLowEnergyControllerPrivateAndroid::addServiceHelper(
- const QLowEnergyServiceData &service)
-{
- // Spec says services "should" be grouped by uuid length (16-bit first, then 128-bit).
- // Since this is not mandatory, we ignore it here and let the caller take responsibility
- // for it.
-
- const auto servicePrivate = QSharedPointer<QLowEnergyServicePrivate>::create();
- servicePrivate->state = QLowEnergyService::LocalService;
- servicePrivate->setController(this);
- servicePrivate->uuid = service.uuid();
- servicePrivate->type = service.type() == QLowEnergyServiceData::ServiceTypePrimary
- ? QLowEnergyService::PrimaryService : QLowEnergyService::IncludedService;
- foreach (QLowEnergyService * const includedService, service.includedServices()) {
- servicePrivate->includedServices << includedService->serviceUuid();
- includedService->d_ptr->type |= QLowEnergyService::IncludedService;
- }
-
- // Spec v4.2, Vol 3, Part G, Section 3.
- const QLowEnergyHandle oldLastHandle = this->lastLocalHandle;
- servicePrivate->startHandle = ++this->lastLocalHandle; // Service declaration.
- this->lastLocalHandle += servicePrivate->includedServices.count(); // Include declarations.
- foreach (const QLowEnergyCharacteristicData &cd, service.characteristics()) {
- const QLowEnergyHandle declHandle = ++this->lastLocalHandle;
- QLowEnergyServicePrivate::CharData charData;
- charData.valueHandle = ++this->lastLocalHandle;
- charData.uuid = cd.uuid();
- charData.properties = cd.properties();
- charData.value = cd.value();
- foreach (const QLowEnergyDescriptorData &dd, cd.descriptors()) {
- QLowEnergyServicePrivate::DescData descData;
- descData.uuid = dd.uuid();
- descData.value = dd.value();
- charData.descriptorList.insert(++this->lastLocalHandle, descData);
- }
- servicePrivate->characteristicList.insert(declHandle, charData);
- }
- servicePrivate->endHandle = this->lastLocalHandle;
- const bool handleOverflow = this->lastLocalHandle <= oldLastHandle;
- if (handleOverflow) {
- qCWarning(QT_BT_ANDROID) << "Not enough attribute handles left to create this service";
- this->lastLocalHandle = oldLastHandle;
- return nullptr;
- }
-
- this->localServices.insert(servicePrivate->uuid, servicePrivate);
- this->addToGenericAttributeList(service, servicePrivate->startHandle);
- return new QLowEnergyService(servicePrivate);
-}
-
-
QT_END_NAMESPACE