mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
add @Override annotations to device specific code
@Override is helpful to ensure that factoring can't cause "orphaned" methods
This commit is contained in:
committed by
José Rebelo
parent
0dd1abdb13
commit
5c439be493
+1
@@ -44,6 +44,7 @@ public class BandWPSeriesDeviceCoordinator extends AbstractBLEDeviceCoordinator
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatteryConfig[] getBatteryConfig(final GBDevice device) {
|
||||
BatteryConfig battery0 = new BatteryConfig(0, R.drawable.ic_earbuds_battery, R.string.left_earbud);
|
||||
BatteryConfig battery1 = new BatteryConfig(1, R.drawable.ic_earbuds_battery, R.string.right_earbud);
|
||||
|
||||
+2
@@ -214,6 +214,7 @@ public class AppsManagementActivity extends AbstractGBActivity {
|
||||
webView.loadUrl(url);
|
||||
|
||||
webView.setWebViewClient(new WebViewClient(){
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String weburl){
|
||||
//webView.loadUrl("javascript:showToast('WebView in Espruino')");
|
||||
}
|
||||
@@ -262,6 +263,7 @@ public class AppsManagementActivity extends AbstractGBActivity {
|
||||
|
||||
});
|
||||
webView.setDownloadListener(new DownloadListener() {
|
||||
@Override
|
||||
public void onDownloadStart(String url, String userAgent,
|
||||
String contentDisposition, String mimetype,
|
||||
long contentLength) {
|
||||
|
||||
+2
@@ -38,11 +38,13 @@ public class FemometerVinca2SampleProvider extends AbstractTimeSampleProvider<Fe
|
||||
return getSession().getFemometerVinca2TemperatureSampleDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getTimestampSampleProperty() {
|
||||
return FemometerVinca2TemperatureSampleDao.Properties.Timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return FemometerVinca2TemperatureSampleDao.Properties.DeviceId;
|
||||
|
||||
+3
@@ -50,6 +50,7 @@ public class HPlusHealthSampleProvider extends AbstractSampleProvider<HPlusHealt
|
||||
super(device, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityKind normalizeType(int rawType) {
|
||||
switch (rawType) {
|
||||
case HPlusDataRecord.TYPE_DAY_SLOT:
|
||||
@@ -63,6 +64,7 @@ public class HPlusHealthSampleProvider extends AbstractSampleProvider<HPlusHealt
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int toRawActivityKind(ActivityKind activityKind) {
|
||||
switch (activityKind) {
|
||||
case DEEP_SLEEP:
|
||||
@@ -139,6 +141,7 @@ public class HPlusHealthSampleProvider extends AbstractSampleProvider<HPlusHealt
|
||||
}
|
||||
|
||||
Collections.sort(samples, new Comparator<HPlusHealthActivitySample>() {
|
||||
@Override
|
||||
public int compare(HPlusHealthActivitySample one, HPlusHealthActivitySample other) {
|
||||
return one.getTimestamp() - other.getTimestamp();
|
||||
}
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HuamiActivitySummaryParser.class);
|
||||
protected ActivitySummaryData summaryData = new ActivitySummaryData();
|
||||
|
||||
@Override
|
||||
public BaseActivitySummary parseBinaryData(BaseActivitySummary summary, final boolean forDetails) {
|
||||
Date startTime = summary.getStartTime();
|
||||
if (startTime == null) {
|
||||
|
||||
+1
@@ -598,6 +598,7 @@ public abstract class HuamiCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return !supportsCalendarEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsDebugLogs() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -65,6 +65,7 @@ public class AmazfitActive2Coordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ public class AmazfitActiveCoordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -79,6 +79,7 @@ public class AmazfitActiveEdgeCoordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -75,6 +75,7 @@ public class AmazfitBalanceCoordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -74,6 +74,7 @@ public class AmazfitCheetahProCoordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -81,6 +81,7 @@ public class AmazfitTRex3Coordinator extends ZeppOsCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -269,6 +269,7 @@ public abstract class HuaweiBRCoordinator extends AbstractBLClassicDeviceCoordin
|
||||
return huaweiCoordinator.getStressChartParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||
return huaweiCoordinator.getDeviceSpecificSettings(device);
|
||||
}
|
||||
|
||||
+1
@@ -278,6 +278,7 @@ public abstract class HuaweiLECoordinator extends AbstractBLEDeviceCoordinator i
|
||||
return huaweiCoordinator.getStressChartParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||
return huaweiCoordinator.getDeviceSpecificSettings(device);
|
||||
}
|
||||
|
||||
+1
@@ -241,6 +241,7 @@ public class FileDownloadService0A {
|
||||
super(paramsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseTlv() throws ParseException {
|
||||
isOk = this.tlv.getInteger(0x7f) == 0x000186A0;
|
||||
if (isOk) {
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
|
||||
public class BohemicSmartBraceletDeviceCoordinator extends LefunDeviceCoordinator {
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
// Since the Lefun coordinator overrides supports, we also need to
|
||||
return ".bohemic".equals(candidate.getName());
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
|
||||
public class VivitarHrBpMonitorActivityTrackerCoordinator extends LefunDeviceCoordinator {
|
||||
@Override
|
||||
public boolean supports(GBDeviceCandidate candidate) {
|
||||
// Since the Lefun coordinator overrides supports, we also need to
|
||||
return "IMP-2027".equals(candidate.getName());
|
||||
|
||||
+2
@@ -146,10 +146,12 @@ public class LenovoWatchPairingActivity extends AbstractGBActivity implements Bo
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBroadcastReceivers() {
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(LocalBroadcastManager.getInstance(this), pairingReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
}
|
||||
|
||||
+3
@@ -244,16 +244,19 @@ public class MiBandPairingActivity extends AbstractGBActivity implements Bonding
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBroadcastReceivers() {
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(LocalBroadcastManager.getInstance(this), pairingReceiver);
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(this, bondingReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
ContextCompat.registerReceiver(this, bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED), ContextCompat.RECEIVER_EXPORTED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return this;
|
||||
}
|
||||
|
||||
+2
@@ -37,11 +37,13 @@ public class MiScaleSampleProvider extends AbstractTimeSampleProvider<MiScaleWei
|
||||
return getSession().getMiScaleWeightSampleDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getTimestampSampleProperty() {
|
||||
return MiScaleWeightSampleDao.Properties.Timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return MiScaleWeightSampleDao.Properties.DeviceId;
|
||||
|
||||
+2
@@ -65,11 +65,13 @@ public class PebbleMisfitSampleProvider extends AbstractSampleProvider<PebbleMis
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getTimestampSampleProperty() {
|
||||
return PebbleMisfitSampleDao.Properties.Timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return PebbleMisfitSampleDao.Properties.DeviceId;
|
||||
|
||||
+2
@@ -249,11 +249,13 @@ public class PebblePairingActivity extends AbstractGBActivity implements Bonding
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterBroadcastReceivers() {
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(LocalBroadcastManager.getInstance(this), pairingReceiver);
|
||||
AndroidUtils.safeUnregisterBroadcastReceiver(this, bondingReceiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBroadcastReceivers() {
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
ContextCompat.registerReceiver(this, bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED), ContextCompat.RECEIVER_EXPORTED);
|
||||
|
||||
+2
@@ -142,6 +142,7 @@ public class PineTimeJFCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNavigation() {
|
||||
return true;
|
||||
}
|
||||
@@ -157,6 +158,7 @@ public class PineTimeJFCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
// nothing to delete, yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_transliteration,
|
||||
|
||||
+1
@@ -194,6 +194,7 @@ public class QHybridCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
* Returns the directory containing the watch app cache.
|
||||
* @throws IOException when the external files directory cannot be accessed
|
||||
*/
|
||||
@Override
|
||||
public File getAppCacheDir() throws IOException {
|
||||
return new File(FileUtils.getExternalFilesDir(), "qhybrid-app-cache");
|
||||
}
|
||||
|
||||
+2
-1
@@ -41,7 +41,6 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Parcel;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.EditTextPreference;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.MultiSelectListPreference;
|
||||
@@ -131,6 +130,7 @@ public class SonyHeadphonesSettingsCustomizer implements DeviceSpecificSettingsC
|
||||
final Preference ambientSoundLevel = handler.findPreference(PREF_SONY_AMBIENT_SOUND_LEVEL);
|
||||
|
||||
final Preference.OnPreferenceChangeListener ambientSoundControlPrefListener = new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
boolean isAmbientSoundEnabled = AmbientSoundControl.Mode.AMBIENT_SOUND.name().toLowerCase(Locale.getDefault()).equals(newVal);
|
||||
focusOnVoice.setEnabled(isAmbientSoundEnabled);
|
||||
@@ -162,6 +162,7 @@ public class SonyHeadphonesSettingsCustomizer implements DeviceSpecificSettingsC
|
||||
.setMessage(R.string.sony_anc_optimize_confirmation_description)
|
||||
.setIcon(R.drawable.ic_hearing)
|
||||
.setPositiveButton(R.string.start, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int whichButton) {
|
||||
handler.notifyPreferenceChanged(PREF_SONY_NOISE_OPTIMIZER_START);
|
||||
|
||||
|
||||
+6
@@ -258,18 +258,22 @@ public class SonyWena3Coordinator extends AbstractBLEDeviceCoordinator {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean supportsNotificationVibrationPatterns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNotificationVibrationRepetitionPatterns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNotificationLedPatterns() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNotificationPattern[] getNotificationVibrationPatterns() {
|
||||
return new AbstractNotificationPattern[] {
|
||||
VibrationKind.NONE, VibrationKind.BASIC,
|
||||
@@ -279,6 +283,7 @@ public class SonyWena3Coordinator extends AbstractBLEDeviceCoordinator {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNotificationPattern[] getNotificationVibrationRepetitionPatterns() {
|
||||
return new AbstractNotificationPattern[] {
|
||||
VibrationCount.ONCE, VibrationCount.TWICE, VibrationCount.THREE, VibrationCount.FOUR,
|
||||
@@ -286,6 +291,7 @@ public class SonyWena3Coordinator extends AbstractBLEDeviceCoordinator {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNotificationPattern[] getNotificationLedPatterns() {
|
||||
return new AbstractNotificationPattern[] {
|
||||
LedColor.NONE, LedColor.RED, LedColor.YELLOW, LedColor.GREEN,
|
||||
|
||||
+2
@@ -189,6 +189,7 @@ public class ControlActivity extends AbstractGBActivity implements JoystickView.
|
||||
public void periodicDataSender() {
|
||||
periodicDataSenderRunner = new CountDownTimer(Long.MAX_VALUE, 100) {
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
periodicDataSenderRunnerIsRunning = true;
|
||||
setLights();
|
||||
@@ -210,6 +211,7 @@ public class ControlActivity extends AbstractGBActivity implements JoystickView.
|
||||
create_intent_with_data();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
start();
|
||||
}
|
||||
|
||||
+1
@@ -96,6 +96,7 @@ public class JoystickView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent e) {
|
||||
if (v.equals(this)) {
|
||||
if (e.getAction() != MotionEvent.ACTION_UP) {
|
||||
|
||||
+1
@@ -141,6 +141,7 @@ public class WaspOSCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_transliteration
|
||||
|
||||
+1
@@ -195,6 +195,7 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsAppsManagement(final GBDevice device) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
@@ -261,6 +261,7 @@ public class BandWPSeriesDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendConfiguration(String config) {
|
||||
try {
|
||||
TransactionBuilder builder = performInitialized("sendConfig");
|
||||
|
||||
+1
-1
@@ -39,7 +39,6 @@ import nodomain.freeyourgadget.gadgetbridge.export.ActivityTrackExporter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.export.GPXExporter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityPoint;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryData;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityTrack;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
@@ -317,6 +316,7 @@ class BangleJSActivityTrack {
|
||||
private static void initializeTimeoutTask(GBDevice device, Context context) {
|
||||
|
||||
timeoutTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
signalFetchingEnded(device, context);
|
||||
LOG.warn(context.getString(R.string.busy_task_fetch_sports_details_interrupted));
|
||||
|
||||
+1
@@ -644,6 +644,7 @@ public class CasioGBX100DeviceSupport extends Casio2C2DSupport implements Shared
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
LOG.debug(key + " changed");
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,6 @@ import android.net.Uri;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol;
|
||||
@@ -52,6 +51,7 @@ public class PixooSupport extends AbstractSerialDeviceSupport {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new PixooProtocol(getDevice());
|
||||
}
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ public class EarFunDeviceSupport extends AbstractHeadphoneDeviceSupport {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new EarFunProtocol(getDevice());
|
||||
}
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public class EarFunIOThread extends BtClassicIoThread {
|
||||
public static final UUID GAIA_SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
|
||||
private static final UUID GAIA_UUID = UUID.fromString("00001107-D102-11E1-9B23-00025B00A5A5");
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return GAIA_SPP_UUID;
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol;
|
||||
|
||||
public class EarFunAirPro4DeviceSupport extends EarFunDeviceSupport {
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new EarFunAirPro4Protocol(getDevice());
|
||||
}
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol;
|
||||
|
||||
public class EarFunAirSDeviceSupport extends EarFunDeviceSupport {
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new EarFunAirSProtocol(getDevice());
|
||||
}
|
||||
|
||||
+6
@@ -163,14 +163,17 @@ public class Equalizer {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPresetName() {
|
||||
return presetName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocalizedPresetName() {
|
||||
return localizedPresetName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getSettings() {
|
||||
return settings;
|
||||
}
|
||||
@@ -213,14 +216,17 @@ public class Equalizer {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPresetName() {
|
||||
return presetName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocalizedPresetName() {
|
||||
return localizedPresetName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class GalaxyBudsDeviceSupport extends AbstractHeadphoneDeviceSupport {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new GalaxyBudsProtocol(getDevice());
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public class GalaxyBudsIOThread extends BtClassicIoThread {
|
||||
private final GalaxyBudsProtocol galaxyBudsProtocol;
|
||||
private final GBDevice gbDevice;
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
if (gbDevice.getType().equals(DeviceType.GALAXY_BUDS)) {
|
||||
|
||||
+1
@@ -66,6 +66,7 @@ public class FileTransferHandler implements MessageHandler {
|
||||
return upload.getCurrentlyUploading() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GFDIMessage handle(GFDIMessage message) {
|
||||
if (message instanceof DownloadRequestStatusMessage)
|
||||
download.processDownloadRequestStatusMessage((DownloadRequestStatusMessage) message);
|
||||
|
||||
+1
@@ -161,6 +161,7 @@ public class NotificationsHandler implements MessageHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GFDIMessage handle(GFDIMessage message) {
|
||||
if (!enabled)
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -56,7 +56,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.DateTimeUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarEvent;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.calendar.CalendarManager;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.preferences.DevicePrefs;
|
||||
|
||||
public class ProtocolBufferHandler implements MessageHandler {
|
||||
|
||||
@@ -82,6 +81,7 @@ public class ProtocolBufferHandler implements MessageHandler {
|
||||
return lastProtobufRequestId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtobufMessage handle(GFDIMessage protobufMessage) {
|
||||
if (protobufMessage instanceof ProtobufMessage) {
|
||||
return processIncoming((ProtobufMessage) protobufMessage);
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public class BaseTypeByte implements BaseTypeInterface {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ public class BaseTypeDouble implements BaseTypeInterface {
|
||||
this.invalid = Double.longBitsToDouble(0xFFFFFFFFFFFFFFFFL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ public class BaseTypeFloat implements BaseTypeInterface {
|
||||
this.invalid = Float.intBitsToFloat(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ public class BaseTypeInt implements BaseTypeInterface {
|
||||
this.unsigned = unsigned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public class BaseTypeLong implements BaseTypeInterface {
|
||||
this.unsigned = unsigned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ public class BaseTypeShort implements BaseTypeInterface {
|
||||
this.unsigned = unsigned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getByteSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public class MusicControlMessage extends GFDIMessage {
|
||||
return new MusicControlMessage(garminMessage, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GBDeviceEvent> getGBDeviceEvent() {
|
||||
return Collections.singletonList(event);
|
||||
}
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ public class WeatherMessage extends GFDIMessage {
|
||||
return new WeatherMessage(format, latitude, longitude, hoursOfForecast, garminMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GBDeviceEvent> getGBDeviceEvent() {
|
||||
return Collections.singletonList(weatherRequestDeviceEvent);
|
||||
}
|
||||
|
||||
+1
@@ -85,6 +85,7 @@ public class ProtobufStatusMessage extends GFDIStatusMessage {
|
||||
return sendOutgoing;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
+1
@@ -264,6 +264,7 @@ class HPlusHandlerThread extends GBDeviceIoThread {
|
||||
if (mDaySlotRecords.size() > 0) {
|
||||
//Sort the samples
|
||||
Collections.sort(mDaySlotRecords, new Comparator<HPlusDataRecordDaySlot>() {
|
||||
@Override
|
||||
public int compare(HPlusDataRecordDaySlot one, HPlusDataRecordDaySlot other) {
|
||||
return one.timestamp - other.timestamp;
|
||||
}
|
||||
|
||||
+1
-2
@@ -19,8 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -71,6 +69,7 @@ public class HuamiActivityDetailsParser extends AbstractHuamiActivityDetailsPars
|
||||
activityTrack.setName(createActivityName(summary));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityTrack parse(byte[] bytes) throws GBException {
|
||||
int i = 0;
|
||||
try {
|
||||
|
||||
+4
@@ -438,6 +438,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport
|
||||
* @param precision
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public byte[] getTimeBytes(Calendar calendar, TimeUnit precision) {
|
||||
byte[] bytes;
|
||||
if (precision == TimeUnit.MINUTES) {
|
||||
@@ -3869,6 +3870,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport
|
||||
return new UpdateFirmwareOperation(uri, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMTU() {
|
||||
return mMTU;
|
||||
}
|
||||
@@ -3890,6 +3892,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivitySampleSize() {
|
||||
return mActivitySampleSize;
|
||||
}
|
||||
@@ -3898,6 +3901,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport
|
||||
return GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean("force_new_protocol", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HuamiCoordinator getCoordinator() {
|
||||
return (HuamiCoordinator) gbDevice.getDeviceCoordinator();
|
||||
}
|
||||
|
||||
+3
@@ -76,6 +76,7 @@ public class Mi2FirmwareInfo extends HuamiFirmwareInfo {
|
||||
super(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HuamiFirmwareType determineFirmwareType(byte[] bytes) {
|
||||
if (ArrayUtils.startsWith(bytes, FT_HEADER)) {
|
||||
if (bytes[FONT_TYPE_OFFSET] == 0x00 || bytes[FONT_TYPE_OFFSET] == (byte) 0xff) {
|
||||
@@ -91,10 +92,12 @@ public class Mi2FirmwareInfo extends HuamiFirmwareInfo {
|
||||
return HuamiFirmwareType.INVALID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGenerallyCompatibleWith(GBDevice device) {
|
||||
return isHeaderValid() && (device.getType() == DeviceType.MIBAND2 || device.getType() == DeviceType.MIBAND2_HRX);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<Integer, String> getCrcMap() {
|
||||
return crcToVersion;
|
||||
}
|
||||
|
||||
+1
@@ -152,6 +152,7 @@ public class UpdateFirmwareOperation2020 extends UpdateFirmwareOperation {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean sendFwInfo() {
|
||||
try {
|
||||
TransactionBuilder builder = performInitialized("send firmware info");
|
||||
|
||||
+1
@@ -138,6 +138,7 @@ public class ZeppOsWeatherHandler {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toJson() {
|
||||
return content;
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,6 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -78,6 +77,7 @@ public class ZeppOsAppsService extends AbstractZeppOsService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(final ZeppOsTransactionBuilder builder) {
|
||||
requestApps(builder);
|
||||
}
|
||||
|
||||
+6
@@ -109,24 +109,30 @@ public class ZeppOsFileTransferService extends AbstractZeppOsService {
|
||||
}
|
||||
|
||||
public interface UploadCallback extends Callback {
|
||||
@Override
|
||||
void onFileUploadFinish(final boolean success);
|
||||
|
||||
@Override
|
||||
void onFileUploadProgress(final int progress);
|
||||
|
||||
@Override
|
||||
default void onFileDownloadFinish(final String url, final String filename, final byte[] data) {
|
||||
LOG.error("Received unexpected file on upload callback for {}: url={} filename={} length={}", getClass(), url, filename, data.length);
|
||||
}
|
||||
}
|
||||
|
||||
public interface DownloadCallback extends Callback {
|
||||
@Override
|
||||
default void onFileUploadFinish(final boolean success) {
|
||||
LOG.error("Received unexpected upload finish on download callback for {}: success={}", getClass(), success);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onFileUploadProgress(final int progress) {
|
||||
LOG.error("Received unexpected upload progress on download callback for {}: progress={}", getClass(), progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
void onFileDownloadFinish(final String url, final String filename, final byte[] data);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -203,6 +203,7 @@ public class HuaweiBRSupport extends AbstractBTBRDeviceSupport {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
supportProvider.onTestNewFunction();
|
||||
}
|
||||
|
||||
+1
@@ -207,6 +207,7 @@ public class HuaweiLESupport extends AbstractBTLEDeviceSupport {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
supportProvider.onTestNewFunction();
|
||||
}
|
||||
|
||||
+1
@@ -196,6 +196,7 @@ public class HuaweiOTAManager {
|
||||
firmwareCheckHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
File fwFile = null;
|
||||
int lastProgress = 0;
|
||||
|
||||
+2
@@ -146,12 +146,14 @@ public class HuaweiStressCalibration {
|
||||
openOrClose((byte) 3);
|
||||
|
||||
this.measureTimer = new CountDownTimer(60000, 1000) {
|
||||
@Override
|
||||
public void onTick(long j) {
|
||||
if (callback != null) {
|
||||
callback.onProgress(j);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
stopMeasurements(false);
|
||||
}
|
||||
|
||||
+1
@@ -86,6 +86,7 @@ public class HuaweiP2PCalendarService extends HuaweiBaseP2PService {
|
||||
return (HuaweiP2PCalendarService) manager.getRegisteredService(HuaweiP2PCalendarService.MODULE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModule() {
|
||||
return HuaweiP2PCalendarService.MODULE;
|
||||
}
|
||||
|
||||
+1
@@ -120,6 +120,7 @@ public class SendNotificationOperation extends AbstractID115Operation {
|
||||
builder.queue(getQueue());
|
||||
}
|
||||
|
||||
@Override
|
||||
void handleResponse(byte[] data) {
|
||||
if (!isOperationRunning()) {
|
||||
LOG.error("ignoring notification because operation is not running. Data length: " + data.length);
|
||||
|
||||
+1
@@ -91,6 +91,7 @@ public abstract class Request extends AbstractBTLEOperation<LefunDeviceSupport>
|
||||
*
|
||||
* @return the class name
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
Class thisClass = getClass();
|
||||
while (thisClass.isAnonymousClass()) thisClass = thisClass.getSuperclass();
|
||||
|
||||
+2
@@ -644,6 +644,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
// init repeat handler
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Actions to do after repeatDelay seconds
|
||||
if (((isRinging) && (remainingRepeats > 0)) || ((isRinging) && (continuousRing))) {
|
||||
@@ -698,6 +699,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||
// repeat missed call notification
|
||||
final Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Actions to do after repeatDelay seconds
|
||||
if ((isMissedCall) && (remainingMissedRepeats > 0)) {
|
||||
|
||||
+1
@@ -43,6 +43,7 @@ public class LiveviewIoThread extends BtClassicIoThread {
|
||||
super(gbDevice, context, lvProtocol, lvSupport, lvBtAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected byte[] parseIncoming(InputStream inputStream) throws IOException {
|
||||
ByteArrayOutputStream msgStream = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ public class TestMi1AFirmwareInfo extends CompositeMiFirmwareInfo {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isHeaderValid() {
|
||||
return getFirst().isHeaderValid();
|
||||
}
|
||||
|
||||
+1
@@ -46,6 +46,7 @@ public class Ear1Support extends AbstractHeadphoneDeviceSupport {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GBDeviceProtocol createDeviceProtocol() {
|
||||
return new NothingProtocol(getDevice());
|
||||
}
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ public class NothingIOThread extends BtClassicIoThread {
|
||||
|
||||
private final NothingProtocol mNothingProtocol;
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return mNothingProtocol.UUID_DEVICE_CTRL;
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ public class OppoHeadphonesIoThread extends BtClassicIoThread {
|
||||
// Some devices will not reply to the first battery request, so we need to retry a few times
|
||||
private int batteryRetries = 0;
|
||||
private final Runnable batteryReqRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final int batteryCount = getDevice().getDeviceCoordinator().getBatteryCount(getDevice());
|
||||
boolean knownBattery = false;
|
||||
|
||||
+1
@@ -1302,6 +1302,7 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
return encodeMessage(ENDPOINT_PHONECONTROL, pebbleCmd, 0, parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeSetMusicState(byte state, int position, int playRate, byte shuffle, byte repeat) {
|
||||
if (mFwMajor < 3) {
|
||||
return null;
|
||||
|
||||
+6
-1
@@ -27,7 +27,6 @@ import android.content.Context;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
@@ -75,6 +74,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
connectToPebble(btDevice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
@@ -91,6 +91,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
@@ -108,6 +109,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
@@ -122,6 +124,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
@@ -148,6 +151,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor bluetoothGattDescriptor, int status) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
@@ -172,6 +176,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(gatt.getDevice())) {
|
||||
return;
|
||||
|
||||
+6
@@ -91,6 +91,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
mWaitWriteCompleteLatch = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCharacteristicReadRequest(BluetoothDevice device, int requestId, int offset, BluetoothGattCharacteristic characteristic) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(device)) {
|
||||
return;
|
||||
@@ -108,6 +109,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCharacteristicWriteRequest(BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic,
|
||||
boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(device)) {
|
||||
@@ -121,6 +123,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
mPebbleLESupport.handlePPoGATTPacket(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
|
||||
if (!mPebbleLESupport.isExpectedDevice(device)) {
|
||||
return;
|
||||
@@ -132,6 +135,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDescriptorWriteRequest(BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
|
||||
boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
|
||||
|
||||
@@ -150,6 +154,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceAdded(int status, BluetoothGattService service) {
|
||||
LOG.info("onServiceAdded() status = " + status + " service = " + service.getUuid());
|
||||
if (status == BluetoothGatt.GATT_SUCCESS && service.getUuid().equals(SERVER_SERVICE)) {
|
||||
@@ -169,6 +174,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback {
|
||||
mPebbleLESupport.setMTU(mtu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotificationSent(BluetoothDevice bluetoothDevice, int status) {
|
||||
|
||||
if (!mPebbleLESupport.isExpectedDevice(bluetoothDevice)) {
|
||||
|
||||
+1
@@ -37,6 +37,7 @@ public class PixelBudsAIOThread extends BtClassicIoThread {
|
||||
setUpdateState(GBDevice.State.INITIALIZED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return UUID_DEVICE_CTRL;
|
||||
|
||||
+1
@@ -370,6 +370,7 @@ public class FossilWatchAdapter extends WatchAdapter {
|
||||
queueWrite(new SaveCalibrationRequest());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vibrate(nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.misfit.PlayNotificationRequest.VibrationType vibration) {
|
||||
// queueWrite(new nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.misfit.PlayNotificationRequest(vibration, -1, -1));
|
||||
}
|
||||
|
||||
+2
@@ -362,10 +362,12 @@ public class MisfitWatchAdapter extends WatchAdapter {
|
||||
logger.debug(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActivityHand(double progress) {
|
||||
queueWrite(new SetCurrentStepCountRequest(Math.min((int) (1000000 * progress), 999999)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vibrate(PlayNotificationRequest.VibrationType vibration) {
|
||||
queueWrite(new PlayNotificationRequest(vibration, -1, -1));
|
||||
}
|
||||
|
||||
+2
-8
@@ -16,29 +16,22 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.application;
|
||||
|
||||
import android.content.pm.ApplicationInfo;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil_hr.FossilHRWatchAdapter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupAndGetRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.file.FileHandle;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupRequest.FILE_LOOKUP_ERROR;
|
||||
|
||||
public class ApplicationsListRequest extends FileLookupAndGetRequest{
|
||||
public ApplicationsListRequest(FossilHRWatchAdapter adapter) {
|
||||
super(FileHandle.APP_CODE, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFileData(byte[] fileData){
|
||||
ArrayList<ApplicationInformation> applicationInfos = new ArrayList<>();
|
||||
ByteBuffer buffer = ByteBuffer.wrap(fileData);
|
||||
@@ -73,6 +66,7 @@ public class ApplicationsListRequest extends FileLookupAndGetRequest{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFileLookupError(FILE_LOOKUP_ERROR error){
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ public class NotificationImage extends AssetFile {
|
||||
}
|
||||
|
||||
public byte[] getImageData() { return getFileData(); }
|
||||
@Override
|
||||
public String getFileName() { return super.getFileName(); }
|
||||
public int getWidth() { return width; }
|
||||
public int getHeight() { return height; }
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.Req
|
||||
public class GetVibrationStrengthRequest extends Request {
|
||||
public int strength = -1;
|
||||
|
||||
@Override
|
||||
public void handleResponse(BluetoothGattCharacteristic characteristic, byte[] value) {
|
||||
if (value.length < 4) {
|
||||
return;
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public class OTAEraseRequest extends Request {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UUID getRequestUUID(){
|
||||
return UUID.fromString("3dda0003-957f-7d4a-34a6-74696673696d");
|
||||
}
|
||||
|
||||
+5
@@ -126,22 +126,27 @@ public class Roidmi1Protocol extends RoidmiProtocol {
|
||||
return encodeCommand(COMMAND_SET_FREQUENCY, freq[0], freq[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeGetLedColor() {
|
||||
return encodeCommand(COMMAND_GET_COLOR, (byte) 0, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeGetFmFrequency() {
|
||||
return encodeCommand(COMMAND_GET_FREQUENCY, (byte) 0, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeGetVoltage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] packetHeader() {
|
||||
return PACKET_HEADER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] packetTrailer() {
|
||||
return PACKET_TRAILER;
|
||||
}
|
||||
|
||||
+1
@@ -145,6 +145,7 @@ public class Roidmi3Protocol extends RoidmiProtocol {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeGetVoltage() {
|
||||
return encodeCommand(COMMAND_GET_VOLTAGE);
|
||||
}
|
||||
|
||||
+1
-5
@@ -17,17 +17,12 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.roidmi;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.roidmi.RoidmiConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceIoThread;
|
||||
@@ -39,6 +34,7 @@ public class RoidmiSupport extends AbstractSerialDeviceSupport {
|
||||
private final Handler handler = new Handler();
|
||||
private int infoRequestTries = 0;
|
||||
private final Runnable infosRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
infoRequestTries += 1;
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphon
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.Message;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public class SonyHeadphonesIoThread extends BtClassicIoThread {
|
||||
@@ -55,6 +54,7 @@ public class SonyHeadphonesIoThread extends BtClassicIoThread {
|
||||
* TODO: Implement this in a more elegant way. Ideally, we should retry every command for which we didn't get an ACK.
|
||||
*/
|
||||
private final Runnable initSendRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// If we still haven't got any reply, re-send the init
|
||||
if (!mProtocol.hasProtocolImplementation()) {
|
||||
|
||||
+2
@@ -309,6 +309,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Request getButtonModes() {
|
||||
return new Request(
|
||||
PayloadTypeV1.AUTOMATIC_POWER_OFF_BUTTON_MODE_GET.getMessageType(),
|
||||
@@ -319,6 +320,7 @@ public class SonyProtocolImplV1 extends AbstractSonyProtocolImpl {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Request setButtonModes(final ButtonModes config) {
|
||||
return new Request(
|
||||
PayloadTypeV1.AUTOMATIC_POWER_OFF_BUTTON_MODE_SET.getMessageType(),
|
||||
|
||||
+2
@@ -60,6 +60,8 @@ abstract class LinearSamplePacketParser<Sample> extends SamplePacketParser<Sampl
|
||||
return new Date(startDate.getTime() + (long) msBetweenSamples * index);
|
||||
}
|
||||
|
||||
@Override
|
||||
abstract Sample takeSampleFromBuffer(ByteBuffer buffer);
|
||||
@Override
|
||||
abstract boolean canTakeSampleFromBuffer(ByteBuffer buffer);
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public class SoundcoreLibertyIOThread extends BtClassicIoThread {
|
||||
setUpdateState(GBDevice.State.INITIALIZED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return mUuidToConnect;
|
||||
|
||||
+1
@@ -59,6 +59,7 @@ public class SoundcoreMotion300IOThread extends BtClassicIoThread {
|
||||
handler.postDelayed(() -> write(protocol.encodeGetDeviceInfo()), 500);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return UUID.fromString("0cf12d31-fac3-4553-bd80-d6832e7b3135");
|
||||
|
||||
+1
-2
@@ -18,9 +18,7 @@ import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btclassic.BtClassicIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.soundcore.liberty.SoundcoreLibertyProtocol;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.AbstractSerialDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol;
|
||||
|
||||
public class SoundcoreQ30IOThread extends BtClassicIoThread {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SoundcoreQ30IOThread.class);
|
||||
@@ -45,6 +43,7 @@ public class SoundcoreQ30IOThread extends BtClassicIoThread {
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
protected UUID getUuidToConnect(@NonNull ParcelUuid[] uuids) {
|
||||
return UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ public abstract class AbstractMessage implements Message {
|
||||
|
||||
private List<WithingsStructure> dataStructures = new ArrayList<WithingsStructure>();
|
||||
|
||||
@Override
|
||||
public List<WithingsStructure> getDataStructures() {
|
||||
return Collections.unmodifiableList(dataStructures);
|
||||
}
|
||||
|
||||
+1
@@ -55,6 +55,7 @@ public class LiveWorkoutHandler implements IncomingMessageHandler {
|
||||
this.support = support;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
List<WithingsStructure> data = message.getDataStructures();
|
||||
if (data != null) {
|
||||
|
||||
+2
@@ -234,6 +234,7 @@ public class XiaomiBleSupport extends XiaomiConnectionSupport {
|
||||
this.mXiaomiSupport = xiaomiSupport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthSuccess() {
|
||||
characteristicCommandRead.reset();
|
||||
characteristicCommandWrite.reset();
|
||||
@@ -246,6 +247,7 @@ public class XiaomiBleSupport extends XiaomiConnectionSupport {
|
||||
this.commsSupport.setContext(device, adapter, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCommand(final String taskName, final XiaomiProto.Command command) {
|
||||
if (this.characteristicCommandWrite == null) {
|
||||
// Can sometimes happen in race conditions when connecting + receiving calendar event or weather updates
|
||||
|
||||
+1
@@ -287,6 +287,7 @@ public abstract class XiaomiSppPacketV2 {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XiaomiSppPacketV2 build() {
|
||||
return new DataPacket(this);
|
||||
}
|
||||
|
||||
+1
@@ -258,6 +258,7 @@ public class XiaomiSppSupport extends XiaomiConnectionSupport {
|
||||
// do not queue here, that's the job of the caller
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendDataChunk(final String taskName, final byte[] chunk, @Nullable final XiaomiCharacteristic.SendCallback callback) {
|
||||
LOG.debug("sendDataChunk(): encoded data chunk for task '{}': {}", taskName, GB.hexdump(chunk));
|
||||
this.commsSupport.createTransactionBuilder("send " + taskName)
|
||||
|
||||
+1
-3
@@ -17,8 +17,6 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.xiaomi;
|
||||
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FORCE_CONNECTION_TYPE;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
@@ -42,7 +40,6 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.xiaomi.XiaomiCoordinator;
|
||||
@@ -168,6 +165,7 @@ public class XiaomiSupport extends AbstractDeviceSupport {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContext(final GBDevice device, final BluetoothAdapter adapter, final Context context) {
|
||||
// FIXME unsetDynamicState unsets the fw version, which causes problems..
|
||||
if (device.getFirmwareVersion() != null) {
|
||||
|
||||
Reference in New Issue
Block a user