]> sigrok.org Git - libsigrok.git/blobdiff - src/serial_bt.c
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / serial_bt.c
index 67b4e6a5f45808b40e49e9cd64ff58ee0b1c5cd5..977f248b5eb4b62fc682a939fe7664cda4c63789 100644 (file)
@@ -84,6 +84,7 @@ static const struct scan_supported_item {
        { "DL24M_BLE", SER_BT_CONN_AC6328, NULL, },
        { "DL24M_SPP", SER_BT_CONN_RFCOMM, "/channel=2", },
        { "HC-05", SER_BT_CONN_RFCOMM, NULL, },
+       { "TC66C", SER_BT_CONN_DIALOG, "/mtu=200", },
        { "UC96_BLE", SER_BT_CONN_AC6328, NULL, },
        { "UC96_SPP", SER_BT_CONN_RFCOMM, "/channel=2", },
        { "UM25C", SER_BT_CONN_RFCOMM, NULL, },
@@ -114,6 +115,8 @@ static const char *ser_bt_conn_names[SER_BT_CONN_MAX] = {
        [SER_BT_CONN_NRF51] = "nrf51",
        [SER_BT_CONN_CC254x] = "cc254x",
        [SER_BT_CONN_AC6328] = "ac6328",
+       [SER_BT_CONN_DIALOG] = "dialog",
+       [SER_BT_CONN_NOTIFY] = "notify",
 };
 
 static enum ser_bt_conn_t lookup_conn_name(const char *name)
@@ -305,6 +308,23 @@ static int ser_bt_parse_conn_spec(
                if (cccd_val)
                        *cccd_val = 0x0001;
                break;
+       case SER_BT_CONN_DIALOG:
+               if (read_hdl)
+                       *read_hdl = 23;
+               if (write_hdl)
+                       *write_hdl = 18;
+               if (cccd_hdl)
+                       *cccd_hdl = 0;
+               if (cccd_val)
+                       *cccd_val = 0x0001;
+               if (ble_mtu)
+                       *ble_mtu = 400;
+               break;
+       case SER_BT_CONN_NOTIFY:
+               /* All other values must be provided externally. */
+               if (cccd_val)
+                       *cccd_val = 0x0001;
+               break;
        default:
                return SR_ERR_ARG;
        }
@@ -508,6 +528,8 @@ static int ser_bt_open(struct sr_serial_dev_inst *serial, int flags)
        case SER_BT_CONN_NRF51:
        case SER_BT_CONN_CC254x:
        case SER_BT_CONN_AC6328:
+       case SER_BT_CONN_DIALOG:
+       case SER_BT_CONN_NOTIFY:
                rc = sr_bt_config_notify(desc,
                        read_hdl, write_hdl, cccd_hdl, cccd_val,
                        ble_mtu);
@@ -543,6 +565,8 @@ static int ser_bt_open(struct sr_serial_dev_inst *serial, int flags)
        case SER_BT_CONN_NRF51:
        case SER_BT_CONN_CC254x:
        case SER_BT_CONN_AC6328:
+       case SER_BT_CONN_DIALOG:
+       case SER_BT_CONN_NOTIFY:
                rc = sr_bt_connect_ble(desc);
                if (rc < 0)
                        return SR_ERR;
@@ -620,6 +644,8 @@ static int ser_bt_write(struct sr_serial_dev_inst *serial,
        case SER_BT_CONN_NRF51:
        case SER_BT_CONN_CC254x:
        case SER_BT_CONN_AC6328:
+       case SER_BT_CONN_DIALOG:
+       case SER_BT_CONN_NOTIFY:
                /*
                 * Assume that when applications call the serial layer's
                 * write routine, then the BLE chip/module does support
@@ -686,6 +712,8 @@ static int ser_bt_read(struct sr_serial_dev_inst *serial,
                case SER_BT_CONN_NRF51:
                case SER_BT_CONN_CC254x:
                case SER_BT_CONN_AC6328:
+               case SER_BT_CONN_DIALOG:
+               case SER_BT_CONN_NOTIFY:
                        dlen = sr_ser_has_queued_data(serial);
                        rc = sr_bt_check_notify(serial->bt_desc);
                        if (rc < 0)
@@ -784,6 +812,8 @@ static int bt_source_cb(int fd, int revents, void *cb_data)
                case SER_BT_CONN_NRF51:
                case SER_BT_CONN_CC254x:
                case SER_BT_CONN_AC6328:
+               case SER_BT_CONN_DIALOG:
+               case SER_BT_CONN_NOTIFY:
                        dlen = sr_ser_has_queued_data(serial);
                        rc = sr_bt_check_notify(serial->bt_desc);
                        if (rc < 0)