Regularize debug messages for Faceshift and DDE

This commit is contained in:
David Rowe 2015-04-25 11:35:14 -07:00
parent c37eb3de8a
commit 6071e44ba4
3 changed files with 16 additions and 7 deletions

View file

@ -199,7 +199,7 @@ void DdeFaceTracker::setEnabled(bool enabled) {
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
_ddeStopping = false;
qDebug() << "[Info] DDE Face Tracker Starting";
qCDebug(interfaceapp) << "DDE Face Tracker: Starting";
_ddeProcess = new QProcess(qApp);
connect(_ddeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
_ddeProcess->start(QCoreApplication::applicationDirPath() + DDE_PROGRAM_PATH, DDE_ARGUMENTS);
@ -208,7 +208,7 @@ void DdeFaceTracker::setEnabled(bool enabled) {
if (!enabled && _ddeProcess) {
_ddeStopping = true;
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
qDebug() << "[Info] DDE Face Tracker Stopped";
qCDebug(interfaceapp) << "DDE Face Tracker: Stopping";
}
#endif
}
@ -250,7 +250,7 @@ bool DdeFaceTracker::isActive() const {
//private slots and methods
void DdeFaceTracker::socketErrorOccurred(QAbstractSocket::SocketError socketError) {
qCDebug(interfaceapp) << "[Error] DDE Face Tracker Socket Error: " << _udpSocket.errorString();
qCWarning(interfaceapp) << "DDE Face Tracker: Socket error: " << _udpSocket.errorString();
}
void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState) {
@ -278,7 +278,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState
state = "Unconnected";
break;
}
qCDebug(interfaceapp) << "[Info] DDE Face Tracker Socket: " << state;
qCDebug(interfaceapp) << "DDE Face Tracker: Socket: " << state;
}
void DdeFaceTracker::readPendingDatagrams() {
@ -422,7 +422,7 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) {
FaceTracker::countFrame();
} else {
qCDebug(interfaceapp) << "[Error] DDE Face Tracker Decode Error";
qCWarning(interfaceapp) << "DDE Face Tracker: Decode error";
}
_lastReceiveTimestamp = usecTimestampNow();
}

View file

@ -39,6 +39,7 @@ Faceshift::Faceshift() :
connect(&_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(noteError(QAbstractSocket::SocketError)));
connect(&_tcpSocket, SIGNAL(readyRead()), SLOT(readFromSocket()));
connect(&_tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SIGNAL(connectionStateChanged()));
connect(&_tcpSocket, SIGNAL(disconnected()), SLOT(noteDisconnected()));
connect(&_udpSocket, SIGNAL(readyRead()), SLOT(readPendingDatagrams()));
@ -131,6 +132,7 @@ void Faceshift::setTCPEnabled(bool enabled) {
if ((_tcpEnabled = enabled)) {
connectSocket();
} else {
qCDebug(interfaceapp, "Faceshift: Disconnecting...");
_tcpSocket.disconnectFromHost();
}
#endif
@ -149,7 +151,7 @@ void Faceshift::connectSocket() {
void Faceshift::noteConnected() {
#ifdef HAVE_FACESHIFT
qCDebug(interfaceapp, "Faceshift: Connected.");
qCDebug(interfaceapp, "Faceshift: Connected");
// request the list of blendshape names
string message;
fsBinaryStream::encode_message(message, fsMsgSendBlendshapeNames());
@ -157,10 +159,16 @@ void Faceshift::noteConnected() {
#endif
}
void Faceshift::noteDisconnected() {
#ifdef HAVE_FACESHIFT
qCDebug(interfaceapp, "Faceshift: Disconnected");
#endif
}
void Faceshift::noteError(QAbstractSocket::SocketError error) {
if (!_tcpRetryCount) {
// Only spam log with fail to connect the first time, so that we can keep waiting for server
qCDebug(interfaceapp) << "Faceshift: " << _tcpSocket.errorString();
qCWarning(interfaceapp) << "Faceshift: " << _tcpSocket.errorString();
}
// retry connection after a 2 second delay
if (_tcpEnabled) {

View file

@ -95,6 +95,7 @@ private slots:
void noteError(QAbstractSocket::SocketError error);
void readPendingDatagrams();
void readFromSocket();
void noteDisconnected();
private:
Faceshift();