From 2aa6ffe0c8a1d60cc1eda20a67838f41aa057396 Mon Sep 17 00:00:00 2001 From: Claudiu Olteanu Date: Tue, 18 Aug 2015 20:17:45 +0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qtserialbluetooth.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'qtserialbluetooth.cpp') 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); -- cgit v1.2.3-70-g09d2