Skip to content

Commit

Permalink
bluetooth: mesh: remove deprecated legacy sensor API
Browse files Browse the repository at this point in the history
- Removing kconfig option BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE and
removing legacy sensor API.
- Remove unit tests for legacy sensor APIs.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
  • Loading branch information
m-alperen-sener committed Sep 27, 2024
1 parent 04933aa commit ee59927
Show file tree
Hide file tree
Showing 42 changed files with 831 additions and 5,232 deletions.
7 changes: 0 additions & 7 deletions doc/nrf/libraries/bluetooth_services/mesh/light_ctrl_cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ Light Lightness Control Client
:local:
:depth: 2

.. note::
This model interacts with the new sensor API introduced as of |NCS| v2.6.0.
As a consequence, parts of the model API have been changed as well.
The old API is deprecated, but still available by enabling the Kconfig option :kconfig:option:`CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`.
The Kconfig option is enabled by default in the deprecation period.
See the documentation for |NCS| versions prior to v2.6.0 for documentation about the old sensor API.

The Light Lightness Control (LC) Client configures and interacts with the :ref:`bt_mesh_light_ctrl_srv_readme`.

The Light LC Client creates a single model instance in the mesh composition data, and it can send messages to both the Light LC Server and the Light LC Setup Server, as long as it has the right application keys.
Expand Down
7 changes: 0 additions & 7 deletions doc/nrf/libraries/bluetooth_services/mesh/light_ctrl_srv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ Light Lightness Control Server
:local:
:depth: 2

.. note::
This model interacts with the new sensor API introduced as of |NCS| v2.6.0.
As a consequence, parts of the model API have been changed as well.
The old API is deprecated, but still available by enabling the Kconfig option :kconfig:option:`CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`.
The Kconfig option is enabled by default in the deprecation period.
See the documentation for |NCS| versions prior to v2.6.0 for documentation about the old sensor API.

The Light Lightness Control (LC) Server controls a single :ref:`bt_mesh_lightness_srv_readme` instance on the same device with a state machine.

The state machine defines common behavior for a light fixture through three states, each with its own timing parameters and light levels.
Expand Down
6 changes: 0 additions & 6 deletions doc/nrf/libraries/bluetooth_services/mesh/sensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Bluetooth Mesh sensors
:local:
:depth: 2

.. note::
A new sensor API is introduced as of |NCS| v2.6.0.
The old API is deprecated, but still available by enabling the Kconfig option :kconfig:option:`CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`.
The Kconfig option is enabled by default in the deprecation period.
See the documentation for |NCS| versions prior to v2.6.0 for documentation about the old sensor API.

The Bluetooth® Mesh specification provides a common scheme for representing all sensors.
A single Bluetooth Mesh sensor instance represents a single physical sensor, and a mesh device may present any number of sensors to the network through a Sensor Server model.
Sensors represent their measurements as a list of sensor channels, as described by the sensor's assigned type.
Expand Down
6 changes: 0 additions & 6 deletions doc/nrf/libraries/bluetooth_services/mesh/sensor_cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Sensor Client
:local:
:depth: 2

.. note::
A new sensor API is introduced as of |NCS| v2.6.0.
The old API is deprecated, but still available by enabling the Kconfig option :kconfig:option:`CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`.
The Kconfig option is enabled by default in the deprecation period.
See the documentation for |NCS| versions prior to v2.6.0 for documentation about the old sensor API.

The Sensor Client model reads and configures the sensors exposed by :ref:`bt_mesh_sensor_srv_readme` models.

Unlike the Sensor Server model, the Sensor Client only creates a single model instance in the mesh composition data.
Expand Down
6 changes: 0 additions & 6 deletions doc/nrf/libraries/bluetooth_services/mesh/sensor_srv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Sensor Server
:local:
:depth: 2

