mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-01-28 22:01:50 +00:00
[Linux] Add cross device setting
This commit is contained in:
committed by
Tim Gromeyer
parent
816992fd8a
commit
1c7bdf987c
@@ -30,6 +30,7 @@ class AirPodsTrayApp : public QObject {
|
||||
Q_PROPERTY(bool rightPodInEar READ isRightPodInEar NOTIFY primaryChanged)
|
||||
Q_PROPERTY(bool airpodsConnected READ areAirpodsConnected NOTIFY airPodsStatusChanged)
|
||||
Q_PROPERTY(int earDetectionBehavior READ earDetectionBehavior WRITE setEarDetectionBehavior NOTIFY earDetectionBehaviorChanged)
|
||||
Q_PROPERTY(bool crossDeviceEnabled READ crossDeviceEnabled WRITE setCrossDeviceEnabled NOTIFY crossDeviceEnabledChanged)
|
||||
|
||||
public:
|
||||
AirPodsTrayApp(bool debugMode)
|
||||
@@ -270,6 +271,20 @@ public slots:
|
||||
emit earDetectionBehaviorChanged(behavior);
|
||||
}
|
||||
|
||||
void setCrossDeviceEnabled(bool enabled)
|
||||
{
|
||||
if (CrossDevice.isEnabled == enabled)
|
||||
{
|
||||
LOG_INFO("Cross-device feature is already " << (enabled ? "enabled" : "disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
CrossDevice.isEnabled = enabled;
|
||||
saveCrossDeviceEnabled();
|
||||
connectToPhone();
|
||||
emit crossDeviceEnabledChanged(enabled);
|
||||
}
|
||||
|
||||
bool writePacketToSocket(const QByteArray &packet, const QString &logMessage)
|
||||
{
|
||||
if (socket && socket->isOpen())
|
||||
@@ -578,10 +593,8 @@ private slots:
|
||||
{
|
||||
char primary = data[6];
|
||||
char secondary = data[7];
|
||||
m_primaryInEar = primary == 0x00;
|
||||
m_secoundaryInEar = secondary == 0x00;
|
||||
m_primaryInEar = primary == 0x00;
|
||||
m_secoundaryInEar = secondary == 0x00;
|
||||
m_primaryInEar = data[6] == 0x00;
|
||||
m_secoundaryInEar = data[7] == 0x00;
|
||||
m_earDetectionStatus = QString("Primary: %1, Secondary: %2")
|
||||
.arg(getEarStatus(primary), getEarStatus(secondary));
|
||||
LOG_INFO("Ear detection status: " << m_earDetectionStatus);
|
||||
|
||||
Reference in New Issue
Block a user