This commit is contained in:
Aleksander Nowakowski
2018-06-19 16:43:21 +02:00
parent 27c491f633
commit 54b29534cd
3 changed files with 128 additions and 121 deletions

View File

@@ -71,13 +71,15 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
private final static int OPERATOR_LAST_RECORD = 6;
/**
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL}, {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL},
* {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The syntax of the operand is: [Filter Type][Minimum][Maximum].<br/>
* This filter selects the records by the sequence number.
*/
private final static int FILTER_TYPE_SEQUENCE_NUMBER = 1;
/**
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL}, {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL},
* {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The syntax of the operand is: [Filter Type][Minimum][Maximum].<br/>
* This filter selects the records by the user facing time (base time + offset time).
*/
@@ -219,8 +221,7 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
// Request the records
if (number > 0) {
final BluetoothGattCharacteristic racpCharacteristic = mRecordAccessControlPointCharacteristic;
setOpCode(racpCharacteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(racpCharacteristic);
writeCharacteristic(racpCharacteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_ALL_RECORDS));
} else {
mCallbacks.onOperationCompleted(gatt.getDevice());
}
@@ -259,35 +260,34 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
/**
* Writes given operation parameters to the characteristic
*
* @param characteristic the characteristic to write. This must be the Record Access Control Point characteristic
* @param opCode the operation code
* @param operator the operator (see {@link #OPERATOR_NULL} and others
* @param params optional parameters (one for >=, <=, two for the range, none for other operators)
* @param opCode the operation code
* @param operator the operator (see {@link #OPERATOR_NULL} and others
* @param params optional parameters (one for >=, <=, two for the range, none for other operators)
*/
private void setOpCode(final BluetoothGattCharacteristic characteristic, final int opCode, final int operator, final Integer... params) {
final int size = 2 + ((params.length > 0) ? 1 : 0) + params.length * 2; // 1 byte for opCode, 1 for operator, 1 for filter type (if parameters exists) and 2 for each parameter
characteristic.setValue(new byte[size]);
private byte[] getOpCode(final int opCode, final int operator, final Integer... params) {
// 1 byte for opCode, 1 for operator, 1 for filter type (if parameters exists) and 2 for each parameter
final int size = 2 + ((params.length > 0) ? 1 : 0) + params.length * 2;
final byte[] data = new byte[size];
// write the operation code
// Write the operation code
int offset = 0;
characteristic.setValue(opCode, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
data[offset++] = (byte) opCode;
// write the operator. This is always present but may be equal to OPERATOR_NULL
characteristic.setValue(operator, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
// Write the operator. This is always present but may be equal to OPERATOR_NULL
data[offset++] = (byte) operator;
// if parameters exists, append them. Parameters should be sorted from minimum to maximum. Currently only one or two params are allowed
// If parameters exists, append them. Parameters should be sorted from minimum to maximum.
// Currently only one or two params are allowed
if (params.length > 0) {
// our implementation use only sequence number as a filer type
characteristic.setValue(FILTER_TYPE_SEQUENCE_NUMBER, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
// Our implementation use only sequence number as a filer type
data[offset++] = FILTER_TYPE_SEQUENCE_NUMBER;
for (final Integer i : params) {
characteristic.setValue(i, BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset += 2;
data[offset++] = (byte) (i & 0xFF);
data[offset++] = (byte) ((i >> 8) & 0xFF);
}
}
return data;
}
/**
@@ -306,7 +306,8 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
}
/**
* Sends the request to obtain the last (most recent) record from glucose device. The data will be returned to Glucose Measurement characteristic as a notification followed by Record Access
* Sends the request to obtain the last (most recent) record from glucose device. The data will
* be returned to Glucose Measurement characteristic as a notification followed by Record Access
* Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
*/
public void getLastRecord() {
@@ -317,13 +318,13 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_LAST_RECORD);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_LAST_RECORD));
}
/**
* Sends the request to obtain the first (oldest) record from glucose device. The data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control
* Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
* Sends the request to obtain the first (oldest) record from glucose device. The data will be
* returned to Glucose Measurement characteristic as a notification followed by Record Access
* Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
*/
public void getFirstRecord() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -333,8 +334,7 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_FIRST_RECORD);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_FIRST_RECORD));
}
/**
@@ -346,14 +346,15 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
mAbort = true;
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_ABORT_OPERATION, OPERATOR_NULL);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_ABORT_OPERATION, OPERATOR_NULL));
}
/**
* Sends the request to obtain all records from glucose device. Initially we want to notify him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS} is send. The
* data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of
* error.
* Sends the request to obtain all records from glucose device. Initially we want to notify
* him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS}
* is send. The data will be returned to Glucose Measurement characteristic as a notification
* followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS}
* or other in case of error.
*/
public void getAllRecords() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -363,14 +364,15 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_NUMBER_OF_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_NUMBER_OF_RECORDS, OPERATOR_ALL_RECORDS));
}
/**
* Sends the request to obtain all records from glucose device. Initially we want to notify him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS} is send. The
* data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of
* error.
* Sends the request to obtain all records from glucose device. Initially we want to notify
* him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS}
* is send. The data will be returned to Glucose Measurement characteristic as a notification
* followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS}
* or other in case of error.
*/
public void refreshRecords() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -385,8 +387,7 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
final int sequenceNumber = mRecords.keyAt(mRecords.size() - 1) + 1;
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_GREATER_THEN_OR_EQUAL, sequenceNumber);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_GREATER_THEN_OR_EQUAL, sequenceNumber));
// Info:
// Operators OPERATOR_GREATER_THEN_OR_EQUAL, OPERATOR_LESS_THEN_OR_EQUAL and OPERATOR_RANGE are not supported by the CGMS sample from SDK
// The "Operation not supported" response will be received
@@ -401,8 +402,7 @@ public class CGMSManager extends BleManager<CGMSManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_DELETE_STORED_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_DELETE_STORED_RECORDS, OPERATOR_ALL_RECORDS));
}
}