.. note::
A new sensor API is introduced as of |NCS| v2.6.0.
The old API is deprecated, but still available by enabling the Kconfig option :kconfig:option:`CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`.
The Kconfig option is enabled by default in the deprecation period.
See the documentation for |NCS| versions prior to v2.6.0 for documentation about the old sensor API.

The Sensor Server model holds a list of sensors, and exposes them to the mesh network.
There may be multiple Sensor Server models on a single mesh node, and each model may hold up to 47 sensors.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ Bluetooth Mesh
* Added metadata as optional parameter for models Light Lightness Server, Light HSL Server, Light CTL Temperature Server, Sensor Server, and Time Server.
To use the metadata, enable the :kconfig:option:`CONFIG_BT_MESH_LARGE_COMP_DATA_SRV` Kconfig option.

* Removed:

* Removed the ``BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE`` Kconfig option as the old APIs based on the :c:struct:`sensor_value` type are removed.
Applications using the old APIs must be updated (see the :ref:`migration guide <migration_2_6>`).

DECT NR+
--------

Expand Down
9 changes: 0 additions & 9 deletions include/bluetooth/mesh/light_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,12 @@ bt_mesh_lc_prop_format_get(uint16_t id)
.accuracy = CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_ACCURACY, \
}

#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT \
.lux = { \
{ CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_STANDBY }, \
{ CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_ON }, \
{ CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_PROLONG } \
}
#else
#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT \
.centilux = { \
CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_STANDBY * 100, \
CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_ON * 100, \
CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG_LUX_PROLONG * 100 \
}
#endif
#else
#define BT_MESH_LIGHT_CTRL_SRV_LUX_INIT
#endif
Expand Down
102 changes: 0 additions & 102 deletions include/bluetooth/mesh/light_ctrl_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ struct bt_mesh_light_ctrl_cli_handlers {
struct bt_mesh_msg_ctx *ctx,
const struct bt_mesh_onoff_status *status);

#if !defined(CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE) || defined(__DOXYGEN__)
/** @brief Light LC Property status handler.
*
* The Light Lightness Control Server's properties are configuration
Expand All @@ -109,23 +108,6 @@ struct bt_mesh_light_ctrl_cli_handlers {
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
const struct bt_mesh_sensor_value *value);
#else
/** @brief Light LC Property status handler.
*
* The Light Lightness Control Server's properties are configuration
* parameters for its behavior. All properties are represented as a
* single sensor value channel.
*
* @param[in] cli Client that received the message.
* @param[in] ctx Context of the message.
* @param[in] id ID of the property.
* @param[in] value Value of the property.
*/
void (*prop)(struct bt_mesh_light_ctrl_cli *cli,
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
const struct sensor_value *value);
#endif

/** @brief Light LC Regulator Coefficient status handler.
*
Expand Down Expand Up @@ -397,7 +379,6 @@ int bt_mesh_light_ctrl_cli_light_onoff_set_unack(
struct bt_mesh_light_ctrl_cli *cli, struct bt_mesh_msg_ctx *ctx,
const struct bt_mesh_onoff_set *set);

#if !defined(CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE) || defined(__DOXYGEN__)
/** @brief Get a Light Lightness Control Server property value.
*
* Properties are the configuration parameters for the Light Lightness Control
Expand Down Expand Up @@ -480,89 +461,6 @@ int bt_mesh_light_ctrl_cli_prop_set_unack(
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
const struct bt_mesh_sensor_value *val);
#else
/** @brief Get a Light Lightness Control Server property value.
*
* Properties are the configuration parameters for the Light Lightness Control
* Server. Each property value is represented as a single sensor channel.
*
* This call is blocking if the @c rsp buffer is non-NULL. Otherwise, this
* function will return, and the response will be passed to the
* @ref bt_mesh_light_ctrl_cli_handlers::prop callback.
*
* @param[in] cli Client model to send on.
* @param[in] ctx Message context, or NULL to use the configured publish
* parameters.
* @param[in] id Light Lightness Control Server property to get.
* @param[out] rsp Property value response buffer, or NULL to keep from
* blocking.
*
* @retval 0 Successfully sent the message and populated the @c
* rsp buffer.
* @retval -EALREADY A blocking request is already in progress.
* @retval -EADDRNOTAVAIL A message context was not provided and publishing is
* not configured.
* @retval -EAGAIN The device has not been provisioned.
* @retval -ETIMEDOUT The request timed out without a response.
*/
int bt_mesh_light_ctrl_cli_prop_get(struct bt_mesh_light_ctrl_cli *cli,
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
struct sensor_value *rsp);

