Part 1
요약·해설
초기화, Target list, timeout, capability 협상과 bt_mesh_blob_cli_send 흐름을 설명합니다.
Sender
bt_mesh_blob_cli_inputs
Unicast · group
Push · Pull
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
6693683EA7B762B28B5039E8AAE1FB68D8ADE9C9EF092F66E5677B15BC9EEDC9
.. _bluetooth_mesh_blob_cli:
BLOB Transfer Client
####################
The Binary Large Object (BLOB) Transfer Client is the sender of the BLOB transfer. It supports
sending BLOBs of any size to any number of Target nodes, in both Push BLOB Transfer Mode and Pull
BLOB Transfer Mode.
Usage
*****
Initialization
==============
The BLOB Transfer Client is instantiated on an element with a set of event handler callbacks:
.. code-block:: C
static const struct bt_mesh_blob_cli_cb blob_cb = {
/* Callbacks */
};
static struct bt_mesh_blob_cli blob_cli = {
.cb = &blob_cb,
};
static const struct bt_mesh_model models[] = {
BT_MESH_MODEL_BLOB_CLI(&blob_cli),
};
Transfer context
================
Both the transfer capabilities retrieval procedure and the BLOB transfer uses an instance of a
:c:struct:`bt_mesh_blob_cli_inputs` to determine how to perform the transfer. The BLOB Transfer Client
Inputs structure must at least be initialized with a list of targets, an application key and a time
to live (TTL) value before it is used in a procedure:
.. code-block:: c
static struct bt_mesh_blob_target targets[3] = {
{ .addr = 0x0001 },
{ .addr = 0x0002 },
{ .addr = 0x0003 },
};
static struct bt_mesh_blob_cli_inputs inputs = {
.app_idx = MY_APP_IDX,
.ttl = BT_MESH_TTL_DEFAULT,
};
sys_slist_init(&inputs.targets);
sys_slist_append(&inputs.targets, &targets[0].n);
sys_slist_append(&inputs.targets, &targets[1].n);
sys_slist_append(&inputs.targets, &targets[2].n);
Note that all BLOB Transfer Servers in the transfer must be bound to the chosen application key.
Group address
-------------
The application may additionally specify a group address in the context structure. If the group is
not :c:macro:`BT_MESH_ADDR_UNASSIGNED`, the messages in the transfer will be sent to the group
address, instead of being sent individually to each Target node. Mesh Manager must ensure that all
Target nodes having the BLOB Transfer Server model subscribe to this group address.
Using group addresses for transferring the BLOBs can generally increase the transfer speed, as the
BLOB Transfer Client sends each message to all Target nodes at the same time. However, sending
large, segmented messages to group addresses in Bluetooth Mesh is generally less reliable than
sending them to unicast addresses, as there is no transport layer acknowledgment mechanism for
groups. This can lead to longer recovery periods at the end of each block, and increases the risk of
losing Target nodes. Using group addresses for BLOB transfers will generally only pay off if the
list of Target nodes is extensive, and the effectiveness of each addressing strategy will vary
heavily between different deployments and the size of the chunks.
Transfer timeout
----------------
If a Target node fails to respond to an acknowledged message within the BLOB Transfer Client's time
limit, the Target node is dropped from the transfer. The application can reduce the chances of this
by giving the BLOB Transfer Client extra time through the context structure. The extra time may be
set in 10-second increments, up to 182 hours, in addition to the base time of 20 seconds. The wait
time scales automatically with the transfer TTL.
Note that the BLOB Transfer Client only moves forward with the transfer in following cases:
* All Target nodes have responded.
* A node has been removed from the list of Target nodes.
* The BLOB Transfer Client times out.
Increasing the wait time will increase this delay.
BLOB transfer capabilities retrieval
====================================
It is generally recommended to retrieve BLOB transfer capabilities before starting a transfer. The
procedure populates the transfer capabilities from all Target nodes with the most liberal set of
parameters that allows all Target nodes to participate in the transfer. Any Target nodes that fail
to respond, or respond with incompatible transfer parameters, will be dropped.
Target nodes are prioritized according to their order in the list of Target nodes. If a Target node
is found to be incompatible with any of the previous Target nodes, for instance by reporting a
non-overlapping block size range, it will be dropped. Lost Target nodes will be reported through the
:c:member:`lost_target <bt_mesh_blob_cli_cb.lost_target>` callback.
The end of the procedure is signalled through the :c:member:`caps <bt_mesh_blob_cli_cb.caps>`
callback, and the resulting capabilities can be used to determine the block and chunk sizes required
for the BLOB transfer.
BLOB transfer
=============
The BLOB transfer is started by calling :c:func:`bt_mesh_blob_cli_send` function, which (in addition
to the aforementioned transfer inputs) requires a set of transfer parameters and a BLOB stream
instance. The transfer parameters include the 64-bit BLOB ID, the BLOB size, the transfer mode, the
block size in logarithmic representation and the chunk size. The BLOB ID is application defined, but
must match the BLOB ID the BLOB Transfer Servers have been started with.
The transfer runs until it either completes successfully for at least one Target node, or it is
cancelled. The end of the transfer is communicated to the application through the :c:member:`end
<bt_mesh_blob_cli_cb.end>` callback. Lost Target nodes will be reported through the
:c:member:`lost_target <bt_mesh_blob_cli_cb.lost_target>` callback.
API reference
*************
.. doxygengroup:: bt_mesh_blob_cli
:project: Zephyr
:members:
Part 3
한국어 전문 번역
BLOB Transfer Client
Client는 BLOB transfer의 sender입니다. Push와 Pull mode 모두에서 크기와 Target node 수에 관계없이 BLOB을 전송할 수 있습니다.
사용법
초기화
Event handler callback set과 함께 element에 BLOB Transfer Client를 instance화합니다.
static const struct bt_mesh_blob_cli_cb blob_cb = {
/* Callbacks */
};
static struct bt_mesh_blob_cli blob_cli = {
.cb = &blob_cb,
};
static const struct bt_mesh_model models[] = {
BT_MESH_MODEL_BLOB_CLI(&blob_cli),
};Transfer context
Capability 조회 절차와 실제 BLOB transfer는 모두 bt_mesh_blob_cli_inputs instance를 사용해 전송 방식을 결정합니다. Procedure에 쓰기 전에 최소한 Target list, application key와 TTL 값을 초기화해야 합니다.
static struct bt_mesh_blob_target targets[3] = {
{ .addr = 0x0001 },
{ .addr = 0x0002 },
{ .addr = 0x0003 },
};
static struct bt_mesh_blob_cli_inputs inputs = {
.app_idx = MY_APP_IDX,
.ttl = BT_MESH_TTL_DEFAULT,
};
sys_slist_init(&inputs.targets);
sys_slist_append(&inputs.targets, &targets[0].n);
sys_slist_append(&inputs.targets, &targets[1].n);
sys_slist_append(&inputs.targets, &targets[2].n);Transfer에 참여하는 모든 BLOB Transfer Server는 선택한 application key에 bind되어 있어야 합니다.
Group address
Application은 context structure에 group address를 추가로 지정할 수 있습니다. Address가 BT_MESH_ADDR_UNASSIGNED가 아니면 각 Target에 개별 전송하지 않고 group address로 message를 보냅니다. Mesh Manager는 BLOB Transfer Server model을 가진 모든 Target이 이 group address를 subscribe하도록 보장해야 합니다.
Group address를 사용하면 Client가 한 message를 모든 Target에 동시에 보내므로 일반적으로 transfer가 빨라집니다. 그러나 Bluetooth Mesh에서 크고 segmented된 group message는 group에 transport layer acknowledgment가 없어 unicast보다 신뢰성이 낮습니다. Block 끝의 recovery 시간이 길어지고 Target을 잃을 위험도 커집니다.
따라서 group 방식의 이득은 Target list가 충분히 클 때 주로 나타나며, 어느 addressing 전략이 나은지는 deployment 환경과 chunk size에 크게 좌우됩니다.
Transfer timeout
Target이 Client 시간 제한 안에 acknowledged message에 응답하지 않으면 transfer에서 제외됩니다. Application은 context structure에서 추가 시간을 주어 이 가능성을 줄일 수 있습니다. 추가 시간은 기본 20초에 더해 10초 단위로 최대 182시간까지 설정하며 wait time은 TTL에 따라 자동으로 늘어납니다.
Client는 모든 Target이 응답했거나, node가 Target list에서 제거됐거나, Client timeout이 발생한 경우에만 다음 단계로 진행합니다. Wait time을 늘리면 이 지연도 함께 커집니다.
BLOB transfer capability 조회
Transfer 전에 capability를 조회하는 것이 일반적으로 권장됩니다. 이 절차는 모든 Target이 참여할 수 있는 가장 여유로운 parameter set을 계산합니다. 응답하지 않거나 호환되지 않는 parameter를 보고한 Target은 제외합니다.
Target 우선순위는 Target list 순서입니다. 예를 들어 block size 범위가 앞선 Target과 겹치지 않으면 뒤의 Target을 제외합니다. 잃은 Target은 bt_mesh_blob_cli_cb.lost_target callback으로 보고합니다.
Procedure 종료는 bt_mesh_blob_cli_cb.caps callback으로 알리고, 얻은 capability로 BLOB transfer에 필요한 block·chunk size를 정할 수 있습니다.
BLOB transfer
bt_mesh_blob_cli_send를 호출해 시작합니다. 앞서 설명한 input 외에 transfer parameter set과 BLOB stream instance가 필요합니다. Parameter에는 64-bit BLOB ID, BLOB size, transfer mode, logarithmic representation의 block size와 chunk size가 들어갑니다.
BLOB ID는 application이 정의하지만 Server를 시작할 때 사용한 BLOB ID와 반드시 같아야 합니다. Transfer는 Target 하나 이상에서 성공하거나 취소될 때까지 실행됩니다. 종료는 bt_mesh_blob_cli_cb.end, 잃은 Target은 bt_mesh_blob_cli_cb.lost_target callback으로 application에 전달합니다.
API Reference
공식 bt_mesh_blob_cli Doxygen group이 Client input, target, callback과 전송 API를 생성합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.