Skip to content

Commit

Permalink
refactor(wearos-lib): extend from base record and remove already incl…
Browse files Browse the repository at this point in the history
…uded features
  • Loading branch information
matey97 committed Jul 26, 2022
1 parent 1e3f757 commit 909a1f3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package es.uji.geotec.wearossensors.records;

import es.uji.geotec.backgroundsensors.record.Record;
import es.uji.geotec.wearossensors.sensor.WearSensor;

public class HeartRateRecord extends Record {

private int value;

public HeartRateRecord(long timestamp, int value) {
super(timestamp);
super(WearSensor.HEART_RATE, timestamp);
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

import android.location.Location;

import es.uji.geotec.backgroundsensors.record.Record;
import es.uji.geotec.wearossensors.sensor.WearSensor;

public class LocationRecord extends Record {

private double latitude;
private double longitude;
private double altitude;

public LocationRecord(long timestamp, double latitude, double longitude, double altitude) {
super(timestamp);
super(WearSensor.LOCATION, timestamp);
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;
}

public LocationRecord(Location location) {
super(location.getTime());
super(WearSensor.LOCATION, location.getTime());
this.latitude = location.getLatitude();
this.longitude = location.getLongitude();
this.altitude = location.getAltitude();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import java.util.List;

import es.uji.geotec.backgroundsensors.record.Record;
import es.uji.geotec.backgroundsensors.record.callback.RecordCallback;
import es.uji.geotec.wearossensors.messaging.MessagingClient;
import es.uji.geotec.wearossensors.records.Record;

public abstract class AbstractRecordCallback<T extends Record> {
public abstract class AbstractRecordCallback<T extends Record> implements RecordCallback<T> {

private MessagingClient messagingClient;
private String requesterId;
Expand All @@ -19,6 +20,7 @@ public AbstractRecordCallback(Context context, String requesterId, String sendin
this.sendingPath = sendingPath;
}

@Override
public void onRecordsCollected(List<T> records) {
byte[] recordsEncoded = encodeRecords(records);
this.messagingClient.sendNewRecord(requesterId, sendingPath, recordsEncoded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;

import es.uji.geotec.wearossensors.sensoring.WearSensor;
import es.uji.geotec.wearossensors.sensor.WearSensor;

public class RecordCallbackProvider {
private RecordCallbackProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.nio.ByteBuffer;
import java.util.List;

import es.uji.geotec.wearossensors.records.TriAxialRecord;
import es.uji.geotec.backgroundsensors.record.TriAxialRecord;


public class TriAxialRecordCallback extends AbstractRecordCallback<TriAxialRecord> {
Expand Down

0 comments on commit 909a1f3

Please sign in to comment.