1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Avoid code duplication by reusing logMessageContent()

This commit is contained in:
cpfeiffer 2015-09-01 21:26:51 +02:00
parent 46171e4ab8
commit 5c2bd1e8df
3 changed files with 3 additions and 8 deletions

View File

@ -627,7 +627,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
*
* @param value
*/
private void logMessageContent(byte[] value) {
public void logMessageContent(byte[] value) {
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
for (byte b : value) {
LOG.warn("DATA: " + String.format("0x%2x", b));

View File

@ -165,9 +165,7 @@ public class FetchActivityOperation extends AbstractBTLEOperation<MiBandSupport>
} else {
// 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);
for (byte b : value) {
LOG.warn("DATA: " + String.format("0x%8x", b));
}
getSupport().logMessageContent(value);
}
} else {
LOG.error("error buffering activity data: remaining bytes: " + activityStruct.activityDataRemainingBytes + ", received: " + value.length);

View File

@ -80,10 +80,7 @@ public class UpdateFirmwareOperation extends AbstractBTLEOperation<MiBandSupport
private void handleNotificationNotif(byte[] value) {
if(value.length != 1) {
LOG.error("Notifications should be 1 byte long.");
LOG.info("RECEIVED DATA WITH LENGTH: " + value.length);
for (byte b : value) {
LOG.warn("DATA: " + String.format("0x%2x", b));
}
getSupport().logMessageContent(value);
return;
}
switch (value[0]) {