Logger modifications

This commit is contained in:
Aleksander Nowakowski 2014-11-10 16:25:04 +01:00
parent 80cf2e3153
commit f91e608aa1
1 changed files with 10 additions and 6 deletions

View File

@ -576,9 +576,11 @@ public abstract class DfuBaseService extends IntentService {
} }
} else if (!mImageSizeSent) { } else if (!mImageSizeSent) {
// we've got confirmation that the image size was sent // we've got confirmation that the image size was sent
sendLogBroadcast(Level.INFO, "Data written to " + characteristic.getUuid() + ", value (0x): " + parse(characteristic));
mImageSizeSent = true; mImageSizeSent = true;
} else if (!mInitPacketSent) { } else if (!mInitPacketSent) {
// we've got confirmation that the init packet was sent // we've got confirmation that the init packet was sent
sendLogBroadcast(Level.INFO, "Data written to " + characteristic.getUuid() + ", value (0x): " + parse(characteristic));
mInitPacketSent = true; mInitPacketSent = true;
} }
} else { } else {
@ -918,7 +920,7 @@ public abstract class DfuBaseService extends IntentService {
version = readVersion(gatt, versionCharacteristic); version = readVersion(gatt, versionCharacteristic);
final int minor = (version & 0x0F); final int minor = (version & 0x0F);
final int major = (version >> 8); final int major = (version >> 8);
sendLogBroadcast(Level.INFO, "Version number read (version " + major + "." + minor + ")"); sendLogBroadcast(Level.APPLICATION, "Version number read: " + major + "." + minor);
} }
/* /*
@ -931,12 +933,12 @@ public abstract class DfuBaseService extends IntentService {
// the service is connected to the application, not to the bootloader // the service is connected to the application, not to the bootloader
logi("Application with buttonless update found"); logi("Application with buttonless update found");
sendLogBroadcast(Level.INFO, "Application with buttonless update found"); sendLogBroadcast(Level.WARNING, "Application with buttonless update found");
sendLogBroadcast(Level.VERBOSE, "Jumping to the DFU Bootloader..."); sendLogBroadcast(Level.VERBOSE, "Jumping to the DFU Bootloader...");
// enable notifications // enable notifications
setCharacteristicNotification(gatt, controlPointCharacteristic, true); setCharacteristicNotification(gatt, controlPointCharacteristic, true);
sendLogBroadcast(Level.INFO, "Notifications enabled"); sendLogBroadcast(Level.APPLICATION, "Notifications enabled");
// send 'jump to bootloader command' (Start DFU) // send 'jump to bootloader command' (Start DFU)
updateProgressNotification(PROGRESS_DISCONNECTING); updateProgressNotification(PROGRESS_DISCONNECTING);
@ -962,7 +964,7 @@ public abstract class DfuBaseService extends IntentService {
// enable notifications // enable notifications
setCharacteristicNotification(gatt, controlPointCharacteristic, true); setCharacteristicNotification(gatt, controlPointCharacteristic, true);
sendLogBroadcast(Level.INFO, "Notifications enabled"); sendLogBroadcast(Level.APPLICATION, "Notifications enabled");
try { try {
// set up the temporary variable that will hold the responses // set up the temporary variable that will hold the responses
@ -1150,7 +1152,7 @@ public abstract class DfuBaseService extends IntentService {
* b) If the ZIP file contains a application.hex (or .bin) file the 'application.dat' file must be included and contain the Init packet for the application. * b) If the ZIP file contains a application.hex (or .bin) file the 'application.dat' file must be included and contain the Init packet for the application.
*/ */
if (initIs != null) { if (initIs != null) {
sendLogBroadcast(Level.VERBOSE, "Writing Initialize DFU Parameters..."); sendLogBroadcast(Level.APPLICATION, "Writing Initialize DFU Parameters...");
logi("Sending the Initialize DFU Parameters START (Op Code = 2, Value = 0)"); logi("Sending the Initialize DFU Parameters START (Op Code = 2, Value = 0)");
writeOpCode(gatt, controlPointCharacteristic, OP_CODE_INIT_DFU_PARAMS_START); writeOpCode(gatt, controlPointCharacteristic, OP_CODE_INIT_DFU_PARAMS_START);
@ -1167,12 +1169,14 @@ public abstract class DfuBaseService extends IntentService {
} }
logi("Sending the Initialize DFU Parameters COMPLETE (Op Code = 2, Value = 1)"); logi("Sending the Initialize DFU Parameters COMPLETE (Op Code = 2, Value = 1)");
writeOpCode(gatt, controlPointCharacteristic, OP_CODE_INIT_DFU_PARAMS_COMPLETE); writeOpCode(gatt, controlPointCharacteristic, OP_CODE_INIT_DFU_PARAMS_COMPLETE);
sendLogBroadcast(Level.INFO, "Initialize DFU Parameters completed");
// a notification will come with confirmation. Let's wait for it a bit // a notification will come with confirmation. Let's wait for it a bit
response = readNotificationResponse(); response = readNotificationResponse();
status = getStatusCode(response, OP_CODE_INIT_DFU_PARAMS_KEY); status = getStatusCode(response, OP_CODE_INIT_DFU_PARAMS_KEY);
sendLogBroadcast(Level.APPLICATION, "Responce received (Op Code = " + response[1] + ", Status = " + status + ")"); sendLogBroadcast(Level.APPLICATION, "Responce received (Op Code = " + response[1] + ", Status = " + status + ")");
if (status != DFU_STATUS_SUCCESS)
throw new RemoteDfuException("Device returned error after sending init packet", status);
sendLogBroadcast(Level.APPLICATION, "Initialize DFU Parameters completed");
} else } else
mInitPacketSent = true; mInitPacketSent = true;