Esempio n. 1
0
int
ble_l2cap_sig_update_req_tx(struct ble_hs_conn *conn,
                            struct ble_l2cap_chan *chan, uint8_t id,
                            struct ble_l2cap_sig_update_req *req)
{
    struct os_mbuf *txom;
    void *payload_buf;
    int rc;

    rc = ble_l2cap_sig_init_cmd(BLE_L2CAP_SIG_OP_UPDATE_REQ, id,
                                BLE_L2CAP_SIG_UPDATE_REQ_SZ, &txom,
                                &payload_buf);
    if (rc != BLE_HS_ENONE) {
        return rc;
    }

    ble_l2cap_sig_update_req_write(payload_buf, BLE_L2CAP_SIG_UPDATE_REQ_SZ,
                                   req);

    rc = ble_l2cap_tx(conn, chan, txom);
    if (rc != BLE_HS_ENONE) {
        return rc;
    }

    return BLE_HS_ENONE;
}
int
ble_l2cap_sig_update_req_tx(uint16_t conn_handle, uint8_t id,
                            struct ble_l2cap_sig_update_req *req)
{
    struct os_mbuf *txom;
    void *payload_buf;
    int rc;

    rc = ble_l2cap_sig_init_cmd(BLE_L2CAP_SIG_OP_UPDATE_REQ, id,
                                BLE_L2CAP_SIG_UPDATE_REQ_SZ, &txom,
                                &payload_buf);
    if (rc != 0) {
        return rc;
    }

    ble_l2cap_sig_update_req_write(payload_buf, BLE_L2CAP_SIG_UPDATE_REQ_SZ,
                                   req);

    rc = ble_l2cap_sig_tx(conn_handle, txom);
    if (rc != 0) {
        return rc;
    }

    return 0;
}