From cc29d7e1d1014b05d5b78a5e5531896b92ea6e49 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 15 Jun 2014 18:07:26 +0200 Subject: small cleanup, preparing error signals --- gatosocket.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gatosocket.h') diff --git a/gatosocket.h b/gatosocket.h index 6bb6998..4b4afbf 100644 --- a/gatosocket.h +++ b/gatosocket.h @@ -7,6 +7,7 @@ #include "gatoaddress.h" +/** This class encapsulates a message-oriented bluetooth L2CAP socket. */ class GatoSocket : public QObject { Q_OBJECT @@ -22,17 +23,26 @@ public: StateConnected }; + enum Error { + TimeoutError, + UnknownError + }; + State state() const; bool connectTo(const GatoAddress &addr, unsigned short cid); void close(); + /** Dequeues a pending message from the rx queue. + * Doesn't block: if there are no pending messages, returns null QByteArray. */ QByteArray receive(); + /** Adds a message to the tx queue. */ void send(const QByteArray &pkt); signals: void connected(); void disconnected(); + void error(Error error); void readyRead(); private: -- cgit v1.2.3