connectivity/bluetooth/api/l2cap.html · connectivity/bluetooth/api/l2cap.rst 공식 원문 ↗

Zephyr 3.7.0 · Connectivity · Bluetooth · API

Bluetooth L2CAP API

Segmentation·reassembly와 credit-based flow control로 connection-oriented data channel을 제공합니다.

Official pathconnectivity/bluetooth/api/l2cap.html
Source fileconnectivity/bluetooth/api/l2cap.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Channel callback, async receive 완료, blocking send, PSM server와 client 연결을 설명합니다.

Channel

Connection-oriented

Flow

Credit based

Object

bt_l2cap_chan

Group

bt_l2cap

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 DBAA07F95F85FCD229D14E1EE73199F80FD29EAA60DC8F8BEE7A203B211E0678
.. _bt_l2cap:

Logical Link Control and Adaptation Protocol (L2CAP)
####################################################

L2CAP layer enables connection-oriented channels which can be enable with the
configuration option: :kconfig:option:`CONFIG_BT_L2CAP_DYNAMIC_CHANNEL`. This channels
support segmentation and reassembly transparently, they also support credit
based flow control making it suitable for data streams.

Channels instances are represented by the :c:struct:`bt_l2cap_chan` struct which
contains the callbacks in the :c:struct:`bt_l2cap_chan_ops` struct to inform
when the channel has been connected, disconnected or when the encryption has
changed.
In addition to that it also contains the ``recv`` callback which is called
whenever an incoming data has been received. Data received this way can be
marked as processed by returning 0 or using
:c:func:`bt_l2cap_chan_recv_complete` API if processing is asynchronous.

.. note::
  The ``recv`` callback is called directly from RX Thread thus it is not
  recommended to block for long periods of time.

For sending data the :c:func:`bt_l2cap_chan_send` API can be used noting that
it may block if no credits are available, and resuming as soon as more credits
are available.

Servers can be registered using :c:func:`bt_l2cap_server_register` API passing
the :c:struct:`bt_l2cap_server` struct which informs what ``psm`` it should
listen to, the required security level ``sec_level``, and the callback
``accept`` which is called to authorize incoming connection requests and
allocate channel instances.

Client channels can be initiated with use of :c:func:`bt_l2cap_chan_connect`
API and can be disconnected with the :c:func:`bt_l2cap_chan_disconnect` API.
Note that the later can also disconnect channel instances created by servers.

API Reference
*************

.. doxygengroup:: bt_l2cap

Part 3

한국어 전문 번역

Logical Link Control and Adaptation Protocol

L2CAP layer는 CONFIG_BT_L2CAP_DYNAMIC_CHANNEL로 활성화하는 connection-oriented channel을 제공합니다. Channel은 segmentation·reassembly를 application에 투명하게 처리하고 credit-based flow control을 지원하므로 data stream 전송에 적합합니다.

Channel object와 callback

Channel instance는 bt_l2cap_chan으로 나타냅니다. 그 안의 bt_l2cap_chan_ops callback은 connect, disconnect와 encryption 변경 event를 알립니다. Incoming data를 받을 때는 recv callback을 호출합니다.

동기 처리라면 recv에서 0을 반환해 처리가 끝났음을 표시합니다. 비동기 처리라면 buffer 처리가 끝난 뒤 bt_l2cap_chan_recv_complete를 호출합니다.

Data 송신

bt_l2cap_chan_send를 사용합니다. 사용 가능한 credit이 없으면 block할 수 있으며 새 credit이 생기면 재개합니다.

Server 등록

bt_l2cap_server_register에 bt_l2cap_server를 전달합니다. Struct에는 listen할 psm, 필요한 security level인 sec_level, incoming connection을 authorize하고 channel instance를 할당하는 accept callback이 들어갑니다.

Client connection

bt_l2cap_chan_connect로 client channel을 연결하고 bt_l2cap_chan_disconnect로 해제합니다. Disconnect API는 server가 만든 channel instance에도 사용할 수 있습니다.

API Reference

공식 bt_l2cap Doxygen group이 L2CAP channel·server API를 생성합니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.