-
- All Implemented Interfaces:
-
android.os.Parcelable,no.nordicsemi.android.ble.callback.DataReceivedCallback,no.nordicsemi.android.ble.callback.profile.ProfileDataCallback,no.nordicsemi.android.ble.common.profile.TimeZoneCallback
public final class TimeZoneResponse extends TimeZoneDataCallback implements Parcelable
Response class that could be used as a result of a synchronous request. The data received are available through getters instead of a callback.
Usage example:
try { TimeZoneResponse response = readCharacteristic(characteristic) .awaitValid(TimeZoneResponse.class); if (response.isTimeZoneOffsetKnown()) { int offset = response.getTimeZoneOffset(); ... } ... } catch (RequestFailedException e) { Log.w(TAG, "Request failed with status " + e.getStatus(), e); } catch (InvalidDataException e) { Log.w(TAG, "Invalid data received: " + e.getResponse().getRawData()); }
-
-
Field Summary
Fields Modifier and Type Field Description private inttimeZoneOffsetpublic final static Parcelable.Creator<TimeZoneResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description TimeZoneResponse()
-
Method Summary
Modifier and Type Method Description intgetTimeZoneOffset()voidonTimeZoneReceived(@NonNull() BluetoothDevice device, int offset)Callback called when time zone packet has been received. voidonUnknownTimeZoneReceived(@NonNull() BluetoothDevice device)Callback called when the time zone packet was received with value -128 (unknown time zone). booleanisTimeZoneOffsetKnown()voidwriteToParcel(@NonNull() Parcel dest, int flags)-
Methods inherited from class no.nordicsemi.android.ble.common.callback.TimeZoneDataCallback
onDataReceived, readTimeZone -
Methods inherited from class no.nordicsemi.android.ble.callback.profile.ProfileReadResponse
isValid, onInvalidDataReceived, writeToParcel -
Methods inherited from class no.nordicsemi.android.ble.response.ReadResponse
describeContents, getBluetoothDevice, getRawData, onDataReceived -
Methods inherited from class no.nordicsemi.android.ble.common.profile.TimeZoneCallback
onTimeZoneReceived -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getTimeZoneOffset
int getTimeZoneOffset()
-
onTimeZoneReceived
void onTimeZoneReceived(@NonNull() BluetoothDevice device, int offset)
Callback called when time zone packet has been received.
- Parameters:
device- the target device.offset- the offset from UTC in minutes, in 15 min intervals (e.g.
-
onUnknownTimeZoneReceived
void onUnknownTimeZoneReceived(@NonNull() BluetoothDevice device)
Callback called when the time zone packet was received with value -128 (unknown time zone).
- Parameters:
device- the target device.
-
isTimeZoneOffsetKnown
boolean isTimeZoneOffsetKnown()
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
-
-
-