Skip to content

Commit

Permalink
Yeelight lgtm findings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Grey committed Apr 30, 2021
1 parent c92eda9 commit c8acd2c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libsrc/leddevice/dev_net/LedDeviceYeelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
if ( ! _tcpSocket->waitForBytesWritten(WRITE_TIMEOUT.count()) )
{
QString errorReason = QString ("(%1) %2").arg(_tcpSocket->error()).arg( _tcpSocket->errorString());
log ( 2, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
log ( 2, "Error:", "bytesWritten: [%lld], %s", bytesWritten, QSTRING_CSTR(errorReason));
this->setInError ( errorReason );
}
else
{
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
log ( 3, "Success:", "Bytes written [%lld]", bytesWritten );

// Avoid to overrun the Yeelight Command Quota
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime;
Expand All @@ -258,7 +258,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
{
do
{
log ( 3, "Reading:", "Bytes available [%d]", _tcpSocket->bytesAvailable() );
log ( 3, "Reading:", "Bytes available [%lld]", _tcpSocket->bytesAvailable() );
while ( _tcpSocket->canReadLine() )
{
QByteArray response = _tcpSocket->readLine();
Expand Down Expand Up @@ -338,7 +338,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
{
int error = _tcpStreamSocket->error();
QString errorReason = QString ("(%1) %2").arg(error).arg( _tcpStreamSocket->errorString());
log ( 1, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
log ( 1, "Error:", "bytesWritten: [%lld], %s", bytesWritten, QSTRING_CSTR(errorReason));

if ( error == QAbstractSocket::RemoteHostClosedError )
{
Expand All @@ -353,7 +353,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
}
else
{
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
log ( 3, "Success:", "Bytes written [%lld]", bytesWritten );
rc = true;
}
}
Expand Down

0 comments on commit c8acd2c

Please sign in to comment.