* storing callsign and realname as QByteArray instead of QString makes it easier to ensure that C-strings passed to the shim have lifetimes coincident with the shim
* added a bit more error handling and invariant enforcement
* now we terminate the connection automatically on fatal errors
* added first doxygen comment (first of many)
This commit is contained in:
Mathew Sutcliffe
2013-08-04 17:58:05 +01:00
parent 56e05b55a9
commit 0c310227b4
3 changed files with 64 additions and 34 deletions

View File

@@ -15,6 +15,7 @@
#include <QScopedPointer>
#include <QBasicTimer>
#include <QTextCodec>
#include <QByteArray>
namespace BlackCore
{
@@ -80,9 +81,14 @@ namespace BlackCore
private:
QByteArray toFSD(QString qstr) const;
QString fromFSD(const char* cstr) const;
bool isDisconnected() const { return m_status == Cvatlib_Network::connStatus_Idle || m_status == Cvatlib_Network::connStatus_Disconnected; }
signals:
void terminate();
private:
QScopedPointer<Cvatlib_Network> m_net;
Cvatlib_Network::connStatus m_status;
QBasicTimer m_timer;
static int const c_updateIntervalMillisecs = 100;
@@ -92,8 +98,8 @@ namespace BlackCore
quint16 m_serverPort;
QString m_username;
QString m_password;
QString m_callsign;
QString m_realname;
QByteArray m_callsign;
QByteArray m_realname;
QTextCodec* m_fsdTextCodec;
};