Avoid code duplication by reusing logMessageContent()
This commit is contained in:
parent
46171e4ab8
commit
5c2bd1e8df
|
@ -627,7 +627,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
private void logMessageContent(byte[] value) {
|
public void logMessageContent(byte[] value) {
|
||||||
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
||||||
for (byte b : value) {
|
for (byte b : value) {
|
||||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
LOG.warn("DATA: " + String.format("0x%2x", b));
|
||||||
|
|
|
@ -165,9 +165,7 @@ public class FetchActivityOperation extends AbstractBTLEOperation<MiBandSupport>
|
||||||
} else {
|
} else {
|
||||||
// the length of the chunk is not what we expect. We need to make sense of this data
|
// the length of the chunk is not what we expect. We need to make sense of this data
|
||||||
LOG.warn("GOT UNEXPECTED ACTIVITY DATA WITH LENGTH: " + value.length + ", EXPECTED LENGTH: " + activityStruct.activityDataRemainingBytes);
|
LOG.warn("GOT UNEXPECTED ACTIVITY DATA WITH LENGTH: " + value.length + ", EXPECTED LENGTH: " + activityStruct.activityDataRemainingBytes);
|
||||||
for (byte b : value) {
|
getSupport().logMessageContent(value);
|
||||||
LOG.warn("DATA: " + String.format("0x%8x", b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.error("error buffering activity data: remaining bytes: " + activityStruct.activityDataRemainingBytes + ", received: " + value.length);
|
LOG.error("error buffering activity data: remaining bytes: " + activityStruct.activityDataRemainingBytes + ", received: " + value.length);
|
||||||
|
|
|
@ -80,10 +80,7 @@ public class UpdateFirmwareOperation extends AbstractBTLEOperation<MiBandSupport
|
||||||
private void handleNotificationNotif(byte[] value) {
|
private void handleNotificationNotif(byte[] value) {
|
||||||
if(value.length != 1) {
|
if(value.length != 1) {
|
||||||
LOG.error("Notifications should be 1 byte long.");
|
LOG.error("Notifications should be 1 byte long.");
|
||||||
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
|
getSupport().logMessageContent(value);
|
||||||
for (byte b : value) {
|
|
||||||
LOG.warn("DATA: " + String.format("0x%2x", b));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (value[0]) {
|
switch (value[0]) {
|
||||||
|
|
Loading…
Reference in New Issue