]> sigrok.org Git - libsigrok.git/blobdiff - src/serial_bt.c
korad-kaxxxxp: use ID text prefix with optional version for RND models
[libsigrok.git] / src / serial_bt.c
index 37a1a68b0ad2147d5b540c10b49ec53773fcb59f..ea3531d3cd950adbfb561bc0b55bb48a8e688d20 100644 (file)
@@ -24,9 +24,7 @@
 #include <string.h>
 #include <memory.h>
 
-/** @cond PRIVATE */
 #define LOG_PREFIX "serial-bt"
-/** @endcond */
 
 #ifdef HAVE_SERIAL_COMM
 #ifdef HAVE_BLUETOOTH
@@ -109,8 +107,6 @@ static const char *conn_name_text(enum ser_bt_conn_t type)
  *
  * @return 0 upon success, non-zero upon failure.
  *
- * @internal
- *
  * Summary of parsing rules as they are implemented:
  * - Implementor's note: Automatic scan for available devices is not
  *   yet implemented. So strictly speaking some parts of the input
@@ -146,9 +142,9 @@ static int ser_bt_parse_conn_spec(
        uint16_t *read_hdl, uint16_t *write_hdl,
        uint16_t *cccd_hdl, uint16_t *cccd_val)
 {
+       char **fields, *field;
        enum ser_bt_conn_t type;
        const char *addr;
-       char **fields, *field;
 
        if (conn_type)
                *conn_type = SER_BT_CONN_UNKNOWN;
@@ -165,9 +161,6 @@ static int ser_bt_parse_conn_spec(
        if (cccd_val)
                *cccd_val = 0;
 
-       type = SER_BT_CONN_UNKNOWN;
-       addr = NULL;
-
        if (!serial || !spec || !spec[0])
                return SR_ERR_ARG;
 
@@ -494,17 +487,14 @@ static int ser_bt_read(struct sr_serial_dev_inst *serial,
         * Immediately satisfy the caller's request from the RX buffer
         * if the requested amount of data is available already.
         */
-       if (sr_ser_has_queued_data(serial) >= count) {
-               rc = sr_ser_unqueue_rx_data(serial, buf, count);
-               return rc;
-       }
+       if (sr_ser_has_queued_data(serial) >= count)
+               return sr_ser_unqueue_rx_data(serial, buf, count);
 
        /*
         * When a timeout was specified, then determine the deadline
         * where to stop reception.
         */
        deadline_us = 0;
-       now_us = 0;     /* Silence a (false) compiler warning. */
        if (timeout_ms) {
                now_us = g_get_monotonic_time();
                deadline_us = now_us + timeout_ms * 1000;
@@ -576,28 +566,6 @@ static int ser_bt_read(struct sr_serial_dev_inst *serial,
        return sr_ser_unqueue_rx_data(serial, buf, dlen);
 }
 
-static int ser_bt_set_params(struct sr_serial_dev_inst *serial,
-               int baudrate, int bits, int parity, int stopbits,
-               int flowcontrol, int rts, int dtr)
-{
-       /*
-        * Bluetooth communication has no concept of bitrate, so ignore
-        * these arguments silently. Neither need we pass the frame format
-        * down to internal BT comm routines, nor need we keep the values
-        * here, since the caller will cache/register them already.
-        */
-       (void)serial;
-       (void)baudrate;
-       (void)bits;
-       (void)parity;
-       (void)stopbits;
-       (void)flowcontrol;
-       (void)rts;
-       (void)dtr;
-
-       return SR_OK;
-}
-
 struct bt_source_args_t {
        /* The application callback. */
        sr_receive_data_callback cb;
@@ -766,9 +734,8 @@ static void scan_cb(void *cb_args, const char *addr, const char *name)
 
        /* Check whether the device was seen before. */
        for (l = scan_args->addr_list; l; l = l->next) {
-               if (strcmp(addr, l->data) == 0) {
+               if (strcmp(addr, l->data) == 0)
                        return;
-               }
        }
 
        /* Substitute colons in the address by dashes. */
@@ -838,7 +805,14 @@ static struct ser_lib_functions serlib_bt = {
        .drain = ser_bt_drain,
        .write = ser_bt_write,
        .read = ser_bt_read,
-       .set_params = ser_bt_set_params,
+       /*
+        * Bluetooth communication has no concept of bitrate, so ignore
+        * these arguments silently. Neither need we pass the frame format
+        * down to internal BT comm routines, nor need we keep the values
+        * here, since the caller will cache/register them already.
+        */
+       .set_params = std_dummy_set_params,
+       .set_handshake = std_dummy_set_handshake,
        .setup_source_add = ser_bt_setup_source_add,
        .setup_source_remove = ser_bt_setup_source_remove,
        .list = ser_bt_list,