Skip to content

Commit

Permalink
samples: Bluetooth: add peripheral_esl and central_esl sample
Browse files Browse the repository at this point in the history
Add a sample running electronic shelf label service
as tag role.
The sample use LED on DKs to simulate EPD display.
This sample provides real EPD reference code as well.

Add a sample running esl client as AP role.

Signed-off-by: Pirun Lee <pirun.lee@nordicsemi.no>
  • Loading branch information
pirun committed Sep 6, 2023
1 parent 8c2582b commit c23a6e7
Show file tree
Hide file tree
Showing 61 changed files with 5,217 additions and 45 deletions.
42 changes: 21 additions & 21 deletions doc/nrf/libraries/bluetooth_services/services/esl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,74 @@ Electronic Shelf Label Service (ESLS)
:local:
:depth: 2

The Electronic Shelf Label Service allows electronic shelf labels (ESL) to be controlled and updated using Bluetooth® wireless technology.
The Electronic Shelf Label Service allows you to control and update electronic shelf labels (ESL) using Bluetooth® wireless technology.

The ESL Service is used in the :ref:`peripheral_esl` sample.

Service UUID
************

The 128-bit vendor-specific service UUID is ``0x1857``.
The 16-bit vendor-specific service UUID is ``0x1857``.

Characteristics
***************

This service has 9 characteristics.
This service has the following nine characteristics.

ESL Address Characteristic (``0x2BF6``)
============================================================
=======================================

Write
Write data to the ESL Address Characteristic to configure unique address to ESL device.
Write data to the ESL Address Characteristic to configure a unique address to ESL device.

AP Sync Key Material Characteristic (``0x2BF7``)
============================================================
================================================

Write
The AP Sync Key Material is configured when an AP, acting as a Client, writes its AP Sync Key Material value to the AP Sync Key Material characteristic.
The AP Sync Key Material is configured when an AP, acting as a client, writes its AP Sync Key Material value to the AP Sync Key Material characteristic.

ESL Response Key Material Characteristic (``0x2BF8``)
============================================================
=====================================================

Write
The ESL Response Key Material is configured when an AP, acting as a Client, writes a value to the ESL Response Key Material characteristic.
The ESL Response Key Material is configured when an AP, acting as a client, writes a value to the ESL Response Key Material characteristic.

ESL Current Absolute Time Characteristic (``0x2BF9``)
============================================================
=====================================================

Write
When a value is written to the ESL Current Absolute Time characteristic, the Server shall set its current system time to the value.
When a value is written to the ESL Current Absolute Time characteristic, the server sets its current system time to the value.


ESL Display Information Characteristic (``0x2BFA``)
============================================================
===================================================

Read
The ESL Display Information characteristic shall return an array of one or more Display Data Structures when read by a Client.
The ESL Display Information characteristic returns an array of one or more Display Data Structures when read by a client.

ESL Image Information Characteristic (``0x2BFB``)
============================================================
=================================================

Read
When read, the ESL Image Information characteristic shall return the Max_Image_Index value equal to the numerically highest Image_Index value supported by the ESL.
When read, the ESL Image Information characteristic returns the Max_Image_Index value equal to the numerically highest Image_Index value supported by the ESL.

ESL Sensor Information Characteristic (``0x2BFC``)
============================================================
==================================================

Read
The ESL Sensor Information characteristic shall return an array of one or more Sensor Information Structures when read by a Client.
The ESL Sensor Information characteristic returns an array of one or more Sensor Information Structures when read by a client.

ESL LED Information Characteristic (``0x2BFD``)
============================================================
===============================================

Read
The ESL LED Information characteristic shall return an array of one or more octets when read by a Client.
The ESL LED Information characteristic returns an array of one or more octets when read by a client.

ESL Control Point Characteristic (``0x2BFE``)
============================================================
=============================================

Write Without Response, Write, Notify
The ESL Control Point characteristic allows a Client to write commands to an ESL while in a connection.
The ESL Control Point characteristic allows a client to write commands to an ESL while connected.

API documentation
*****************
Expand Down
48 changes: 24 additions & 24 deletions doc/nrf/libraries/bluetooth_services/services/esl_client.rst
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
.. _esl_service_client_readme:

