MeshX 0.4
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
Loading...
Searching...
No Matches
meshx_ble_mesh_light_srv.h File Reference

Header file for the MeshX BLE Mesh Light Server module. This file defines the data structures, function prototypes, and callback parameters for managing the Light Server models in a BLE Mesh network. It includes support for various lighting models such as Light CTL, HSL, xyL, and LC. More...

Go to the source code of this file.

Data Structures

struct  meshx_state_change_light_lightness_set_t
struct  meshx_state_change_light_lightness_linear_set_t
struct  meshx_state_change_light_lightness_default_set_t
struct  meshx_state_change_light_lightness_range_set_t
struct  meshx_state_change_light_ctl_set_t
struct  meshx_state_change_light_ctl_temperature_set_t
struct  meshx_state_change_light_ctl_temperature_range_set_t
struct  meshx_state_change_light_ctl_default_set_t
struct  meshx_state_change_light_hsl_set_t
struct  meshx_state_change_light_hsl_hue_set_t
struct  meshx_state_change_light_hsl_saturation_set_t
struct  meshx_state_change_light_hsl_default_set_t
struct  meshx_state_change_light_hsl_range_set_t
struct  meshx_state_change_light_xyl_set_t
struct  meshx_state_change_light_xyl_default_set_t
struct  meshx_state_change_light_xyl_range_set_t
struct  meshx_state_change_light_lc_mode_set_t
struct  meshx_state_change_light_lc_om_set_t
struct  meshx_state_change_light_lc_light_onoff_set_t
struct  meshx_state_change_light_lc_property_set_t
struct  meshx_state_change_sensor_status_t
union  meshx_lighting_server_state_change_t
 Lighting Server Model state change value union. More...
struct  meshx_light_lightness_state_t
struct  meshx_light_ctl_state_t
struct  meshx_light_hsl_state_t
struct  meshx_light_xyl_state_t
struct  meshx_light_lc_state_t
struct  meshx_lighting_server_state
 Lighting Server Model state Used to set/restore the model state values internally. More...
struct  meshx_lighting_server_cb_param
struct  meshx_light_ctl_srv_state
struct  meshx_light_ctl_srv
 Structure representing the Light CTL Server model. More...
struct  meshx_light_server_send_params
 Light Server send parameters. Used by meshXBaseLightServerModel::plat_send_msg to forward state change events. More...

Typedefs

typedef struct meshx_lighting_server_state meshx_lighting_server_state_t
 Lighting Server Model state Used to set/restore the model state values internally.
typedef struct meshx_lighting_server_cb_param meshx_lighting_server_cb_param_t
typedef struct meshx_light_ctl_srv_state meshx_light_ctl_srv_state_t
typedef struct meshx_light_ctl_srv meshx_light_ctl_srv_t
 Structure representing the Light CTL Server model.
typedef control_task_msg_handle_t meshx_lighting_server_cb
typedef struct meshx_light_server_send_params meshx_light_server_send_params_t
 Light Server send parameters. Used by meshXBaseLightServerModel::plat_send_msg to forward state change events.

Functions

meshx_err_t meshx_plat_light_srv_init (void)
 Initialize the platform-specific Light Server.
meshx_err_t meshx_plat_light_srv_restore (meshx_ptr_t p_model, const meshx_lighting_server_state_t *state, uint16_t state_len)
 Restore the Light Server model state from persistent storage.
meshx_err_t meshx_plat_light_ctl_setup_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv)
 Creates and initializes a Light CTL (Color Temperature Lightness) Setup Server model instance.
meshx_err_t meshx_plat_get_ctl_setup_srv_model (meshx_ptr_t p_model)
meshx_err_t meshx_get_ctl_setup_srv_model (meshx_ptr_t p_model)
meshx_err_t meshx_plat_light_ctl_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv)
 Create a Light CTL Server instance.
meshx_err_t meshx_plat_light_lightness_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_lightness_srv)
 Create a Light Lightness Server instance.
meshx_err_t meshx_plat_light_hsl_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_hsl_srv)
 Create a Light HSL Server instance.
meshx_err_t meshx_plat_light_xyl_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_xyl_srv)
 Create a Light xyL Server instance.
meshx_err_t meshx_plat_light_lc_srv_create (meshx_ptr_t p_model, meshx_ptr_t *p_pub, meshx_ptr_t *p_lc_srv)
 Create a Light LC Server instance.
