summaryrefslogtreecommitdiff
path: root/gatoperipheral.cpp
diff options
context:
space:
mode:
authorJavier <maemo@javispedro.com>2014-07-26 22:59:39 +0200
committerJavier <maemo@javispedro.com>2014-07-26 22:59:39 +0200
commite34f49ff20f2227ffca0515201e7493fd55ef64a (patch)
tree486b48932015af92c9577b6cddc88834cb839df4 /gatoperipheral.cpp
parentaaf7fb81d16018cac51c67443bd09e499dbf1e7e (diff)
downloadlibgato-e34f49ff20f2227ffca0515201e7493fd55ef64a.tar.gz
libgato-e34f49ff20f2227ffca0515201e7493fd55ef64a.zip
add "requireencryption" connection option (ABI broken!)
Diffstat (limited to 'gatoperipheral.cpp')
-rw-r--r--gatoperipheral.cpp9
1 files changed, 7 insertions, 2 deletions
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()