Electronic Shelf Label Service (ESLS) Client
Electronic Shelf Label Service (ESLS) client
############################################

.. contents::
:local:
:depth: 2

This module implements the Electronic Shelf Label Service client which acts as Access Point(AP) to use the ESL Service exposed by an ESL device,
and how the central AP communicates with ESLs connectionlessly when one or more ESLs are in the Synchronized state.
The Electronic Shelf Label Service client library acts as an Access Point (AP) for using the ESL Service exposed by an ESL device.
It defines how the central AP communicates with ESLs when one or more ESLs are in the Synchronized state.

The ESL Service Client is used in the :ref:`central_esl` sample.
The ESL Service client is used in the :ref:`central_esl` sample.

Service UUID
************

The 128-bit vendor-specific service UUID is ``0x1857``.
The 16-bit vendor-specific service UUID is ``0x1857``.

Characteristics
***************

This service has 9 characteristics.
This service has the following nine characteristics.

ESL Address Characteristic (``0x2BF6``)
============================================================
=======================================

Write
Write data to the ESL Address Characteristic to configure unique address to ESL device.
Write data to the ESL Address Characteristic to configure a unique address to ESL device.

AP Sync Key Material Characteristic (``0x2BF7``)
============================================================
================================================

Write
The AP Sync Key Material is configured when an AP, acting as a Client, writes its AP Sync Key Material value to the AP Sync Key Material characteristic.
The AP Sync Key Material is configured when an AP, acting as a client, writes its AP Sync Key Material value to the AP Sync Key Material characteristic.

ESL Response Key Material Characteristic (``0x2BF8``)
============================================================
=====================================================

Write
The ESL Response Key Material is configured when an AP, acting as a Client, writes a value to the ESL Response Key Material characteristic.
The ESL Response Key Material is configured when an AP, acting as a client, writes a value to the ESL Response Key Material characteristic.

ESL Current Absolute Time Characteristic (``0x2BF9``)
============================================================
=====================================================

Write
When a value is written to the ESL Current Absolute Time characteristic, the Server shall set its current system time to the value.
When a value is written to the ESL Current Absolute Time characteristic, the server sets its current system time to the value.


ESL Display Information Characteristic (``0x2BFA``)
============================================================
===================================================

Read
The ESL Display Information characteristic shall return an array of one or more Display Data Structures when read by a Client.
The ESL Display Information characteristic returns an array of one or more Display Data Structures when read by a client.

ESL Image Information Characteristic (``0x2BFB``)
============================================================
=================================================

Read
When read, the ESL Image Information characteristic shall return the Max_Image_Index value equal to the numerically highest Image_Index value supported by the ESL.
When read, the ESL Image Information characteristic returns the Max_Image_Index value equal to the numerically highest Image_Index value supported by the ESL.

ESL Sensor Information Characteristic (``0x2BFC``)
============================================================
==================================================

Read
The ESL Sensor Information characteristic shall return an array of one or more Sensor Information Structures when read by a Client.
The ESL Sensor Information characteristic returns an array of one or more Sensor Information Structures when read by a client.

ESL LED Information Characteristic (``0x2BFD``)
============================================================
===============================================

Read
The ESL LED Information characteristic shall return an array of one or more octets when read by a Client.
The ESL LED Information characteristic returns an array of one or more octets when read by a client.

ESL Control Point Characteristic (``0x2BFE``)
============================================================
=============================================

Write Without Response, Write, Notify
The ESL Control Point characteristic allows a Client to write commands to an ESL while in a connection.
The ESL Control Point characteristic allows a client to write commands to an ESL while connected.

API documentation
*****************
Expand Down
26 changes: 26 additions & 0 deletions samples/bluetooth/central_esl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

# The application uses the conf/<board> scheme for configuration files.
#set(APPLICATION_CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/conf/\${BOARD}")

set(PM_STATIC_YML_FILE
#"${CMAKE_CURRENT_SOURCE_DIR}/conf/\${BOARD}/pm_static_${BOARD}.yml"
${CMAKE_CURRENT_SOURCE_DIR}/boards/pm_static_${BOARD}.yml
)

