Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/btshell/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,25 @@ static const struct shell_cmd_help gatt_clear_pending_notif_help = {
.usage = NULL,
.params = NULL,
};

#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
/*****************************************************************************
* $gatt-eatt-connect *
*****************************************************************************/

static const struct shell_param gatt_eatt_connect_params[] = {
{"conn", "connection handle, usage: =<UINT16>" },
{"chan_num", "number of channels to connect, usage =<UINT16>" },
{NULL, NULL }
};

static const struct shell_cmd_help gatt_eatt_connect_help = {
.summary = "Connect EATT channels",
.usage = NULL,
.params = gatt_eatt_connect_params,
};
#endif

#endif

#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM)
Expand Down Expand Up @@ -4645,6 +4664,15 @@ static const struct shell_cmd btshell_commands[] = {
.help = &gatt_clear_pending_notif_help,
#endif
},
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
{
.sc_cmd = "gatt-eatt-connect",
.sc_cmd_func = cmd_gatt_eatt_connect,
#if MYNEWT_VAL(SHELL_CMD_HELP)
.help = &gatt_eatt_connect_help,
#endif
},
#endif
#if MYNEWT_VAL(BLE_L2CAP_COC_MAX_NUM)
{
.sc_cmd = "l2cap-update",
Expand Down
32 changes: 32 additions & 0 deletions apps/btshell/src/cmd_gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,3 +664,35 @@ cmd_gatt_clear_pending_notif(int argc, char **argv)
return ENOTSUP;
#endif
}

#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
/*****************************************************************************
* $gatt-eatt-connect *
*****************************************************************************/

int
cmd_gatt_eatt_connect(int argc, char **argv)
{
uint16_t conn_handle;
uint16_t chan_num;
int rc;

rc = parse_arg_init(argc - 1, argv + 1);
if (rc != 0) {
return rc;
}

conn_handle = parse_arg_uint16("conn", &rc);
if (rc != 0) {
console_printf("invalid 'conn' parameter\n");
return rc;
}

chan_num = parse_arg_uint16("chan_num", &rc);
if (rc != 0) {
console_printf("invalid 'chan_num' parameter\n");
return rc;
}
return ble_eatt_connect(conn_handle, chan_num);
}
#endif
3 changes: 3 additions & 0 deletions apps/btshell/src/cmd_gatt.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ int cmd_gatt_write(int argc, char **argv);
int cmd_gatt_enqueue_notif(int argc, char **argv);
int cmd_gatt_send_pending_notif(int argc, char **argv);
int cmd_gatt_clear_pending_notif(int argc, char **argv);
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
int cmd_gatt_eatt_connect(int argc, char **argv);
#endif

#endif
11 changes: 11 additions & 0 deletions nimble/host/include/host/ble_att.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,17 @@ uint16_t ble_att_preferred_mtu(void);
*/
int ble_att_set_preferred_mtu(uint16_t mtu);

/**
* Manually establish L2CAP Enhanced Connection
*
* @param conn_handle ACL connection handle
* @param chan_num Number of channels to establish
*
* @return 0 on sucess;
* NimBLE host error return code on
* error.
*/
int ble_eatt_connect(uint16_t conn_handle, uint8_t chan_num);
#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions nimble/host/include/host/ble_l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#ifndef H_BLE_L2CAP_
#define H_BLE_L2CAP_

#include <inttypes.h>
#include "nimble/nimble_opt.h"
#ifdef __cplusplus
extern "C" {
Expand Down
Loading
Loading