mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Identify device in realtime samples
This commit is contained in:
parent
aaff8db9f4
commit
b40749d53c
@ -77,9 +77,11 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -88,11 +90,9 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.discovery.DiscoveryActivityV2;
|
import nodomain.freeyourgadget.gadgetbridge.activities.discovery.DiscoveryActivityV2;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
|
import nodomain.freeyourgadget.gadgetbridge.model.RecordedDataTypes;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
@ -135,7 +135,8 @@ public class ControlCenterv2 extends AppCompatActivity
|
|||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
case DeviceService.ACTION_REALTIME_SAMPLES:
|
case DeviceService.ACTION_REALTIME_SAMPLES:
|
||||||
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
final GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
|
handleRealtimeSample(device, intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
||||||
break;
|
break;
|
||||||
case ACTION_REQUEST_PERMISSIONS:
|
case ACTION_REQUEST_PERMISSIONS:
|
||||||
checkAndRequestPermissions();
|
checkAndRequestPermissions();
|
||||||
@ -153,22 +154,22 @@ public class ControlCenterv2 extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
private boolean pesterWithPermissions = true;
|
private boolean pesterWithPermissions = true;
|
||||||
private ActivitySample currentHRSample;
|
private final Map<GBDevice, ActivitySample> currentHRSample = new HashMap<>();
|
||||||
|
|
||||||
public ActivitySample getCurrentHRSample() {
|
public ActivitySample getCurrentHRSample(final GBDevice device) {
|
||||||
return currentHRSample;
|
return currentHRSample.get(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCurrentHRSample(ActivitySample sample) {
|
private void setCurrentHRSample(final GBDevice device, ActivitySample sample) {
|
||||||
if (HeartRateUtils.getInstance().isValidHeartRateValue(sample.getHeartRate())) {
|
if (HeartRateUtils.getInstance().isValidHeartRateValue(sample.getHeartRate())) {
|
||||||
currentHRSample = sample;
|
currentHRSample.put(device, sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleRealtimeSample(Serializable extra) {
|
private void handleRealtimeSample(final GBDevice device, Serializable extra) {
|
||||||
if (extra instanceof ActivitySample) {
|
if (extra instanceof ActivitySample) {
|
||||||
ActivitySample sample = (ActivitySample) extra;
|
ActivitySample sample = (ActivitySample) extra;
|
||||||
setCurrentHRSample(sample);
|
setCurrentHRSample(device, sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +72,10 @@ public class DevicesFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
|
final GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
switch (Objects.requireNonNull(action)) {
|
switch (Objects.requireNonNull(action)) {
|
||||||
case DeviceManager.ACTION_DEVICES_CHANGED:
|
case DeviceManager.ACTION_DEVICES_CHANGED:
|
||||||
case GBApplication.ACTION_NEW_DATA:
|
case GBApplication.ACTION_NEW_DATA:
|
||||||
final GBDevice device = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
|
||||||
if (action.equals(GBApplication.ACTION_NEW_DATA)) {
|
if (action.equals(GBApplication.ACTION_NEW_DATA)) {
|
||||||
createRefreshTask("get activity data", requireContext(), device).execute();
|
createRefreshTask("get activity data", requireContext(), device).execute();
|
||||||
}
|
}
|
||||||
@ -88,17 +88,21 @@ public class DevicesFragment extends Fragment {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case DeviceService.ACTION_REALTIME_SAMPLES:
|
case DeviceService.ACTION_REALTIME_SAMPLES:
|
||||||
handleRealtimeSample(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
handleRealtimeSample(device, intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private void handleRealtimeSample(Serializable extra) {
|
private void handleRealtimeSample(GBDevice device, Serializable extra) {
|
||||||
if (extra instanceof ActivitySample) {
|
if (extra instanceof ActivitySample) {
|
||||||
ActivitySample sample = (ActivitySample) extra;
|
ActivitySample sample = (ActivitySample) extra;
|
||||||
if (HeartRateUtils.getInstance().isValidHeartRateValue(sample.getHeartRate())) {
|
if (HeartRateUtils.getInstance().isValidHeartRateValue(sample.getHeartRate())) {
|
||||||
refreshPairedDevices();
|
if (device != null) {
|
||||||
|
refreshSingleDevice(device);
|
||||||
|
} else {
|
||||||
|
refreshPairedDevices();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,14 @@ import java.io.Serializable;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.HeartRateSample;
|
import nodomain.freeyourgadget.gadgetbridge.model.HeartRateSample;
|
||||||
|
|
||||||
public class HeartRateDialog extends Dialog {
|
public class HeartRateDialog extends Dialog {
|
||||||
|
private final GBDevice device;
|
||||||
|
|
||||||
protected static final Logger LOG = LoggerFactory.getLogger(HeartRateDialog.class);
|
protected static final Logger LOG = LoggerFactory.getLogger(HeartRateDialog.class);
|
||||||
LinearLayout heart_rate_dialog_results_layout;
|
LinearLayout heart_rate_dialog_results_layout;
|
||||||
RelativeLayout heart_rate_dialog_loading_layout;
|
RelativeLayout heart_rate_dialog_loading_layout;
|
||||||
@ -62,7 +65,10 @@ public class HeartRateDialog extends Dialog {
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
switch (Objects.requireNonNull(intent.getAction())) {
|
switch (Objects.requireNonNull(intent.getAction())) {
|
||||||
case DeviceService.ACTION_REALTIME_SAMPLES:
|
case DeviceService.ACTION_REALTIME_SAMPLES:
|
||||||
setMeasurementResults(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
final GBDevice incomingDevice = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
|
||||||
|
if (device.equals(incomingDevice)) {
|
||||||
|
setMeasurementResults(intent.getSerializableExtra(DeviceService.EXTRA_REALTIME_SAMPLE));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG.info("ignoring intent action {}", intent.getAction());
|
LOG.info("ignoring intent action {}", intent.getAction());
|
||||||
@ -71,8 +77,9 @@ public class HeartRateDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public HeartRateDialog(@NonNull Context context) {
|
public HeartRateDialog(final GBDevice device, @NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
this.device = device;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMeasurementResults(Serializable result) {
|
private void setMeasurementResults(Serializable result) {
|
||||||
|
@ -411,7 +411,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
}
|
}
|
||||||
holder.heartRateStatusBox.setVisibility((device.isInitialized() && coordinator.supportsRealtimeData() && coordinator.supportsManualHeartRateMeasurement(device)) ? View.VISIBLE : View.GONE);
|
holder.heartRateStatusBox.setVisibility((device.isInitialized() && coordinator.supportsRealtimeData() && coordinator.supportsManualHeartRateMeasurement(device)) ? View.VISIBLE : View.GONE);
|
||||||
if (parent.getContext() instanceof ControlCenterv2) {
|
if (parent.getContext() instanceof ControlCenterv2) {
|
||||||
ActivitySample sample = ((ControlCenterv2) parent.getContext()).getCurrentHRSample();
|
ActivitySample sample = ((ControlCenterv2) parent.getContext()).getCurrentHRSample(device);
|
||||||
if (sample != null) {
|
if (sample != null) {
|
||||||
holder.heartRateStatusLabel.setText(String.valueOf(sample.getHeartRate()));
|
holder.heartRateStatusLabel.setText(String.valueOf(sample.getHeartRate()));
|
||||||
} else {
|
} else {
|
||||||
@ -430,7 +430,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
GBApplication.deviceService(device).onHeartRateTest();
|
GBApplication.deviceService(device).onHeartRateTest();
|
||||||
HeartRateDialog dialog = new HeartRateDialog(context);
|
HeartRateDialog dialog = new HeartRateDialog(device, context);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ public class ColmiR0xPacketHandler {
|
|||||||
sampleProvider.addSample(gbSample);
|
sampleProvider.addSample(gbSample);
|
||||||
// Send local intent with sample for listeners like the heart rate dialog
|
// Send local intent with sample for listeners like the heart rate dialog
|
||||||
Intent liveIntent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES);
|
Intent liveIntent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES);
|
||||||
|
liveIntent.putExtra(GBDevice.EXTRA_DEVICE, device);
|
||||||
liveIntent.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, gbSample);
|
liveIntent.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, gbSample);
|
||||||
LocalBroadcastManager.getInstance(context)
|
LocalBroadcastManager.getInstance(context)
|
||||||
.sendBroadcast(liveIntent);
|
.sendBroadcast(liveIntent);
|
||||||
|
@ -858,6 +858,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
// push realtime data
|
// push realtime data
|
||||||
if (realtime && (realtimeHRM || realtimeStep)) {
|
if (realtime && (realtimeHRM || realtimeStep)) {
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
@ -212,6 +212,7 @@ public class CyclingSensorSupport extends CyclingSensorBaseSupport {
|
|||||||
sample.setTimestamp(now);
|
sample.setTimestamp(now);
|
||||||
|
|
||||||
Intent liveIntent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES);
|
Intent liveIntent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES);
|
||||||
|
liveIntent.putExtra(GBDevice.EXTRA_DEVICE, getDevice());
|
||||||
liveIntent.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
liveIntent.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
liveIntent.putExtra("EXTRA_DEVICE_ADDRESS", getDevice().getAddress());
|
liveIntent.putExtra("EXTRA_DEVICE_ADDRESS", getDevice().getAddress());
|
||||||
LocalBroadcastManager.getInstance(getContext())
|
LocalBroadcastManager.getInstance(getContext())
|
||||||
|
@ -1328,6 +1328,7 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
public void broadcastSample(FitProActivitySample sample) {
|
public void broadcastSample(FitProActivitySample sample) {
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
@ -446,6 +446,7 @@ class HPlusHandlerThread extends GBDeviceIoThread {
|
|||||||
sample.setSteps(sample.getSteps() - prevRealTimeRecord.steps);
|
sample.setSteps(sample.getSteps() - prevRealTimeRecord.steps);
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, System.currentTimeMillis());
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, System.currentTimeMillis());
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
@ -2616,6 +2616,7 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.JYouActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.entities.JYouActivitySample;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||||
@ -178,6 +179,7 @@ public class Y5Support extends JYouSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
|
||||||
|
@ -756,6 +756,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sample.setSteps(diff);
|
sample.setSteps(diff);
|
||||||
lastStepsCount = command.getSteps();
|
lastStepsCount = command.getSteps();
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
@ -910,6 +911,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
session.getLefunActivitySampleDao().insertOrReplace(sample);
|
session.getLefunActivitySampleDao().insertOrReplace(sample);
|
||||||
|
|
||||||
final Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
final Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
@ -557,6 +557,7 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
|||||||
*/
|
*/
|
||||||
private void broadcastSample(MakibesHR3ActivitySample sample) {
|
private void broadcastSample(MakibesHR3ActivitySample sample) {
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
@ -971,6 +971,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
|
||||||
|
@ -1131,6 +1131,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
|
|||||||
this.addGBActivitySample(sample);
|
this.addGBActivitySample(sample);
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
@ -1157,6 +1158,7 @@ public class PineTimeJFSupport extends AbstractBTLEDeviceSupport implements DfuL
|
|||||||
this.addGBActivitySample(sample);
|
this.addGBActivitySample(sample);
|
||||||
|
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, sample.getTimestamp());
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
@ -71,6 +71,7 @@ public class SonySWR12HandlerThread extends GBDeviceIoThread {
|
|||||||
provider.addGBActivitySample(sample);
|
provider.addGBActivitySample(sample);
|
||||||
GBApplication.releaseDB();
|
GBApplication.releaseDB();
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample)
|
||||||
.putExtra(DeviceService.EXTRA_TIMESTAMP, timestamp);
|
.putExtra(DeviceService.EXTRA_TIMESTAMP, timestamp);
|
||||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||||
|
@ -30,6 +30,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRSampleProvider;
|
import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRSampleProvider;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.WithingsSteelHRActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.entities.WithingsSteelHRActivitySample;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.WithingsSteelHRDeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.WithingsSteelHRDeviceSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.activity.SleepActivitySampleHelper;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.activity.SleepActivitySampleHelper;
|
||||||
@ -78,6 +79,7 @@ public class HeartRateHandler extends AbstractResponseHandler {
|
|||||||
sample = SleepActivitySampleHelper.mergeIfNecessary(provider, sample);
|
sample = SleepActivitySampleHelper.mergeIfNecessary(provider, sample);
|
||||||
provider.addGBActivitySample(sample);
|
provider.addGBActivitySample(sample);
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, support.getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(support.getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(support.getContext()).sendBroadcast(intent);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -31,6 +31,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRSampleProvider;
|
import nodomain.freeyourgadget.gadgetbridge.devices.withingssteelhr.WithingsSteelHRSampleProvider;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.WithingsSteelHRActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.entities.WithingsSteelHRActivitySample;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.WithingsSteelHRDeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.WithingsSteelHRDeviceSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.activity.SleepActivitySampleHelper;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.withingssteelhr.activity.SleepActivitySampleHelper;
|
||||||
@ -82,6 +83,7 @@ public class LiveHeartrateHandler implements IncomingMessageHandler {
|
|||||||
logger.warn("Error saving current heart rate: " + ex.getLocalizedMessage());
|
logger.warn("Error saving current heart rate: " + ex.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, support.getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(support.getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(support.getContext()).sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
@ -940,6 +940,7 @@ public class XiaomiHealthService extends AbstractXiaomiService {
|
|||||||
previousSteps = realTimeStats.getSteps();
|
previousSteps = realTimeStats.getSteps();
|
||||||
|
|
||||||
final Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
final Intent intent = new Intent(DeviceService.ACTION_REALTIME_SAMPLES)
|
||||||
|
.putExtra(GBDevice.EXTRA_DEVICE, getSupport().getDevice())
|
||||||
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
.putExtra(DeviceService.EXTRA_REALTIME_SAMPLE, sample);
|
||||||
LocalBroadcastManager.getInstance(getSupport().getContext()).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(getSupport().getContext()).sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user