Java Code Examples for no.nordicsemi.android.ble.common.profile.ht.TemperatureMeasurementCallback#toCelsius()

The following examples show how to use no.nordicsemi.android.ble.common.profile.ht.TemperatureMeasurementCallback#toCelsius() . 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: HTService.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onTemperatureMeasurementReceived(@NonNull final BluetoothDevice device,
											 final float temperature, @TemperatureUnit final int unit,
											 @Nullable final Calendar calendar,
											 @Nullable @TemperatureType final Integer type) {
	temp = TemperatureMeasurementCallback.toCelsius(temperature, unit);

	final Intent broadcast = new Intent(BROADCAST_HTS_MEASUREMENT);
	broadcast.putExtra(EXTRA_DEVICE, getBluetoothDevice());
	broadcast.putExtra(EXTRA_TEMPERATURE, temp);
	// ignore the rest
	LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast);

	if (!bound) {
		// Here we may update the notification to display the current temperature.
		// TODO modify the notification here
	}
}
 
Example 2
Source File: TemperatureMeasurementResponse.java    From Android-BLE-Common-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public float getTemperatureCelsius() {
	return TemperatureMeasurementCallback.toCelsius(temperature, unit);
}
 
Example 3
Source File: TemperatureMeasurementResponse.java    From Android-BLE-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public float getTemperatureCelsius() {
	return TemperatureMeasurementCallback.toCelsius(temperature, unit);
}