@Override | @Override | ||||
public void onChanged(Boolean aBoolean) { | public void onChanged(Boolean aBoolean) { | ||||
if (aBoolean) { | if (aBoolean) { | ||||
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), true, "Accelerometer", 10); | |||||
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), true, "Accelerometer", 10); | |||||
} | } | ||||
else { | else { | ||||
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), mAccelerometerViewModel.getLocalDeviceUUID(), false, "Accelerometer", 0); | |||||
mAccelerometerViewModel.setDevice(mAccelerometerViewModel.getLocalDeviceUUID(), mAccelerometerViewModel.getSystemTimeStamp(), false, "Accelerometer", 0); | |||||
} | } | ||||
} | } |
@Override | @Override | ||||
public void onClick(View v) { | public void onClick(View v) { | ||||
//openAudiodetectionActivity(); | //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() { | videodetectionButton.setOnClickListener(new View.OnClickListener() { | ||||
//openVideodetectionActivity(); | //openVideodetectionActivity(); | ||||
mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "Video"); | mMainActivityViewModel.setSensorType(mMainActivityViewModel.getLocalDeviceUUID(), "Video"); | ||||
mMainActivityViewModel.setTimeStamp(mMainActivityViewModel.getLocalDeviceUUID(), "12:50"); | mMainActivityViewModel.setTimeStamp(mMainActivityViewModel.getLocalDeviceUUID(), "12:50"); | ||||
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), mMainActivityViewModel.getLocalDeviceUUID()); | |||||
mMainActivityViewModel.setDeviceID(mMainActivityViewModel.getLocalDeviceUUID(), "12345"); | |||||
} | } | ||||
}); | }); | ||||
accelerometerButton.setOnClickListener(new View.OnClickListener() { | accelerometerButton.setOnClickListener(new View.OnClickListener() { |
return deviceUUID; | 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); | String checkedDeviceID = checkDeviceID(deviceID); | ||||
Device device = connectedDevicesList.get(checkedDeviceID); | Device device = connectedDevicesList.get(checkedDeviceID); | ||||
if(device != null) { | if(device != null) { | ||||
device.setTimeStamp(timeStamp); | device.setTimeStamp(timeStamp); | ||||
device.setDeviceID(newDeviceID); | |||||
device.setSensorStatus(sensorStatus); | device.setSensorStatus(sensorStatus); | ||||
device.setSensorType(sensorType); | device.setSensorType(sensorType); | ||||
device.setSensorMassage(sensorMassage); | device.setSensorMassage(sensorMassage); | ||||
setDeviceIDMapper(newDeviceID); | |||||
connectedDevicesList.remove(checkedDeviceID); | |||||
addToConnectedDeviceList(newDeviceID, device); | |||||
addToConnectedDeviceList(checkedDeviceID, device); | |||||
setMutableLiveDataValue(); | setMutableLiveDataValue(); | ||||
} | } | ||||
} | } |
return mDeviceList; | 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) { | public void setTimeStamp(String deviceID, String timeStamp) { |
return mDeviceList; | 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) { | public void setTimeStamp(String deviceID, String timeStamp) { |