mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +01:00
Cycling sensor: renamed "bicycle" to "cycling"
This commit is contained in:
parent
7ce2786072
commit
3c6fdec414
@ -89,7 +89,7 @@ public class GBDaoGenerator {
|
||||
addAlarms(schema, user, device);
|
||||
addReminders(schema, user, device);
|
||||
addWorldClocks(schema, user, device);
|
||||
addBicycleSensorActivitySample(schema, user, device);
|
||||
addCyclingSensorActivitySample(schema, user, device);
|
||||
|
||||
Entity notificationFilter = addNotificationFilters(schema);
|
||||
|
||||
@ -391,14 +391,14 @@ public class GBDaoGenerator {
|
||||
return activitySample;
|
||||
}
|
||||
|
||||
private static Entity addBicycleSensorActivitySample(Schema schema, Entity user, Entity device){
|
||||
Entity activitySample = addEntity(schema, "BicycleSensorActivitySample");
|
||||
private static Entity addCyclingSensorActivitySample(Schema schema, Entity user, Entity device){
|
||||
Entity activitySample = addEntity(schema, "CyclingSensorActivitySample");
|
||||
activitySample.implementsSerializable();
|
||||
|
||||
addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
|
||||
|
||||
activitySample.addIntProperty("RevolutionCount");
|
||||
activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
|
||||
activitySample.addFloatProperty("Speed");
|
||||
return activitySample;
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,6 @@ public class CyclingDataFragment extends AbstractChartFragment{
|
||||
currentSpeedChart.setHighlightPerTapEnabled(true);
|
||||
currentSpeedChart.setCenterTextOffset(0, 0);
|
||||
|
||||
currentSpeedChart.
|
||||
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
|
@ -351,5 +351,5 @@ public class DeviceSettingsPreferenceConst {
|
||||
public static final String PREF_HOURLY_CHIME_ENABLE = "hourly_chime_enable";
|
||||
public static final String PREF_HOURLY_CHIME_START = "hourly_chime_start";
|
||||
public static final String PREF_HOURLY_CHIME_END = "hourly_chime_end";
|
||||
public static final String PREF_BICYCLE_SENSOR_PERSISTENCE_INTERVAL = "pref_bicycle_persistence_interval";
|
||||
public static final String PREF_CYCLING_SENSOR_PERSISTENCE_INTERVAL = "pref_cycling_persistence_interval";
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
|
||||
addPreferenceHandlerFor(PREF_OFFLINE_VOICE_RESPONSE_DURING_SCREEN_LIGHTING);
|
||||
addPreferenceHandlerFor(PREF_OFFLINE_VOICE_LANGUAGE);
|
||||
|
||||
addPreferenceHandlerFor(PREF_BICYCLE_SENSOR_PERSISTENCE_INTERVAL);
|
||||
addPreferenceHandlerFor(PREF_CYCLING_SENSOR_PERSISTENCE_INTERVAL);
|
||||
|
||||
addPreferenceHandlerFor("lock");
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.bicycle_sensor.coordinator;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.coordinator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@ -12,16 +12,16 @@ import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.bicycle_sensor.db.CyclingSensorActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.db.CyclingSensorActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.bicycle_sensor.support.CyclingSensorSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.cycling_sensor.support.CyclingSensorSupport;
|
||||
|
||||
public class BicycleSensorCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
public class CyclingSensorCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
@Override
|
||||
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
|
||||
|
||||
@ -30,7 +30,7 @@ public class BicycleSensorCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
@NonNull
|
||||
@Override
|
||||
public DeviceType getSupportedType(GBDeviceCandidate candidate) {
|
||||
if(candidate.supportsService(CyclingSensorSupport.UUID_BICYCLE_SENSOR_SERVICE)){
|
||||
if(candidate.supportsService(CyclingSensorSupport.UUID_CYCLING_SENSOR_SERVICE)){
|
||||
return getDeviceType();
|
||||
}
|
||||
return DeviceType.UNKNOWN;
|
||||
@ -38,7 +38,7 @@ public class BicycleSensorCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
|
||||
@Override
|
||||
public DeviceType getDeviceType() {
|
||||
return DeviceType.BICYCLE_SENSOR;
|
||||
return DeviceType.CYCLING_SENSOR;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -125,7 +125,7 @@ public class BicycleSensorCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_bicycle_sensor
|
||||
R.xml.devicesettings_cycling_sensor
|
||||
};
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.bicycle_sensor.db;
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.db;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -6,37 +6,37 @@ import androidx.annotation.Nullable;
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractSampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.BicycleSensorActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.BicycleSensorActivitySampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.CyclingSensorActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.CyclingSensorActivitySampleDao;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
|
||||
public class CyclingSensorActivitySampleProvider extends AbstractSampleProvider<BicycleSensorActivitySample> {
|
||||
public class CyclingSensorActivitySampleProvider extends AbstractSampleProvider<CyclingSensorActivitySample> {
|
||||
public CyclingSensorActivitySampleProvider(GBDevice device, DaoSession session) {
|
||||
super(device, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractDao<BicycleSensorActivitySample, ?> getSampleDao() {
|
||||
return getSession().getBicycleSensorActivitySampleDao();
|
||||
public AbstractDao<CyclingSensorActivitySample, ?> getSampleDao() {
|
||||
return getSession().getCyclingSensorActivitySampleDao();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Property getRawKindSampleProperty() {
|
||||
return BicycleSensorActivitySampleDao.Properties.RevolutionCount;
|
||||
return CyclingSensorActivitySampleDao.Properties.RevolutionCount;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected Property getTimestampSampleProperty() {
|
||||
return BicycleSensorActivitySampleDao.Properties.Timestamp;
|
||||
return CyclingSensorActivitySampleDao.Properties.Timestamp;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return BicycleSensorActivitySampleDao.Properties.DeviceId;
|
||||
return CyclingSensorActivitySampleDao.Properties.DeviceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,7 +55,7 @@ public class CyclingSensorActivitySampleProvider extends AbstractSampleProvider<
|
||||
}
|
||||
|
||||
@Override
|
||||
public BicycleSensorActivitySample createActivitySample() {
|
||||
return new BicycleSensorActivitySample();
|
||||
public CyclingSensorActivitySample createActivitySample() {
|
||||
return new CyclingSensorActivitySample();
|
||||
}
|
||||
}
|
@ -133,7 +133,7 @@ public enum DeviceType {
|
||||
SUPER_CARS(530, R.drawable.ic_device_supercars, R.drawable.ic_device_supercars_disabled, R.string.devicetype_super_cars),
|
||||
ASTEROIDOS(540, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_asteroidos),
|
||||
SOFLOW_SO6(550, R.drawable.ic_device_vesc, R.drawable.ic_device_vesc_disabled, R.string.devicetype_soflow_s06),
|
||||
BICYCLE_SENSOR(560, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.device_name_bicycle_sensor),
|
||||
CYCLING_SENSOR(560, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.device_name_cycling_sensor),
|
||||
TEST(1000, R.drawable.ic_device_default, R.drawable.ic_device_default_disabled, R.string.devicetype_test);
|
||||
|
||||
private final int key;
|
||||
|
@ -33,7 +33,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.asteroidos.AsteroidOSDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.bicycle_sensor.support.CyclingSensorSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.cycling_sensor.support.CyclingSensorSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.binary_sensor.BinarySensorSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.fitpro.FitProDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.banglejs.BangleJSDeviceSupport;
|
||||
@ -369,7 +369,7 @@ public class DeviceSupportFactory {
|
||||
return new ServiceDeviceSupport(new AsteroidOSDeviceSupport());
|
||||
case SOFLOW_SO6:
|
||||
return new ServiceDeviceSupport(new SoFlowSupport());
|
||||
case BICYCLE_SENSOR:
|
||||
case CYCLING_SENSOR:
|
||||
return new ServiceDeviceSupport(new CyclingSensorSupport());
|
||||
}
|
||||
return null;
|
||||
|
@ -1,10 +1,8 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.bicycle_sensor.support;
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.cycling_sensor.support;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.binary_sensor.BinarySensorSupport;
|
||||
|
||||
public class CyclingSensorBaseSupport extends AbstractBTLEDeviceSupport {
|
||||
public CyclingSensorBaseSupport(Logger logger) {
|
@ -1,4 +1,4 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.bicycle_sensor.support;
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.cycling_sensor.support;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.ActivityKind.TYPE_CYCLING;
|
||||
|
||||
@ -22,8 +22,8 @@ import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSett
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.bicycle_sensor.db.CyclingSensorActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.BicycleSensorActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.db.CyclingSensorActivitySampleProvider;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.CyclingSensorActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
||||
@ -87,9 +87,9 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
||||
}
|
||||
}
|
||||
|
||||
public final static UUID UUID_BICYCLE_SENSOR_SERVICE =
|
||||
public final static UUID UUID_CYCLING_SENSOR_SERVICE =
|
||||
UUID.fromString("00001816-0000-1000-8000-00805f9b34fb");
|
||||
public final static UUID UUID_BICYCLE_SENSOR_CSC_MEASUREMENT =
|
||||
public final static UUID UUID_CYCLING_SENSOR_CSC_MEASUREMENT =
|
||||
UUID.fromString("00002a5b-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CyclingSensorSupport.class);
|
||||
@ -107,19 +107,19 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
||||
public CyclingSensorSupport() {
|
||||
super(logger);
|
||||
|
||||
addSupportedService(UUID_BICYCLE_SENSOR_SERVICE);
|
||||
addSupportedService(UUID_CYCLING_SENSOR_SERVICE);
|
||||
addSupportedService(BatteryInfoProfile.SERVICE_UUID);
|
||||
}
|
||||
|
||||
private int getPersistenceInterval(){
|
||||
SharedPreferences deviceSpecificPrefs = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress());
|
||||
return deviceSpecificPrefs.getInt(DeviceSettingsPreferenceConst.PREF_BICYCLE_SENSOR_PERSISTENCE_INTERVAL, 60);
|
||||
return deviceSpecificPrefs.getInt(DeviceSettingsPreferenceConst.PREF_CYCLING_SENSOR_PERSISTENCE_INTERVAL, 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendConfiguration(String config) {
|
||||
switch (config){
|
||||
case DeviceSettingsPreferenceConst.PREF_BICYCLE_SENSOR_PERSISTENCE_INTERVAL:
|
||||
case DeviceSettingsPreferenceConst.PREF_CYCLING_SENSOR_PERSISTENCE_INTERVAL:
|
||||
persistenceInterval = getPersistenceInterval();
|
||||
break;
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
||||
builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext()));
|
||||
|
||||
BluetoothGattCharacteristic measurementCharacteristic =
|
||||
getCharacteristic(UUID_BICYCLE_SENSOR_CSC_MEASUREMENT);
|
||||
getCharacteristic(UUID_CYCLING_SENSOR_CSC_MEASUREMENT);
|
||||
|
||||
builder.add(new NotifyAction(measurementCharacteristic, true));
|
||||
|
||||
@ -177,7 +177,7 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
||||
try(DBHandler handler = GBApplication.acquireDB()) {
|
||||
DaoSession session = handler.getDaoSession();
|
||||
|
||||
BicycleSensorActivitySample sample = new BicycleSensorActivitySample();
|
||||
CyclingSensorActivitySample sample = new CyclingSensorActivitySample();
|
||||
CyclingSensorActivitySampleProvider sampleProvider =
|
||||
new CyclingSensorActivitySampleProvider(getDevice(), session);
|
||||
|
||||
@ -223,7 +223,7 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
||||
|
||||
@Override
|
||||
public boolean onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
|
||||
if(characteristic.getUuid().equals(UUID_BICYCLE_SENSOR_CSC_MEASUREMENT)){
|
||||
if(characteristic.getUuid().equals(UUID_CYCLING_SENSOR_CSC_MEASUREMENT)){
|
||||
handleMeasurementCharacteristic(characteristic);
|
||||
return true;
|
||||
}
|
@ -44,7 +44,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.asteroidos.AsteroidOSDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.bicycle_sensor.coordinator.BicycleSensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.cycling_sensor.coordinator.CyclingSensorCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr3pro.AmazfitGTR3ProCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4.AmazfitGTS4Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgts4mini.AmazfitGTS4MiniCoordinator;
|
||||
@ -372,7 +372,7 @@ public class DeviceHelper {
|
||||
result.add(new SuperCarsCoordinator());
|
||||
result.add(new AsteroidOSDeviceCoordinator());
|
||||
result.add(new SoFlowCoordinator());
|
||||
result.add(new BicycleSensorCoordinator());
|
||||
result.add(new CyclingSensorCoordinator());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -2089,5 +2089,5 @@
|
||||
<string name="fossil_hr_pairing_failed">Pairing with watch failed</string>
|
||||
<string name="fossil_hr_confirmation_skipped">Skipping on-device confirmation</string>
|
||||
<string name="fossil_hr_confirmation_timeout">Confirmation timeout, continuing</string>
|
||||
<string name="device_name_bicycle_sensor">Bicycle sensor</string>
|
||||
<string name="device_name_cycling_sensor">Cycling sensor</string>
|
||||
</resources>
|
||||
|
@ -8,6 +8,6 @@
|
||||
android:title="Persistence interval"
|
||||
android:summary="Interval in seconds when the current cycling data should be written to the database"
|
||||
android:icon="@drawable/ic_activity_biking"
|
||||
android:key="pref_bicycle_persistence_interval" />
|
||||
android:key="pref_cycling_persistence_interval" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user