Skip to content

Commit

Permalink
Bluetooth: shell: Add support for RFCOMM Disconnect
Browse files Browse the repository at this point in the history
This is used to disconnect a dlc.

Syntax:
>br-rfcomm-disconnect

Change-Id: I8f345d9fbb1f1f84bfb1f697322d9a87ff531797
Signed-off-by: Jaganath Kanakkassery <[email protected]>
  • Loading branch information
jkanakkx authored and Johan Hedberg committed Dec 9, 2016
1 parent 4349141 commit 7775319
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/bluetooth/shell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,18 @@ static int cmd_rfcomm_send(int argc, char *argv[])
return 0;
}

static int cmd_rfcomm_disconnect(int argc, char *argv[])
{
int err;

err = bt_rfcomm_dlc_disconnect(&rfcomm_dlc);
if (err) {
printk("Unable to disconnect: %u\n", -err);
}

return 0;
}

#endif /* CONFIG_BLUETOOTH_RFCOMM) */

static int cmd_bredr_discoverable(int argc, char *argv[])
Expand Down Expand Up @@ -2288,6 +2300,7 @@ static const struct shell_cmd commands[] = {
{ "br-rfcomm-register", cmd_bredr_rfcomm_register },
{ "br-rfcomm-connect", cmd_rfcomm_connect, "<channel>" },
{ "br-rfcomm-send", cmd_rfcomm_send, "<number of packets>"},
{ "br-rfcomm-disconnect", cmd_rfcomm_disconnect, HELP_NONE },
#endif /* CONFIG_BLUETOOTH_RFCOMM */
#endif
{ NULL, NULL }
Expand Down

0 comments on commit 7775319

Please sign in to comment.