Added event notifications for the Mares Nemo.
This commit is contained in:
parent
204c83c150
commit
6b4663444b
@ -170,6 +170,11 @@ mares_nemo_device_dump (device_t *abstract, unsigned char data[], unsigned int s
|
||||
return DEVICE_STATUS_MEMORY;
|
||||
}
|
||||
|
||||
// Enable progress notifications.
|
||||
device_progress_t progress = DEVICE_PROGRESS_INITIALIZER;
|
||||
progress.maximum = MARES_NEMO_MEMORY_SIZE + 20;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Receive the header of the package.
|
||||
unsigned char header = 0x00;
|
||||
for (unsigned int i = 0; i < 20;) {
|
||||
@ -185,6 +190,10 @@ mares_nemo_device_dump (device_t *abstract, unsigned char data[], unsigned int s
|
||||
}
|
||||
}
|
||||
|
||||
// Update and emit a progress event.
|
||||
progress.current += 20;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
unsigned int nbytes = 0;
|
||||
while (nbytes < MARES_NEMO_MEMORY_SIZE) {
|
||||
// Read the packet.
|
||||
@ -220,6 +229,10 @@ mares_nemo_device_dump (device_t *abstract, unsigned char data[], unsigned int s
|
||||
return DEVICE_STATUS_PROTOCOL;
|
||||
}
|
||||
|
||||
// Update and emit a progress event.
|
||||
progress.current += MARES_NEMO_PACKET_SIZE;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
nbytes += MARES_NEMO_PACKET_SIZE;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user