zephyr/samples/bluetooth/mesh_provisioner
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _ble_mesh_provisioner:

Bluetooth: Mesh Provisioner
###########################

Overview
********

This sample demonstrates how to use the Bluetooth mesh APIs related to
provisioning and using the Configuration Database (CDB). It is intended
to be tested together with a device capable of being provisioned. For
example, one could use the sample in
:zephyr_file:`samples/bluetooth/mesh`
or :zephyr_file:`tests/bluetooth/mesh_shell`.

The application provisions itself and loads the CDB with an application
key, then waits to receive an Unprovisioned Beacon from a device. If the
board has a push button connected via GPIO and configured using the
``sw0`` :ref:`devicetree <dt-guide>` alias, the application then waits
for the user to press the button, which will trigger provisioning using
PB-ADV. If the board doesn't have the push button, the sample will
provision detected devices automatically. Once provisioning is done, the
node will be present in the CDB but not yet marked as configured. The
application will notice the unconfigured node and start configuring it.
If no errors are encountered, the node is marked as configured.

The configuration of a node involves adding an application key, getting
the composition data, and binding all its models to the application key.

Requirements
************

* A board with Bluetooth LE support, or
* QEMU with BlueZ running on the host

Building and Running
********************

This sample can be found under
:zephyr_file:`samples/bluetooth/mesh_provisioner` in the Zephyr tree.

See :ref:`bluetooth samples section <bluetooth-samples>` for details on
how to run the sample inside QEMU.

For other boards, build and flash the application as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/bluetooth/mesh_provisioner
   :board: <board>
   :goals: flash
   :compact:

Refer to your :ref:`board's documentation <boards>` for alternative
flash instructions if your board doesn't support the ``flash`` target.