-
- 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.RecordAccessControlPointCallback
public final class RecordAccessControlPointResponse extends RecordAccessControlPointDataCallback 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 { RecordAccessControlPointResponse response = readCharacteristic(characteristic) .awaitValid(RecordAccessControlPointResponse.class); if (response.isOperationCompleted() && response.wereRecordsFound()) { int number = response.getNumberOfRecords(); ... } ... } 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 intnumberOfRecordsprivate interrorCodeprivate intrequestCodepublic final static Parcelable.Creator<RecordAccessControlPointResponse>CREATOR
-
Constructor Summary
Constructors Constructor Description RecordAccessControlPointResponse()
-
Method Summary
Modifier and Type Method Description intgetNumberOfRecords()Returns number of records found matching filter criteria. intgetErrorCode()Returned error code. intgetRequestCode()Returns the request Op Code. voidonRecordAccessOperationCompleted(@NonNull() BluetoothDevice device, int requestCode)Callback called when the request has finished successfully, that isall requested records were reported or deleted, or the operation has aborted,depending on the request. voidonRecordAccessOperationCompletedWithNoRecordsFound(@NonNull() BluetoothDevice device, int requestCode)Callback called when the request to report or delete records has finishedsuccessfully, but no records were found matching given filter criteria. voidonNumberOfRecordsReceived(@NonNull() BluetoothDevice device, int numberOfRecords)Callback called as a result to 'Report number of stored records' request, also when therewere no records found. voidonRecordAccessOperationError(@NonNull() BluetoothDevice device, int requestCode, int errorCode)Callback called in case an error has been returned from the Record Access Control Pointcharacteristic. booleanisOperationCompleted()Returns true if the operation has completed successfully. booleanwereRecordsFound()Returns false if operation completed with error RACP_ERROR_NO_RECORDS_FOUND,true in other cases. voidwriteToParcel(@NonNull() Parcel dest, int flags)-
Methods inherited from class no.nordicsemi.android.ble.common.callback.RecordAccessControlPointDataCallback
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.RecordAccessControlPointCallback
onNumberOfRecordsReceived, onRecordAccessOperationCompleted, onRecordAccessOperationCompletedWithNoRecordsFound, onRecordAccessOperationError -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getNumberOfRecords
int getNumberOfRecords()
Returns number of records found matching filter criteria. This is only valid if RACP_OP_CODE_REPORT_NUMBER_OF_RECORDS request was made.
-
getErrorCode
int getErrorCode()
Returned error code. Check RACP_ERROR_* constants.
-
getRequestCode
int getRequestCode()
Returns the request Op Code. One of RACP_OP_CODE_REPORT_STORED_RECORDS, RACP_OP_CODE_DELETE_STORED_RECORDS, RACP_OP_CODE_DELETE_STORED_RECORDS or RACP_OP_CODE_REPORT_NUMBER_OF_RECORDS.
-
onRecordAccessOperationCompleted
void onRecordAccessOperationCompleted(@NonNull() BluetoothDevice device, int requestCode)
Callback called when the request has finished successfully, that isall requested records were reported or deleted, or the operation has aborted,depending on the request.
- Parameters:
device- the target device.requestCode- the request code that has completed, one of RACP_OP_CODE_* constants.
-
onRecordAccessOperationCompletedWithNoRecordsFound
void onRecordAccessOperationCompletedWithNoRecordsFound(@NonNull() BluetoothDevice device, int requestCode)
Callback called when the request to report or delete records has finishedsuccessfully, but no records were found matching given filter criteria.
- Parameters:
device- the target device.requestCode- the request code that has completed, one of RACP_OP_CODE_* constants.
-
onNumberOfRecordsReceived
void onNumberOfRecordsReceived(@NonNull() BluetoothDevice device, int numberOfRecords)
Callback called as a result to 'Report number of stored records' request, also when therewere no records found.
- Parameters:
device- the target device.numberOfRecords- the number of records matching given filter criteria.
-
onRecordAccessOperationError
void onRecordAccessOperationError(@NonNull() BluetoothDevice device, int requestCode, int errorCode)
Callback called in case an error has been returned from the Record Access Control Pointcharacteristic.
The 'No records found' error is returned as onRecordAccessOperationCompletedWithNoRecordsFound instead.
- Parameters:
device- the target device.requestCode- the request code that has finished with an error.errorCode- the error code, one of RACP_ERROR_* constants, or other (unknown)is such was reported.
-
isOperationCompleted
boolean isOperationCompleted()
Returns true if the operation has completed successfully.
-
wereRecordsFound
boolean wereRecordsFound()
Returns false if operation completed with error RACP_ERROR_NO_RECORDS_FOUND,true in other cases.
-
writeToParcel
void writeToParcel(@NonNull() Parcel dest, int flags)
-
-
-
-