mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-08 03:16:17 +00:00
Add set_timeout callback for Bluetooth custom serial implementation
The new callback will be usefull when we will implement the support for Windows. The implementation of native serial set_timeout method uses a HANDLER on Windows and we will use the WinSock2 API which has a socket descriptor. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
69c81ed8e4
commit
2aa6ffe0c8
1 changed files with 11 additions and 1 deletions
|
@ -224,6 +224,15 @@ static int qt_serial_get_transmitted(serial_t *device)
|
||||||
return device->socket->bytesToWrite();
|
return device->socket->bytesToWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qt_serial_set_timeout(serial_t *device, long timeout)
|
||||||
|
{
|
||||||
|
if (device == NULL)
|
||||||
|
return DC_STATUS_INVALIDARGS;
|
||||||
|
|
||||||
|
device->timeout = timeout;
|
||||||
|
|
||||||
|
return DC_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
const dc_serial_operations_t qt_serial_ops = {
|
const dc_serial_operations_t qt_serial_ops = {
|
||||||
.open = qt_serial_open,
|
.open = qt_serial_open,
|
||||||
|
@ -232,7 +241,8 @@ const dc_serial_operations_t qt_serial_ops = {
|
||||||
.write = qt_serial_write,
|
.write = qt_serial_write,
|
||||||
.flush = qt_serial_flush,
|
.flush = qt_serial_flush,
|
||||||
.get_received = qt_serial_get_received,
|
.get_received = qt_serial_get_received,
|
||||||
.get_transmitted = qt_serial_get_transmitted
|
.get_transmitted = qt_serial_get_transmitted,
|
||||||
|
.set_timeout = qt_serial_set_timeout
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void dc_serial_init (dc_serial_t *serial, void *data, const dc_serial_operations_t *ops);
|
extern void dc_serial_init (dc_serial_t *serial, void *data, const dc_serial_operations_t *ops);
|
||||||
|
|
Loading…
Add table
Reference in a new issue