meshx_err_t meshx_plat_light_srv_delete (meshx_ptr_t *p_pub, meshx_ptr_t *p_ctl_srv)
 Delete a Light CTL Server instance.
meshx_err_t meshx_plat_set_light_ctl_srv_state (meshx_ptr_t p_model, uint16_t delta_uv, uint16_t lightness, uint16_t temperature, uint16_t temp_range_max, uint16_t temp_range_min)
 Set the state of the Light CTL Server.
meshx_err_t meshx_plat_light_ctl_srv_restore (meshx_ptr_t p_model, uint16_t delta_uv, uint16_t lightness, uint16_t temperature, uint16_t temp_range_max, uint16_t temp_range_min)
 Restore the state of the Light CTL Server.
meshx_err_t meshx_plat_gen_light_srv_send_status (const meshx_model_t *p_model, const meshx_ctx_t *p_ctx, const meshx_lighting_server_state_change_t *state_change)
 Send a status message from the Light Server. This function constructs and sends a status message containing the current state of the Light Server.

Detailed Description

Header file for the MeshX BLE Mesh Light Server module. This file defines the data structures, function prototypes, and callback parameters for managing the Light Server models in a BLE Mesh network. It includes support for various lighting models such as Light CTL, HSL, xyL, and LC.

Copyright (c) 2024 - 2025 MeshX

  • Defines state change event structures for different lighting models.
  • Provides APIs for initializing, creating, deleting, and managing Light Server instances.
  • Supports Light CTL Server state management, including setting and restoring states.
  • Includes callback parameters for handling received lighting messages.
Author
Pranjal Chanda

Typedef Documentation

◆ meshx_light_ctl_srv_state_t

◆ meshx_light_ctl_srv_t

Structure representing the Light CTL Server model.

This structure contains the model and state information for the Light CTL Server.

◆ meshx_light_server_send_params_t

Light Server send parameters. Used by meshXBaseLightServerModel::plat_send_msg to forward state change events.

◆ meshx_lighting_server_cb

◆ meshx_lighting_server_cb_param_t

Lighting Server Model callback parameters

◆ meshx_lighting_server_state_t

Lighting Server Model state Used to set/restore the model state values internally.

Function Documentation

◆ meshx_get_ctl_setup_srv_model()

meshx_err_t meshx_get_ctl_setup_srv_model ( meshx_ptr_t p_model)
685{
687}
meshx_err_t meshx_plat_get_ctl_setup_srv_model(meshx_ptr_t p_model)

◆ meshx_plat_gen_light_srv_send_status()

meshx_err_t meshx_plat_gen_light_srv_send_status ( const meshx_model_t * p_model,
const meshx_ctx_t * p_ctx,
const meshx_lighting_server_state_change_t * state_change )

Send a status message from the Light Server. This function constructs and sends a status message containing the current state of the Light Server.

Parameters
[in]p_modelPointer to the Light Server model.
[in]p_ctxPointer to the context containing message information.
[in]state_changeThe state change data to be sent in the status message.
Returns
  • MESHX_SUCCESS: Successfully sent the status message.
  • MESHX_INVALID_ARG: Invalid argument provided.
  • MESHX_ERR_PLAT: Platform-specific error occurred.

◆ meshx_plat_get_ctl_setup_srv_model()

meshx_err_t meshx_plat_get_ctl_setup_srv_model ( meshx_ptr_t p_model)

◆ meshx_plat_light_ctl_setup_srv_create()

meshx_err_t meshx_plat_light_ctl_setup_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_ctl_srv )

Creates and initializes a Light CTL (Color Temperature Lightness) Setup Server model instance.

This function sets up the Light CTL Setup Server for a given model, configuring publication and server context pointers.

Parameters
[in]p_modelPointer to the parent model instance.
[out]p_pubPointer to the publication context to be initialized.
[out]p_ctl_srvPointer to the Light CTL Setup Server context to be initialized.
Returns
meshx_err_t Error code indicating the result of the operation.
  • MESHX_OK on success
  • Appropriate error code otherwise

◆ meshx_plat_light_ctl_srv_create()

meshx_err_t meshx_plat_light_ctl_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_ctl_srv )

Create a Light CTL Server instance.

This function initializes and allocates resources for a Light CTL Server model.

Parameters
[in]p_modelPointer to the model instance.
[out]p_pubPointer to the publication context.
[out]p_ctl_srvPointer to the Light CTL Server instance.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_ctl_srv_restore()

