Browse Source

Adapted setDevice method

DoNotMerge_Runnable_Test_Branch
Christian Tinz 1 year ago
parent
commit
db74988f3d

+ 2
- 2
app/src/main/java/com/example/greenwatch/AccelerometerActivity.java View File

@@ -75,10 +75,10 @@ public class AccelerometerActivity extends AppCompatActivity implements SensorEv
@Override
public void onChanged(Boolean aBoolean) {
if (aBoolean) {
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), true, "Accelerometer", 10);
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), true, "Accelerometer", 10);
}
else {
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), false, "Accelerometer", 0);
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), false, "Accelerometer", 0);
}

}

+ 2
- 2
app/src/main/java/com/example/greenwatch/MainActivity.java View File

@@ -69,7 +69,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
//openAudiodetectionActivity();
mMainActivityViewModel.setDevice(mMainActivityViewModel.getLocalDeviceUUID(), "10:51", "12345", false, "Audio", 10);
mMainActivityViewModel.setDevice(mMainActivityViewModel.getLocalDeviceUUID(), "10:51", false, "Audio", 10);
}
});
videodetectionButton.setOnClickListener(new View.OnClickListener() {
@@ -78,7 +78,7 @@ public class MainActivity extends AppCompatActivity {
//openVideodetectionActivity();
mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "Video");
mMainActivityViewModel.setTimeStamp(mMainActivityViewModel.getLocalDeviceUUID(), "12:50");
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), mMainActivityViewModel.getLocalDeviceUUID());
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), "12345");
}
});
accelerometerButton.setOnClickListener(new View.OnClickListener() {

+ 2
- 5
app/src/main/java/com/example/greenwatch/repositories/DeviceRepository.java View File

@@ -73,18 +73,15 @@ public class DeviceRepository {
return deviceUUID;
}

public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
public void setDevice(String deviceID, String timeStamp, boolean sensorStatus, String sensorType, int sensorMassage) {
String checkedDeviceID = checkDeviceID(deviceID);
Device device = connectedDevicesList.get(checkedDeviceID);
if(device != null) {
device.setTimeStamp(timeStamp);
device.setDeviceID(newDeviceID);
device.setSensorStatus(sensorStatus);
device.setSensorType(sensorType);
device.setSensorMassage(sensorMassage);
setDeviceIDMapper(newDeviceID);
connectedDevicesList.remove(checkedDeviceID);
addToConnectedDeviceList(newDeviceID, device);
addToConnectedDeviceList(checkedDeviceID, device);
setMutableLiveDataValue();
}
}

+ 2
- 2
app/src/main/java/com/example/greenwatch/viewmodels/AccelerometerViewModel.java View File

@@ -93,8 +93,8 @@ public class AccelerometerViewModel extends ViewModel {
return mDeviceList;
}

public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp,newDeviceID, sensorStatus, sensorType, sensorMassage);
public void setDevice(String deviceID, String timeStamp, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp, sensorStatus, sensorType, sensorMassage);
}

public void setTimeStamp(String deviceID, String timeStamp) {

+ 2
- 2
app/src/main/java/com/example/greenwatch/viewmodels/MainActivityViewModel.java View File

@@ -27,8 +27,8 @@ public class MainActivityViewModel extends ViewModel {
return mDeviceList;
}

public void setDevice(String deviceID, String timeStamp, String newDeviceID, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp,newDeviceID, sensorStatus, sensorType, sensorMassage);
public void setDevice(String deviceID, String timeStamp, boolean sensorStatus, String sensorType, int sensorMassage) {
mDeviceRepository.setDevice(deviceID, timeStamp, sensorStatus, sensorType, sensorMassage);
}

public void setTimeStamp(String deviceID, String timeStamp) {

Loading…
Cancel
Save