mirror of
https://github.com/oliexdev/openScale.git
synced 2025-09-02 21:02:48 +02:00
BluetoothStandardWeightProfile: make debug messages about User Control Point more explicit;
This commit is contained in:
@@ -233,27 +233,32 @@ public class BluetoothStandardWeightProfile extends BluetoothCommunication {
|
|||||||
protected void handleUserControlPointNotify(byte[] value) {
|
protected void handleUserControlPointNotify(byte[] value) {
|
||||||
if(value[0]==UDS_CP_RESPONSE) {
|
if(value[0]==UDS_CP_RESPONSE) {
|
||||||
switch (value[1]) {
|
switch (value[1]) {
|
||||||
|
case UDS_CP_LIST_ALL_USERS:
|
||||||
|
Timber.d("UDS_CP_LIST_ALL_USERS value [" + byteInHex(value) + "]");
|
||||||
|
break;
|
||||||
case UDS_CP_REGISTER_NEW_USER:
|
case UDS_CP_REGISTER_NEW_USER:
|
||||||
if (value[2] == UDS_CP_RESP_VALUE_SUCCESS) {
|
if (value[2] == UDS_CP_RESP_VALUE_SUCCESS) {
|
||||||
int userIndex = value[3];
|
int userIndex = value[3];
|
||||||
int userId = this.selectedUser.getId();
|
int userId = this.selectedUser.getId();
|
||||||
Timber.d(String.format("Created user with ID %d and Index %d", userId, userIndex));
|
Timber.d(String.format("UDS_CP_REGISTER_NEW_USER: Created scale user index: "
|
||||||
|
+ "%d (app user id: %d)", userIndex, userId));
|
||||||
storeUserScaleIndex(userId, userIndex);
|
storeUserScaleIndex(userId, userIndex);
|
||||||
resumeMachineState();
|
resumeMachineState();
|
||||||
} else {
|
} else {
|
||||||
Timber.e("ERROR: could not register new user");
|
Timber.e("UDS_CP_REGISTER_NEW_USER: ERROR: could not register new scale user, code: " + value[2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UDS_CP_CONSENT:
|
case UDS_CP_CONSENT:
|
||||||
if (registerNewUser) {
|
if (registerNewUser) {
|
||||||
|
Timber.d("UDS_CP_CONSENT: registerNewUser==true, value[2] == " + value[2]);
|
||||||
resumeMachineState();
|
resumeMachineState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (value[2] == UDS_CP_RESP_VALUE_SUCCESS) {
|
if (value[2] == UDS_CP_RESP_VALUE_SUCCESS) {
|
||||||
Timber.d("Success user consent");
|
Timber.d("UDS_CP_CONSENT: Success user consent");
|
||||||
resumeMachineState();
|
resumeMachineState();
|
||||||
} else if (value[2] == UDS_CP_RESP_USER_NOT_AUTHORIZED) {
|
} else if (value[2] == UDS_CP_RESP_USER_NOT_AUTHORIZED) {
|
||||||
Timber.e("Not authorized");
|
Timber.e("UDS_CP_CONSENT: Not authorized");
|
||||||
enterScaleUserConsentUi(this.selectedUser.getId(), getUserScaleIndex(this.selectedUser.getId()));
|
enterScaleUserConsentUi(this.selectedUser.getId(), getUserScaleIndex(this.selectedUser.getId()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -261,10 +266,15 @@ public class BluetoothStandardWeightProfile extends BluetoothCommunication {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Timber.e("Unhandled response");
|
Timber.e("CHARACTERISTIC_USER_CONTROL_POINT: Unhandled response code "
|
||||||
|
+ value[1] + " value [" + byteInHex(value) + "]");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Timber.d("CHARACTERISTIC_USER_CONTROL_POINT: non-response code " + value[0]
|
||||||
|
+ " value [" + byteInHex(value) + "]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ScaleMeasurement weightMeasurementToScaleMeasurement(byte[] value) {
|
protected ScaleMeasurement weightMeasurementToScaleMeasurement(byte[] value) {
|
||||||
|
Reference in New Issue
Block a user