1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-24 17:45:50 +01:00

Sony WF-1000XM5: Experimental support

This commit is contained in:
José Rebelo 2023-09-28 23:49:19 +01:00
parent 25af69733f
commit 5f05a0d88f
8 changed files with 97 additions and 4 deletions

View File

@ -109,7 +109,7 @@ vendor's servers.
- LinkBuds S
- WH-1000XM2, WH-1000XM3, WH-1000XM4, WH-1000XM5
- WF-SP800N
- WF-1000XM3, WF-1000XM4
- WF-1000XM3, WF-1000XM4, WF-1000XM5 (experimental)
- [Wena 3](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Sony-Wena-3)
- Teclast H10, H30
- TLW64

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 José Rebelo
/* Copyright (C) 2023 José Rebelo
This file is part of Gadgetbridge.

View File

@ -0,0 +1,89 @@
/* Copyright (C) 2022 José Rebelo
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 <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators;
import androidx.annotation.NonNull;
import java.util.Arrays;
import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCapabilities;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
public class SonyWF1000XM5Coordinator extends SonyHeadphonesCoordinator {
@NonNull
@Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
if (candidate.getName().contains("WF-1000XM5")) {
return DeviceType.SONY_WF_1000XM5;
}
return DeviceType.UNKNOWN;
}
@Override
public BatteryConfig[] getBatteryConfig() {
final BatteryConfig battery1 = new BatteryConfig(0, R.drawable.ic_tws_case, R.string.battery_case);
final BatteryConfig battery2 = new BatteryConfig(1, R.drawable.ic_galaxy_buds_l, R.string.left_earbud);
final BatteryConfig battery3 = new BatteryConfig(2, R.drawable.ic_galaxy_buds_r, R.string.right_earbud);
return new BatteryConfig[]{battery1, battery2, battery3};
}
@Override
public List<SonyHeadphonesCapabilities> getCapabilities() {
return Arrays.asList(
SonyHeadphonesCapabilities.BatteryDual,
SonyHeadphonesCapabilities.BatteryCase,
SonyHeadphonesCapabilities.AmbientSoundControl,
SonyHeadphonesCapabilities.WindNoiseReduction,
SonyHeadphonesCapabilities.EqualizerSimple,
SonyHeadphonesCapabilities.AudioUpsampling,
SonyHeadphonesCapabilities.ButtonModesLeftRight,
SonyHeadphonesCapabilities.PauseWhenTakenOff,
SonyHeadphonesCapabilities.AutomaticPowerOffWhenTakenOff
);
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_sony_wf_1000xm5;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_disabled;
}
@Override
public boolean isExperimental() {
// Ambient Sound Control is not 100% working
// Volume control from headphones is not working?
return true;
}
}

View File

@ -122,6 +122,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.soflow.SoFlowCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyLinkBudsSCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWF1000XM3Coordinator;
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.SonyWFSP800NCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWH1000XM2Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWH1000XM3Coordinator;
@ -254,6 +255,7 @@ public enum DeviceType {
SONY_WF_1000XM4(435, SonyWF1000XM4Coordinator.class),
SONY_LINKBUDS_S(436, SonyLinkBudsSCoordinator.class),
SONY_WH_1000XM5(437, SonyWH1000XM5Coordinator.class),
SONY_WF_1000XM5(438, SonyWF1000XM5Coordinator.class),
BOSE_QC35(440, QC35Coordinator.class),
VESC_NRF(500, VescCoordinator.class),
VESC_HM10(501, VescCoordinator.class),

View File

@ -118,6 +118,7 @@ public class SonyHeadphonesProtocol extends GBDeviceProtocol {
case 0x03:
// LinkBuds S 2.0.2: 01:00:03:00:00:07:00:00
// WH-1000XM5 1.1.3: 01:00:03:00:00:00:00:00
// WF-1000XM5 2.0.1: 01:00:03:00:10:04:00:00
protocolImpl = new SonyProtocolImplV3(getDevice());
break;
default:

View File

@ -460,7 +460,7 @@ public class SonyProtocolImplV2 extends SonyProtocolImplV1 {
final AmbientSoundControl ambientSoundControl = new AmbientSoundControl(mode, focusOnVoice, ambientSound);
LOG.warn("Ambient sound control: {}", ambientSoundControl);
LOG.debug("Ambient sound control: {}", ambientSoundControl);
final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences()
.withPreferences(ambientSoundControl.toPreferences());

View File

@ -285,7 +285,7 @@ public class SonyProtocolImplV3 extends SonyProtocolImplV2 {
final AmbientSoundControl ambientSoundControl = new AmbientSoundControl(mode, focusOnVoice, ambientSound);
LOG.warn("Ambient sound control: {}", ambientSoundControl);
LOG.debug("Ambient sound control: {}", ambientSoundControl);
final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences()
.withPreferences(ambientSoundControl.toPreferences());

View File

@ -1367,6 +1367,7 @@
<string name="devicetype_sony_wf_sp800n">Sony WF-SP800N</string>
<string name="devicetype_sony_wf_1000xm3">Sony WF-1000XM3</string>
<string name="devicetype_sony_wf_1000xm4">Sony WF-1000XM4</string>
<string name="devicetype_sony_wf_1000xm5">Sony WF-1000XM5</string>
<string name="devicetype_sony_linkbuds_s">Sony LinkBuds S</string>
<string name="devicetype_binary_sensor">Binary sensor</string>
<string name="choose_auto_export_location">Choose export location</string>