-
- All Implemented Interfaces:
-
android.os.Parcelable,no.nordicsemi.android.ble.callback.DataReceivedCallback,no.nordicsemi.android.ble.callback.profile.ProfileDataCallback,no.nordicsemi.android.ble.common.callback.cgm.CRCSecuredResponse,no.nordicsemi.android.ble.common.profile.cgm.CGMFeatureCallback,no.nordicsemi.android.ble.common.profile.cgm.CGMTypes,no.nordicsemi.android.ble.common.profile.glucose.GlucoseTypes
public final class CGMFeatureResponse extends CGMFeatureDataCallback implements CRCSecuredResponse, 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 { CGMFeatureResponse response = readCharacteristic(characteristic) .awaitValid(CGMFeatureResponse.class); if (response.getFeatures().calibrationSupported) { ... } ... } 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 CGMTypes.CGMFeaturesfeaturesprivate inttypeprivate intsampleLocationpublic final static Parcelable.Creator<CGMFeatureResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description CGMFeatureResponse()
-
Method Summary
Modifier and Type Method Description CGMTypes.CGMFeaturesgetFeatures()intgetType()intgetSampleLocation()voidonContinuousGlucoseMonitorFeaturesReceived(@NonNull() BluetoothDevice device, @NonNull() CGMTypes.CGMFeatures features, int type, int sampleLocation, boolean secured)Callback called when Continuous Glucose Monitor Feature value was received. voidonContinuousGlucoseMonitorFeaturesReceivedWithCrcError(@NonNull() BluetoothDevice device, @NonNull() Data data)Callback called when a CGM Feature packet with E2E field was received but the CRC checkhas failed. booleanisSecured()Returns true if the packet was secured with E2E CRC. booleanisCrcValid()Returns true if the packet was secured with E2E CRC value and the CRC was valid.In all other cases it returns false. voidwriteToParcel(@NonNull() Parcel dest, int flags)-
Methods inherited from class no.nordicsemi.android.ble.common.callback.cgm.CGMFeatureDataCallback
onDataReceived -
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.cgm.CGMFeatureCallback
onContinuousGlucoseMonitorFeaturesReceived, onContinuousGlucoseMonitorFeaturesReceivedWithCrcError -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getFeatures
CGMTypes.CGMFeatures getFeatures()
-
getType
int getType()
-
getSampleLocation
int getSampleLocation()
-
onContinuousGlucoseMonitorFeaturesReceived
void onContinuousGlucoseMonitorFeaturesReceived(@NonNull() BluetoothDevice device, @NonNull() CGMTypes.CGMFeatures features, int type, int sampleLocation, boolean secured)
Callback called when Continuous Glucose Monitor Feature value was received.
If the E2E CRC field was present in the CGM packet, the data has been verified against it.If CRC check has failed, the onContinuousGlucoseMonitorFeaturesReceivedWithCrcError will be called instead.
- Parameters:
device- the target device.features- the features supported by the target device.type- the sample type, see TYPE_* constants.sampleLocation- the sample location, see SAMPLE_LOCATION_* constants.secured- true, if the value received was secured with E2E-CRC value and theCRC matched the packet.
-
onContinuousGlucoseMonitorFeaturesReceivedWithCrcError
void onContinuousGlucoseMonitorFeaturesReceivedWithCrcError(@NonNull() BluetoothDevice device, @NonNull() Data data)
Callback called when a CGM Feature packet with E2E field was received but the CRC checkhas failed.
- Parameters:
device- the target device.data- the CGM Feature packet data that was received, including the CRC field.
-
isSecured
boolean isSecured()
Returns true if the packet was secured with E2E CRC.See isCrcValid to check if the CRC was valid.
-
isCrcValid
boolean isCrcValid()
Returns true if the packet was secured with E2E CRC value and the CRC was valid.In all other cases it returns false.
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
-
-
-