mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-10 19:52:24 +00:00
Merge pull request #45 from tim-gromeyer/ear-detection-status-in.case
[Linux] Add "in case" as ear detection status
This commit is contained in:
@@ -568,6 +568,12 @@ public slots:
|
|||||||
notifyAndroidDevice();
|
notifyAndroidDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getEarStatus(char value)
|
||||||
|
{
|
||||||
|
return (value == 0x00) ? "In Ear" : (value == 0x01) ? "Out of Ear"
|
||||||
|
: "In case";
|
||||||
|
}
|
||||||
|
|
||||||
void parseData(const QByteArray &data) {
|
void parseData(const QByteArray &data) {
|
||||||
LOG_DEBUG("Received: " << data.toHex());
|
LOG_DEBUG("Received: " << data.toHex());
|
||||||
if (data.size() == 11 && data.startsWith(QByteArray::fromHex("0400040009000D"))) {
|
if (data.size() == 11 && data.startsWith(QByteArray::fromHex("0400040009000D"))) {
|
||||||
@@ -579,11 +585,10 @@ public slots:
|
|||||||
LOG_ERROR("Invalid noise control mode value received: " << mode);
|
LOG_ERROR("Invalid noise control mode value received: " << mode);
|
||||||
}
|
}
|
||||||
} else if (data.size() == 8 && data.startsWith(QByteArray::fromHex("040004000600"))) {
|
} else if (data.size() == 8 && data.startsWith(QByteArray::fromHex("040004000600"))) {
|
||||||
bool primaryInEar = data[6] == 0x00;
|
char primary = data[6];
|
||||||
bool secondaryInEar = data[7] == 0x00;
|
char secondary = data[7];
|
||||||
QString earDetectionStatus = QString("Primary: %1, Secondary: %2")
|
QString earDetectionStatus = QString("Primary: %1, Secondary: %2")
|
||||||
.arg(primaryInEar ? "In Ear" : "Out of Ear")
|
.arg(getEarStatus(primary), getEarStatus(secondary));
|
||||||
.arg(secondaryInEar ? "In Ear" : "Out of Ear");
|
|
||||||
LOG_INFO("Ear detection status: " << earDetectionStatus);
|
LOG_INFO("Ear detection status: " << earDetectionStatus);
|
||||||
emit earDetectionStatusChanged(earDetectionStatus);
|
emit earDetectionStatusChanged(earDetectionStatus);
|
||||||
} else if (data.size() == 22 && data.startsWith(QByteArray::fromHex("040004000400"))) {
|
} else if (data.size() == 22 && data.startsWith(QByteArray::fromHex("040004000400"))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user