File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,12 @@ public slots:
568568 notifyAndroidDevice ();
569569 }
570570
571+ QString getEarStatus (char value)
572+ {
573+ return (value == 0x00 ) ? " In Ear" : (value == 0x01 ) ? " Out of Ear"
574+ : " In case" ;
575+ }
576+
571577 void parseData (const QByteArray &data) {
572578 LOG_DEBUG (" Received: " << data.toHex ());
573579 if (data.size () == 11 && data.startsWith (QByteArray::fromHex (" 0400040009000D" ))) {
@@ -579,11 +585,10 @@ public slots:
579585 LOG_ERROR (" Invalid noise control mode value received: " << mode);
580586 }
581587 } else if (data.size () == 8 && data.startsWith (QByteArray::fromHex (" 040004000600" ))) {
582- bool primaryInEar = data[6 ] == 0x00 ;
583- bool secondaryInEar = data[7 ] == 0x00 ;
588+ char primary = data[6 ];
589+ char secondary = data[7 ];
584590 QString earDetectionStatus = QString (" Primary: %1, Secondary: %2" )
585- .arg (primaryInEar ? " In Ear" : " Out of Ear" )
586- .arg (secondaryInEar ? " In Ear" : " Out of Ear" );
591+ .arg (getEarStatus (primary), getEarStatus (secondary));
587592 LOG_INFO (" Ear detection status: " << earDetectionStatus);
588593 emit earDetectionStatusChanged (earDetectionStatus);
589594 } else if (data.size () == 22 && data.startsWith (QByteArray::fromHex (" 040004000400" ))) {
You can’t perform that action at this time.
0 commit comments