mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-04-22 22:29:30 +00:00
Show more info
This commit is contained in:
@@ -78,13 +78,13 @@ void BleManager::onDeviceDiscovered(const QBluetoothDeviceInfo &info)
|
|||||||
int rightNibble = areValuesFlipped ? podsBatteryByte & 0x0F : (podsBatteryByte >> 4) & 0x0F;
|
int rightNibble = areValuesFlipped ? podsBatteryByte & 0x0F : (podsBatteryByte >> 4) & 0x0F;
|
||||||
deviceInfo.leftPodBattery = (leftNibble == 15) ? -1 : leftNibble * 10;
|
deviceInfo.leftPodBattery = (leftNibble == 15) ? -1 : leftNibble * 10;
|
||||||
deviceInfo.rightPodBattery = (rightNibble == 15) ? -1 : rightNibble * 10;
|
deviceInfo.rightPodBattery = (rightNibble == 15) ? -1 : rightNibble * 10;
|
||||||
int caseNibble = (flagsAndCaseBattery >> 4) & 0x0F;
|
int caseNibble = (flagsAndCaseBattery >> 4) & 0x0F; // Extracts upper nibble
|
||||||
deviceInfo.caseBattery = (caseNibble == 15) ? -1 : caseNibble * 10;
|
deviceInfo.caseBattery = (caseNibble == 15) ? -1 : caseNibble * 10;
|
||||||
|
|
||||||
// Parse charging statuses from flags (lower 4 bits of data[7])
|
// Parse charging statuses from flags (lower 4 bits of data[7])
|
||||||
quint8 flags = flagsAndCaseBattery & 0x0F;
|
quint8 flags = flagsAndCaseBattery & 0x0F; // Extracts lower nibble
|
||||||
deviceInfo.leftCharging = areValuesFlipped ? (flags & 0x02) != 0 : (flags & 0x01) != 0; // Bit 1 or 0
|
deviceInfo.leftCharging = areValuesFlipped ? (flags & 0x01) != 0 : (flags & 0x02) != 0; //
|
||||||
deviceInfo.rightCharging = areValuesFlipped ? (flags & 0x01) != 0 : (flags & 0x02) != 0; // Bit 0 or 1
|
deviceInfo.rightCharging = areValuesFlipped ? (flags & 0x02) != 0 : (flags & 0x01) != 0; //
|
||||||
deviceInfo.caseCharging = (flags & 0x04) != 0; // Keeping original bit 1 for consistency
|
deviceInfo.caseCharging = (flags & 0x04) != 0; // Keeping original bit 1 for consistency
|
||||||
|
|
||||||
// Additional status flags from status byte (data[5])
|
// Additional status flags from status byte (data[5])
|
||||||
|
|||||||
@@ -285,21 +285,25 @@ void BleScanner::onDeviceSelected()
|
|||||||
.arg(statusBinary));
|
.arg(statusBinary));
|
||||||
|
|
||||||
// Lid State enum handling
|
// Lid State enum handling
|
||||||
|
QString lidStateStr;
|
||||||
|
|
||||||
switch (device.lidState)
|
switch (device.lidState)
|
||||||
{
|
{
|
||||||
case DeviceInfo::LidState::OPEN:
|
case DeviceInfo::LidState::OPEN:
|
||||||
lidStateLabel->setText("Open");
|
lidStateStr.append("Open");
|
||||||
break;
|
break;
|
||||||
case DeviceInfo::LidState::CLOSED:
|
case DeviceInfo::LidState::CLOSED:
|
||||||
lidStateLabel->setText("Closed");
|
lidStateStr.append("Closed");
|
||||||
break;
|
break;
|
||||||
case DeviceInfo::LidState::NOT_IN_CASE:
|
case DeviceInfo::LidState::NOT_IN_CASE:
|
||||||
lidStateLabel->setText("Not in Case");
|
lidStateStr.append("Not in Case");
|
||||||
break;
|
break;
|
||||||
case DeviceInfo::LidState::UNKNOWN:
|
case DeviceInfo::LidState::UNKNOWN:
|
||||||
lidStateLabel->setText("Unknown");
|
lidStateStr.append("Unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
lidStateStr.append(" (0x" + QString::number(device.lidOpenCounter, 16).toUpper() + " = " + QString::number(device.lidOpenCounter) + ")");
|
||||||
|
lidStateLabel->setText(lidStateStr);
|
||||||
|
|
||||||
QString colorName = getColorName(device.deviceColor);
|
QString colorName = getColorName(device.deviceColor);
|
||||||
colorLabel->setText(colorName + " (" + QString::number(device.deviceColor) + ")");
|
colorLabel->setText(colorName + " (" + QString::number(device.deviceColor) + ")");
|
||||||
|
|||||||
Reference in New Issue
Block a user