summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qtserialbluetooth.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp
index 9d1c14b74..45fc8d1ec 100644
--- a/qtserialbluetooth.cpp
+++ b/qtserialbluetooth.cpp
@@ -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;