Implemented progress notifications for the Reefnet Sensus Ultra.
This commit is contained in:
parent
b3c1de2336
commit
7e9a1be445
@ -352,6 +352,10 @@ reefnet_sensusultra_device_dump (device_t *abstract, unsigned char *data, unsign
|
|||||||
if (size < REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE)
|
if (size < REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE)
|
||||||
return DEVICE_STATUS_ERROR;
|
return DEVICE_STATUS_ERROR;
|
||||||
|
|
||||||
|
// Enable progress notifications.
|
||||||
|
device_progress_state_t progress;
|
||||||
|
progress_init (&progress, abstract, REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE);
|
||||||
|
|
||||||
// Send the instruction code to the device.
|
// Send the instruction code to the device.
|
||||||
int rc = reefnet_sensusultra_send_ushort (device, 0xB421);
|
int rc = reefnet_sensusultra_send_ushort (device, 0xB421);
|
||||||
if (rc != DEVICE_STATUS_SUCCESS)
|
if (rc != DEVICE_STATUS_SUCCESS)
|
||||||
@ -367,6 +371,8 @@ reefnet_sensusultra_device_dump (device_t *abstract, unsigned char *data, unsign
|
|||||||
if (rc != DEVICE_STATUS_SUCCESS)
|
if (rc != DEVICE_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
progress_event (&progress, DEVICE_EVENT_PROGRESS, REEFNET_SENSUSULTRA_PACKET_SIZE);
|
||||||
|
|
||||||
// Accept the packet.
|
// Accept the packet.
|
||||||
rc = reefnet_sensusultra_send_uchar (device, ACCEPT);
|
rc = reefnet_sensusultra_send_uchar (device, ACCEPT);
|
||||||
if (rc != DEVICE_STATUS_SUCCESS)
|
if (rc != DEVICE_STATUS_SUCCESS)
|
||||||
@ -615,6 +621,10 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback
|
|||||||
return DEVICE_STATUS_MEMORY;
|
return DEVICE_STATUS_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable progress notifications.
|
||||||
|
device_progress_state_t progress;
|
||||||
|
progress_init (&progress, abstract, REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE);
|
||||||
|
|
||||||
// Initialize the state for the parsing code.
|
// Initialize the state for the parsing code.
|
||||||
unsigned int previous = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE;
|
unsigned int previous = REEFNET_SENSUSULTRA_MEMORY_DATA_SIZE;
|
||||||
|
|
||||||
@ -637,6 +647,8 @@ reefnet_sensusultra_device_foreach (device_t *abstract, dive_callback_t callback
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress_event (&progress, DEVICE_EVENT_PROGRESS, REEFNET_SENSUSULTRA_PACKET_SIZE);
|
||||||
|
|
||||||
// Abort the transfer if the page contains no useful data.
|
// Abort the transfer if the page contains no useful data.
|
||||||
if (reefnet_sensusultra_isempty (data + index, REEFNET_SENSUSULTRA_PACKET_SIZE))
|
if (reefnet_sensusultra_isempty (data + index, REEFNET_SENSUSULTRA_PACKET_SIZE))
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user