Merge branch 'master' into refactor/led_device

This commit is contained in:
Murat Seker
2020-08-23 21:02:25 +02:00
committed by GitHub
272 changed files with 1711 additions and 1738 deletions

View File

@@ -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: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
this->setInError ( errorReason );
}
else
{
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
// Avoid to overrun the Yeelight Command Quota
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime;
@@ -247,7 +247,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
if ( elapsedTime < _waitTimeQuota )
{
int waitTime = _waitTimeQuota;
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %dms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %llms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
// Wait time (in ms) before doing next write to not overrun Yeelight command quota
std::this_thread::sleep_for(std::chrono::milliseconds(_waitTimeQuota));
@@ -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 [%ll]", _tcpSocket->bytesAvailable() );
while ( _tcpSocket->canReadLine() )
{
QByteArray response = _tcpSocket->readLine();
@@ -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: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
if ( error == QAbstractSocket::RemoteHostClosedError )
{
@@ -353,7 +353,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
}
else
{
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
rc = true;
}
}
@@ -572,7 +572,7 @@ bool YeelightLight::identify()
return rc;
}
bool YeelightLight::isInMusicMode( bool deviceCheck)
bool YeelightLight::isInMusicMode(bool deviceCheck)
{
bool inMusicMode = false;
@@ -896,7 +896,7 @@ bool YeelightLight::setColorHSV(const ColorRgb &colorRGB)
}
void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int duration )
void YeelightLight::setTransitionEffect(YeelightLight::API_EFFECT effect, int duration)
{
if( effect != _transitionEffect )
{
@@ -911,7 +911,7 @@ void YeelightLight::setTransitionEffect ( YeelightLight::API_EFFECT effect ,int
}
void YeelightLight::setBrightnessConfig (int min, int max, bool switchoff, int extraTime, double factor )
void YeelightLight::setBrightnessConfig(int min, int max, bool switchoff, int extraTime, double factor)
{
_brightnessMin = min;
_isBrightnessSwitchOffMinimum = switchoff;
@@ -944,7 +944,7 @@ bool YeelightLight::setMusicMode(bool on, const QHostAddress &hostAddress, int p
return rc;
}
void YeelightLight::log(const int logLevel, const char* msg, const char* type, ...)
void YeelightLight::log(int logLevel, const char* msg, const char* type, ...)
{
if ( logLevel <= _debugLevel)
{