summaryrefslogtreecommitdiff
path: root/src/metawatchbletransport.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <dev.git@javispedro.com>2014-09-20 19:18:00 +0200
committerJavier S. Pedro <dev.git@javispedro.com>2014-09-20 19:18:00 +0200
commitcc1af30276d3650dd71589cd1d7c005da3a64873 (patch)
tree6e6ab2a2e1d4c8f8567d7785e34dfe5b043b2ebd /src/metawatchbletransport.cpp
parentbca10d6ab21bf0e49253fc01e313a4618b7fcae7 (diff)
downloadsalmeta-cc1af30276d3650dd71589cd1d7c005da3a64873.tar.gz
salmeta-cc1af30276d3650dd71589cd1d7c005da3a64873.zip
add normal/rfcomm bluetooth transport for older MWs
Diffstat (limited to 'src/metawatchbletransport.cpp')
-rw-r--r--src/metawatchbletransport.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/metawatchbletransport.cpp b/src/metawatchbletransport.cpp
index 6df6c2a..cd03415 100644
--- a/src/metawatchbletransport.cpp
+++ b/src/metawatchbletransport.cpp
@@ -5,8 +5,9 @@ const GatoUUID MetaWatchBLETransport::ServiceUuid(quint16(0x8880));
const GatoUUID MetaWatchBLETransport::InputCharacteristicUuid(quint16(0x8882));
const GatoUUID MetaWatchBLETransport::OutputCharacteristicUuid(quint16(0x8881));
-MetaWatchBLETransport::MetaWatchBLETransport(GatoPeripheral *peripheral, QObject *parent) :
- MetaWatchTransport(parent), _dev(peripheral)
+MetaWatchBLETransport::MetaWatchBLETransport(const GatoAddress &address, QObject *parent) :
+ MetaWatchTransport(parent),
+ _dev(new GatoPeripheral(address, this))
{
connect(_dev, SIGNAL(connected()), SLOT(handleDeviceConnected()));
connect(_dev, SIGNAL(disconnected()), SLOT(handleDeviceDisconnected()));
@@ -22,6 +23,11 @@ MetaWatchBLETransport::~MetaWatchBLETransport()
disconnectDevice();
}
+bool MetaWatchBLETransport::isDeviceConnected() const
+{
+ return _dev->state() == GatoPeripheral::StateConnected;
+}
+
void MetaWatchBLETransport::sendMessage(quint8 type, quint8 options, const QByteArray &payload)
{
QByteArray packet = encode(type, options, payload);