diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java
index 49a9f3ac4..f74bf0496 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCapabilities.java
@@ -24,6 +24,7 @@ public enum SonyHeadphonesCapabilities {
PowerOffFromPhone,
AmbientSoundControl,
AmbientSoundControl2,
+ NoNoiseCancelling,
WindNoiseReduction,
SpeakToChatEnabled,
SpeakToChatConfig,
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java
index 8172f4e63..ce55b01af 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/SonyHeadphonesCoordinator.java
@@ -119,6 +119,8 @@ public abstract class SonyHeadphonesCoordinator extends AbstractBLClassicDeviceC
if (supports(SonyHeadphonesCapabilities.AmbientSoundControl) || supports(SonyHeadphonesCapabilities.AmbientSoundControl2)) {
if (supports(SonyHeadphonesCapabilities.WindNoiseReduction)) {
deviceSpecificSettings.addRootScreen(R.xml.devicesettings_sony_headphones_ambient_sound_control_wind_noise_reduction);
+ } else if (supports(SonyHeadphonesCapabilities.NoNoiseCancelling)) {
+ deviceSpecificSettings.addRootScreen(R.xml.devicesettings_sony_headphones_ambient_sound_control_no_noise_cancelling);
} else {
deviceSpecificSettings.addRootScreen(R.xml.devicesettings_sony_headphones_ambient_sound_control);
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC510Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC510Coordinator.java
new file mode 100644
index 000000000..54b45ee55
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/sony/headphones/coordinators/SonyWFC510Coordinator.java
@@ -0,0 +1,63 @@
+/* Copyright (C) 2024 Marcel
+
+ This file is part of Gadgetbridge.
+
+ Gadgetbridge is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gadgetbridge is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see . */
+package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCapabilities;
+import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
+
+public class SonyWFC510Coordinator extends SonyHeadphonesCoordinator {
+
+ @Override
+ protected Pattern getSupportedDeviceName() {
+ return Pattern.compile("WF-C510");
+ }
+
+ @Override
+ public List getCapabilities() {
+ return Arrays.asList(
+ SonyHeadphonesCapabilities.BatteryDual2,
+ SonyHeadphonesCapabilities.BatteryCase,
+ SonyHeadphonesCapabilities.AmbientSoundControl2,
+ SonyHeadphonesCapabilities.NoNoiseCancelling,
+ SonyHeadphonesCapabilities.EqualizerSimple,
+ SonyHeadphonesCapabilities.EqualizerWithCustomBands,
+ SonyHeadphonesCapabilities.AudioUpsampling,
+ SonyHeadphonesCapabilities.ButtonModesLeftRight,
+ SonyHeadphonesCapabilities.PowerOffFromPhone
+ );
+ }
+
+ @Override
+ public int getDeviceNameResource() {
+ return R.string.devicetype_sony_wf_c510;
+ }
+
+ @Override
+ public int getDefaultIconResource() {
+ return R.drawable.ic_device_galaxy_buds;
+ }
+
+ @Override
+ public int getDisabledIconResource() {
+ return R.drawable.ic_device_galaxy_buds_disabled;
+ }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
index 3ce006b0e..236b101a2 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java
@@ -252,6 +252,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWF1000XM4Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWF1000XM5Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWFC500Coordinator;
+import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWFC510Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWFC700NCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWFSP800NCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWH1000XM2Coordinator;
@@ -524,6 +525,7 @@ public enum DeviceType {
SONY_WH_1000XM5(SonyWH1000XM5Coordinator.class),
SONY_WF_1000XM5(SonyWF1000XM5Coordinator.class),
SONY_WF_C500(SonyWFC500Coordinator.class),
+ SONY_WF_C510(SonyWFC510Coordinator.class),
SONY_WF_C700N(SonyWFC700NCoordinator.class),
SOUNDCORE_LIBERTY3_PRO(SoundcoreLiberty3ProCoordinator.class),
SOUNDCORE_LIBERTY4_NC(SoundcoreLiberty4NCCoordinator.class),
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java
index 0dcc8bd38..ba3ada3c4 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/sony/headphones/protocol/impl/v2/SonyProtocolImplV2.java
@@ -545,17 +545,18 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
@Override
public List extends GBDeviceEvent> handleAmbientSoundControl(final byte[] payload) {
- if (payload.length != 8 && payload.length != 7) {
+ if (payload.length < 6 || payload.length > 8) {
LOG.warn("Unexpected payload length {}", payload.length);
return Collections.emptyList();
}
- if (payload[1] != 0x15 && payload[1] != 0x17) {
+ if (payload[1] != 0x15 && payload[1] != 0x17 && payload[1] != 0x22) {
LOG.warn("Not ambient sound control, ignoring {}", payload[1]);
return Collections.emptyList();
}
final boolean includesWindNoiseReduction = payload[1] == 0x17 && payload.length > 7;
+ final boolean noNoiseCancelling = payload[1] == 0x22;
AmbientSoundControl.Mode mode = null;
@@ -574,6 +575,8 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
mode = AmbientSoundControl.Mode.AMBIENT_SOUND;
}
}
+ } else if (noNoiseCancelling) {
+ mode = AmbientSoundControl.Mode.AMBIENT_SOUND;
} else {
if (payload[4] == (byte) 0x00) {
mode = AmbientSoundControl.Mode.NOISE_CANCELLING;
@@ -588,7 +591,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
return Collections.emptyList();
}
- int i = includesWindNoiseReduction ? 6 : 5;
+ int i = payload.length - 2;
final Boolean focusOnVoice = booleanFromByte(payload[i]);
if (focusOnVoice == null) {
LOG.warn("Unknown focus on voice mode {}", String.format("%02x", payload[i]));
@@ -1078,7 +1081,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
case OFF:
return (byte) 0xff;
case AMBIENT_SOUND_CONTROL:
- return (byte) (supportsWindNoiseCancelling() ? 0x35 : 0x00); // Seems to be the only one that differs?
+ return (byte) (supportsWindNoiseCancelling() || getCoordinator().supports(SonyHeadphonesCapabilities.NoNoiseCancelling) ? 0x35 : 0x00); // Seems to be the only one that differs?
case PLAYBACK_CONTROL:
return (byte) 0x20;
case VOLUME_CONTROL:
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 52058317e..9e2875dda 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -3560,6 +3560,16 @@
- ambient_sound
+
+ - @string/sony_ambient_sound_off
+ - @string/sony_ambient_sound_ambient_sound
+
+
+
+ - off
+ - ambient_sound
+
+
- @string/automatic
- @string/sony_protocol_v1
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1f125c88f..38a8513df 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1844,6 +1844,7 @@
Sony WF-1000XM4
Sony WF-1000XM5
Sony WF-C500
+ Sony WF-C510
Sony WF-C700N
Sony WI-C100
Sony WI-SP600N
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_no_noise_cancelling.xml b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_no_noise_cancelling.xml
new file mode 100644
index 000000000..19d00f0ef
--- /dev/null
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_no_noise_cancelling.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+