Meross: improve datetime performance
This commit is contained in:
parent
6693e6c509
commit
ec4a987fea
@ -124,7 +124,7 @@ void IntegrationPluginMeross::confirmPairing(ThingPairingInfo *info, const QStri
|
|||||||
|
|
||||||
QByteArray nonce = QUuid::createUuid().toString().remove(QRegExp("[{}-]")).left(16).toUtf8();
|
QByteArray nonce = QUuid::createUuid().toString().remove(QRegExp("[{}-]")).left(16).toUtf8();
|
||||||
QByteArray initKey = "23x17ahWarFH6w29";
|
QByteArray initKey = "23x17ahWarFH6w29";
|
||||||
QByteArray timestamp = QByteArray::number(QDateTime::currentDateTime().toMSecsSinceEpoch() / 1000);
|
QByteArray timestamp = QByteArray::number(QDateTime::currentMSecsSinceEpoch() / 1000);
|
||||||
QByteArray signature = initKey + timestamp + nonce + encodedParams;
|
QByteArray signature = initKey + timestamp + nonce + encodedParams;
|
||||||
|
|
||||||
signature = QCryptographicHash::hash(signature, QCryptographicHash::Md5).toHex();
|
signature = QCryptographicHash::hash(signature, QCryptographicHash::Md5).toHex();
|
||||||
@ -374,7 +374,7 @@ QNetworkReply* IntegrationPluginMeross::request(Thing *thing, const QString &nam
|
|||||||
QByteArray key = m_keys.value(thing);
|
QByteArray key = m_keys.value(thing);
|
||||||
|
|
||||||
QString messageId = QUuid::createUuid().toString().remove(QRegExp("[{}-]"));
|
QString messageId = QUuid::createUuid().toString().remove(QRegExp("[{}-]"));
|
||||||
qulonglong timestamp = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
qulonglong timestamp = QDateTime::currentMSecsSinceEpoch();
|
||||||
quint16 timestampMs = timestamp % 1000;
|
quint16 timestampMs = timestamp % 1000;
|
||||||
timestamp = timestamp / 1000;
|
timestamp = timestamp / 1000;
|
||||||
QByteArray signature = QCryptographicHash::hash(QString(messageId + key + QString::number(timestamp)).toUtf8(), QCryptographicHash::Md5).toHex();
|
QByteArray signature = QCryptographicHash::hash(QString(messageId + key + QString::number(timestamp)).toUtf8(), QCryptographicHash::Md5).toHex();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user