mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Add implementation for BTH custom serial write method used on Windows
Implement the write method used for our custom serial implementation on Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
994087c0b9
commit
3b811552aa
1 changed files with 13 additions and 2 deletions
|
@ -263,9 +263,20 @@ static int qt_serial_write(serial_t *device, const void* data, unsigned int size
|
|||
if (device == NULL)
|
||||
return DC_STATUS_INVALIDARGS;
|
||||
|
||||
// TODO write *size* bytes from data to the device
|
||||
unsigned int nbytes = 0;
|
||||
int rc;
|
||||
|
||||
return 0;
|
||||
while (nbytes < size) {
|
||||
rc = send(device->socket, (char *) data + nbytes, size - nbytes, 0);
|
||||
|
||||
if (rc < 0) {
|
||||
return -1; // Error during send call.
|
||||
}
|
||||
|
||||
nbytes += rc;
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
#else
|
||||
if (device == NULL || device->socket == NULL)
|
||||
return DC_STATUS_INVALIDARGS;
|
||||
|
|
Loading…
Add table
Reference in a new issue