no.nordicsemi.android.ble.common.profile.bp.BloodPressureMeasurementCallback Java Examples

The following examples show how to use no.nordicsemi.android.ble.common.profile.bp.BloodPressureMeasurementCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BPMActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onBloodPressureMeasurementReceived(@NonNull final BluetoothDevice device,
											   final float systolic, final float diastolic, final float meanArterialPressure, final int unit,
											   @Nullable final Float pulseRate, @Nullable final Integer userID,
											   @Nullable final BPMStatus status, @Nullable final Calendar calendar) {
	runOnUiThread(() -> {
		systolicView.setText(String.valueOf(systolic));
		diastolicView.setText(String.valueOf(diastolic));
		meanAPView.setText(String.valueOf(meanArterialPressure));
		if (pulseRate != null)
			pulseView.setText(String.valueOf(pulseRate));
		else
			pulseView.setText(R.string.not_available_value);
		if (calendar != null)
			timestampView.setText(getString(R.string.bpm_timestamp, calendar));
		else
			timestampView.setText(R.string.not_available);

		systolicUnitView.setText(unit == BloodPressureMeasurementCallback.UNIT_mmHg ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
		diastolicUnitView.setText(unit == BloodPressureMeasurementCallback.UNIT_mmHg ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
		meanAPUnitView.setText(unit == BloodPressureMeasurementCallback.UNIT_mmHg ? R.string.bpm_unit_mmhg : R.string.bpm_unit_kpa);
	});
}