samples/bluetooth/extended_adv/README.html · samples/bluetooth/extended_adv/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Bluetooth · Extended Advertising

Bluetooth Extended Advertising

Advertiser는 즉시 재시작하고 scanner는 5초 cooldown하며 연결 cycle을 반복합니다.

Official pathsamples/bluetooth/extended_adv/README.html
Source filesamples/bluetooth/extended_adv/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

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

Part 1

요약·해설

별도 thread scheduling과 recycled callback deadlock 주의, 양쪽 전체 출력을 설명합니다.

Roles

Advertiser · Scanner

Delay

5 seconds

Safety

Avoid callback restart

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 A411771968495B0CE75D9DA4CE39525FCE96C3B8C423C006B8EC4527397461B5
.. _bluetooth_extended_advertising_sample:

Bluetooth: Extended Advertising
################################

Overview
********

This sample demonstrates the use of the extended advertising feature, by:

- Outlining the steps required to initialize an extended advertising application.
- Demo how to gracefully restart the functionality, after a disconnect.

The sample consists of the advertiser initiating a connectable advertisement set,
which prompts the scanner to connect after scanning for extended advertisements.
Once the connection is established, the advertiser waits for 5 seconds to disconnect.
After the connection is dropped, the advertiser immediately restarts broadcasting,
while the scanner cools-down for 5 seconds to restart its process.

This sample handles all actions in a separate thread, to promote good design
practices. Even though it is not strictly required, scheduling from another context is
strongly recommended (e.g. using a work item), as re-starting an advertiser or
scanner from within the `recycled` callback exposes the application to deadlocking.

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

* Two boards with Bluetooth Low Energy support

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

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

See :ref:`bluetooth samples section <bluetooth-samples>` for details.

This sample uses two applications, so two devices need to be setup.
Flash one device with the scanner application, and another device with the
advertiser application.

The two devices should automatically connect if they are close enough.

Here are the outputs you should get by default:

Advertiser:

.. code-block:: console

        *** Booting Zephyr OS build zephyr-v3.5.0-4935-gfc7972183da5 ***
        Starting Extended Advertising Demo
        Starting Extended Advertising
        Connected (err 0x00)
        Connected state!
        Initiating disconnect within 5 seconds...
        Disconnected (reason 0x16)
        Connection object available from previous conn. Disconnect is complete!
        Disconnected state! Restarting advertising
        Starting Extended Advertising
        Connected (err 0x00)
        Connected state!
        Initiating disconnect within 5 seconds...
        Disconnected (reason 0x16)
        Connection object available from previous conn. Disconnect is complete!
        Disconnected state! Restarting advertising
        Starting Extended Advertising

Scanner:

.. code-block:: console

        *** Booting Zephyr OS build zephyr-v3.5.0-4935-ge3308caf97bc ***
        Starting Extended Advertising Demo [Scanner]
        Found extended advertisement packet!
        Stopping scan
        Connected (err 0x00)
        Connected state!
        Disconnected (reason 0x13)
        Recycled cb called!
        Disconnected, cooldown for 5 seconds!
        Starting to scan for extended adv
        Found extended advertisement packet!
        Stopping scan
        Connected (err 0x00)
        Connected state!
        Disconnected (reason 0x13)
        Recycled cb called!
        Disconnected, cooldown for 5 seconds!
        Starting to scan for extended adv
        Found extended advertisement packet!
        Stopping scan
        Connected (err 0x00)
        Connected state!
        Disconnected (reason 0x13)
        Recycled cb called!
        Disconnected, cooldown for 5 seconds!

Part 3

한국어 전문 번역

개요

Extended Advertising 기능의 다음 사용법을 보여주는 sample입니다.

  • Extended Advertising application을 initialize하는 데 필요한 단계
  • Disconnect 뒤 기능을 안전하게 다시 시작하는 방법

Advertiser가 connectable advertising set을 시작하면 scanner가 extended advertisement를 scanning한 뒤 연결합니다. 연결이 설정되면 advertiser는 5초를 기다린 다음 disconnect합니다. 연결이 끊기면 advertiser는 즉시 broadcasting을 다시 시작하고, scanner는 5초 동안 cooldown한 뒤 과정을 다시 시작합니다.

좋은 설계 관행을 보여주기 위해 모든 action은 별도 thread에서 처리합니다. 엄격한 필수 조건은 아니지만 work item 같은 다른 context에서 scheduling하는 것을 강력히 권장합니다. recycled callback 안에서 advertiser나 scanner를 다시 시작하면 application이 deadlock에 노출됩니다.

요구사항

  • Bluetooth Low Energy를 지원하는 board 두 개

Build와 실행

Zephyr tree의 samples/bluetooth/extended_adv에서 이 sample을 찾을 수 있습니다. 자세한 공통 사항은 Bluetooth sample section을 참조하십시오.

이 sample은 application 두 개를 사용하므로 device 두 개를 준비해야 합니다. 한 device에는 Scanner application을, 다른 device에는 Advertiser application을 flash합니다. 두 device가 충분히 가까우면 자동으로 연결됩니다.

기본적으로 다음과 같은 출력이 나타납니다.

Advertiser

*** Booting Zephyr OS build zephyr-v3.5.0-4935-gfc7972183da5 ***
Starting Extended Advertising Demo
Starting Extended Advertising
Connected (err 0x00)
Connected state!
Initiating disconnect within 5 seconds...
Disconnected (reason 0x16)
Connection object available from previous conn. Disconnect is complete!
Disconnected state! Restarting advertising
Starting Extended Advertising
Connected (err 0x00)
Connected state!
Initiating disconnect within 5 seconds...
Disconnected (reason 0x16)
Connection object available from previous conn. Disconnect is complete!
Disconnected state! Restarting advertising
Starting Extended Advertising

Scanner

*** Booting Zephyr OS build zephyr-v3.5.0-4935-ge3308caf97bc ***
Starting Extended Advertising Demo [Scanner]
Found extended advertisement packet!
Stopping scan
Connected (err 0x00)
Connected state!
Disconnected (reason 0x13)
Recycled cb called!
Disconnected, cooldown for 5 seconds!
Starting to scan for extended adv
Found extended advertisement packet!
Stopping scan
Connected (err 0x00)
Connected state!
Disconnected (reason 0x13)
Recycled cb called!
Disconnected, cooldown for 5 seconds!
Starting to scan for extended adv
Found extended advertisement packet!
Stopping scan
Connected (err 0x00)
Connected state!
Disconnected (reason 0x13)
Recycled cb called!
Disconnected, cooldown for 5 seconds!

Source

출처

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