No ACL setup yet! Denying access to everyone.
en:edu:zmitac:s2:aih:lab:nrf52zephyrblebeacon
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:edu:zmitac:s2:aih:lab:nrf52zephyrblebeacon [2023/12/09 13:59] – ktokarz | en:edu:zmitac:s2:aih:lab:nrf52zephyrblebeacon [2023/12/09 18:42] (current) – ktokarz | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| This example advertises the device as the "Test beacon" | This example advertises the device as the "Test beacon" | ||
| - | After importing it to the Visual Studio Code we should make some configuration: | + | After importing it to the Visual Studio Code we should make some configuration: |
| + | < | ||
| + | CONFIG_BT=y | ||
| + | CONFIG_BT_DEBUG_LOG=y | ||
| + | CONFIG_BT_DEVICE_NAME=" | ||
| + | </ | ||
| This example starts the Bluetooth interface with the function bt_enable() that passes the pointer to the bt_ready() which is the callback function to notify that initialization has finished. | This example starts the Bluetooth interface with the function bt_enable() that passes the pointer to the bt_ready() which is the callback function to notify that initialization has finished. | ||
| < | < | ||
| Line 9: | Line 14: | ||
| </ | </ | ||
| - | Inside this bt_ready() function, we call bt_le_adv_start() function to start advertising. | + | Inside this bt_ready() function, we call bt_le_adv_start() function to start our device to function as the server (broadcaster) and begin advertising. |
| < | < | ||
| bt_le_adv_start(BT_LE_ADV_NCONN, | bt_le_adv_start(BT_LE_ADV_NCONN, | ||
| </ | </ | ||
| - | The beacon example is very simple because the beacon device is intended to advertise only so, there is no further functionality implemented. This example shows the so-called Eddystone format (([[https:// | ||
| - | For example, web prefixes can be encoded as in the table. | ||
| - | ^ Decimal | + | The argument " |
| - | | 0 | 0x00 | %%http://www.%% | | + | |
| - | | 1 | 0x01 | %%https://www.%% | | + | The " |
| - | | 2 | + | < |
| - | | 3 | + | static const struct bt_data ad[] = { |
| + | BT_DATA_BYTES(BT_DATA_FLAGS, | ||
| + | BT_DATA_BYTES(BT_DATA_UUID16_ALL, | ||
| + | BT_DATA_BYTES(BT_DATA_SVC_DATA16, | ||
| + | 0xaa, 0xfe, /* Eddystone UUID */ | ||
| + | 0x10, /* Eddystone-URL frame type */ | ||
| + | | ||
| + | 0x00, /* URL Scheme Prefix | ||
| + | ' | ||
| + | ' | ||
| + | 0x08) /* .org */ | ||
| + | }; | ||
| + | </ | ||
| + | It contains three elements of specific types. The complete list of types with their identifiers you can find in the official Bluetooth SiG website ((https://bitbucket.org/ | ||
| + | <table bletypes> | ||
| + | < | ||
| + | ^ Type ID ^ Type name (as in BLE specification) ^ Content ^ | ||
| + | | 0x01 | Flags | specifies if BR/EDR is supported | ||
| + | | 0x03 | Complete List of 16-bit Service Class UUIDs | Eddystone UUID | | ||
| + | | 0x16 | Service Data - 16-bit UUID | UUID and content of Eddystone data | | ||
| + | </table> | ||
| + | |||
| + | The " | ||
| + | <table blesdtypes> | ||
| + | < | ||
| + | ^ Type ID ^ Type name (as in BLE specification) ^ Content ^ | ||
| + | | 0x09 | Complete Local Name | name of the device | | ||
| + | </ | ||
| + | You can observe the details in the nRF Connect application on your mobile phone. | ||
| + | The beacon example is very simple because the beacon device is intended to advertise only, so there is no further functionality implemented. This example shows the so-called Eddystone format (([[https:// | ||
| + | For example, web prefixes can be encoded as in the table {{ref> | ||
| + | <table eddyprefix> | ||
| + | < | ||
| + | ^ Decimal | ||
| + | | 0 | 0x00 |%%http:// | ||
| + | | 1 | 0x01 |%%https:// | ||
| + | | 2 | 0x02 |%%http:// | ||
| + | | 3 | 0x03 |%%https:// | ||
| + | </ | ||
| + | Web suffixes defined in Eddystone format are listed in the table {{ref> | ||
| + | <table eddysuffix> | ||
| + | < | ||
| + | ^ Decimal | ||
| + | | 0 | 0x00 | .com/ | | ||
| + | | 1 | 0x01 | .org/ | | ||
| + | | 2 | 0x02 | .edu/ | | ||
| + | | 3 | 0x03 | .net/ | | ||
| + | | 4 | 0x04 | .info/ | ||
| + | | 5 | 0x05 | .biz/ | | ||
| + | | 6 | 0x06 | .gov/ | | ||
| + | | 7 | 0x07 | .com | | ||
| + | | 8 | 0x08 | .org | | ||
| + | | 9 | 0x09 | .edu | | ||
| + | | 10 | 0x0a | .net | | ||
| + | | 11 | 0x0b | .info | | ||
| + | | 12 | 0x0c | .biz | | ||
| + | | 13 | 0x0d | .gov | | ||
| + | </ | ||
| + | ===== Tasks to do during the laboratory ===== | ||
| + | - Import the Zephyr BLE Beacon example, compile it, and run. | ||
| + | - Use the nRF Connect application (For Android mobile) and find the "Test beacon" | ||
| + | - Modify the software obtaining different prefixes and suffixes for the beacon. | ||
| + | - Modify the name of the device with "Polsl Beacon", | ||
en/edu/zmitac/s2/aih/lab/nrf52zephyrblebeacon.1702126773.txt.gz · Last modified: by ktokarz
