Part 1
요약·해설
Scan 2종, remote provisioning과 세 NPPI procedure 선택 규칙을 코드 예제와 함께 설명합니다.
Regular · extended
Remote
Key · address · composition
Device key
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
8A543FB558C1283BD8E6BE8AF0A02A4992E5BB893FDFA1F6E2B0DFEEE7B264E2
.. _bluetooth_mesh_models_rpr_cli:
Remote Provisioning Client
##########################
The Remote Provisioning Client model is a foundation model defined by the Bluetooth
mesh specification. It is enabled with the
:kconfig:option:`CONFIG_BT_MESH_RPR_CLI` option.
The Remote Provisioning Client model is introduced in the Bluetooth Mesh Protocol
Specification version 1.1.
This model provides functionality to remotely provision devices into a mesh network, and perform
Node Provisioning Protocol Interface procedures by interacting with mesh nodes that support the
:ref:`bluetooth_mesh_models_rpr_srv` model.
The Remote Provisioning Client model communicates with a Remote Provisioning Server model
using the device key of the node containing the target Remote Provisioning Server model instance.
If present, the Remote Provisioning Client model must be instantiated on the primary
element.
Scanning
********
The scanning procedure is used to scan for unprovisioned devices located nearby the Remote
Provisioning Server. The Remote Provisioning Client starts a scan procedure by using the
:c:func:`bt_mesh_rpr_scan_start` call:
.. code-block:: C
static void rpr_scan_report(struct bt_mesh_rpr_cli *cli,
const struct bt_mesh_rpr_node *srv,
struct bt_mesh_rpr_unprov *unprov,
struct net_buf_simple *adv_data)
{
}
struct bt_mesh_rpr_cli rpr_cli = {
.scan_report = rpr_scan_report,
};
const struct bt_mesh_rpr_node srv = {
.addr = 0x0004,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
struct bt_mesh_rpr_scan_status status;
uint8_t *uuid = NULL;
uint8_t timeout = 10;
uint8_t max_devs = 3;
bt_mesh_rpr_scan_start(&rpr_cli, &srv, uuid, timeout, max_devs, &status);
The above example shows pseudo code for starting a scan procedure on the target Remote Provisioning
Server node. This procedure will start a ten-second, multiple-device scanning where the generated
scan report will contain a maximum of three unprovisioned devices. If the UUID argument was
specified, the same procedure would only scan for the device with the corresponding UUID. After the
procedure completes, the server sends the scan report that will be handled in the client's
:c:member:`bt_mesh_rpr_cli.scan_report` callback.
Additionally, the Remote Provisioning Client model also supports extended scanning with the
:c:func:`bt_mesh_rpr_scan_start_ext` call. Extended scanning supplements regular scanning by
allowing the Remote Provisioning Server to report additional data for a specific device. The Remote
Provisioning Server will use active scanning to request a scan response from the unprovisioned
device if it is supported by the unprovisioned device.
Provisioning
************
The Remote Provisioning Client starts a provisioning procedure by using the
:c:func:`bt_mesh_provision_remote` call:
.. code-block:: C
struct bt_mesh_rpr_cli rpr_cli;
const struct bt_mesh_rpr_node srv = {
.addr = 0x0004,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
uint8_t uuid[16] = { 0xaa };
uint16_t addr = 0x0006;
uint16_t net_idx = 0;
bt_mesh_provision_remote(&rpr_cli, &srv, uuid, net_idx, addr);
The above example shows pseudo code for remotely provisioning a device through a Remote Provisioning
Server node. This procedure will attempt to provision the device with the corresponding UUID, and
assign the address 0x0006 to its primary element using the network key located at index zero.
.. note::
During the remote provisioning, the same :c:struct:`bt_mesh_prov` callbacks are triggered as for
ordinary provisioning. See section :ref:`bluetooth_mesh_provisioning` for further details.
Re-provisioning
***************
In addition to scanning and provisioning functionality, the Remote Provisioning Client also provides
means to reconfigure node addresses, device keys and Composition Data on devices that support the
:ref:`bluetooth_mesh_models_rpr_srv` model. This is provided through the Node Provisioning Protocol
Interface (NPPI) which supports the following three procedures:
* Device Key Refresh procedure: Used to change the device key of the Target node without a need to
reconfigure the node.
* Node Address Refresh procedure: Used to change the node’s device key and unicast address.
* Node Composition Refresh procedure: Used to change the device key of the node, and to add or
delete models or features of the node.
The three NPPI procedures can be initiated with the :c:func:`bt_mesh_reprovision_remote` call:
.. code-block:: C
struct bt_mesh_rpr_cli rpr_cli;
struct bt_mesh_rpr_node srv = {
.addr = 0x0006,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
bool composition_changed = false;
uint16_t new_addr = 0x0009;
bt_mesh_reprovision_remote(&rpr_cli, &srv, new_addr, composition_changed);
The above example shows pseudo code for triggering a Node Address Refresh procedure on the Target
node. The specific procedure is not chosen directly, but rather through the other parameters that
are inputted. In the example we can see that the current unicast address of the Target is 0x0006,
while the new address is set to 0x0009. If the two addresses were the same, and the
``composition_changed`` flag was set to true, this code would instead trigger a Node Composition
Refresh procedure. If the two addresses were the same, and the ``composition_changed`` flag was set
to false, this code would trigger a Device Key Refresh procedure.
API reference
*************
.. doxygengroup:: bt_mesh_rpr_cli
:project: Zephyr
:members:
Part 3
한국어 전문 번역
Remote Provisioning Client
Bluetooth Mesh specification이 정의한 foundation model이며 CONFIG_BT_MESH_RPR_CLI로 활성화합니다.
Bluetooth Mesh Protocol Specification 1.1에 도입됐습니다. Remote Provisioning Server를 지원하는 mesh node와 상호작용해 device를 network에 remote provisioning하고 Node Provisioning Protocol Interface(NPPI) procedure를 수행합니다.
Target Server가 있는 node의 device key로 통신하며 이 model을 사용한다면 primary element에 instance화해야 합니다.
Scanning
Remote Provisioning Server 근처의 unprovisioned device를 찾는 procedure입니다. Client가 bt_mesh_rpr_scan_start를 호출해 시작합니다.
static void rpr_scan_report(struct bt_mesh_rpr_cli *cli,
const struct bt_mesh_rpr_node *srv,
struct bt_mesh_rpr_unprov *unprov,
struct net_buf_simple *adv_data)
{
}
struct bt_mesh_rpr_cli rpr_cli = {
.scan_report = rpr_scan_report,
};
const struct bt_mesh_rpr_node srv = {
.addr = 0x0004,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
struct bt_mesh_rpr_scan_status status;
uint8_t *uuid = NULL;
uint8_t timeout = 10;
uint8_t max_devs = 3;
bt_mesh_rpr_scan_start(&rpr_cli, &srv, uuid, timeout, max_devs, &status);예제는 address 0x0004의 Server에서 10초 동안 여러 device를 scan하고 최대 3개의 unprovisioned device를 report합니다. UUID가 NULL이 아니라면 해당 UUID 하나만 찾습니다.
Procedure가 끝나면 Server가 scan report를 보내고 Client의 bt_mesh_rpr_cli.scan_report callback이 처리합니다.
bt_mesh_rpr_scan_start_ext는 extended scan을 시작합니다. 특정 device에 대해 더 많은 data를 보고하며 unprovisioned device가 지원하면 Server가 active scan으로 scan response를 요청합니다.
Provisioning
bt_mesh_provision_remote로 remote provisioning을 시작합니다.
struct bt_mesh_rpr_cli rpr_cli;
const struct bt_mesh_rpr_node srv = {
.addr = 0x0004,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
uint8_t uuid[16] = { 0xaa };
uint16_t addr = 0x0006;
uint16_t net_idx = 0;
bt_mesh_provision_remote(&rpr_cli, &srv, uuid, net_idx, addr);예제는 Server node를 통해 지정 UUID의 device를 provision하고 network key index 0을 사용하며 primary element에 address 0x0006을 할당합니다.
Reprovisioning
Remote Provisioning Client는 Server를 지원하는 device의 node address, device key와 Composition Data를 재구성할 수 있습니다. NPPI는 세 procedure를 지원합니다.
- Device Key Refresh: Node를 다시 configure하지 않고 Target device key를 변경합니다.
- Node Address Refresh: Node device key와 unicast address를 변경합니다.
- Node Composition Refresh: Device key를 변경하고 node model 또는 feature를 추가·삭제합니다.
세 procedure는 모두 bt_mesh_reprovision_remote로 시작합니다.
struct bt_mesh_rpr_cli rpr_cli;
struct bt_mesh_rpr_node srv = {
.addr = 0x0006,
.net_idx = 0,
.ttl = BT_MESH_TTL_DEFAULT,
};
bool composition_changed = false;
uint16_t new_addr = 0x0009;
bt_mesh_reprovision_remote(&rpr_cli, &srv, new_addr, composition_changed);예제는 Target unicast address를 0x0006에서 0x0009로 바꾸므로 Node Address Refresh를 실행합니다. Function이 procedure 이름을 직접 받지 않고 input parameter 조합으로 선택합니다.
- 현재 address와 새 address가 다름: Node Address Refresh
- 두 address가 같고
composition_changed=true: Node Composition Refresh - 두 address가 같고
composition_changed=false: Device Key Refresh
API Reference
공식 bt_mesh_rpr_cli Doxygen group이 Remote scan·provision·reprovision API를 생성합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.