From e34f49ff20f2227ffca0515201e7493fd55ef64a Mon Sep 17 00:00:00 2001 From: Javier Date: Sat, 26 Jul 2014 22:59:39 +0200 Subject: add "requireencryption" connection option (ABI broken!) --- gatoperipheral.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gatoperipheral.cpp') diff --git a/gatoperipheral.cpp b/gatoperipheral.cpp index 2225672..21244b8 100644 --- a/gatoperipheral.cpp +++ b/gatoperipheral.cpp @@ -149,7 +149,7 @@ bool GatoPeripheral::advertisesService(const GatoUUID &uuid) const return d->service_uuids.contains(uuid); } -void GatoPeripheral::connectPeripheral() +void GatoPeripheral::connectPeripheral(PeripheralConnectOptions options) { Q_D(GatoPeripheral); if (d->att->state() != GatoSocket::StateDisconnected) { @@ -157,7 +157,12 @@ void GatoPeripheral::connectPeripheral() return; } - d->att->connectTo(d->addr); + GatoSocket::SecurityLevel sec_level = GatoSocket::SecurityLow; + if (options & PeripheralConnectOptionRequireEncryption) { + sec_level = GatoSocket::SecurityMedium; + } + + d->att->connectTo(d->addr, sec_level); } void GatoPeripheral::disconnectPeripheral() -- cgit v1.2.3