Implemented progress notifications for the Uwatec Aladin.

This commit is contained in:
Jef Driesen 2008-08-19 11:37:04 +00:00
parent 7e9a1be445
commit b884d90125

View File

@ -145,6 +145,10 @@ uwatec_aladin_device_dump (device_t *abstract, unsigned char data[], unsigned in
if (! device_is_uwatec_aladin (abstract)) if (! device_is_uwatec_aladin (abstract))
return DEVICE_STATUS_TYPE_MISMATCH; return DEVICE_STATUS_TYPE_MISMATCH;
// Enable progress notifications.
device_progress_state_t progress;
progress_init (&progress, abstract, UWATEC_ALADIN_MEMORY_SIZE + 2);
unsigned char answer[UWATEC_ALADIN_MEMORY_SIZE + 2] = {0}; unsigned char answer[UWATEC_ALADIN_MEMORY_SIZE + 2] = {0};
// Receive the header of the package. // Receive the header of the package.
@ -158,9 +162,12 @@ uwatec_aladin_device_dump (device_t *abstract, unsigned char data[], unsigned in
i++; // Continue. i++; // Continue.
} else { } else {
i = 0; // Reset. i = 0; // Reset.
progress_event (&progress, DEVICE_EVENT_WAITING, 0);
} }
} }
progress_event (&progress, DEVICE_EVENT_PROGRESS, 4);
// Receive the remaining part of the package. // Receive the remaining part of the package.
int rc = serial_read (device->port, answer + 4, sizeof (answer) - 4); int rc = serial_read (device->port, answer + 4, sizeof (answer) - 4);
if (rc != sizeof (answer) - 4) { if (rc != sizeof (answer) - 4) {
@ -168,6 +175,8 @@ uwatec_aladin_device_dump (device_t *abstract, unsigned char data[], unsigned in
return EXITCODE (rc); return EXITCODE (rc);
} }
progress_event (&progress, DEVICE_EVENT_PROGRESS, sizeof (answer) - 4);
// Reverse the bit order. // Reverse the bit order.
array_reverse_bits (answer, sizeof (answer)); array_reverse_bits (answer, sizeof (answer));