Port the Reefnet Sensus Original, Pro and Ultra to the new event code.
This commit is contained in:
parent
7cba191322
commit
3ce6a725a9
@ -267,8 +267,9 @@ reefnet_sensus_device_dump (device_t *abstract, unsigned char *data, unsigned in
|
||||
}
|
||||
|
||||
// Enable progress notifications.
|
||||
device_progress_state_t progress;
|
||||
progress_init (&progress, abstract, 4 + REEFNET_SENSUS_MEMORY_SIZE + 2 + 3);
|
||||
device_progress_t progress = DEVICE_PROGRESS_INITIALIZER;
|
||||
progress.maximum = 4 + REEFNET_SENSUS_MEMORY_SIZE + 2 + 3;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Send the command to the device.
|
||||
unsigned char command = 0x40;
|
||||
@ -295,7 +296,9 @@ reefnet_sensus_device_dump (device_t *abstract, unsigned char *data, unsigned in
|
||||
return EXITCODE (n);
|
||||
}
|
||||
|
||||
progress_event (&progress, DEVICE_EVENT_PROGRESS, len);
|
||||
// Update and emit a progress event.
|
||||
progress.current += len;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
nbytes += len;
|
||||
}
|
||||
|
||||
@ -235,8 +235,9 @@ reefnet_sensuspro_device_dump (device_t *abstract, unsigned char *data, unsigned
|
||||
}
|
||||
|
||||
// Enable progress notifications.
|
||||
device_progress_state_t progress;
|
||||
progress_init (&progress, abstract, REEFNET_SENSUSPRO_MEMORY_SIZE + 2);
|
||||
device_progress_t progress = DEVICE_PROGRESS_INITIALIZER;
|
||||
progress.maximum = REEFNET_SENSUSPRO_MEMORY_SIZE + 2;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
unsigned char command = 0xB4;
|
||||
int rc = serial_write (device->port, &command, 1);
|
||||
@ -258,7 +259,9 @@ reefnet_sensuspro_device_dump (device_t *abstract, unsigned char *data, unsigned
|
||||
return EXITCODE (rc);
|
||||
}
|
||||
|
||||
progress_event (&progress, DEVICE_EVENT_PROGRESS, len);
|
||||
// Update and emit a progress event.
|
||||
progress.current += len;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
nbytes += len;
|
||||
}
|
||||
|
||||
@ -384,8 +384,9 @@ reefnet_sensusultra_device_dump (device_t *abstract, unsigned char *data, unsign
|
||||
}
|
||||
|
||||
// Enable progress notifications.
|
||||
device_progress_state_t progress;
|
||||
progress_init (&progress, abstract, REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE);
|
||||
device_progress_t progress = DEVICE_PROGRESS_INITIALIZER;
|
||||
progress.maximum = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Send the instruction code to the device.
|
||||
device_status_t rc = reefnet_sensusultra_send_ushort (device, 0xB421);
|
||||
@ -402,7 +403,9 @@ reefnet_sensusultra_device_dump (device_t *abstract, unsigned char *data, unsign
|
||||
if (rc != DEVICE_STATUS_SUCCESS)
|
||||
return rc;
|
||||
|
||||
progress_event (&progress, DEVICE_EVENT_PROGRESS, REEFNET_SENSUSULTRA_PACKET_SIZE);
|
||||
// Update and emit a progress event.
|
||||
progress.current += REEFNET_SENSUSULTRA_PACKET_SIZE;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Accept the packet.
|
||||
rc = reefnet_sensusultra_send_uchar (device, ACCEPT);
|
||||
@ -670,8 +673,9 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback
|
||||
}
|
||||
|
||||
// Enable progress notifications.
|
||||
device_progress_state_t progress;
|
||||
progress_init (&progress, abstract, REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE);
|
||||
device_progress_t progress = DEVICE_PROGRESS_INITIALIZER;
|
||||
progress.maximum = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Initialize the state for the parsing code.
|
||||
unsigned int previous = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE;
|
||||
@ -695,7 +699,9 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback
|
||||
return rc;
|
||||
}
|
||||
|
||||
progress_event (&progress, DEVICE_EVENT_PROGRESS, REEFNET_SENSUSULTRA_PACKET_SIZE);
|
||||
// Update and emit a progress event.
|
||||
progress.current += REEFNET_SENSUSULTRA_PACKET_SIZE;
|
||||
device_event_emit (abstract, DEVICE_EVENT_PROGRESS, &progress);
|
||||
|
||||
// Abort the transfer if the page contains no useful data.
|
||||
if (reefnet_sensusultra_isempty (data + offset, REEFNET_SENSUSULTRA_PACKET_SIZE))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user