Bluetooth: Move le_conn_update() to conn.c

Change-Id: Iaaf1cce09aef2e09c0cb2cca3500368a5faec2ae
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-07-15 14:08:53 +03:00 committed by Anas Nashif
commit e060c621d1
5 changed files with 27 additions and 27 deletions

View file

@ -587,3 +587,26 @@ int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand,
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_START_ENCRYPTION, buf, NULL);
}
int bt_conn_le_conn_update(struct bt_conn *conn, uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout)
{
struct hci_cp_le_conn_update *conn_update;
struct bt_buf *buf;
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_UPDATE,
sizeof(*conn_update));
if (!buf) {
return -ENOBUFS;
}
conn_update = bt_buf_add(buf, sizeof(*conn_update));
memset(conn_update, 0, sizeof(*conn_update));
conn_update->handle = sys_cpu_to_le16(conn->handle);
conn_update->conn_interval_min = sys_cpu_to_le16(min);
conn_update->conn_interval_max = sys_cpu_to_le16(max);
conn_update->conn_latency = sys_cpu_to_le16(latency);
conn_update->supervision_timeout = sys_cpu_to_le16(timeout);
return bt_hci_cmd_send(BT_HCI_OP_LE_CONN_UPDATE, buf);
}

View file

@ -110,3 +110,6 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state);
/* rand and ediv should be in BT order */
int bt_conn_le_start_encryption(struct bt_conn *conn, uint64_t rand,
uint16_t ediv, const uint8_t *ltk);
int bt_conn_le_conn_update(struct bt_conn *conn, uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout);

View file

@ -1534,26 +1534,3 @@ int bt_stop_scanning(void)
return bt_le_scan_update();
}
int bt_hci_le_conn_update(uint16_t handle, uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout)
{
struct hci_cp_le_conn_update *conn_update;
struct bt_buf *buf;
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_UPDATE,
sizeof(*conn_update));
if (!buf) {
return -ENOBUFS;
}
conn_update = bt_buf_add(buf, sizeof(*conn_update));
memset(conn_update, 0, sizeof(*conn_update));
conn_update->handle = sys_cpu_to_le16(handle);
conn_update->conn_interval_min = sys_cpu_to_le16(min);
conn_update->conn_interval_max = sys_cpu_to_le16(max);
conn_update->conn_latency = sys_cpu_to_le16(latency);
conn_update->supervision_timeout = sys_cpu_to_le16(timeout);
return bt_hci_cmd_send(BT_HCI_OP_LE_CONN_UPDATE, buf);
}

View file

@ -159,7 +159,4 @@ const char *bt_addr_str(const bt_addr_t *addr);
const char *bt_addr_le_str(const bt_addr_le_t *addr);
#endif
int bt_hci_le_conn_update(uint16_t handle, uint16_t min, uint16_t max,
uint16_t latency, uint16_t timeout);
int bt_le_scan_update(void);

View file

@ -236,7 +236,7 @@ static void le_conn_param_update_req(struct bt_conn *conn, uint8_t ident,
bt_l2cap_send(conn, BT_L2CAP_CID_LE_SIG, buf);
if (result == BT_L2CAP_CONN_PARAM_ACCEPTED) {
bt_hci_le_conn_update(conn->handle, min, max, latency, timeout);
bt_conn_le_conn_update(conn, min, max, latency, timeout);
}
}