meshx_err_t meshx_plat_light_ctl_srv_restore ( meshx_ptr_t p_model,
uint16_t delta_uv,
uint16_t lightness,
uint16_t temperature,
uint16_t temp_range_max,
uint16_t temp_range_min )

Restore the state of the Light CTL Server.

This function restores the state of the Light CTL Server with the provided parameters.

Parameters
[in]p_modelPointer to the model instance.
[in]delta_uvDelta UV value.
[in]lightnessLightness value.
[in]temperatureTemperature value.
[in]temp_range_maxMaximum temperature range.
[in]temp_range_minMinimum temperature range.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_hsl_srv_create()

meshx_err_t meshx_plat_light_hsl_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_hsl_srv )

Create a Light HSL Server instance.

This function initializes and allocates resources for a Light HSL Server model.

Parameters
[in]p_modelPointer to the model instance.
[out]p_pubPointer to the publication context.
[out]p_hsl_srvPointer to the Light HSL Server instance.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_lc_srv_create()

meshx_err_t meshx_plat_light_lc_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_lc_srv )

Create a Light LC Server instance.

This function initializes and allocates resources for a Light LC (Light Control) Server model.

Parameters
[in]p_modelPointer to the model instance.
[out]p_pubPointer to the publication context.
[out]p_lc_srvPointer to the Light LC Server instance.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_lightness_srv_create()

meshx_err_t meshx_plat_light_lightness_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_lightness_srv )

Create a Light Lightness Server instance.

This function initializes and allocates resources for a Light Lightness Server model.

Parameters
[in]p_modelPointer to the model instance.
[out]p_pubPointer to the publication context.
[out]p_lightness_srvPointer to the Light Lightness Server instance.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_srv_delete()

meshx_err_t meshx_plat_light_srv_delete ( meshx_ptr_t * p_pub,
meshx_ptr_t * p_ctl_srv )

Delete a Light CTL Server instance.

This function releases resources associated with a Light CTL Server model.

Parameters
[in,out]p_pubPointer to the publication context to be deleted.
[in,out]p_ctl_srvPointer to the Light CTL Server instance to be deleted.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_srv_init()

meshx_err_t meshx_plat_light_srv_init ( void )

Initialize the platform-specific Light Server.

This function sets up the necessary resources for the Light Server.

Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_light_srv_restore()

meshx_err_t meshx_plat_light_srv_restore ( meshx_ptr_t p_model,
const meshx_lighting_server_state_t * state,
uint16_t state_len )

Restore the Light Server model state from persistent storage.

This function restores the Light Server model state from persistent storage.

Parameters
[in]p_modelPointer to the model instance to be restored.
[in]statePointer to the state data to be restored.
[in]state_lenLength of the state data in bytes.
Returns
meshx_err_t Returns an error code indicating success or failure of the operation.
  • MESHX_SUCCESS on success.
  • MESHX_ERR_INVALID_ARG if any parameter is invalid.
  • MESHX_ERR_INVALID_STATE if the state data is corrupted.
  • Other error codes for implementation-specific failures.

◆ meshx_plat_light_xyl_srv_create()

meshx_err_t meshx_plat_light_xyl_srv_create ( meshx_ptr_t p_model,
meshx_ptr_t * p_pub,
meshx_ptr_t * p_xyl_srv )

Create a Light xyL Server instance.

This function initializes and allocates resources for a Light xyL Server model.

Parameters
[in]p_modelPointer to the model instance.
[out]p_pubPointer to the publication context.
[out]p_xyl_srvPointer to the Light xyL Server instance.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.

◆ meshx_plat_set_light_ctl_srv_state()

meshx_err_t meshx_plat_set_light_ctl_srv_state ( meshx_ptr_t p_model,
uint16_t delta_uv,
uint16_t lightness,
uint16_t temperature,
uint16_t temp_range_max,
uint16_t temp_range_min )

Set the state of the Light CTL Server.

This function updates the state of the Light CTL Server with the provided parameters.

Parameters
[in]p_modelPointer to the model instance.
[in]delta_uvDelta UV value.
[in]lightnessLightness value.
[in]temperatureTemperature value.
[in]temp_range_maxMaximum temperature range.
[in]temp_range_minMinimum temperature range.
Returns
  • MESHX_SUCCESS on success.
  • Appropriate error code on failure.