diff options
author | Claudiu Olteanu <olteanu.claudiu@ymail.com> | 2015-08-18 20:17:45 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-20 22:45:16 -0700 |
commit | 2aa6ffe0c8a1d60cc1eda20a67838f41aa057396 (patch) | |
tree | 2e274f13f531ce0aba6f098336019c94861393f0 /qtserialbluetooth.cpp | |
parent | 69c81ed8e4758b41c54faf7e48e48290e2a56581 (diff) | |
download | subsurface-2aa6ffe0c8a1d60cc1eda20a67838f41aa057396.tar.gz |
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>
Diffstat (limited to 'qtserialbluetooth.cpp')
-rw-r--r-- | qtserialbluetooth.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp index 5a982d68b..378f33043 100644 --- a/qtserialbluetooth.cpp +++ b/qtserialbluetooth.cpp @@ -224,6 +224,15 @@ static int qt_serial_get_transmitted(serial_t *device) 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 = { .open = qt_serial_open, @@ -232,7 +241,8 @@ const dc_serial_operations_t qt_serial_ops = { .write = qt_serial_write, .flush = qt_serial_flush, .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); |