diff options
author | Javier <maemo@javispedro.com> | 2014-07-26 22:59:39 +0200 |
---|---|---|
committer | Javier <maemo@javispedro.com> | 2014-07-26 22:59:39 +0200 |
commit | e34f49ff20f2227ffca0515201e7493fd55ef64a (patch) | |
tree | 486b48932015af92c9577b6cddc88834cb839df4 /gatoattclient.cpp | |
parent | aaf7fb81d16018cac51c67443bd09e499dbf1e7e (diff) | |
download | libgato-e34f49ff20f2227ffca0515201e7493fd55ef64a.tar.gz libgato-e34f49ff20f2227ffca0515201e7493fd55ef64a.zip |
add "requireencryption" connection option (ABI broken!)
Diffstat (limited to 'gatoattclient.cpp')
-rw-r--r-- | gatoattclient.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gatoattclient.cpp b/gatoattclient.cpp index 6cf6d69..0bf5877 100644 --- a/gatoattclient.cpp +++ b/gatoattclient.cpp @@ -75,7 +75,8 @@ static QByteArray remove_method_signature(const char *sig) } GatoAttClient::GatoAttClient(QObject *parent) : - QObject(parent), socket(new GatoSocket(this)), cur_mtu(ATT_DEFAULT_LE_MTU), next_id(1) + QObject(parent), socket(new GatoSocket(this)), cur_mtu(ATT_DEFAULT_LE_MTU), next_id(1), + required_sec(GatoSocket::SecurityLow) { connect(socket, SIGNAL(connected()), SLOT(handleSocketConnected())); connect(socket, SIGNAL(disconnected()), SLOT(handleSocketDisconnected())); @@ -91,8 +92,9 @@ GatoSocket::State GatoAttClient::state() const return socket->state(); } -bool GatoAttClient::connectTo(const GatoAddress &addr) +bool GatoAttClient::connectTo(const GatoAddress &addr, GatoSocket::SecurityLevel sec_level) { + required_sec = sec_level; return socket->connectTo(addr, ATT_CID); } @@ -540,6 +542,10 @@ QList<GatoAttClient::AttributeGroupData> GatoAttClient::parseAttributeGroupData( void GatoAttClient::handleSocketConnected() { + if (socket->securityLevel() < required_sec) { + socket->setSecurityLevel(required_sec); + } + requestExchangeMTU(ATT_MAX_LE_MTU, this, SLOT(handleServerMTU(quint16))); emit connected(); } |