You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/07/08 21:03:09 UTC
[15/16] incubator-mynewt-site git commit: BLE Host API added. Project
Blinky documentation for Primo corrected. This closes #104 and #105.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/e98b0c12/develop/mkdocs/search_index.json
----------------------------------------------------------------------
diff --git a/develop/mkdocs/search_index.json b/develop/mkdocs/search_index.json
index 3d8f1f7..3f31246 100644
--- a/develop/mkdocs/search_index.json
+++ b/develop/mkdocs/search_index.json
@@ -492,7 +492,7 @@
},
{
"location": "/os/tutorials/blinky_primo/",
- "text": "Blinky, your \"Hello World!\", on Arduino Primo\n\n\n\n\nObjective\n\n\nLearn how to use packages from a default application repository of Mynewt to build your first \nHello World\n application (Blinky) on a target board. Once built using the \nnewt\n tool, this application will blink the LED lights on the target board.\n\n\nCreate a project with a simple app that blinks an LED on the Arduino Primo board. Download the application to the target and watch it blink!\n\n\nNote that the Mynewt OS will run on the nRF52 chip in the Arduino Primo board. However, the board support package for the Arduino Primo is different from the nRF52 dev kit board support package.\n\n\n\n\nHardware and Software needed\n\n\n\n\nArduino Primo\n\n\nLaptop running Mac OS\n\n\nA micro USB 2.0 cable to power the Arduino primo board\n\n\nIt is assumed you have already installed newt tool. \n\n\nIt is assumed you already installed native tools as described \nhere\n\n\nDebugger - choose one
of the two options below. Option 1 requires additional hardware but very easy to set up. Option 2 is free software install but not as simple as Option 1.\n\n\n\n\n\n\nOption 1\n\n\n\n\nSegger J-Link Debug Probe\n - any model (this tutorial has been tested with J-Link EDU and J-Link Pro)\n\n\nJ-Link 9 pin Cortex-M Adapter\n that allows JTAG, SWD and SWO connections between J-Link and Cortex M based target hardware systems\n\n\n\n\nOption 2\n\n\n\n\nNo additional hardware is required but a version of OpenOCD 0.10.0 that is currently in development needs to be installed. A patch for the nRF52 has been applied to the OpenOCD code in development and a tarball has been made available for download \nhere\n. Untar it. From the top of the directory tree (\"openocd-code-89bf96ffe6ac66c80407af8383b9d5adc0dc35f4\"), build it using the following configuration:\n\n\n\n\n$./configure --enable-cmsis-dap --enable-openjtag_ftdi --enable-jlink --enable-stlink\n\n\n\n\n\nThen run \nmake\n and \nsudo ma
ke install\n. This step takes minutes, so be patient.\n\n\n$ openocd -v\nOpen On-Chip Debugger 0.10.0-dev-snapshot (2016-05-20-10:43)\nLicensed under GNU GPL v2\nFor bug reports, read\n http://openocd.org/doc/doxygen/bugs.html\n\n\n\n\n\nYou can now use openocd to upload to Arduino Primo board via the USB port itself.\n\n\n\n\nInstall jlinkEXE\n\n\nIn order to be able to communicate with the SEGGER J-Link debugger on the dev board, you have to download and install the J-Link GDB Server software on to your laptop. You may download the \"Software and documentation pack for Mac OS X\" from \nhttps://www.segger.com/jlink-software.html\n. \n\n\n\n\nCreate a project.\n\n\nCreate a new project to hold your work. For a deeper understanding, you can read about project creation in \n\nGet Started -- Creating Your First Project\n\nor just follow the commands below.\n\n\n $ mkdir ~/dev\n $ cd ~/dev\n $ newt new myproj\n Downloading project skeleton from apache/incubator-mynewt-b
linky...\n Installing skeleton in myproj...\n Project myproj successfully created.\n\n $ cd myproj\n\n $ newt install -v \n apache-mynewt-core\n Downloading repository description for apache-mynewt-core... success!\n ...\n apache-mynewt-core successfully installed version 0.9.0\n\n\n\n\n\n\n\nIf you are working with 0.9.0 release (and not any subsequent releases), you will have to instruct newt to download code for the Arduino Primo Board Support Package (bsp) from the \ndevelop\n branch. You first edit the \nproject.yml\n file in your project directory to change \nvers:0-latest\n to \n0-dev\n:\n\n\nsnip\n\n#\nrepository.apache-mynewt-core:\n type: github\n\n vers: 0-dev\n\n user: apache\n repo: incubator-mynewt-core\n\n\n\n\n\nThen you run \nnewt upgrade\n:\n\n\n$ newt upgrade\napache-mynewt-core\nWould you like to upgrade repository apache-mynewt-core from 0.9.0-none to 0.0.0-none ? [Yn] Y\n\n\n\n\n\nNote\n: With the next release, the Arduino Pr
imo bsp will be included in the main release package. The above edit and \nnewt upgrade\n step will not be required.\n\n\n\n\nCreate the targets\n\n\nCreate two targets - one for the bootloader and one for the Primo board. \n\n\n$ newt target create primoblinky\n$ newt target set primoblinky app=@apache-mynewt-core/apps/blinky bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=debug\n\n$ newt target create primo_boot\n$ newt target set primo_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=optimized\n\n$ newt target show\ntargets/my_blinky_sim\n app=apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/native\n build_profile=debug\ntargets/primo_boot\n app=@apache-mynewt-core/apps/boot\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized\ntargets/primoblinky\n app=@apache-mynewt-core/apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimiz
ed\n\n\n\n\n\n\n\nBuild the target executables\n\n\n$ newt build primo_boot\n\nsnip\n\nCompiling log_shell.c\nArchiving log.a\nLinking boot.elf\nApp successfully built: ~/dev/myproj/bin/primo_boot/apps/boot/boot.elf\n\n\n\n\n\n$ newt build primoblinky\n\nsnip\n\nCompiling stats_shell.c\nArchiving stats.a\nLinking blinky.elf\nApp successfully built: ~/dev/myproj/bin/primoblinky/apps/blinky/blinky.elf\n\n\n\n\n\n\n\nSign and create the blinky application image\n\n\nYou must sign and version your application image to download it using newt to the board. Use the newt create-image command to perform this action. You may assign an arbitrary version (e.g. 1.0.0) to the image.\n\n\n$ newt create-image primoblinky 1.0.0\n\n\n\n\n\n\n\nConnect the board\n\n\nConnect the Segger J-Link debug probe to the JTAG port on the Primo board using the Jlink 9-pin adapter and cable. Note that there are two JTAG ports on the board. Use the one nearest to the reset button as shown in the picture. Also use
a micro USB 2.0 cable to connect the Primo board to one of your laptop's USB host ports.\n\n\n\n\n\n\nNote:\n If you are going the OpenOCD route, you do not need to attach this connector. \n\n\nDownload to the target\n\n\nDownload the bootloader first and then the blinky executable to the target platform. Don't forget to reset the board if you don't see the LED blinking right away. If the reset button doesn't work, powercycle the board!\n\n\n$ newt -v load primo_boot\n$ newt -v load primoblinky\n\n\n\n\n\n\n\nNote:\n If you want to erase the flash and load the image again, you can use JLinkExe to issue an \nerase\n command.\n\n\n$ JLinkExe -device nRF52 -speed 4000 -if SWD\nSEGGER J-Link Commander V5.12c (Compiled Apr 21 2016 16:05:51)\nDLL version V5.12c, compiled Apr 21 2016 16:05:45\n\nConnecting to J-Link via USB...O.K.\nFirmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17\nHardware version: V1.00\nS/N: 682863966\nVTref = 3.300V\n\n\nType \nconnect\n to estab
lish a target connection, \n?\n for help\nJ-Link\nerase\nCortex-M4 identified.\nErasing device (0;?i?)...\nComparing flash [100%] Done.\nErasing flash [100%] Done.\nVerifying flash [100%] Done.\nJ-Link: Flash download: Total time needed: 0.363s (Prepare: 0.093s, Compare: 0.000s, Erase: 0.262s, Program: 0.000s, Verify: 0.000s, Restore: 0.008s)\nErasing done.\nJ-Link\nexit\n$\n\n\n\n\n\n\n\nConclusion\n\n\nYou have created, setup, compiled, loaded, and ran your first mynewt application\nfor an Arduino Primo board.\n\n\nWe have more fun tutorials for you to get your hands dirty. Be bold and work on the OS with tutorials on \nwriting a test suite\n or try enabling additional functionality such as \nremote comms\n or \nBluetooth Low Energy\n on your current board.\n\n\nIf you see anything missing or want to send us feedback, please do so by signing up for appropriate mailing lists on our \nCommunity Page\n.\n\n\nKeep on hacking and blinking!",
+ "text": "Blinky, your \"Hello World!\", on Arduino Primo\n\n\n\n\nObjective\n\n\nLearn how to use packages from a default application repository of Mynewt to build your first \nHello World\n application (Blinky) on a target board. Once built using the \nnewt\n tool, this application will blink the LED lights on the target board.\n\n\nCreate a project with a simple app that blinks an LED on the Arduino Primo board. Download the application to the target and watch it blink!\n\n\nNote that the Mynewt OS will run on the nRF52 chip in the Arduino Primo board. However, the board support package for the Arduino Primo is different from the nRF52 dev kit board support package.\n\n\n\n\nHardware and Software needed\n\n\n\n\nArduino Primo\n\n\nLaptop running Mac OS\n\n\nA micro USB 2.0 cable to power the Arduino primo board\n\n\nIt is assumed you have already installed newt tool. \n\n\nIt is assumed you already installed native tools as described \nhere\n\n\nDebugger - choose one
of the two options below. Option 1 requires additional hardware but very easy to set up. Option 2 is free software install but not as simple as Option 1.\n\n\n\n\n\n\nOption 1\n\n\n\n\nSegger J-Link Debug Probe\n - any model (this tutorial has been tested with J-Link EDU and J-Link Pro)\n\n\nJ-Link 9 pin Cortex-M Adapter\n that allows JTAG, SWD and SWO connections between J-Link and Cortex M based target hardware systems\n\n\n\n\nOption 2\n\n\n\n\nNo additional hardware is required but a version of OpenOCD 0.10.0 that is currently in development needs to be installed. A patch for the nRF52 has been applied to the OpenOCD code in development and a tarball has been made available for download \nhere\n. Untar it. From the top of the directory tree (\"openocd-code-89bf96ffe6ac66c80407af8383b9d5adc0dc35f4\"), build it using the following configuration:\n\n\n\n\n$./configure --enable-cmsis-dap --enable-openjtag_ftdi --enable-jlink --enable-stlink\n\n\n\n\n\nThen run \nmake\n and \nsudo ma
ke install\n. This step takes minutes, so be patient.\n\n\n$ openocd -v\nOpen On-Chip Debugger 0.10.0-dev-snapshot (2016-05-20-10:43)\nLicensed under GNU GPL v2\nFor bug reports, read\n http://openocd.org/doc/doxygen/bugs.html\n\n\n\n\n\nNext, make sure that you have checked out the newt develop branch and rebuilt newt.\n\n\n$ cd $GOPATH/src/mynewt.apache.org/newt\n$ git checkout develop\n$ git pull\n$ cd newt\n$ go install\n\n\n\n\n\nNote:\n This step can be removed once the changes have been pushed to master.\n\n\nYou can now use openocd to upload to Arduino Primo board via the USB port itself.\n\n\n\n\nInstall jlinkEXE\n\n\nIn order to be able to communicate with the SEGGER J-Link debugger on the dev board, you have to download and install the J-Link GDB Server software on to your laptop. You may download the \"Software and documentation pack for Mac OS X\" from \nhttps://www.segger.com/jlink-software.html\n. \n\n\n\n\nCreate a project.\n\n\nCreate a new project to hold your w
ork. For a deeper understanding, you can read about project creation in \n\nGet Started -- Creating Your First Project\n\nor just follow the commands below.\n\n\n $ mkdir ~/dev\n $ cd ~/dev\n $ newt new myproj\n Downloading project skeleton from apache/incubator-mynewt-blinky...\n Installing skeleton in myproj...\n Project myproj successfully created.\n\n $ cd myproj\n\n $ newt install -v \n apache-mynewt-core\n Downloading repository description for apache-mynewt-core... success!\n ...\n apache-mynewt-core successfully installed version 0.9.0\n\n\n\n\n\n\n\nIf you are working with 0.9.0 release (and not any subsequent releases), you will have to instruct newt to download code for the Arduino Primo Board Support Package (bsp) from the \ndevelop\n branch. You first edit the \nproject.yml\n file in your project directory to change \nvers:0-latest\n to \n0-dev\n:\n\n\nsnip\n\n#\nrepository.apache-mynewt-core:\n type: github\n\n vers: 0-dev\n\n
user: apache\n repo: incubator-mynewt-core\n\n\n\n\n\nThen you run \nnewt upgrade\n:\n\n\n$ newt upgrade\napache-mynewt-core\nWould you like to upgrade repository apache-mynewt-core from 0.9.0-none to 0.0.0-none ? [Yn] Y\n\n\n\n\n\nNote\n: With the next release, the Arduino Primo bsp will be included in the main release package. The above edit and \nnewt upgrade\n step will not be required.\n\n\n\n\nCreate the targets\n\n\nCreate two targets - one for the bootloader and one for the Primo board. \n\n\n$ newt target create primoblinky\n$ newt target set primoblinky app=@apache-mynewt-core/apps/blinky bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=debug\n\n$ newt target create primo_boot\n$ newt target set primo_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=optimized\n\n$ newt target show\ntargets/my_blinky_sim\n app=apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/native\n build_profile=debug\ntar
gets/primo_boot\n app=@apache-mynewt-core/apps/boot\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized\ntargets/primoblinky\n app=@apache-mynewt-core/apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized\n\n\n\n\n\nIf you are using openocd you must set the openocd_debug feature for both primo_boot and primoblinky.\n\n\n$ newt target set primo_boot features=openocd_debug\n$ newt target set primoblinky features=openocd_debug\n\n\n\n\n\n\n\nBuild the target executables\n\n\n$ newt build primo_boot\n\nsnip\n\nCompiling log_shell.c\nArchiving log.a\nLinking boot.elf\nApp successfully built: ~/dev/myproj/bin/primo_boot/apps/boot/boot.elf\n\n\n\n\n\n$ newt build primoblinky\n\nsnip\n\nCompiling stats_shell.c\nArchiving stats.a\nLinking blinky.elf\nApp successfully built: ~/dev/myproj/bin/primoblinky/apps/blinky/blinky.elf\n\n\n\n\n\n\n\nSign and create the blinky application image\n\n\nYou must sign and vers
ion your application image to download it using newt to the board. Use the newt create-image command to perform this action. You may assign an arbitrary version (e.g. 1.0.0) to the image.\n\n\n$ newt create-image primoblinky 1.0.0\n\n\n\n\n\n\n\nConnect the board\n\n\nConnect the Segger J-Link debug probe to the JTAG port on the Primo board using the Jlink 9-pin adapter and cable. Note that there are two JTAG ports on the board. Use the one nearest to the reset button as shown in the picture. Also use a micro USB 2.0 cable to connect the Primo board to one of your laptop's USB host ports.\n\n\n\n\n\n\nNote:\n If you are going the OpenOCD route, you do not need to attach this connector. \n\n\nDownload to the target\n\n\nDownload the bootloader first and then the blinky executable to the target platform. Don't forget to reset the board if you don't see the LED blinking right away. If the reset button doesn't work, powercycle the board!\n\n\n$ newt -v load primo_boot\n$ newt -v load pr
imoblinky\n\n\n\n\n\n\n\nNote:\n If you want to erase the flash and load the image again, you can use JLinkExe to issue an \nerase\n command.\n\n\n$ JLinkExe -device nRF52 -speed 4000 -if SWD\nSEGGER J-Link Commander V5.12c (Compiled Apr 21 2016 16:05:51)\nDLL version V5.12c, compiled Apr 21 2016 16:05:45\n\nConnecting to J-Link via USB...O.K.\nFirmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17\nHardware version: V1.00\nS/N: 682863966\nVTref = 3.300V\n\n\nType \nconnect\n to establish a target connection, \n?\n for help\nJ-Link\nerase\nCortex-M4 identified.\nErasing device (0;?i?)...\nComparing flash [100%] Done.\nErasing flash [100%] Done.\nVerifying flash [100%] Done.\nJ-Link: Flash download: Total time needed: 0.363s (Prepare: 0.093s, Compare: 0.000s, Erase: 0.262s, Program: 0.000s, Verify: 0.000s, Restore: 0.008s)\nErasing done.\nJ-Link\nexit\n$\n\n\n\n\n\n\n\nConclusion\n\n\nYou have created, setup, compiled, loaded, and ran your first mynewt appli
cation\nfor an Arduino Primo board.\n\n\nWe have more fun tutorials for you to get your hands dirty. Be bold and work on the OS with tutorials on \nwriting a test suite\n or try enabling additional functionality such as \nremote comms\n or \nBluetooth Low Energy\n on your current board.\n\n\nIf you see anything missing or want to send us feedback, please do so by signing up for appropriate mailing lists on our \nCommunity Page\n.\n\n\nKeep on hacking and blinking!",
"title": "Blinky on Arduino Primo"
},
{
@@ -517,7 +517,7 @@
},
{
"location": "/os/tutorials/blinky_primo/#option-2",
- "text": "No additional hardware is required but a version of OpenOCD 0.10.0 that is currently in development needs to be installed. A patch for the nRF52 has been applied to the OpenOCD code in development and a tarball has been made available for download here . Untar it. From the top of the directory tree (\"openocd-code-89bf96ffe6ac66c80407af8383b9d5adc0dc35f4\"), build it using the following configuration: $./configure --enable-cmsis-dap --enable-openjtag_ftdi --enable-jlink --enable-stlink Then run make and sudo make install . This step takes minutes, so be patient. $ openocd -v\nOpen On-Chip Debugger 0.10.0-dev-snapshot (2016-05-20-10:43)\nLicensed under GNU GPL v2\nFor bug reports, read\n http://openocd.org/doc/doxygen/bugs.html You can now use openocd to upload to Arduino Primo board via the USB port itself.",
+ "text": "No additional hardware is required but a version of OpenOCD 0.10.0 that is currently in development needs to be installed. A patch for the nRF52 has been applied to the OpenOCD code in development and a tarball has been made available for download here . Untar it. From the top of the directory tree (\"openocd-code-89bf96ffe6ac66c80407af8383b9d5adc0dc35f4\"), build it using the following configuration: $./configure --enable-cmsis-dap --enable-openjtag_ftdi --enable-jlink --enable-stlink Then run make and sudo make install . This step takes minutes, so be patient. $ openocd -v\nOpen On-Chip Debugger 0.10.0-dev-snapshot (2016-05-20-10:43)\nLicensed under GNU GPL v2\nFor bug reports, read\n http://openocd.org/doc/doxygen/bugs.html Next, make sure that you have checked out the newt develop branch and rebuilt newt. $ cd $GOPATH/src/mynewt.apache.org/newt\n$ git checkout develop\n$ git pull\n$ cd newt\n$ go install Note: This step can be removed once the
changes have been pushed to master. You can now use openocd to upload to Arduino Primo board via the USB port itself.",
"title": "Option 2"
},
{
@@ -532,7 +532,7 @@
},
{
"location": "/os/tutorials/blinky_primo/#create-the-targets",
- "text": "Create two targets - one for the bootloader and one for the Primo board. $ newt target create primoblinky\n$ newt target set primoblinky app=@apache-mynewt-core/apps/blinky bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=debug\n\n$ newt target create primo_boot\n$ newt target set primo_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=optimized\n\n$ newt target show\ntargets/my_blinky_sim\n app=apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/native\n build_profile=debug\ntargets/primo_boot\n app=@apache-mynewt-core/apps/boot\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized\ntargets/primoblinky\n app=@apache-mynewt-core/apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized",
+ "text": "Create two targets - one for the bootloader and one for the Primo board. $ newt target create primoblinky\n$ newt target set primoblinky app=@apache-mynewt-core/apps/blinky bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=debug\n\n$ newt target create primo_boot\n$ newt target set primo_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52 build_profile=optimized\n\n$ newt target show\ntargets/my_blinky_sim\n app=apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/native\n build_profile=debug\ntargets/primo_boot\n app=@apache-mynewt-core/apps/boot\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized\ntargets/primoblinky\n app=@apache-mynewt-core/apps/blinky\n bsp=@apache-mynewt-core/hw/bsp/arduino_primo_nrf52\n build_profile=optimized If you are using openocd you must set the openocd_debug feature for both primo_boot and primoblinky. $ newt target set primo_boo
t features=openocd_debug\n$ newt target set primoblinky features=openocd_debug",
"title": "Create the targets"
},
{
@@ -7276,6 +7276,1516 @@
"title": "Initialize the NimBLE host"
},
{
+ "location": "/network/ble/ble_hs/ble_hs/",
+ "text": "NimBLE Host\n\n\nIntroduction\n\n\nAt a high level, the NimBLE stack is is divided into two components:\n\n\n\n\nHost\n\n\nController\n\n\n\n\nThis document is an API reference for the host component. If you are interested in the general structure of the NimBLE stack and its non-host components, you might want to read the \nBLE introduction\n.\n\n\nThe host sits directly below the application, and it serves as the interface to the application for all BLE operations.\n\n\nReference\n\n\n\n\nNimBLE Host Return Codes\n\n\nInitialization and Configuration\n\n\nGeneric Access Protocol (GAP)\n\n\nGeneric Attribute Profile (GATT) Client\n\n\nGeneric Attribute Profile (GATT) Server\n\n\nIdentity\n\n\nOther",
+ "title": "toc"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs/#nimble-host",
+ "text": "",
+ "title": "NimBLE Host"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs/#introduction",
+ "text": "At a high level, the NimBLE stack is is divided into two components: Host Controller This document is an API reference for the host component. If you are interested in the general structure of the NimBLE stack and its non-host components, you might want to read the BLE introduction . The host sits directly below the application, and it serves as the interface to the application for all BLE operations.",
+ "title": "Introduction"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs/#reference",
+ "text": "NimBLE Host Return Codes Initialization and Configuration Generic Access Protocol (GAP) Generic Attribute Profile (GATT) Client Generic Attribute Profile (GATT) Server Identity Other",
+ "title": "Reference"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/",
+ "text": "NimBLE Host Return Codes\n\n\n\n\nIntroduction\n\n\nSummary\n\n\nExample\n\n\n\n\n\n\nReturn Code Reference\n\n\nReturn codes - Core\n\n\nReturn codes - ATT\n\n\nReturn codes - HCI\n\n\nReturn codes - L2CAP\n\n\nReturn codes - Security manager (us)\n\n\nReturn codes - Security manager (peer)\n\n\n\n\n\n\n\n\nIntroduction\n\n\nSummary\n\n\nThe NimBLE host reports status to the application via a set of return codes. The host encompasses several layers of the Bluetooth specification that each defines its own set of status codes. Rather than \"abstract away\" information from lower layers that the application developer might find useful, the NimBLE host aims to indicate precisely what happened when something fails. Consequently, the host utilizes a rather large set of return codes.\n\n\nA return code of 0 indicates success. For failure conditions, the return codes are partitioned into five separate sets:\n\n\n\n\n\n\n\n\nSet\n\n\nCondition\n\n\n\n\n\n\n\n\n\n\nC
ore\n\n\nErrors detected internally by the NimBLE host.\n\n\n\n\n\n\nATT\n\n\nThe ATT server has reported a failure via the transmission of an ATT Error Response. The return code corresponds to the value of the Error Code field in the response.\n\n\n\n\n\n\nHCI\n\n\nThe controller has reported an error to the host via a command complete or command status HCI event. The return code corresponds to the value of the Status field in the event.\n\n\n\n\n\n\nL2CAP\n\n\nAn L2CAP signalling procedure has failed and an L2CAP Command Reject was sent as a result. The return code corresponds to the value of the Reason field in the command.\n\n\n\n\n\n\nSecurity manager (us)\n\n\nThe host detected an error during a security manager procedure and sent a Pairing Failed command to the peer. The return code corresponds to the value of the Reason field in the Pairing Failed command.\n\n\n\n\n\n\nSecurity manager (peer)\n\n\nA security manager procedure failed because the peer sent us a Pairing Fai
led command. The return code corresponds to the value of the Reason field in the Pairing Failed command.\n\n\n\n\n\n\n\n\nThe return codes in the core set are defined by the NimBLE Host. The other sets are defined in the Bluetooth specification; the codes in this latter group are referred to as \nformal status codes\n. As defined in the Bluetooth specification, the formal status code sets are not disjoint. That is, they overlap. For example, the spec defines a status code of 1 to have all of the following meanings:\n\n\n\n\n\n\n\n\nLayer\n\n\nMeaning\n\n\n\n\n\n\n\n\n\n\nATT\n\n\nInvalid handle.\n\n\n\n\n\n\nHCI\n\n\nUnknown HCI command.\n\n\n\n\n\n\nL2CAP\n\n\nSignalling MTU exceeded.\n\n\n\n\n\n\nSM\n\n\nPasskey entry failed.\n\n\n\n\n\n\n\n\nClearly, the host can't just return an unadorned formal status code and expect the application to make sense of it. To resolve this ambiguity, the NimBLE host divides the full range of an int into several subranges. Each subrange corre
sponds to one of the five return code sets. For example, the ATT set is mapped onto the subrange \n[0x100, 0x200)\n. To indicate an ATT error of 3 (write not permitted), the NimBLE host returns a value 0x103 to the application.\n\n\nThe host defines a set of convenience macros for converting from a formal status code to NimBLE host status code. These macros are documented in the table below.\n\n\n\n\n\n\n\n\nMacro\n\n\nStatus code set\n\n\nBase value\n\n\n\n\n\n\n\n\n\n\nBLE_HS_ATT_ERR()\n\n\nATT\n\n\n0x100\n\n\n\n\n\n\nBLE_HS_HCI_ERR()\n\n\nHCI\n\n\n0x200\n\n\n\n\n\n\nBLE_HS_L2C_ERR()\n\n\nL2CAP\n\n\n0x300\n\n\n\n\n\n\nBLE_HS_SM_US_ERR()\n\n\nSecurity manager (us)\n\n\n0x400\n\n\n\n\n\n\nBLE_HS_SM_PEER_ERR()\n\n\nSecurity manager (peer)\n\n\n0x500\n\n\n\n\n\n\n\n\nExample\n\n\nThe following example demonstrates how an application might determine which error is being reported by the host. In this example, the application performs the GAP encryption procedure and checks the retur
n code. To simplify the example, the application uses a hypothetical \nmy_blocking_enc_proc()\n function, which blocks until the pairing operation has completed.\n\n\nvoid\n\n\nencrypt_connection\n(\nuint16_t\n \nconn_handle\n)\n{\n \nint\n \nrc\n;\n\n \n/* Perform a blocking GAP encryption procedure. */\n\n \nrc\n \n=\n \nmy_blocking_enc_proc\n(\nconn_handle\n);\n \nswitch\n (\nrc\n) {\n \ncase\n \n0\n:\n\n \nconsole_printf\n(\nsuccess - link successfully encrypted\\n\n);\n \nbreak\n;\n\n \ncase\n \nBLE_HS_ENOTCONN\n:\n \nconsole_printf\n(\nfailure - no connection with handle %d\\n\n,\n \nconn_handle\n);\n \nbreak\n;\n\n \ncase\n \nBLE_HS_ERR_SM_US_BASE\n(\nBLE_SM_ERR_CONFIRM_MISMATCH\n)\n:\n\n \nconsole_printf\n(\nfailure - mismatch in peer\ns confirm and random \n\n \ncommands.\\n\n);\n \nbreak\n;\n\n \ncase\n \nBLE_HS_ERR_SM_PEER_BASE\n(\nBLE_SM_ERR_CONFIRM_MISMATCH\n)\
n:\n\n \nconsole_printf\n(\nfailure - peer reports mismatch in our confirm and \n\n \nrandom commands.\\n\n);\n \nbreak\n;\n\n \ndefault\n:\n\n \nconsole_printf\n(\nfailure - other error: 0x%04x\\n\n, \nrc\n);\n \nbreak\n;\n }\n}\n\n\n\n\n\nReturn Code Reference\n\n\nReturn codes - Core\n\n\nThe precise meaning of each of these error codes depends on the function that returns it. The API reference for a particular function indicates the conditions under which each of these codes are returned.\n\n\n#include \nhost/ble_hs.h\n\n\n\n\n\n\n\n\n\n\n\n\nValue\n\n\nName\n\n\nCondition\n\n\n\n\n\n\n\n\n\n\n0x00\n\n\nN/A\n\n\nSuccess\n\n\n\n\n\n\n0x01\n\n\nBLE_HS_EAGAIN\n\n\nTemporary failure; try again.\n\n\n\n\n\n\n0x02\n\n\nBLE_HS_EALREADY\n\n\nOperation already in progress or completed.\n\n\n\n\n\n\n0x03\n\n\nBLE_HS_EINVAL\n\n\nOne or more arguments are invalid.\n\n\n\n\n\n\n0x04\n\n\nBLE_HS_EMSGSIZE\n\n\nThe provided buffer is too
small.\n\n\n\n\n\n\n0x05\n\n\nBLE_HS_ENOENT\n\n\nNo entry matching the specified criteria.\n\n\n\n\n\n\n0x06\n\n\nBLE_HS_ENOMEM\n\n\nOperation failed due to resource exhaustion.\n\n\n\n\n\n\n0x07\n\n\nBLE_HS_ENOTCONN\n\n\nNo open connection with the specified handle.\n\n\n\n\n\n\n0x08\n\n\nBLE_HS_ENOTSUP\n\n\nOperation disabled at compile time.\n\n\n\n\n\n\n0x09\n\n\nBLE_HS_EAPP\n\n\nApplication callback behaved unexpectedly.\n\n\n\n\n\n\n0x0a\n\n\nBLE_HS_EBADDATA\n\n\nCommand from peer is invalid.\n\n\n\n\n\n\n0x0b\n\n\nBLE_HS_EOS\n\n\nMynewt OS error.\n\n\n\n\n\n\n0x0c\n\n\nBLE_HS_ECONTROLLER\n\n\nEvent from controller is invalid.\n\n\n\n\n\n\n0x0d\n\n\nBLE_HS_ETIMEOUT\n\n\nOperation timed out.\n\n\n\n\n\n\n0x0e\n\n\nBLE_HS_EDONE\n\n\nOperation completed successfully.\n\n\n\n\n\n\n0x0f\n\n\nBLE_HS_EBUSY\n\n\nOperation cannot be performed until procedure completes.\n\n\n\n\n\n\n0x10\n\n\nBLE_HS_EREJECT\n\n\nPeer rejected a connection parameter update request.\n\n\n\n\n\n\n0x11\n\n\
nBLE_HS_EUNKNOWN\n\n\nUnexpected failure; catch all.\n\n\n\n\n\n\n0x12\n\n\nBLE_HS_EROLE\n\n\nOperation requires different role (e.g., central vs. peripheral).\n\n\n\n\n\n\n0x13\n\n\nBLE_HS_ETIMEOUT_HCI\n\n\nHCI request timed out; controller unresponsive.\n\n\n\n\n\n\n0x14\n\n\nBLE_HS_ENOMEM_EVT\n\n\nController failed to send event due to memory exhaustion (combined host-controller only).\n\n\n\n\n\n\n0x15\n\n\nBLE_HS_ENOADDR\n\n\nOperation requires an identity address but none configured.\n\n\n\n\n\n\n\n\nReturn codes - ATT\n\n\n#include \nhost/ble_hs.h\n\n\n#include \nhost/ble_att.h\n\n\n\n\n\n\n\n\n\n\n\n\nNimBLE Value\n\n\nFormal Value\n\n\nName\n\n\n\n\n\n\n\n\n\n\n0x0101\n\n\n0x01\n\n\nBLE_ATT_ERR_INVALID_HANDLE\n\n\n\n\n\n\n0x0102\n\n\n0x02\n\n\nBLE_ATT_ERR_READ_NOT_PERMITTED\n\n\n\n\n\n\n0x0103\n\n\n0x03\n\n\nBLE_ATT_ERR_WRITE_NOT_PERMITTED\n\n\n\n\n\n\n0x0104\n\n\n0x04\n\n\nBLE_ATT_ERR_INVALID_PDU\n\n\n\n\n\n\n0x0105\n\n\n0x05\n\n\nBLE_ATT_ERR_INSUFFICIENT_AUTHEN\n\n\n\n\n\
n\n0x0106\n\n\n0x06\n\n\nBLE_ATT_ERR_REQ_NOT_SUPPORTED\n\n\n\n\n\n\n0x0107\n\n\n0x07\n\n\nBLE_ATT_ERR_INVALID_OFFSET\n\n\n\n\n\n\n0x0108\n\n\n0x08\n\n\nBLE_ATT_ERR_INSUFFICIENT_AUTHOR\n\n\n\n\n\n\n0x0109\n\n\n0x09\n\n\nBLE_ATT_ERR_PREPARE_QUEUE_FULL\n\n\n\n\n\n\n0x010a\n\n\n0x0a\n\n\nBLE_ATT_ERR_ATTR_NOT_FOUND\n\n\n\n\n\n\n0x010b\n\n\n0x0b\n\n\nBLE_ATT_ERR_ATTR_NOT_LONG\n\n\n\n\n\n\n0x010c\n\n\n0x0c\n\n\nBLE_ATT_ERR_INSUFFICIENT_KEY_SZ\n\n\n\n\n\n\n0x010d\n\n\n0x0d\n\n\nBLE_ATT_ERR_INVALID_ATTR_VALUE_LEN\n\n\n\n\n\n\n0x010e\n\n\n0x0e\n\n\nBLE_ATT_ERR_UNLIKELY\n\n\n\n\n\n\n0x010f\n\n\n0x0f\n\n\nBLE_ATT_ERR_INSUFFICIENT_ENC\n\n\n\n\n\n\n0x0110\n\n\n0x10\n\n\nBLE_ATT_ERR_UNSUPPORTED_GROUP\n\n\n\n\n\n\n0x0111\n\n\n0x11\n\n\nBLE_ATT_ERR_INSUFFICIENT_RES\n\n\n\n\n\n\n\n\nReturn codes - HCI\n\n\n#include \nhost/ble_hs.h\n\n\n#include \nnimble/ble.h\n\n\n\n\n\n\n\n\n\n\n\n\nNimBLE Value\n\n\nFormal Value\n\n\nName\n\n\n\n\n\n\n\n\n\n\n0x0201\n\n\n0x01\n\n\nBLE_ERR_UNKNOWN_HCI_CMD\n\n\n\n\n\
n\n0x0202\n\n\n0x02\n\n\nBLE_ERR_UNK_CONN_ID\n\n\n\n\n\n\n0x0203\n\n\n0x03\n\n\nBLE_ERR_HW_FAIL\n\n\n\n\n\n\n0x0204\n\n\n0x04\n\n\nBLE_ERR_PAGE_TMO\n\n\n\n\n\n\n0x0205\n\n\n0x05\n\n\nBLE_ERR_AUTH_FAIL\n\n\n\n\n\n\n0x0206\n\n\n0x06\n\n\nBLE_ERR_PINKEY_MISSING\n\n\n\n\n\n\n0x0207\n\n\n0x07\n\n\nBLE_ERR_MEM_CAPACITY\n\n\n\n\n\n\n0x0208\n\n\n0x08\n\n\nBLE_ERR_CONN_SPVN_TMO\n\n\n\n\n\n\n0x0209\n\n\n0x09\n\n\nBLE_ERR_CONN_LIMIT\n\n\n\n\n\n\n0x020a\n\n\n0x0a\n\n\nBLE_ERR_SYNCH_CONN_LIMIT\n\n\n\n\n\n\n0x020b\n\n\n0x0b\n\n\nBLE_ERR_ACL_CONN_EXISTS\n\n\n\n\n\n\n0x020c\n\n\n0x0c\n\n\nBLE_ERR_CMD_DISALLOWED\n\n\n\n\n\n\n0x020d\n\n\n0x0d\n\n\nBLE_ERR_CONN_REJ_RESOURCES\n\n\n\n\n\n\n0x020e\n\n\n0x0e\n\n\nBLE_ERR_CONN_REJ_SECURITY\n\n\n\n\n\n\n0x020f\n\n\n0x0f\n\n\nBLE_ERR_CONN_REJ_BD_ADDR\n\n\n\n\n\n\n0x0210\n\n\n0x10\n\n\nBLE_ERR_CONN_ACCEPT_TMO\n\n\n\n\n\n\n0x0211\n\n\n0x11\n\n\nBLE_ERR_UNSUPPORTED\n\n\n\n\n\n\n0x0212\n\n\n0x12\n\n\nBLE_ERR_INV_HCI_CMD_PARMS\n\n\n\n\n\n\n0x0213\n\n\n0x13\n\n\nB
LE_ERR_REM_USER_CONN_TERM\n\n\n\n\n\n\n0x0214\n\n\n0x14\n\n\nBLE_ERR_RD_CONN_TERM_RESRCS\n\n\n\n\n\n\n0x0215\n\n\n0x15\n\n\nBLE_ERR_RD_CONN_TERM_PWROFF\n\n\n\n\n\n\n0x0216\n\n\n0x16\n\n\nBLE_ERR_CONN_TERM_LOCAL\n\n\n\n\n\n\n0x0217\n\n\n0x17\n\n\nBLE_ERR_REPEATED_ATTEMPTS\n\n\n\n\n\n\n0x0218\n\n\n0x18\n\n\nBLE_ERR_NO_PAIRING\n\n\n\n\n\n\n0x0219\n\n\n0x19\n\n\nBLE_ERR_UNK_LMP\n\n\n\n\n\n\n0x021a\n\n\n0x1a\n\n\nBLE_ERR_UNSUPP_REM_FEATURE\n\n\n\n\n\n\n0x021b\n\n\n0x1b\n\n\nBLE_ERR_SCO_OFFSET\n\n\n\n\n\n\n0x021c\n\n\n0x1c\n\n\nBLE_ERR_SCO_ITVL\n\n\n\n\n\n\n0x021d\n\n\n0x1d\n\n\nBLE_ERR_SCO_AIR_MODE\n\n\n\n\n\n\n0x021e\n\n\n0x1e\n\n\nBLE_ERR_INV_LMP_LL_PARM\n\n\n\n\n\n\n0x021f\n\n\n0x1f\n\n\nBLE_ERR_UNSPECIFIED\n\n\n\n\n\n\n0x0220\n\n\n0x20\n\n\nBLE_ERR_UNSUPP_LMP_LL_PARM\n\n\n\n\n\n\n0x0221\n\n\n0x21\n\n\nBLE_ERR_NO_ROLE_CHANGE\n\n\n\n\n\n\n0x0222\n\n\n0x22\n\n\nBLE_ERR_LMP_LL_RSP_TMO\n\n\n\n\n\n\n0x0223\n\n\n0x23\n\n\nBLE_ERR_LMP_COLLISION\n\n\n\n\n\n\n0x0224\n\n\n0x24\n\n\nBLE_ERR_LMP_
PDU\n\n\n\n\n\n\n0x0225\n\n\n0x25\n\n\nBLE_ERR_ENCRYPTION_MODE\n\n\n\n\n\n\n0x0226\n\n\n0x26\n\n\nBLE_ERR_LINK_KEY_CHANGE\n\n\n\n\n\n\n0x0227\n\n\n0x27\n\n\nBLE_ERR_UNSUPP_QOS\n\n\n\n\n\n\n0x0228\n\n\n0x28\n\n\nBLE_ERR_INSTANT_PASSED\n\n\n\n\n\n\n0x0229\n\n\n0x29\n\n\nBLE_ERR_UNIT_KEY_PAIRING\n\n\n\n\n\n\n0x022a\n\n\n0x2a\n\n\nBLE_ERR_DIFF_TRANS_COLL\n\n\n\n\n\n\n0x022c\n\n\n0x2c\n\n\nBLE_ERR_QOS_PARM\n\n\n\n\n\n\n0x022d\n\n\n0x2d\n\n\nBLE_ERR_QOS_REJECTED\n\n\n\n\n\n\n0x022e\n\n\n0x2e\n\n\nBLE_ERR_CHAN_CLASS\n\n\n\n\n\n\n0x022f\n\n\n0x2f\n\n\nBLE_ERR_INSUFFICIENT_SEC\n\n\n\n\n\n\n0x0230\n\n\n0x30\n\n\nBLE_ERR_PARM_OUT_OF_RANGE\n\n\n\n\n\n\n0x0232\n\n\n0x32\n\n\nBLE_ERR_PENDING_ROLE_SW\n\n\n\n\n\n\n0x0234\n\n\n0x34\n\n\nBLE_ERR_RESERVED_SLOT\n\n\n\n\n\n\n0x0235\n\n\n0x35\n\n\nBLE_ERR_ROLE_SW_FAIL\n\n\n\n\n\n\n0x0236\n\n\n0x36\n\n\nBLE_ERR_INQ_RSP_TOO_BIG\n\n\n\n\n\n\n0x0237\n\n\n0x37\n\n\nBLE_ERR_SEC_SIMPLE_PAIR\n\n\n\n\n\n\n0x0238\n\n\n0x38\n\n\nBLE_ERR_HOST_BUSY_PAIR\n\n\n\n\n\n\n
0x0239\n\n\n0x39\n\n\nBLE_ERR_CONN_REJ_CHANNEL\n\n\n\n\n\n\n0x023a\n\n\n0x3a\n\n\nBLE_ERR_CTLR_BUSY\n\n\n\n\n\n\n0x023b\n\n\n0x3b\n\n\nBLE_ERR_CONN_PARMS\n\n\n\n\n\n\n0x023c\n\n\n0x3c\n\n\nBLE_ERR_DIR_ADV_TMO\n\n\n\n\n\n\n0x023d\n\n\n0x3d\n\n\nBLE_ERR_CONN_TERM_MIC\n\n\n\n\n\n\n0x023e\n\n\n0x3e\n\n\nBLE_ERR_CONN_ESTABLISHMENT\n\n\n\n\n\n\n0x023f\n\n\n0x3f\n\n\nBLE_ERR_MAC_CONN_FAIL\n\n\n\n\n\n\n0x0240\n\n\n0x40\n\n\nBLE_ERR_COARSE_CLK_ADJ\n\n\n\n\n\n\n\n\nReturn codes - L2CAP\n\n\n#include \nhost/ble_hs.h\n\n\n#include \nhost/ble_l2cap.h\n\n\n\n\n\n\n\n\n\n\n\n\nNimBLE Value\n\n\nFormal Value\n\n\nName\n\n\n\n\n\n\n\n\n\n\n0x0300\n\n\n0x00\n\n\nBLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD\n\n\n\n\n\n\n0x0301\n\n\n0x01\n\n\nBLE_L2CAP_SIG_ERR_MTU_EXCEEDED\n\n\n\n\n\n\n0x0302\n\n\n0x02\n\n\nBLE_L2CAP_SIG_ERR_INVALID_CID\n\n\n\n\n\n\n\n\nReturn codes - Security manager (us)\n\n\n#include \nhost/ble_hs.h\n\n\n#include \nhost/ble_sm.h\n\n\n\n\n\n\n\n\n\n\n\n\nNimBLE Value\n\n\nFormal Value\n\n\nN
ame\n\n\n\n\n\n\n\n\n\n\n0x0401\n\n\n0x01\n\n\nBLE_SM_ERR_PASSKEY\n\n\n\n\n\n\n0x0402\n\n\n0x02\n\n\nBLE_SM_ERR_OOB\n\n\n\n\n\n\n0x0403\n\n\n0x03\n\n\nBLE_SM_ERR_AUTHREQ\n\n\n\n\n\n\n0x0404\n\n\n0x04\n\n\nBLE_SM_ERR_CONFIRM_MISMATCH\n\n\n\n\n\n\n0x0405\n\n\n0x05\n\n\nBLE_SM_ERR_PAIR_NOT_SUPP\n\n\n\n\n\n\n0x0406\n\n\n0x06\n\n\nBLE_SM_ERR_ENC_KEY_SZ\n\n\n\n\n\n\n0x0407\n\n\n0x07\n\n\nBLE_SM_ERR_CMD_NOT_SUPP\n\n\n\n\n\n\n0x0408\n\n\n0x08\n\n\nBLE_SM_ERR_UNSPECIFIED\n\n\n\n\n\n\n0x0409\n\n\n0x09\n\n\nBLE_SM_ERR_REPEATED\n\n\n\n\n\n\n0x040a\n\n\n0x0a\n\n\nBLE_SM_ERR_INVAL\n\n\n\n\n\n\n0x040b\n\n\n0x0b\n\n\nBLE_SM_ERR_DHKEY\n\n\n\n\n\n\n0x040c\n\n\n0x0c\n\n\nBLE_SM_ERR_NUMCMP\n\n\n\n\n\n\n0x040d\n\n\n0x0d\n\n\nBLE_SM_ERR_ALREADY\n\n\n\n\n\n\n0x040e\n\n\n0x0e\n\n\nBLE_SM_ERR_CROSS_TRANS\n\n\n\n\n\n\n\n\nReturn codes - Security manager (peer)\n\n\n#include \nhost/ble_hs.h\n\n\n#include \nhost/ble_sm.h\n\n\n\n\n\n\n\n\n\n\n\n\nNimBLE Value\n\n\nFormal Value\n\n\nName\n\n\nCondition\n\n\n\n\n
\n\n\n\n\n\n0x0501\n\n\n0x01\n\n\nBLE_SM_ERR_PASSKEY\n\n\nThe user input of passkey failed, for example, the user cancelled the operation.\n\n\n\n\n\n\n0x0502\n\n\n0x02\n\n\nBLE_SM_ERR_OOB\n\n\nThe OOB data is not available.\n\n\n\n\n\n\n0x0503\n\n\n0x03\n\n\nBLE_SM_ERR_AUTHREQ\n\n\nThe pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices.\n\n\n\n\n\n\n0x0504\n\n\n0x04\n\n\nBLE_SM_ERR_CONFIRM_MISMATCH\n\n\nThe confirm value does not match the calculated compare value.\n\n\n\n\n\n\n0x0505\n\n\n0x05\n\n\nBLE_SM_ERR_PAIR_NOT_SUPP\n\n\nPairing is not supported by the device.\n\n\n\n\n\n\n0x0506\n\n\n0x06\n\n\nBLE_SM_ERR_ENC_KEY_SZ\n\n\nThe resultant encryption key size is insufficient for the security requirements of this device.\n\n\n\n\n\n\n0x0507\n\n\n0x07\n\n\nBLE_SM_ERR_CMD_NOT_SUPP\n\n\nThe SMP command received is not supported on this device.\n\n\n\n\n\n\n0x0508\n\n\n0x08\n\n\nBLE_SM_ERR_UNSPECIFIED\n\n\n
Pairing failed due to an unspecified reason.\n\n\n\n\n\n\n0x0509\n\n\n0x09\n\n\nBLE_SM_ERR_REPEATED\n\n\nPairing or authentication procedure is disallowed because too little time has elapsed since last pairing request or security request.\n\n\n\n\n\n\n0x050a\n\n\n0x0a\n\n\nBLE_SM_ERR_INVAL\n\n\nThe Invalid Parameters error code indicates that the command length is invalid or that a parameter is outside of the specified range.\n\n\n\n\n\n\n0x050b\n\n\n0x0b\n\n\nBLE_SM_ERR_DHKEY\n\n\nIndicates to the remote device that the DHKey Check value received doesn\u2019t match the one calculated by the local device.\n\n\n\n\n\n\n0x050c\n\n\n0x0c\n\n\nBLE_SM_ERR_NUMCMP\n\n\nIndicates that the confirm values in the numeric comparison protocol do not match.\n\n\n\n\n\n\n0x050d\n\n\n0x0d\n\n\nBLE_SM_ERR_ALREADY\n\n\nIndicates that the pairing over the LE transport failed due to a Pairing Request sent over the BR/EDR transport in process.\n\n\n\n\n\n\n0x050e\n\n\n0x0e\n\n\nBLE_SM_ERR_CROSS_TRANS\n\
n\nIndicates that the BR/EDR Link Key generated on the BR/EDR transport cannot be used to derive and distribute keys for the LE transport.",
+ "title": "Return codes"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#nimble-host-return-codes",
+ "text": "Introduction Summary Example Return Code Reference Return codes - Core Return codes - ATT Return codes - HCI Return codes - L2CAP Return codes - Security manager (us) Return codes - Security manager (peer)",
+ "title": "NimBLE Host Return Codes"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#introduction",
+ "text": "",
+ "title": "Introduction"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#summary",
+ "text": "The NimBLE host reports status to the application via a set of return codes. The host encompasses several layers of the Bluetooth specification that each defines its own set of status codes. Rather than \"abstract away\" information from lower layers that the application developer might find useful, the NimBLE host aims to indicate precisely what happened when something fails. Consequently, the host utilizes a rather large set of return codes. A return code of 0 indicates success. For failure conditions, the return codes are partitioned into five separate sets: Set Condition Core Errors detected internally by the NimBLE host. ATT The ATT server has reported a failure via the transmission of an ATT Error Response. The return code corresponds to the value of the Error Code field in the response. HCI The controller has reported an error to the host via a command complete or command status HCI event. The return code corresponds to the value
of the Status field in the event. L2CAP An L2CAP signalling procedure has failed and an L2CAP Command Reject was sent as a result. The return code corresponds to the value of the Reason field in the command. Security manager (us) The host detected an error during a security manager procedure and sent a Pairing Failed command to the peer. The return code corresponds to the value of the Reason field in the Pairing Failed command. Security manager (peer) A security manager procedure failed because the peer sent us a Pairing Failed command. The return code corresponds to the value of the Reason field in the Pairing Failed command. The return codes in the core set are defined by the NimBLE Host. The other sets are defined in the Bluetooth specification; the codes in this latter group are referred to as formal status codes . As defined in the Bluetooth specification, the formal status code sets are not disjoint. That is, they overlap. For example, the spec defines
a status code of 1 to have all of the following meanings: Layer Meaning ATT Invalid handle. HCI Unknown HCI command. L2CAP Signalling MTU exceeded. SM Passkey entry failed. Clearly, the host can't just return an unadorned formal status code and expect the application to make sense of it. To resolve this ambiguity, the NimBLE host divides the full range of an int into several subranges. Each subrange corresponds to one of the five return code sets. For example, the ATT set is mapped onto the subrange [0x100, 0x200) . To indicate an ATT error of 3 (write not permitted), the NimBLE host returns a value 0x103 to the application. The host defines a set of convenience macros for converting from a formal status code to NimBLE host status code. These macros are documented in the table below. Macro Status code set Base value BLE_HS_ATT_ERR() ATT 0x100 BLE_HS_HCI_ERR() HCI 0x200 BLE_HS_L2C_ERR() L2CAP 0x300 BLE_HS_SM_US_ERR() Secur
ity manager (us) 0x400 BLE_HS_SM_PEER_ERR() Security manager (peer) 0x500",
+ "title": "Summary"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#example",
+ "text": "The following example demonstrates how an application might determine which error is being reported by the host. In this example, the application performs the GAP encryption procedure and checks the return code. To simplify the example, the application uses a hypothetical my_blocking_enc_proc() function, which blocks until the pairing operation has completed. void encrypt_connection ( uint16_t conn_handle )\n{\n int rc ;\n\n /* Perform a blocking GAP encryption procedure. */ \n rc = my_blocking_enc_proc ( conn_handle );\n switch ( rc ) {\n case 0 : \n console_printf ( success - link successfully encrypted\\n );\n break ;\n\n case BLE_HS_ENOTCONN :\n console_printf ( failure - no connection with handle %d\\n ,\n conn_handle );\n break ;\n\n case BLE_HS_ERR_SM_US_BASE ( BLE_SM_ERR_CONFIRM_MISMATCH ) : \n console_printf ( failure - mismatch in peer s conf
irm and random \n commands.\\n );\n break ;\n\n case BLE_HS_ERR_SM_PEER_BASE ( BLE_SM_ERR_CONFIRM_MISMATCH ) : \n console_printf ( failure - peer reports mismatch in our confirm and \n random commands.\\n );\n break ;\n\n default : \n console_printf ( failure - other error: 0x%04x\\n , rc );\n break ;\n }\n}",
+ "title": "Example"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-code-reference",
+ "text": "",
+ "title": "Return Code Reference"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-core",
+ "text": "The precise meaning of each of these error codes depends on the function that returns it. The API reference for a particular function indicates the conditions under which each of these codes are returned. #include host/ble_hs.h Value Name Condition 0x00 N/A Success 0x01 BLE_HS_EAGAIN Temporary failure; try again. 0x02 BLE_HS_EALREADY Operation already in progress or completed. 0x03 BLE_HS_EINVAL One or more arguments are invalid. 0x04 BLE_HS_EMSGSIZE The provided buffer is too small. 0x05 BLE_HS_ENOENT No entry matching the specified criteria. 0x06 BLE_HS_ENOMEM Operation failed due to resource exhaustion. 0x07 BLE_HS_ENOTCONN No open connection with the specified handle. 0x08 BLE_HS_ENOTSUP Operation disabled at compile time. 0x09 BLE_HS_EAPP Application callback behaved unexpectedly. 0x0a BLE_HS_EBADDATA Command from peer is invalid. 0x0b BLE_HS_EOS Mynewt OS error. 0x0c BLE_HS_ECONTRO
LLER Event from controller is invalid. 0x0d BLE_HS_ETIMEOUT Operation timed out. 0x0e BLE_HS_EDONE Operation completed successfully. 0x0f BLE_HS_EBUSY Operation cannot be performed until procedure completes. 0x10 BLE_HS_EREJECT Peer rejected a connection parameter update request. 0x11 BLE_HS_EUNKNOWN Unexpected failure; catch all. 0x12 BLE_HS_EROLE Operation requires different role (e.g., central vs. peripheral). 0x13 BLE_HS_ETIMEOUT_HCI HCI request timed out; controller unresponsive. 0x14 BLE_HS_ENOMEM_EVT Controller failed to send event due to memory exhaustion (combined host-controller only). 0x15 BLE_HS_ENOADDR Operation requires an identity address but none configured.",
+ "title": "Return codes - Core"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-att",
+ "text": "#include host/ble_hs.h #include host/ble_att.h NimBLE Value Formal Value Name 0x0101 0x01 BLE_ATT_ERR_INVALID_HANDLE 0x0102 0x02 BLE_ATT_ERR_READ_NOT_PERMITTED 0x0103 0x03 BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x0104 0x04 BLE_ATT_ERR_INVALID_PDU 0x0105 0x05 BLE_ATT_ERR_INSUFFICIENT_AUTHEN 0x0106 0x06 BLE_ATT_ERR_REQ_NOT_SUPPORTED 0x0107 0x07 BLE_ATT_ERR_INVALID_OFFSET 0x0108 0x08 BLE_ATT_ERR_INSUFFICIENT_AUTHOR 0x0109 0x09 BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x010a 0x0a BLE_ATT_ERR_ATTR_NOT_FOUND 0x010b 0x0b BLE_ATT_ERR_ATTR_NOT_LONG 0x010c 0x0c BLE_ATT_ERR_INSUFFICIENT_KEY_SZ 0x010d 0x0d BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN 0x010e 0x0e BLE_ATT_ERR_UNLIKELY 0x010f 0x0f BLE_ATT_ERR_INSUFFICIENT_ENC 0x0110 0x10 BLE_ATT_ERR_UNSUPPORTED_GROUP 0x0111 0x11 BLE_ATT_ERR_INSUFFICIENT_RES",
+ "title": "Return codes - ATT"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-hci",
+ "text": "#include host/ble_hs.h #include nimble/ble.h NimBLE Value Formal Value Name 0x0201 0x01 BLE_ERR_UNKNOWN_HCI_CMD 0x0202 0x02 BLE_ERR_UNK_CONN_ID 0x0203 0x03 BLE_ERR_HW_FAIL 0x0204 0x04 BLE_ERR_PAGE_TMO 0x0205 0x05 BLE_ERR_AUTH_FAIL 0x0206 0x06 BLE_ERR_PINKEY_MISSING 0x0207 0x07 BLE_ERR_MEM_CAPACITY 0x0208 0x08 BLE_ERR_CONN_SPVN_TMO 0x0209 0x09 BLE_ERR_CONN_LIMIT 0x020a 0x0a BLE_ERR_SYNCH_CONN_LIMIT 0x020b 0x0b BLE_ERR_ACL_CONN_EXISTS 0x020c 0x0c BLE_ERR_CMD_DISALLOWED 0x020d 0x0d BLE_ERR_CONN_REJ_RESOURCES 0x020e 0x0e BLE_ERR_CONN_REJ_SECURITY 0x020f 0x0f BLE_ERR_CONN_REJ_BD_ADDR 0x0210 0x10 BLE_ERR_CONN_ACCEPT_TMO 0x0211 0x11 BLE_ERR_UNSUPPORTED 0x0212 0x12 BLE_ERR_INV_HCI_CMD_PARMS 0x0213 0x13 BLE_ERR_REM_USER_CONN_TERM 0x0214 0x14 BLE_ERR_RD_CONN_TERM_RESRCS 0x0215 0x15 BLE_ERR_RD_CONN_TERM_PWROFF 0x0216 0x16 BLE_ERR_CONN_TERM_LOCAL 0x02
17 0x17 BLE_ERR_REPEATED_ATTEMPTS 0x0218 0x18 BLE_ERR_NO_PAIRING 0x0219 0x19 BLE_ERR_UNK_LMP 0x021a 0x1a BLE_ERR_UNSUPP_REM_FEATURE 0x021b 0x1b BLE_ERR_SCO_OFFSET 0x021c 0x1c BLE_ERR_SCO_ITVL 0x021d 0x1d BLE_ERR_SCO_AIR_MODE 0x021e 0x1e BLE_ERR_INV_LMP_LL_PARM 0x021f 0x1f BLE_ERR_UNSPECIFIED 0x0220 0x20 BLE_ERR_UNSUPP_LMP_LL_PARM 0x0221 0x21 BLE_ERR_NO_ROLE_CHANGE 0x0222 0x22 BLE_ERR_LMP_LL_RSP_TMO 0x0223 0x23 BLE_ERR_LMP_COLLISION 0x0224 0x24 BLE_ERR_LMP_PDU 0x0225 0x25 BLE_ERR_ENCRYPTION_MODE 0x0226 0x26 BLE_ERR_LINK_KEY_CHANGE 0x0227 0x27 BLE_ERR_UNSUPP_QOS 0x0228 0x28 BLE_ERR_INSTANT_PASSED 0x0229 0x29 BLE_ERR_UNIT_KEY_PAIRING 0x022a 0x2a BLE_ERR_DIFF_TRANS_COLL 0x022c 0x2c BLE_ERR_QOS_PARM 0x022d 0x2d BLE_ERR_QOS_REJECTED 0x022e 0x2e BLE_ERR_CHAN_CLASS 0x022f 0x2f BLE_ERR_INSUFFICIENT_SEC 0x0230 0x30 BLE_ERR_PARM_OUT_OF_RANGE 0x0232 0x32 BLE_ERR_PENDING
_ROLE_SW 0x0234 0x34 BLE_ERR_RESERVED_SLOT 0x0235 0x35 BLE_ERR_ROLE_SW_FAIL 0x0236 0x36 BLE_ERR_INQ_RSP_TOO_BIG 0x0237 0x37 BLE_ERR_SEC_SIMPLE_PAIR 0x0238 0x38 BLE_ERR_HOST_BUSY_PAIR 0x0239 0x39 BLE_ERR_CONN_REJ_CHANNEL 0x023a 0x3a BLE_ERR_CTLR_BUSY 0x023b 0x3b BLE_ERR_CONN_PARMS 0x023c 0x3c BLE_ERR_DIR_ADV_TMO 0x023d 0x3d BLE_ERR_CONN_TERM_MIC 0x023e 0x3e BLE_ERR_CONN_ESTABLISHMENT 0x023f 0x3f BLE_ERR_MAC_CONN_FAIL 0x0240 0x40 BLE_ERR_COARSE_CLK_ADJ",
+ "title": "Return codes - HCI"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-l2cap",
+ "text": "#include host/ble_hs.h #include host/ble_l2cap.h NimBLE Value Formal Value Name 0x0300 0x00 BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD 0x0301 0x01 BLE_L2CAP_SIG_ERR_MTU_EXCEEDED 0x0302 0x02 BLE_L2CAP_SIG_ERR_INVALID_CID",
+ "title": "Return codes - L2CAP"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-security-manager-us",
+ "text": "#include host/ble_hs.h #include host/ble_sm.h NimBLE Value Formal Value Name 0x0401 0x01 BLE_SM_ERR_PASSKEY 0x0402 0x02 BLE_SM_ERR_OOB 0x0403 0x03 BLE_SM_ERR_AUTHREQ 0x0404 0x04 BLE_SM_ERR_CONFIRM_MISMATCH 0x0405 0x05 BLE_SM_ERR_PAIR_NOT_SUPP 0x0406 0x06 BLE_SM_ERR_ENC_KEY_SZ 0x0407 0x07 BLE_SM_ERR_CMD_NOT_SUPP 0x0408 0x08 BLE_SM_ERR_UNSPECIFIED 0x0409 0x09 BLE_SM_ERR_REPEATED 0x040a 0x0a BLE_SM_ERR_INVAL 0x040b 0x0b BLE_SM_ERR_DHKEY 0x040c 0x0c BLE_SM_ERR_NUMCMP 0x040d 0x0d BLE_SM_ERR_ALREADY 0x040e 0x0e BLE_SM_ERR_CROSS_TRANS",
+ "title": "Return codes - Security manager (us)"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_hs_return_codes/#return-codes-security-manager-peer",
+ "text": "#include host/ble_hs.h #include host/ble_sm.h NimBLE Value Formal Value Name Condition 0x0501 0x01 BLE_SM_ERR_PASSKEY The user input of passkey failed, for example, the user cancelled the operation. 0x0502 0x02 BLE_SM_ERR_OOB The OOB data is not available. 0x0503 0x03 BLE_SM_ERR_AUTHREQ The pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices. 0x0504 0x04 BLE_SM_ERR_CONFIRM_MISMATCH The confirm value does not match the calculated compare value. 0x0505 0x05 BLE_SM_ERR_PAIR_NOT_SUPP Pairing is not supported by the device. 0x0506 0x06 BLE_SM_ERR_ENC_KEY_SZ The resultant encryption key size is insufficient for the security requirements of this device. 0x0507 0x07 BLE_SM_ERR_CMD_NOT_SUPP The SMP command received is not supported on this device. 0x0508 0x08 BLE_SM_ERR_UNSPECIFIED Pairing failed due to an unspecified reason. 0x0509
0x09 BLE_SM_ERR_REPEATED Pairing or authentication procedure is disallowed because too little time has elapsed since last pairing request or security request. 0x050a 0x0a BLE_SM_ERR_INVAL The Invalid Parameters error code indicates that the command length is invalid or that a parameter is outside of the specified range. 0x050b 0x0b BLE_SM_ERR_DHKEY Indicates to the remote device that the DHKey Check value received doesn\u2019t match the one calculated by the local device. 0x050c 0x0c BLE_SM_ERR_NUMCMP Indicates that the confirm values in the numeric comparison protocol do not match. 0x050d 0x0d BLE_SM_ERR_ALREADY Indicates that the pairing over the LE transport failed due to a Pairing Request sent over the BR/EDR transport in process. 0x050e 0x0e BLE_SM_ERR_CROSS_TRANS Indicates that the BR/EDR Link Key generated on the BR/EDR transport cannot be used to derive and distribute keys for the LE transport.",
+ "title": "Return codes - Security manager (peer)"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/",
+ "text": "NimBLE Host Init and Config Reference\n\n\nIntroduction\n\n\nThis section is a reference on initializing and configuring the NimBLE host.\n\n\nHeader\n\n\n#include \nhost/ble_hs.h\n\n\n\n\n\n\nDefinitions\n\n\nBLE host init and config definitions\n\n\nFunctions\n\n\n\n\n\n\n\n\nFunction\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nble_hs_init\n\n\nInitializes the NimBLE host.\n\n\n\n\n\n\nble_hs_start\n\n\nSynchronizes the host with the controller by sending a sequence of HCI commands.",
+ "title": "toc"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/#nimble-host-init-and-config-reference",
+ "text": "",
+ "title": "NimBLE Host Init and Config Reference"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/#introduction",
+ "text": "This section is a reference on initializing and configuring the NimBLE host.",
+ "title": "Introduction"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/#header",
+ "text": "#include host/ble_hs.h",
+ "title": "Header"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/#definitions",
+ "text": "BLE host init and config definitions",
+ "title": "Definitions"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/init/#functions",
+ "text": "Function Description ble_hs_init Initializes the NimBLE host. ble_hs_start Synchronizes the host with the controller by sending a sequence of HCI commands.",
+ "title": "Functions"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/definitions/init_defs/",
+ "text": "Other definitions\n\n\n/* Defines the IO capabilities for the local device. */\n\n\n#define BLE_HS_IO_DISPLAY_ONLY 0x00\n\n\n#define BLE_HS_IO_DISPLAY_YESNO 0x01\n\n\n#define BLE_HS_IO_KEYBOARD_ONLY 0x02\n\n\n#define BLE_HS_IO_NO_INPUT_OUTPUT 0x03\n\n\n#define BLE_HS_IO_KEYBOARD_DISPLAY 0x04\n\n\n\n\n\n\nstruct\n \nble_hs_cfg\n {\n \n/*** HCI settings. */\n\n \n/**\n\n\n * An HCI buffer is a \nflat\n 260-byte buffer. HCI buffers are used by the\n\n\n * controller to send unsolicited events to the host.\n\n\n *\n\n\n * HCI buffers can get tied up when the controller sends lots of\n\n\n * asynchronous / unsolicited events (i.e., non-acks). When the controller\n\n\n * needs to send one of these events, it allocates an HCI buffer, fills it\n\n\n * with the event payload, and puts it on a host queue. If the controller\n\n\n * sends a quick burst of these events, the buffe
r pool may be exhausted,\n\n\n * preventing the host from sending an HCI command to the controller.\n\n\n *\n\n\n * Every time the controller sends a non-ack HCI event to the host, it also\n\n\n * allocates an OS event (it is unfortunate that these are both called\n\n\n * \nevents\n). The OS event is put on the host-parent-task\ns event queue;\n\n\n * it is what wakes up the host-parent-task and indicates that an HCI event\n\n\n * needs to be processsed. The pool of OS events is allocated with the\n\n\n * same number of elements as the HCI buffer pool.\n\n\n */\n\n \nuint8_t\n \nmax_hci_bufs\n;\n\n \n/*** Connection settings. */\n\n \n/**\n\n\n * The maximum number of concurrent connections. This is set\n\n\n * automatically according to the build-time option\n\n\n * NIMBLE_OPT_MAX_CONNECTIONS.\n\n\n */\n\n \nuint8_t\n \nmax_connections\n;\n\n \n/*** GATT server settings. */\n\n \n/**\n\n\n * These are acqu
ired at service registration time and never freed. You\n\n\n * need one of these for every service that you register.\n\n\n */\n\n \nuint16_t\n \nmax_services\n;\n\n \n/**\n\n\n * The total number of in-RAM client characteristic configuration\n\n\n * descriptors (CCCDs). One of these is consumed each time a peer\n\n\n * subscribes to notifications or indications for a characteristic that\n\n\n * your device serves. In addition, at service registration time, the host\n\n\n * uses one of these for each characteristic that supports notifications or\n\n\n * indications. So, the formula which guarantees no resource exhaustion\n\n\n * is:\n\n\n * (num-subscribable-characteristics) * (max-connections + 1)\n\n\n */\n\n \nuint16_t\n \nmax_client_configs\n;\n\n \n/*** GATT client settings. */\n\n \n/**\n\n\n * The maximum number of concurrent GATT client procedures. When you\n\n\n * initiate a GATT procedure (e.g., re
ad a characteristic, discover\n\n\n * services, etc.), one of these is consumed. The resource is freed when\n\n\n * the procedure completes.\n\n\n */\n\n \nuint8_t\n \nmax_gattc_procs\n;\n\n \n/*** ATT server settings. */\n\n \n/**\n\n\n * The total number of local ATT attributes. Attributes are consumed at\n\n\n * service registration time and are never freed. Attributes are used by\n\n\n * GATT server entities: services, characteristics, and descriptors\n\n\n * according to the following formula:\n\n\n * (num-services + (num-characteristics * 2) + num-descriptors)\n\n\n *\n\n\n * Every characteristic that supports indications or notifications\n\n\n * automatically gets a descriptor. All other descriptors are specified by\n\n\n * the application at service registration time.\n\n\n */\n\n \nuint16_t\n \nmax_attrs\n;\n\n \n/**\n\n\n * A GATT server uses these when a peer performs a \nwrite long\n\n\n *
characteristic values\n or \nwrite long characteristic descriptors\n\n\n * procedure. One of these resources is consumed each time a peer sends a\n\n\n * partial write. These procedures are not used often.\n\n\n */\n\n \nuint8_t\n \nmax_prep_entries\n;\n\n \n/*** L2CAP settings. */\n\n \n/**\n\n\n * Each connection requires three L2CAP channels (signal, ATT, and security\n\n\n * manager). In addition, the nimble host may allow channels to be created\n\n\n * \non the fly\n (connection-oriented channels). This functionality is not\n\n\n * available at the moment, so a safe formula to use is:\n\n\n * (max-connections * 3)\n\n\n */\n\n \nuint8_t\n \nmax_l2cap_chans\n;\n\n \n/**\n\n\n * The maximum number of concurrent L2CAP signalling procedures. Only one\n\n\n * L2CAP signalling procedure is supported: slave-initiated connection\n\n\n * update. You will never need more of these than the max number of\n\n\n *
connections.\n\n\n */\n\n \nuint8_t\n \nmax_l2cap_sig_procs\n;\n\n \n/**\n\n\n * The maximum number of concurrent security manager procedures. Security\n\n\n * manager procedures include pairing and restoration of a bonded link.\n\n\n */\n\n \nuint8_t\n \nmax_l2cap_sm_procs\n;\n\n \n/*** Security manager settings. */\n\n \nuint8_t\n \nsm_io_cap\n;\n \nunsigned\n \nsm_oob_data_flag\n:\n1\n;\n \nunsigned\n \nsm_bonding\n:\n1\n;\n \nunsigned\n \nsm_mitm\n:\n1\n;\n \nunsigned\n \nsm_sc\n:\n1\n;\n \nunsigned\n \nsm_keypress\n:\n1\n;\n \nuint8_t\n \nsm_our_key_dist\n;\n \nuint8_t\n \nsm_their_key_dist\n;\n\n \n/*** Store settings. */\n\n \n/**\n\n\n * These function callbacks handle persistence of sercurity material\n\n\n * (bonding).\n\n\n */\n\n \nble_store_read_fn\n \n*store_read_cb\n;\n \nble_store_write_fn\n \n*store_write_cb\n;\n \nble_store_delete_fn\n \n*store_delete_cb\n;\n\n \n/*** privacy setting
s */\n\n \n/**\n\n\n * The frequency at which new resovlable private addresses are generated.\n\n\n * Units are seconds.\n\n\n */\n\n \nuint16_t\n \nrpa_timeout\n;\n};\n\n\n\n\n\nextern\n \nconst\n \nstruct\n \nble_hs_cfg\n \nble_hs_cfg_dflt\n;",
+ "title": "Init and config definitions"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/definitions/init_defs/#other-definitions",
+ "text": "/* Defines the IO capabilities for the local device. */ #define BLE_HS_IO_DISPLAY_ONLY 0x00 #define BLE_HS_IO_DISPLAY_YESNO 0x01 #define BLE_HS_IO_KEYBOARD_ONLY 0x02 #define BLE_HS_IO_NO_INPUT_OUTPUT 0x03 #define BLE_HS_IO_KEYBOARD_DISPLAY 0x04 struct ble_hs_cfg {\n /*** HCI settings. */ \n /** * An HCI buffer is a flat 260-byte buffer. HCI buffers are used by the * controller to send unsolicited events to the host. * * HCI buffers can get tied up when the controller sends lots of * asynchronous / unsolicited events (i.e., non-acks). When the controller * needs to send one of these events, it allocates an HCI buffer, fills it * with the event payload, and puts it on a host queue. If the controller * sends a quick burst of these events, the buffer pool may be exhausted, * preventing the host from sending an HCI command to the contro
ller. * * Every time the controller sends a non-ack HCI event to the host, it also * allocates an OS event (it is unfortunate that these are both called * events ). The OS event is put on the host-parent-task s event queue; * it is what wakes up the host-parent-task and indicates that an HCI event * needs to be processsed. The pool of OS events is allocated with the * same number of elements as the HCI buffer pool. */ \n uint8_t max_hci_bufs ;\n\n /*** Connection settings. */ \n /** * The maximum number of concurrent connections. This is set * automatically according to the build-time option * NIMBLE_OPT_MAX_CONNECTIONS. */ \n uint8_t max_connections ;\n\n /*** GATT server settings. */ \n /** * These are acquired at service registration time and never freed. You * need one of these for every service that you register. */ \n uint16_t max_services ;\n\n
/** * The total number of in-RAM client characteristic configuration * descriptors (CCCDs). One of these is consumed each time a peer * subscribes to notifications or indications for a characteristic that * your device serves. In addition, at service registration time, the host * uses one of these for each characteristic that supports notifications or * indications. So, the formula which guarantees no resource exhaustion * is: * (num-subscribable-characteristics) * (max-connections + 1) */ \n uint16_t max_client_configs ;\n\n /*** GATT client settings. */ \n /** * The maximum number of concurrent GATT client procedures. When you * initiate a GATT procedure (e.g., read a characteristic, discover * services, etc.), one of these is consumed. The resource is freed when * the procedure completes. */ \n uint8_t max_gattc_procs ;\n\n /*** ATT server settings. */ \n /**
* The total number of local ATT attributes. Attributes are consumed at * service registration time and are never freed. Attributes are used by * GATT server entities: services, characteristics, and descriptors * according to the following formula: * (num-services + (num-characteristics * 2) + num-descriptors) * * Every characteristic that supports indications or notifications * automatically gets a descriptor. All other descriptors are specified by * the application at service registration time. */ \n uint16_t max_attrs ;\n\n /** * A GATT server uses these when a peer performs a write long * characteristic values or write long characteristic descriptors * procedure. One of these resources is consumed each time a peer sends a * partial write. These procedures are not used often. */ \n uint8_t max_prep_entries ;\n\n /*** L2CAP settings. */ \n /** * Each co
nnection requires three L2CAP channels (signal, ATT, and security * manager). In addition, the nimble host may allow channels to be created * on the fly (connection-oriented channels). This functionality is not * available at the moment, so a safe formula to use is: * (max-connections * 3) */ \n uint8_t max_l2cap_chans ;\n\n /** * The maximum number of concurrent L2CAP signalling procedures. Only one * L2CAP signalling procedure is supported: slave-initiated connection * update. You will never need more of these than the max number of * connections. */ \n uint8_t max_l2cap_sig_procs ;\n\n /** * The maximum number of concurrent security manager procedures. Security * manager procedures include pairing and restoration of a bonded link. */ \n uint8_t max_l2cap_sm_procs ;\n\n /*** Security manager settings. */ \n uint8_t sm_io_cap ;\n unsigned sm_oob_data_fl
ag : 1 ;\n unsigned sm_bonding : 1 ;\n unsigned sm_mitm : 1 ;\n unsigned sm_sc : 1 ;\n unsigned sm_keypress : 1 ;\n uint8_t sm_our_key_dist ;\n uint8_t sm_their_key_dist ;\n\n /*** Store settings. */ \n /** * These function callbacks handle persistence of sercurity material * (bonding). */ \n ble_store_read_fn *store_read_cb ;\n ble_store_write_fn *store_write_cb ;\n ble_store_delete_fn *store_delete_cb ;\n\n /*** privacy settings */ \n /** * The frequency at which new resovlable private addresses are generated. * Units are seconds. */ \n uint16_t rpa_timeout ;\n}; extern const struct ble_hs_cfg ble_hs_cfg_dflt ;",
+ "title": "Other definitions"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_init/",
+ "text": "ble_hs_init\n\n\nint\n\n\nble_hs_init\n(\nstruct\n \nos_eventq\n \n*app_evq\n, \nstruct\n \nble_hs_cfg\n \n*cfg\n)\n\n\n\n\n\nDescription\n\n\nInitializes the NimBLE host. This function must be called before the OS is started. The NimBLE stack requires an application task to function. One application task in particular is designated as the \"host parent task\". In addition to application-specific work, the host parent task does work for NimBLE by processing events generated by the host. \n\n\nParameters\n\n\n\n\n\n\n\n\nParameter\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\napp_evq\n\n\nThe event queue associated with the host parent task.\n\n\n\n\n\n\ncfg\n\n\nThe set of configuration settings to initialize the host with. Specify null for defaults.\n\n\n\n\n\n\n\n\nReturned values\n\n\n\n\n\n\n\n\nValue\n\n\nCondition\n\n\n\n\n\n\n\n\n\n\n0\n\n\nSuccess.\n\n\n\n\n\n\nBLE host core return code\n\n\nUnexpected error.",
+ "title": "ble_hs_init"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_init/#ble95hs95init",
+ "text": "int ble_hs_init ( struct os_eventq *app_evq , struct ble_hs_cfg *cfg )",
+ "title": "ble_hs_init"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_init/#description",
+ "text": "Initializes the NimBLE host. This function must be called before the OS is started. The NimBLE stack requires an application task to function. One application task in particular is designated as the \"host parent task\". In addition to application-specific work, the host parent task does work for NimBLE by processing events generated by the host.",
+ "title": "Description"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_init/#parameters",
+ "text": "Parameter Description app_evq The event queue associated with the host parent task. cfg The set of configuration settings to initialize the host with. Specify null for defaults.",
+ "title": "Parameters"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_init/#returned-values",
+ "text": "Value Condition 0 Success. BLE host core return code Unexpected error.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_start/",
+ "text": "ble_hs_start\n\n\nint\n\n\nble_hs_start\n(\nvoid\n)\n\n\n\n\n\nDescription\n\n\nSynchronizes the host with the controller by sending a sequence of HCI commands. This function must be called before any other host functionality is used, but it must be called after both the host and controller are initialized. Typically, the host-parent-task calls this function at the top of its task routine. \n\n\nParameters\n\n\nNone\n\n\nReturned values\n\n\n\n\n\n\n\n\nValue\n\n\nCondition\n\n\n\n\n\n\n\n\n\n\n0\n\n\nSuccess.\n\n\n\n\n\n\nBLE host core return code\n\n\nUnexpected error.",
+ "title": "ble_hs_start"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_start/#ble95hs95start",
+ "text": "int ble_hs_start ( void )",
+ "title": "ble_hs_start"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_start/#description",
+ "text": "Synchronizes the host with the controller by sending a sequence of HCI commands. This function must be called before any other host functionality is used, but it must be called after both the host and controller are initialized. Typically, the host-parent-task calls this function at the top of its task routine.",
+ "title": "Description"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_start/#parameters",
+ "text": "None",
+ "title": "Parameters"
+ },
+ {
+ "location": "/network/ble/ble_hs/init/functions/ble_hs_start/#returned-values",
+ "text": "Value Condition 0 Success. BLE host core return code Unexpected error.",
+ "title": "Returned values"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/",
+ "text": "NimBLE Host GAP Reference\n\n\nIntroduction\n\n\nThe Generic Access Profile (GAP) is responsible for all connecting, advertising, scanning, and connection updating operations.\n\n\nHeader\n\n\n#include \nhost/ble_hs.h\n\n\n\n\n\n\nDefinitions\n\n\nBLE host GAP definitions\n\n\nFunctions\n\n\n\n\n\n\n\n\nFunction\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nble_gap_adv_active\n\n\nIndicates whether an advertisement procedure is currently in progress.\n\n\n\n\n\n\nble_gap_adv_rsp_set_fields\n\n\nConfigures the data to include in subsequent scan responses.\n\n\n\n\n\n\nble_gap_adv_set_fields\n\n\nConfigures the data to include in subsequent advertisements.\n\n\n\n\n\n\nble_gap_adv_start\n\n\nInitiates advertising.\n\n\n\n\n\n\nble_gap_adv_stop\n\n\nStops the currently-active advertising procedure.\n\n\n\n\n\n\nble_gap_conn_active\n\n\nIndicates whether a connect procedure is currently in progress.\n\n\n\n\n\n\nble_gap_conn_cancel\n\n\nAborts a connect procedure in progres
s.\n\n\n\n\n\n\nble_gap_conn_find\n\n\nSearches for a connection with the specified handle.\n\n\n\n\n\n\nble_gap_connect\n\n\nInitiates a connect procedure.\n\n\n\n\n\n\nble_gap_disc\n\n\nPerforms the Limited or General Discovery Procedures.\n\n\n\n\n\n\nble_gap_disc_active\n\n\nIndicates whether a discovery procedure is currently in progress.\n\n\n\n\n\n\nble_gap_disc_cancel\n\n\nCancels the discovery procedure currently in progress.\n\n\n\n\n\n\nble_gap_security_initiate\n\n\nInitiates the GAP encryption procedure.\n\n\n\n\n\n\nble_gap_terminate\n\n\nTerminates an established connection.\n\n\n\n\n\n\nble_gap_update_params\n\n\nInitiates a connection parameter update procedure.\n\n\n\n\n\n\nble_gap_wl_set\n\n\nOverwrites the controller's white list with the specified contents.",
+ "title": "toc"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/#nimble-host-gap-reference",
+ "text": "",
+ "title": "NimBLE Host GAP Reference"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/#introduction",
+ "text": "The Generic Access Profile (GAP) is responsible for all connecting, advertising, scanning, and connection updating operations.",
+ "title": "Introduction"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/#header",
+ "text": "#include host/ble_hs.h",
+ "title": "Header"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/#definitions",
+ "text": "BLE host GAP definitions",
+ "title": "Definitions"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/ble_gap/#functions",
+ "text": "Function Description ble_gap_adv_active Indicates whether an advertisement procedure is currently in progress. ble_gap_adv_rsp_set_fields Configures the data to include in subsequent scan responses. ble_gap_adv_set_fields Configures the data to include in subsequent advertisements. ble_gap_adv_start Initiates advertising. ble_gap_adv_stop Stops the currently-active advertising procedure. ble_gap_conn_active Indicates whether a connect procedure is currently in progress. ble_gap_conn_cancel Aborts a connect procedure in progress. ble_gap_conn_find Searches for a connection with the specified handle. ble_gap_connect Initiates a connect procedure. ble_gap_disc Performs the Limited or General Discovery Procedures. ble_gap_disc_active Indicates whether a discovery procedure is currently in progress. ble_gap_disc_cancel Cancels the discovery procedure currently in progress. ble_gap_security_initiate Initiates the
GAP encryption procedure. ble_gap_terminate Terminates an established connection. ble_gap_update_params Initiates a connection parameter update procedure. ble_gap_wl_set Overwrites the controller's white list with the specified contents.",
+ "title": "Functions"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/definitions/ble_gap_defs/",
+ "text": "GAP events\n\n\ntypedef\n \nint\n \nble_gap_event_fn\n(\nstruct\n \nble_gap_event\n \n*ctxt\n, \nvoid\n \n*arg\n);\n\n\n\n\n\n#define BLE_GAP_EVENT_CONNECT 0\n\n\n#define BLE_GAP_EVENT_DISCONNECT 1\n\n\n#define BLE_GAP_EVENT_CONN_CANCEL 2\n\n\n#define BLE_GAP_EVENT_CONN_UPDATE 3\n\n\n#define BLE_GAP_EVENT_CONN_UPDATE_REQ 4\n\n\n#define BLE_GAP_EVENT_L2CAP_UPDATE_REQ 5\n\n\n#define BLE_GAP_EVENT_TERM_FAILURE 6\n\n\n#define BLE_GAP_EVENT_DISC 7\n\n\n#define BLE_GAP_EVENT_DISC_COMPLETE 8\n\n\n#define BLE_GAP_EVENT_ADV_COMPLETE 9\n\n\n#define BLE_GAP_EVENT_ENC_CHANGE 10\n\n\n#define BLE_GAP_EVENT_PASSKEY_ACTION 11\n\n\n#define BLE_GAP_EVENT_NOTIFY 12\n\n\n\n\n\n\n/**\n\n\n * Represents a GAP-related event. When such an event occurs, the host\n\n\n * notifies the application by passing an instance of this structure to an\n\n\n * applica
tion-specified callback.\n\n\n */\n\n\nstruct\n \nble_gap_event\n {\n \n/**\n\n\n * Indicates the type of GAP event that occurred. This is one of the\n\n\n * BLE_GAP_EVENT codes.\n\n\n */\n\n \nuint8_t\n \ntype\n;\n\n \n/**\n\n\n * A discriminated union containing additional details concerning the GAP\n\n\n * event. The \ntype\n field indicates which member of the union is valid.\n\n\n */\n\n \nunion\n {\n \n/**\n\n\n * Represents a connection attempt. Valid for the following event\n\n\n * types:\n\n\n * o BLE_GAP_EVENT_CONNECT\n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * The status of the connection attempt;\n\n\n * o 0: the connection was successfully established.\n\n\n * o BLE host error code: the connection attempt failed for\n\n\n * the specified reason.\n\n\n */\n\n \nint\n \nstatus\n;\n\n
\n/**\n\n\n * Information about the established connection. Only valid on\n\n\n * success.\n\n\n */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \nconnect\n;\n\n \n/**\n\n\n * Represents a terminated connection. Valid for the following event\n\n\n * types:\n\n\n * o BLE_GAP_EVENT_DISCONNECT\n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * A BLE host return code indicating the reason for the\n\n\n * disconnect.\n\n\n */\n\n \nint\n \nreason\n;\n\n \n/** Information about the terminated connection. */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \ndisconnect\n;\n\n \n/**\n\n\n * Represents an advertising report received during a discovery\n\n\n * procedure. Valid for the following event types:\n\n\n * o BLE_GAP_EVENT_DISC\n\n\n */\n\n \n
struct\n \nble_gap_disc_desc\n \ndisc\n;\n\n \n/**\n\n\n * Represents an attempt to update a connection\ns parameters. Valid\n\n\n * for the following event types:\n\n\n * o BLE_GAP_EVENT_CONN_UPDATE\n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * The result of the connection update attempt;\n\n\n * o 0: the connection was successfully updated.\n\n\n * o BLE host error code: the connection update attempt failed\n\n\n * for the specified reason.\n\n\n */\n\n \nint\n \nstatus\n;\n\n \n/**\n\n\n * Information about the relevant connection. If the connection\n\n\n * update attempt was successful, this descriptor contains the\n\n\n * updated parameters.\n\n\n */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \nconn_update\n;\n\n \n/**\n\n\n * Represents
a peer\ns request to update the connection parameters.\n\n\n * This event is generated when a peer performs any of the following\n\n\n * procedures:\n\n\n * o L2CAP Connection Parameter Update Procedure\n\n\n * o Link-Layer Connection Parameters Request Procedure\n\n\n *\n\n\n * Valid for the following event types:\n\n\n * o BLE_GAP_EVENT_L2CAP_UPDATE_REQ\n\n\n * o BLE_GAP_EVENT_CONN_UPDATE_REQ\n\n\n * \n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * Indicates the connection parameters that the peer would like to\n\n\n * use.\n\n\n */\n\n \nconst\n \nstruct\n \nble_gap_upd_params\n \n*peer_params\n;\n\n \n/**\n\n\n * Indicates the connection parameters that the local device would\n\n\n * like to use. The application callback should fill this in. By\n\n\n * default, this struct conta
ins the requested parameters (i.e.,\n\n\n * it is a copy of \npeer_params\n).\n\n\n */\n\n \nstruct\n \nble_gap_upd_params\n \n*self_params\n;\n\n \n/** Information about the relevant connection. */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \nconn_update_req\n;\n\n \n/**\n\n\n * Represents a failed attempt to terminate an established connection.\n\n\n * Valid for the following event types:\n\n\n * o BLE_GAP_EVENT_TERM_FAILURE\n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * A BLE host return code indicating the reason for the failure.\n\n\n */\n\n \nint\n \nstatus\n;\n\n \n/** Information about the relevant connection. */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \nterm_failure\n;\n\n \n/**\n\n\n * Represents an attempt to change the encrypted state of a\n\n\n * c
onnection. Valid for the following event types:\n\n\n * o BLE_GAP_EVENT_ENC_CHANGE\n\n\n */\n\n \nstruct\n {\n \n/**\n\n\n * Indicates the result of the encryption state change attempt;\n\n\n * o 0: the encrypted state was successfully updated;\n\n\n * o BLE host error code: the encryption state change attempt\n\n\n * failed for the specified reason.\n\n\n */\n\n \nint\n \nstatus\n;\n\n \n/**\n\n\n * Information about the relevant connection. If the encryption\n\n\n * state change attempt was successful, this descriptor reflects\n\n\n * the updated state.\n\n\n */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \nenc_change\n;\n\n \n/**\n\n\n * Represents a passkey query needed to complete a pairing procedure.\n\n\n * Valid for the following event types:\n\n\
n * o BLE_GAP_EVENT_PASSKEY_ACTION\n\n\n */\n\n \nstruct\n {\n \n/** Contains details about the passkey query. */\n\n \nstruct\n \nble_gap_passkey_params\n \nparams\n;\n\n \n/** Information about the relevant connection. */\n\n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n } \npasskey\n;\n\n \n/**\n\n\n * Represents a received ATT notification or indication.\n\n\n * Valid for the following event types:\n\n\n * o BLE_GAP_EVENT_NOTIFY\n\n\n */\n\n \nstruct\n {\n \n/** The handle of the relevant ATT attribute. */\n\n \nuint16_t\n \nattr_handle\n;\n\n \n/** The contents of the notification or indication. */\n\n \nvoid\n \n*attr_data\n;\n\n \n/** The number of data bytes contained in the message. */\n\n \nuint16_t\n \nattr_len\n;\n\n \n/** Information about the relevant connection. */\n\
n \nstruct\n \nble_gap_conn_desc\n \nconn\n;\n\n \n/**\n\n\n * Whether the received command is a notification or an\n\n\n * indication;\n\n\n * o 0: Notification;\n\n\n * o 1: Indication.\n\n\n */\n\n \nunsigned\n \nindication\n:\n1\n;\n } \nnotify\n;\n };\n};\n\n\n\n\n\nstruct\n \nble_gap_sec_state\n {\n \nunsigned\n \nencrypted\n:\n1\n;\n \nunsigned\n \nauthenticated\n:\n1\n;\n \nunsigned\n \nbonded\n:\n1\n;\n};\n\n\n\n\n\n/**\n\n\n * @param discoverable_mode One of the following constants:\n\n\n * o BLE_GAP_DISC_MODE_NON\n\n\n * (non-discoverable; 3.C.9.2.2).\n\n\n * o BLE_GAP_DISC_MODE_LTD\n\n\n * (limited-discoverable; 3.C.9.2.3).\n\n\n * o BLE_GAP_DISC_MODE_GEN\n\n\n *
(general-discoverable; 3.C.9.2.4).\n\n\n * @param connectable_mode One of the following constants:\n\n\n * o BLE_GAP_CONN_MODE_NON\n\n\n * (non-connectable; 3.C.9.3.2).\n\n\n * o BLE_GAP_CONN_MODE_DIR\n\n\n * (directed-connectable; 3.C.9.3.3).\n\n\n * o BLE_GAP_CONN_MODE_UND\n\n\n * (undirected-connectable; 3.C.9.3.4).\n\n\n */\n\n\nstruct\n \nble_gap_adv_params\n {\n \n/*** Mandatory fields. */\n\n \nuint8_t\n \nconn_mode\n;\n \nuint8_t\n \ndisc_mode\n;\n\n \n/*** Optional fields; assign 0 to make the stack calculate them. */\n\n \nuint16_t\n \nitvl_min\n;\n \nuint16_t\n \nitvl_max\n;\n \nuint8_t\n \nchannel_map\n;\n \nuint8_t\n \nfilter_policy\n;\n \nuint8_t\n \nhigh_duty_cycle\n:\n1\n;\n};\n\n\n\n\n\nstruct\n \nble_gap_co
nn_desc\n {\n \nstruct\n \nble_gap_sec_state\n \nsec_state\n;\n \nuint8_t\n \npeer_ota_addr\n[\n6\n];\n \nuint8_t\n \npeer_id_addr\n[\n6\n];\n \nuint8_t\n \nour_id_addr\n[\n6\n];\n \nuint8_t\n \nour_ota_addr\n[\n6\n];\n \nuint16_t\n \nconn_handle\n;\n \nuint16_t\n \nconn_itvl\n;\n \nuint16_t\n \nconn_latency\n;\n \nuint16_t\n \nsupervision_timeout\n;\n \nuint8_t\n \npeer_ota_addr_type\n;\n \nuint8_t\n \npeer_id_addr_type\n;\n \nuint8_t\n \nour_id_addr_type\n;\n \nuint8_t\n \nour_ota_addr_type\n;\n \nuint8_t\n \nrole\n;\n \nuint8_t\n \nmaster_clock_accuracy\n;\n};\n\n\n\n\n\nstruct\n \nble_gap_conn_params\n {\n \nuint16_t\n \nscan_itvl\n;\n \nuint16_t\n \nscan_window\n;\n \nuint16_t\n \nitvl_min\n;\n \nuint16_t\n \nitvl_max\n;\n \nuint16_t\n \nlatency\n;\n \nuint16_t\n \nsupervision_timeout\n;\n \nuint16_t\n \nmin_ce_len\n;\n \nuint16_t\n \nmax_ce_len\n;\n};\n\n\n\n\n\nstruct\n \nble_gap_disc_params\n {\n \nuint1
6_t\n \nitvl\n;\n \nuint16_t\n \nwindow\n;\n \nuint8_t\n \nfilter_policy\n;\n \nuint8_t\n \nlimited\n:\n1\n;\n \nuint8_t\n \npassive\n:\n1\n;\n \nuint8_t\n \nfilter_duplicates\n:\n1\n;\n};\n\n\n\n\n\nstruct\n \nble_gap_upd_params\n {\n \nuint16_t\n \nitvl_min\n;\n \nuint16_t\n \nitvl_max\n;\n \nuint16_t\n \nlatency\n;\n \nuint16_t\n \nsupervision_timeout\n;\n \nuint16_t\n \nmin_ce_len\n;\n \nuint16_t\n \nmax_ce_len\n;\n};\n\n\n\n\n\nstruct\n \nble_gap_passkey_params\n {\n \nuint8_t\n \naction\n;\n \nuint32_t\n \nnumcmp\n;\n};",
+ "title": "GAP definitions"
+ },
+ {
+ "location": "/network/ble/ble_hs/ble_gap/definitions/ble_gap_defs/#gap-events",
+ "text": "typedef int ble_gap_event_fn ( struct ble_gap_event *ctxt , void *arg ); #define BLE_GAP_EVENT_CONNECT 0 #define BLE_GAP_EVENT_DISCONNECT 1 #define BLE_GAP_EVENT_CONN_CANCEL 2 #define BLE_GAP_EVENT_CONN_UPDATE 3 #define BLE_GAP_EVENT_CONN_UPDATE_REQ 4 #define BLE_GAP_EVENT_L2CAP_UPDATE_REQ 5 #define BLE_GAP_EVENT_TERM_FAILURE 6 #define BLE_GAP_EVENT_DISC 7 #define BLE_GAP_EVENT_DISC_COMPLETE 8 #define BLE_GAP_EVENT_ADV_COMPLETE 9 #define BLE_GAP_EVENT_ENC_CHANGE 10 #define BLE_GAP_EVENT_PASSKEY_ACTION 11 #define BLE_GAP_EVENT_NOTIFY 12 /** * Represents a GAP-related event. When such an event occurs, the host * notifies the application by passing an instance of this structure to an * application-specified callback. */ struct ble_gap_event {\n /** * Indicates the type of GAP event that
occurred. This is one of the * BLE_GAP_EVENT codes. */ \n uint8_t type ;\n\n /** * A discriminated union containing additional det
<TRUNCATED>