cwanda commented on a change in pull request #213: Updated bletiny docs and added btshell docs URL: https://github.com/apache/mynewt-site/pull/213#discussion_r126067946
########## File path: docs/network/ble/btshell/btshell_api.md ########## @@ -0,0 +1,120 @@ +## API for btshell app + +"btshell" is one of the sample applications that come with Mynewt. It is a shell application which provides a basic interface to the host-side of the BLE stack. "btshell" includes all the possible roles (Central/Peripheral) and they may be run simultaneously. You can run btshell on a board and issue commands that make it behave as a central or a peripheral with different peers. + +"btshell" is a new application that uses new shell features and has updated command and parameter names. If you want to use legacy BLE application pleas go to [bletiny app](../bletiny/bletiny_api.md). + +Highlighted below are some of the ways you can use the API to establish connections and discover services and characteristics from peer devices. For descriptions of the full API, go to the next sections on [GAP in btshell](btshell_GAP.md) and [GATT in btshell](btshell_GATT.md). + +<br> + +### Set device address. + +On startup, btshell has the following identity address configuration: + +* Public address: None +* Random address: None + +The below `set` commands can be used to change the address configuration: + +``` +set addr_type=public addr=<device-address> +set addr_type=random addr=<device-address> +``` + +For example: + +``` +set addr_type=public addr=01:02:03:04:05:06 +set addr_type=random addr=c1:aa:bb:cc:dd:ee +``` + +The address configuration can be viewed with the `gatt-show-addr` command, as follows: + +``` +gatt-show-addr +public_id_addr=01:02:03:04:05:06 random_id_addr=c1:aa:bb:cc:dd:ee +``` + +<br> + +### Initiate a direct connection to a device + +In this case, your board is acting as a central and initiating a connection with another BLE device. The example assumes you know the address of the peer, either by scanning for available peers or because you have set up the peer yourself. + +```hl_lines="1" +connect peer_addr=d4:f5:13:53:d2:43 +connection established; handle=1 our_ota_addr_type=0 our_ota_addr=0a:0b:0c:0d:0e:0f out_id_addr_type=0 our_id_addr=0a:0b:0c:0d:0e:0f peer_addr_type=0 peer_addr=43:d2:53:13:f5:d4 conn_itvl=40 conn_latency=0 supervision_timeout=256 encrypted=0 authenticated=0 bonded=0 +``` + +The `handle=1` in the output indicates that it is connection-1. + +<br> + +### Configure advertisements to include device name + +In this case, your board is acting as a peripheral. + +``` +set-adv-data name=<your-device-name> +``` + +<br> Review comment: Michal, for this particular file, i will need to wait until the above issues are resolved before I can continue to review the rest of the file. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services