View File

@@ -45,15 +45,25 @@ import no.nordicsemi.android.nrftoolbox.utility.DebugLogger;
public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
private static final String TAG = "GlucoseManager";
/** Glucose service UUID */
/**
* Glucose service UUID
*/
public final static UUID GLS_SERVICE_UUID = UUID.fromString("00001808-0000-1000-8000-00805f9b34fb");
/** Glucose Measurement characteristic UUID */
/**
* Glucose Measurement characteristic UUID
*/
private final static UUID GM_CHARACTERISTIC = UUID.fromString("00002A18-0000-1000-8000-00805f9b34fb");
/** Glucose Measurement Context characteristic UUID */
/**
* Glucose Measurement Context characteristic UUID
*/
private final static UUID GM_CONTEXT_CHARACTERISTIC = UUID.fromString("00002A34-0000-1000-8000-00805f9b34fb");
/** Glucose Feature characteristic UUID */
/**
* Glucose Feature characteristic UUID
*/
private final static UUID GF_CHARACTERISTIC = UUID.fromString("00002A51-0000-1000-8000-00805f9b34fb");
/** Record Access Control Point characteristic UUID */
/**
* Record Access Control Point characteristic UUID
*/
private final static UUID RACP_CHARACTERISTIC = UUID.fromString("00002A52-0000-1000-8000-00805f9b34fb");
private final static int OP_CODE_REPORT_STORED_RECORDS = 1;
@@ -72,13 +82,15 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
private final static int OPERATOR_LAST_RECORD = 6;
/**
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL}, {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL},
* {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The syntax of the operand is: [Filter Type][Minimum][Maximum].<br/>
* This filter selects the records by the sequence number.
*/
private final static int FILTER_TYPE_SEQUENCE_NUMBER = 1;
/**
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL}, {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The filter type is used for range operators ({@link #OPERATOR_LESS_THEN_OR_EQUAL},
* {@link #OPERATOR_GREATER_THEN_OR_EQUAL}, {@link #OPERATOR_WITHING_RANGE}.<br/>
* The syntax of the operand is: [Filter Type][Minimum][Maximum].<br/>
* This filter selects the records by the user facing time (base time + offset time).
*/
@@ -346,8 +358,7 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
// Request the records
if (number > 0) {
final BluetoothGattCharacteristic racpCharacteristic = mRecordAccessControlPointCharacteristic;
setOpCode(racpCharacteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(racpCharacteristic);
writeCharacteristic(racpCharacteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_ALL_RECORDS));
} else {
mCallbacks.onOperationCompleted(gatt.getDevice());
}
@@ -357,23 +368,23 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
DebugLogger.d(TAG, "Response result for: " + requestedOpCode + " is: " + responseCode);
switch (responseCode) {
case RESPONSE_SUCCESS:
if (!mAbort)
case RESPONSE_SUCCESS:
if (!mAbort)
mCallbacks.onOperationCompleted(gatt.getDevice());
else
mCallbacks.onOperationAborted(gatt.getDevice());
break;
case RESPONSE_NO_RECORDS_FOUND:
mCallbacks.onOperationCompleted(gatt.getDevice());
else
mCallbacks.onOperationAborted(gatt.getDevice());
break;
case RESPONSE_NO_RECORDS_FOUND:
mCallbacks.onOperationCompleted(gatt.getDevice());
break;
case RESPONSE_OP_CODE_NOT_SUPPORTED:
mCallbacks.onOperationNotSupported(gatt.getDevice());
break;
case RESPONSE_PROCEDURE_NOT_COMPLETED:
case RESPONSE_ABORT_UNSUCCESSFUL:
default:
mCallbacks.onOperationFailed(gatt.getDevice());
break;
break;
case RESPONSE_OP_CODE_NOT_SUPPORTED:
mCallbacks.onOperationNotSupported(gatt.getDevice());
break;
case RESPONSE_PROCEDURE_NOT_COMPLETED:
case RESPONSE_ABORT_UNSUCCESSFUL:
default:
mCallbacks.onOperationFailed(gatt.getDevice());
break;
}
mAbort = false;
}
@@ -382,41 +393,37 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
/**
* Writes given operation parameters to the characteristic
*
* @param characteristic
* the characteristic to write. This must be the Record Access Control Point characteristic
* @param opCode
* the operation code
* @param operator
* the operator (see {@link #OPERATOR_NULL} and others
* @param params
* optional parameters (one for >=, <=, two for the range, none for other operators)
*
* @param opCode the operation code
* @param operator the operator (see {@link #OPERATOR_NULL} and others
* @param params optional parameters (one for >=, <=, two for the range, none for other operators)
*/
private void setOpCode(final BluetoothGattCharacteristic characteristic, final int opCode, final int operator, final Integer... params) {
final int size = 2 + ((params.length > 0) ? 1 : 0) + params.length * 2; // 1 byte for opCode, 1 for operator, 1 for filter type (if parameters exists) and 2 for each parameter
characteristic.setValue(new byte[size]);
private byte[] getOpCode(final int opCode, final int operator, final Integer... params) {
// 1 byte for opCode, 1 for operator, 1 for filter type (if parameters exists) and 2 for each parameter
final int size = 2 + ((params.length > 0) ? 1 : 0) + params.length * 2;
final byte[] data = new byte[size];
// write the operation code
// Write the operation code
int offset = 0;
characteristic.setValue(opCode, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
data[offset++] = (byte) opCode;
// write the operator. This is always present but may be equal to OPERATOR_NULL
characteristic.setValue(operator, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
// Write the operator. This is always present but may be equal to OPERATOR_NULL
data[offset++] = (byte) operator;
// if parameters exists, append them. Parameters should be sorted from minimum to maximum. Currently only one or two params are allowed
// If parameters exists, append them. Parameters should be sorted from minimum to maximum.
// Currently only one or two params are allowed
if (params.length > 0) {
// our implementation use only sequence number as a filer type
characteristic.setValue(FILTER_TYPE_SEQUENCE_NUMBER, BluetoothGattCharacteristic.FORMAT_UINT8, offset);
offset += 1;
// Our implementation use only sequence number as a filer type
data[offset++] = FILTER_TYPE_SEQUENCE_NUMBER;
for (final Integer i : params) {
characteristic.setValue(i, BluetoothGattCharacteristic.FORMAT_UINT16, offset);
offset += 2;
data[offset++] = (byte) (i & 0xFF);
data[offset++] = (byte) ((i >> 8) & 0xFF);
}
}
return data;
}
/**
* Returns all records as a sparse array where sequence number is the key.
*
@@ -435,7 +442,8 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
}
/**
* Sends the request to obtain the last (most recent) record from glucose device. The data will be returned to Glucose Measurement characteristic as a notification followed by Record Access
* Sends the request to obtain the last (most recent) record from glucose device. The data will
* be returned to Glucose Measurement characteristic as a notification followed by Record Access
* Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
*/
public void getLastRecord() {
@@ -446,13 +454,13 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_LAST_RECORD);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_LAST_RECORD));
}
/**
* Sends the request to obtain the first (oldest) record from glucose device. The data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control
* Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
* Sends the request to obtain the first (oldest) record from glucose device. The data will be
* returned to Glucose Measurement characteristic as a notification followed by Record Access
* Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
*/
public void getFirstRecord() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -462,14 +470,15 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_FIRST_RECORD);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_FIRST_RECORD));
}
/**
* Sends the request to obtain all records from glucose device. Initially we want to notify him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS} is send. The
* data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of
* error.
* Sends the request to obtain all records from glucose device. Initially we want to notify
* him/her about the number of the records so the {@link #OP_CODE_REPORT_NUMBER_OF_RECORDS}
* is send. The data will be returned to Glucose Measurement characteristic as a notification
* followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS}
* or other in case of error.
*/
public void getAllRecords() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -479,17 +488,18 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_NUMBER_OF_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_NUMBER_OF_RECORDS, OPERATOR_ALL_RECORDS));
}
/**
* Sends the request to obtain from the glucose device all records newer than the newest one from local storage. The data will be returned to Glucose Measurement characteristic as a notification
* followed by Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS} or other in case of error.
* Sends the request to obtain from the glucose device all records newer than the newest one
* from local storage. The data will be returned to Glucose Measurement characteristic as a
* notification followed by Record Access Control Point indication with status code
* ({@link #RESPONSE_SUCCESS} or other in case of error.
* <p>
* Refresh button will not download records older than the oldest in the local memory. F.e. if you have pressed Last and then Refresh, than it will try to get only newer records. However if there
* are no records, it will download all existing (using {@link #getAllRecords()}).
* </p>
* Refresh button will not download records older than the oldest in the local memory.
* E.g. if you have pressed Last and then Refresh, than it will try to get only newer records.
* However, if there are no records, it will download all existing (using {@link #getAllRecords()}).
*/
public void refreshRecords() {
if (mRecordAccessControlPointCharacteristic == null)
@@ -504,8 +514,7 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
final int sequenceNumber = mRecords.keyAt(mRecords.size() - 1) + 1;
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_REPORT_STORED_RECORDS, OPERATOR_GREATER_THEN_OR_EQUAL, sequenceNumber);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_REPORT_STORED_RECORDS, OPERATOR_GREATER_THEN_OR_EQUAL, sequenceNumber));
// Info:
// Operators OPERATOR_LESS_THEN_OR_EQUAL and OPERATOR_RANGE are not supported by Nordic Semiconductor Glucose Service in SDK 4.4.2.
}
@@ -520,13 +529,13 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
mAbort = true;
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_ABORT_OPERATION, OPERATOR_NULL);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_ABORT_OPERATION, OPERATOR_NULL));
}
/**
* Sends the request to delete all data from the device. A Record Access Control Point indication with status code ({@link #RESPONSE_SUCCESS} (or other in case of error) will be send.
*
* Sends the request to delete all data from the device. A Record Access Control Point indication
* with status code ({@link #RESPONSE_SUCCESS} (or other in case of error) will be send.
* <p>
* FIXME This method is not supported by Nordic Semiconductor Glucose Service in SDK 4.4.2.
*/
public void deleteAllRecords() {
@@ -537,7 +546,6 @@ public class GlucoseManager extends BleManager<GlucoseManagerCallbacks> {
mCallbacks.onOperationStarted(mBluetoothDevice);
final BluetoothGattCharacteristic characteristic = mRecordAccessControlPointCharacteristic;
setOpCode(characteristic, OP_CODE_DELETE_STORED_RECORDS, OPERATOR_ALL_RECORDS);
writeCharacteristic(characteristic);
writeCharacteristic(characteristic, getOpCode(OP_CODE_DELETE_STORED_RECORDS, OPERATOR_ALL_RECORDS));
}
}

View File

@@ -41,7 +41,7 @@ public class ProximityManager extends BleManager<ProximityManagerCallbacks> {
/** Immediate Alert service UUID */
public final static UUID IMMEDIATE_ALERT_SERVICE_UUID = UUID.fromString("00001802-0000-1000-8000-00805f9b34fb");
/** Linkloss service UUID */
/** Link Loss service UUID */
public final static UUID LINKLOSS_SERVICE_UUID = UUID.fromString("00001803-0000-1000-8000-00805f9b34fb");
/** Alert Level characteristic UUID */
private static final UUID ALERT_LEVEL_CHARACTERISTIC_UUID = UUID.fromString("00002A06-0000-1000-8000-00805f9b34fb");
@@ -129,8 +129,7 @@ public class ProximityManager extends BleManager<ProximityManagerCallbacks> {
return;
if (mAlertLevelCharacteristic != null) {
mAlertLevelCharacteristic.setValue(on ? HIGH_ALERT : NO_ALERT);
writeCharacteristic(mAlertLevelCharacteristic);
writeCharacteristic(mAlertLevelCharacteristic, on ? HIGH_ALERT : NO_ALERT);
mAlertOn = on;
} else {
DebugLogger.w(TAG, "Immediate Alert Level Characteristic is not found");