/** @brief Set a Light Lightness Control Server property value.
*
* Properties are the configuration parameters for the Light Lightness Control
* Server. Each property value is represented as a single sensor channel.
*
* This call is blocking if the @c rsp buffer is non-NULL. Otherwise, this
* function will return, and the response will be passed to the
* @ref bt_mesh_light_ctrl_cli_handlers::prop callback.
*
* @param[in] cli Client model to send on.
* @param[in] ctx Message context, or NULL to use the configured publish
* parameters.
* @param[in] id Light Lightness Control Server property to set.
* @param[in] val New property value.
* @param[out] rsp Property value response buffer, or NULL to keep from
* blocking.
*
* @retval 0 Successfully sent the message and populated the @c
* rsp buffer.
* @retval -EALREADY A blocking request is already in progress.
* @retval -EADDRNOTAVAIL A message context was not provided and publishing is
* not configured.
* @retval -EAGAIN The device has not been provisioned.
* @retval -ETIMEDOUT The request timed out without a response.
*/
int bt_mesh_light_ctrl_cli_prop_set(struct bt_mesh_light_ctrl_cli *cli,
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
const struct sensor_value *val,
struct sensor_value *rsp);

/** @brief Set a Light Lightness Control Server property value without
* requesting a response.
*
* Properties are the configuration parameters for the Light Lightness Control
* Server. Each property value is represented as a single sensor channel.
*
* @param[in] cli Client model to send on.
* @param[in] ctx Message context, or NULL to use the configured publish
* parameters.
* @param[in] id Light Lightness Control Server property to set.
* @param[in] val New property value.
*
* @retval 0 Successfully sent the message.
* @retval -EADDRNOTAVAIL A message context was not provided and publishing is
* not configured.
* @retval -EAGAIN The device has not been provisioned.
*/
int bt_mesh_light_ctrl_cli_prop_set_unack(struct bt_mesh_light_ctrl_cli *cli,
struct bt_mesh_msg_ctx *ctx,
enum bt_mesh_light_ctrl_prop id,
const struct sensor_value *val);
#endif

/** @brief Get a Light Lightness Control Server Regulator Coefficient value.
*
Expand Down
10 changes: 0 additions & 10 deletions include/bluetooth/mesh/light_ctrl_srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,8 @@ struct bt_mesh_light_ctrl_srv_cfg {
/** State-wise light levels. */
uint16_t light[LIGHT_CTRL_STATE_COUNT];
#if CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG
#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
/** Target illuminance values. */
struct sensor_value lux[LIGHT_CTRL_STATE_COUNT];
#else
/** Target illuminance values, in centilux */
uint32_t centilux[LIGHT_CTRL_STATE_COUNT];
#endif /* CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE */
#endif /* CONFIG_BT_MESH_LIGHT_CTRL_SRV_REG */
};

Expand All @@ -159,13 +154,8 @@ struct bt_mesh_light_ctrl_srv {
struct {
/** Initial light level */
uint16_t initial_light;
#ifdef CONFIG_BT_MESH_SENSOR_USE_LEGACY_SENSOR_VALUE
/** Initial illumination level */
struct sensor_value initial_lux;
#else
/** Initial illumination level, in centilux */
uint32_t initial_centilux;
#endif
/** Fade duration */
uint32_t duration;
} fade;
Expand Down
Loading

0 comments on commit ee59927

Please sign in to comment.