list(APPEND hci_rpmsg_b0n_OVERLAY_CONFIG overlay-minimal-size.conf)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(central_esl)

# NORDIC SDK APP START
target_sources(app PRIVATE
src/main.c
)
zephyr_library_include_directories(.)
64 changes: 64 additions & 0 deletions samples/bluetooth/central_esl/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

source "Kconfig.zephyr"

menu "Nordic ESL BLE GATT service client sample"

config BT_ESL_CLIENT_THREAD_STACK_SIZE
int "Thread stack size"
default 1024
help
Stack size used in each of the two threads

config BT_ESL_SECURITY_ENABLED
bool "Enable security"
select BT_SMP
select BT_BONDABLE
select BT_BONDING_REQUIRED
help
"Enable BLE security for the ESL service"

config BT_ESL_AP_AUTO_MODE
bool "AP auto onboarding Tag mode"
help
"When enabled, AP auto scans and configures the tag. When disabled, AP only accepts shell commands"

if BT_ESL_AP_AUTO_MODE
config BT_ESL_AP_AUTO_TAG_PER_GROUP
int "Tag per group"
default ESL_CLIENT_MAX_RESPONSE_SLOT_BUFFER
help
"The number of tags to be kept in same group for auto onboarding.
Tags exceeding this number are placed in next group.
Otherwise, response key is not enough for all tags in same group.
How to select this number depends on the desired scenario.
Less or equal to ESL_CLIENT_MAX_RESPONSE_SLOT_BUFFER decrypts the response EAD on the fly.
Greater than ESL_CLIENT_MAX_RESPONSE_SLOT_BUFFER enables the ESL AP to control large amount of tags at the same time."

config BT_ESL_AP_GROUP_PER_BUTTON
int "Groups for one button"
default 3
help
"The number of groups controlled by one button.
If this number is greater than 1, an AP can control multiple groups by one button.
Otherwise, an AP controls one group by one button."
endif

config BT_ESL_AP_AUTO_PAST_TAG
bool "AP auto past mode"
help
"When enabled, the AP sends automatic update complete command and PAST to an unsynchronized tag. When disabled, the AP only accepts shell commands."

config BT_ESL_AP_PTS
bool "ESL access point for PTS test"
help
Enable PTS test for ESL access point

module = CENTRAL_ESL
module-str = central esl
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"
endmenu
15 changes: 15 additions & 0 deletions samples/bluetooth/central_esl/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _central_esl:

Bluetooth: Central ESL
######################

The Central ESL sample demonstrates how to use the :ref:`esl_service_client_readme` library.

See the subpages for detailed documentation on the sample and its features.

.. toctree::
:maxdepth: 1
:caption: Subpages:

sample_description.rst
central_esl_subcommands.rst
42 changes: 42 additions & 0 deletions samples/bluetooth/central_esl/boards/nrf21540dk_nrf52840.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# External Flash for TAG OTS image storage
# Need this when storage is on flash
CONFIG_MPU_ALLOW_FLASH_WRITE=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FILE_SYSTEM_SHELL=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_ESL_CLIENT_MAX_GROUP=64

# ESL AP two CDC uart, one for command, one for SMP
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Nordic ESL Access Point sample"
CONFIG_UART_LINE_CTRL=y

# LOG
# CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
# CONFIG_MCUMGR_LOG_LEVEL_DBG=y
# CONFIG_BT_DEBUG_OTS_CLIENT=y
# CONFIG_BT_OTS_CLIENT_LOG_LEVEL_DBG=y

# PAWR timing
CONFIG_BT_CTLR_SDC_PAWR_ADV_COUNT=1
CONFIG_BT_CTLR_SDC_PERIODIC_ADV_RSP_TX_BUFFER_COUNT=3
CONFIG_BT_CTLR_SDC_PERIODIC_ADV_RSP_RX_BUFFER_COUNT=12
CONFIG_BT_PER_ADV_SYNC_MAX=1
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=2500
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=0
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=73
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
Loading

0 comments on commit c23a6e7

Please sign in to comment.