-
- 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.sc.SensorLocationTypes,no.nordicsemi.android.ble.common.profile.sc.SpeedAndCadenceControlPointCallback
public final class SpeedAndCadenceControlPointResponse extends SpeedAndCadenceControlPointDataCallback 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 { SpeedAndCadenceControlPointResponse response = waitForIndication(characteristic) .trigger(writeCharacteristic(characteristic, SpeedAndCadenceControlPointData.requestSupportedSensorLocations())) .awaitValid(SpeedAndCadenceControlPointResponse.class); if (response.isOperationCompleted()) { int locations = response.getSupportedSensorLocations(); ... } ... } 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 intrequestCodeprivate interrorCodepublic final static Parcelable.Creator<SpeedAndCadenceControlPointResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description SpeedAndCadenceControlPointResponse()
-
Method Summary
Modifier and Type Method Description intgetRequestCode()intgetErrorCode()voidonSCOperationCompleted(@NonNull() BluetoothDevice device, int requestCode)Callback called when a SC Control Point request has finished successfully. voidonSCOperationError(@NonNull() BluetoothDevice device, int requestCode, int errorCode)Callback called when a SC Control Point request has failed. voidonSupportedSensorLocationsReceived(@NonNull() BluetoothDevice device, @NonNull() Array<int> locations)Callback indicating successful response for SC_OP_CODE_REQUEST_SUPPORTED_SENSOR_LOCATIONS request. booleanisOperationCompleted()Array<int>getSupportedSensorLocations()voidwriteToParcel(@NonNull() Parcel dest, int flags)-
Methods inherited from class no.nordicsemi.android.ble.common.callback.sc.SpeedAndCadenceControlPointDataCallback
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.sc.SpeedAndCadenceControlPointCallback
onSCOperationCompleted, onSCOperationError, onSupportedSensorLocationsReceived -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getRequestCode
int getRequestCode()
-
getErrorCode
int getErrorCode()
-
onSCOperationCompleted
void onSCOperationCompleted(@NonNull() BluetoothDevice device, int requestCode)
Callback called when a SC Control Point request has finished successfully.In case of SC_OP_CODE_REQUEST_SUPPORTED_SENSOR_LOCATIONS request, the onSupportedSensorLocationsReceived will be called instead.
- Parameters:
device- the target device.requestCode- the request code that has completed.
-
onSCOperationError
void onSCOperationError(@NonNull() BluetoothDevice device, int requestCode, int errorCode)
Callback called when a SC Control Point request has failed.
- Parameters:
device- the target device.requestCode- the request code that has completed with an error.One of SC_OP_CODE_* constants, or other if such was requested.errorCode- the received error code, see SC_ERROR_* constants.
-
onSupportedSensorLocationsReceived
void onSupportedSensorLocationsReceived(@NonNull() BluetoothDevice device, @NonNull() Array<int> locations)
Callback indicating successful response for SC_OP_CODE_REQUEST_SUPPORTED_SENSOR_LOCATIONS request.
- Parameters:
device- the target device.locations- an array with supported locations.
-
isOperationCompleted
boolean isOperationCompleted()
-
getSupportedSensorLocations
@Nullable() Array<int> getSupportedSensorLocations()
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
-
-
-