Z-Wave Protocol Controller Reference
zwave_command_class_configuration_control.c File Reference
#include "zwave_command_class_configuration.h"
#include "zwave_command_classes_utils.h"
#include "zwave_command_class_configuration_types.h"
#include "attribute_store_defined_attribute_types.h"
#include "zwave_command_class_indices.h"
#include "zwave_command_handler.h"
#include "zwave_controller_connection_info.h"
#include "zwave_controller_utils.h"
#include "zpc_attribute_store_network_helper.h"
#include "zpc_attribute_resolver.h"
#include "attribute_store.h"
#include "attribute_store_helper.h"
#include "attribute_resolver.h"
#include <string.h>
#include "sl_log.h"
Include dependency graph for zwave_command_class_configuration_control.c:

Macros

#define LOG_TAG   "zwave_command_class_configuration"
 
#define ATTRIBUTE(type)   ATTRIBUTE_COMMAND_CLASS_CONFIGURATION_##type
 
#define CONFIGURATION_SIZE_MASK   0x7
 
#define CONFIGURATION_FORMAT_MASK   0x38
 
#define CONFIGURATION_READ_ONLY_MASK   0x40
 
#define CONFIGURATION_ALTERING_CAPABILITIES_MASK   0x80
 
#define CONFIGURATION_ADVANCED_MASK   0x01
 
#define CONFIGURATION_NO_BULK_SUPPORT_MASK   0x02
 
#define CONFIGURATION_SET_VALUE_INDEX   4
 
#define CONFIGURATION_REPORT_VALUE_INDEX   4
 
#define CONFIGURATION_BULK_SET_VALUE_INDEX   6
 
#define CONFIGURATION_BULK_REPORT_FIRST_VALUE_INDEX   7
 
#define CONFIGURATION_PROPERTIES_REPORT_FIRST_VALUE_INDEX   5
 

Functions

static bool is_bulk_supported (attribute_store_node_t configuration_attribute_node)
 Checks if the node we are talking to supports Bulk Commands. More...
 
static bool is_parameter_read_only (attribute_store_node_t configuration_attribute_node)
 Verifies if a configuration parameter is read-only. More...
 
static attribute_store_node_t create_configuration_parameter (attribute_store_node_t endpoint_node, configuration_parameter_id_t parameter_id)
 Fetch or create a configuration parameter with all its sub-attributes in the attribute store. More...
 
static configuration_parameter_size_t get_configuration_parameter_size (attribute_store_node_t parameter_id_node)
 Get the configuration parameter size for a given parameter id. More...
 
static configuration_parameter_value_t get_configuration_parameter_value (attribute_store_node_t parameter_id_node)
 Get the configuration parameter value for a given parameter id. More...
 
static configuration_parameter_format_t get_configuration_parameter_format (attribute_store_node_t parameter_id_node)
 Get the configuration parameter format for a given parameter id. More...
 
static void set_parameter_value_in_buffer (uint8_t *frame, configuration_parameter_value_t value, configuration_parameter_size_t size, configuration_parameter_format_t format)
 Set the parameter value value in the frame buffer based on the parameter size, MSB first. More...
 
static void save_parameter_value (const uint8_t *frame, attribute_store_node_t parameter_id_node, attribute_store_type_t value_type)
 
static sl_status_t set_default_parameter_properties (attribute_store_node_t parameter_id_node)
 Sets the default parameters properties for a parameter in case a node does not support Properties Get Commands. More...
 
static void set_all_parameters_to_their_default_value (attribute_store_node_t node)
 Set the all Configuration parameters to their default value. More...
 
static void undefine_all_parameter_values (attribute_store_node_t node)
 Undefine the all Configuration parameters values, so they get resolved again. More...
 
static attribute_store_node_t get_parameter_id_node (zwave_node_id_t node_id, zwave_endpoint_id_t endpoint_id, configuration_parameter_id_t parameter_id)
 
static sl_status_t zwave_command_class_configuration_handle_report_command (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Handle incoming Configuration Report Commands. More...
 
static sl_status_t zwave_command_class_configuration_handle_bulk_report_command (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Handle incoming Configuration Bulk Report Commands. More...
 
static sl_status_t zwave_command_class_configuration_handle_properties_report_command (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Handle incoming Configuration Properties Report Commands. More...
 
static sl_status_t zwave_command_class_configuration_handle_info_report_command (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Handle incoming Configuration Info Report Commands. More...
 
static sl_status_t zwave_command_class_configuration_handle_name_report_command (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Handle incoming Configuration Name Report Commands. More...
 
static sl_status_t zwave_command_class_configuration_control_handler (const zwave_controller_connection_info_t *info, const uint8_t *frame, uint16_t frame_length)
 Dispatches incoming Configuration Commands to individual command handlers. More...
 
static sl_status_t zwave_command_class_configuration_get (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Get or Bulk Get Command to find out the value of a parameter. More...
 
static sl_status_t zwave_command_class_configuration_set (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Set or Bulk Set Command to set the value of a parameter. More...
 
static sl_status_t zwave_command_class_configuration_get_next_parameter (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Properties Get or Configuration Get Command to find out if a parameter ID is supported. More...
 
static sl_status_t zwave_command_class_configuration_name_get (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Name Get or fills up data automatically if the command is not supported. More...
 
static sl_status_t zwave_command_class_configuration_info_get (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Info Get or fills up data automatically if the command is not supported. More...
 
static sl_status_t zwave_command_class_configuration_properties_get (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Properties Get or fills up data automatically if the command is not supported. More...
 
static sl_status_t zwave_command_class_configuration_default_reset (attribute_store_node_t node, uint8_t *frame, uint16_t *frame_length)
 Generates a Configuration Default Reset. More...
 
static void on_default_reset_send_data_complete (attribute_store_node_t node, resolver_rule_type_t rule_type, zpc_resolver_event_t event)
 
static void on_next_supported_parameter_id_not_found (attribute_store_node_t node)
 Callback function for when a Get did not succeed in finding the next parameter id. We may have more to search for, so we mark it as defined in this case to trigger a new get resolution with a new parameter id. More...
 
static void on_configuration_get_failure (attribute_store_node_t parameter_value_node)
 Deletes the Configuration Parameter ID if we could not get its value for v1-v2 nodes. More...
 
static void zwave_command_class_configuration_on_configuration_parameter_created (attribute_store_node_t parameter_id_node, attribute_store_change_t change)
 Attribute callback function listening for Configuration Paramter ID creations and creating all the sub-attributes. More...
 
static void zwave_command_class_configuration_on_version_attribute_update (attribute_store_node_t updated_node, attribute_store_change_t change)
 Attribute callback function listening for Configuration version attribute updates. More...
 
sl_status_t zwave_command_class_configuration_init ()
 This function initialize the Configuration Command Class handler. More...
 

Variables

static const attribute_store_type_t default_attributes [] = {ATTRIBUTE(NEXT_SUPPORTED_PARAMETER_ID), ATTRIBUTE(BULK_SUPPORT)}
 
static const attribute_store_type_t configuration_parameter_attributes []
 

Macro Definition Documentation

◆ ATTRIBUTE

#define ATTRIBUTE (   type)    ATTRIBUTE_COMMAND_CLASS_CONFIGURATION_##type

◆ CONFIGURATION_ADVANCED_MASK

#define CONFIGURATION_ADVANCED_MASK   0x01

◆ CONFIGURATION_ALTERING_CAPABILITIES_MASK

#define CONFIGURATION_ALTERING_CAPABILITIES_MASK   0x80

◆ CONFIGURATION_BULK_REPORT_FIRST_VALUE_INDEX

#define CONFIGURATION_BULK_REPORT_FIRST_VALUE_INDEX   7

◆ CONFIGURATION_BULK_SET_VALUE_INDEX

#define CONFIGURATION_BULK_SET_VALUE_INDEX   6

◆ CONFIGURATION_FORMAT_MASK

#define CONFIGURATION_FORMAT_MASK   0x38

◆ CONFIGURATION_NO_BULK_SUPPORT_MASK

#define CONFIGURATION_NO_BULK_SUPPORT_MASK   0x02

◆ CONFIGURATION_PROPERTIES_REPORT_FIRST_VALUE_INDEX

#define CONFIGURATION_PROPERTIES_REPORT_FIRST_VALUE_INDEX   5

◆ CONFIGURATION_READ_ONLY_MASK

#define CONFIGURATION_READ_ONLY_MASK   0x40

◆ CONFIGURATION_REPORT_VALUE_INDEX

#define CONFIGURATION_REPORT_VALUE_INDEX   4

◆ CONFIGURATION_SET_VALUE_INDEX

#define CONFIGURATION_SET_VALUE_INDEX   4

◆ CONFIGURATION_SIZE_MASK

#define CONFIGURATION_SIZE_MASK   0x7

◆ LOG_TAG

#define LOG_TAG   "zwave_command_class_configuration"

Function Documentation

◆ create_configuration_parameter()

static attribute_store_node_t create_configuration_parameter ( attribute_store_node_t  endpoint_node,
configuration_parameter_id_t  parameter_id 
)
static

Fetch or create a configuration parameter with all its sub-attributes in the attribute store.

Parameters
endpoint_nodeAttribute store node for the Endpoint ID
parameter_idConfiguration Parameter ID to create in the Attribute Store
Returns
The created (or exisiting) attribute store node for the configuration parameter ID
Here is the caller graph for this function:

◆ get_configuration_parameter_format()

static configuration_parameter_format_t get_configuration_parameter_format ( attribute_store_node_t  parameter_id_node)
static

Get the configuration parameter format for a given parameter id.

Parameters
parameter_id_nodeAttribute Store Node for the Parameter ID.
Returns
configuration_parameter_format_t, 0 if the format is unknown (default).
Here is the caller graph for this function:

◆ get_configuration_parameter_size()

static configuration_parameter_size_t get_configuration_parameter_size ( attribute_store_node_t  parameter_id_node)
static

Get the configuration parameter size for a given parameter id.

Parameters
parameter_id_nodeAttribute Store Node for the Parameter ID.
Returns
configuration_parameter_size_t, 0 if the size is unknown.
Here is the caller graph for this function:

◆ get_configuration_parameter_value()

static configuration_parameter_value_t get_configuration_parameter_value ( attribute_store_node_t  parameter_id_node)
static

Get the configuration parameter value for a given parameter id.

Parameters
parameter_id_nodeAttribute Store Node for the Parameter ID.
Returns
configuration_parameter_value_t, 0 if the value is unknown.
Here is the caller graph for this function:

◆ get_parameter_id_node()

static attribute_store_node_t get_parameter_id_node ( zwave_node_id_t  node_id,
zwave_endpoint_id_t  endpoint_id,
configuration_parameter_id_t  parameter_id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_bulk_supported()

static bool is_bulk_supported ( attribute_store_node_t  configuration_attribute_node)
static

Checks if the node we are talking to supports Bulk Commands.

Parameters
configuration_attribute_nodeAttribute store node attribute under the Endpoint ID
Returns
true if the node supports Bulk, false otherwise or if we don't know.
Here is the caller graph for this function:

◆ is_parameter_read_only()

static bool is_parameter_read_only ( attribute_store_node_t  configuration_attribute_node)
static

Verifies if a configuration parameter is read-only.

Parameters
configuration_attribute_nodeConfiguration Parameter node, located under ATTRIBUTE(PARAMETER_ID)
Returns
true if it is read-only, false if not or if we do not know.
Here is the caller graph for this function:

◆ on_configuration_get_failure()

static void on_configuration_get_failure ( attribute_store_node_t  parameter_value_node)
static

Deletes the Configuration Parameter ID if we could not get its value for v1-v2 nodes.

Parameters
parameter_value_nodeAttribute store node for the Parameter Value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_default_reset_send_data_complete()

static void on_default_reset_send_data_complete ( attribute_store_node_t  node,
resolver_rule_type_t  rule_type,
zpc_resolver_event_t  event 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_next_supported_parameter_id_not_found()

static void on_next_supported_parameter_id_not_found ( attribute_store_node_t  node)
static

Callback function for when a Get did not succeed in finding the next parameter id. We may have more to search for, so we mark it as defined in this case to trigger a new get resolution with a new parameter id.

Parameters
nodeAttribute store node for the NEXT_SUPPORTED_PARAMETER_ID
Here is the caller graph for this function:

◆ save_parameter_value()

static void save_parameter_value ( const uint8_t *  frame,
attribute_store_node_t  parameter_id_node,
attribute_store_type_t  value_type 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_all_parameters_to_their_default_value()

static void set_all_parameters_to_their_default_value ( attribute_store_node_t  node)
static

Set the all Configuration parameters to their default value.

Parameters
nodeAttribute store node under the Endpoint for which all parameters have to be set to default.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_default_parameter_properties()

static sl_status_t set_default_parameter_properties ( attribute_store_node_t  parameter_id_node)
static

Sets the default parameters properties for a parameter in case a node does not support Properties Get Commands.

Parameters
parameter_id_nodeAttribute Store Node for the Parameter ID.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_parameter_value_in_buffer()

static void set_parameter_value_in_buffer ( uint8_t *  frame,
configuration_parameter_value_t  value,
configuration_parameter_size_t  size,
configuration_parameter_format_t  format 
)
static

Set the parameter value value in the frame buffer based on the parameter size, MSB first.

Parameters
frame"Slice" of the received frame starting where the value is to be written
valueConfiguration parameter value to write in the frame
sizeConfiguration parameter size
formatConfiguration parameter format
Here is the caller graph for this function:

◆ undefine_all_parameter_values()

static void undefine_all_parameter_values ( attribute_store_node_t  node)
static

Undefine the all Configuration parameters values, so they get resolved again.

Parameters
nodeAttribute store node under the Endpoint for which all parameters have to be undefined.
Here is the caller graph for this function:

◆ zwave_command_class_configuration_control_handler()

static sl_status_t zwave_command_class_configuration_control_handler ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Dispatches incoming Configuration Commands to individual command handlers.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_default_reset()

static sl_status_t zwave_command_class_configuration_default_reset ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Default Reset.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a ATTRIBUTE(DEFAULT_RESET_REQUESTED) type
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_get()

static sl_status_t zwave_command_class_configuration_get ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Get or Bulk Get Command to find out the value of a parameter.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a PARAMETER_VALUE under PARAMETER_ID
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_get_next_parameter()

static sl_status_t zwave_command_class_configuration_get_next_parameter ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Properties Get or Configuration Get Command to find out if a parameter ID is supported.

Parameters
nodeAttribute Store node that the resolver tries to resolve.
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_handle_bulk_report_command()

static sl_status_t zwave_command_class_configuration_handle_bulk_report_command ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Handle incoming Configuration Bulk Report Commands.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_handle_info_report_command()

static sl_status_t zwave_command_class_configuration_handle_info_report_command ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Handle incoming Configuration Info Report Commands.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_handle_name_report_command()

static sl_status_t zwave_command_class_configuration_handle_name_report_command ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Handle incoming Configuration Name Report Commands.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_handle_properties_report_command()

static sl_status_t zwave_command_class_configuration_handle_properties_report_command ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Handle incoming Configuration Properties Report Commands.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_handle_report_command()

static sl_status_t zwave_command_class_configuration_handle_report_command ( const zwave_controller_connection_info_t info,
const uint8_t *  frame,
uint16_t  frame_length 
)
static

Handle incoming Configuration Report Commands.

Parameters
infozwave_controller_connection_info_t object.
framePointer to frame data
frame_lengthNumber of bytes contained in the frame
Returns
sl_status_t following the frame handling return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_info_get()

static sl_status_t zwave_command_class_configuration_info_get ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Info Get or fills up data automatically if the command is not supported.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a ATTRIBUTE(PARAMETER_INFO) type
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_name_get()

static sl_status_t zwave_command_class_configuration_name_get ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Name Get or fills up data automatically if the command is not supported.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a ATTRIBUTE(PARAMETER_NAME) type
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_on_configuration_parameter_created()

static void zwave_command_class_configuration_on_configuration_parameter_created ( attribute_store_node_t  parameter_id_node,
attribute_store_change_t  change 
)
static

Attribute callback function listening for Configuration Paramter ID creations and creating all the sub-attributes.

Parameters
parameter_id_nodeAttribute Store node that was modified.
changeType of change applied to the node.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_on_version_attribute_update()

static void zwave_command_class_configuration_on_version_attribute_update ( attribute_store_node_t  updated_node,
attribute_store_change_t  change 
)
static

Attribute callback function listening for Configuration version attribute updates.

Parameters
updated_nodeAttribute Store node that was modified.
changeType of change applied to the node.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_properties_get()

static sl_status_t zwave_command_class_configuration_properties_get ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Properties Get or fills up data automatically if the command is not supported.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a ATTRIBUTE(PARAMETER_MIN_VALUE) type
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_configuration_set()

static sl_status_t zwave_command_class_configuration_set ( attribute_store_node_t  node,
uint8_t *  frame,
uint16_t *  frame_length 
)
static

Generates a Configuration Set or Bulk Set Command to set the value of a parameter.

Parameters
nodeAttribute Store node that the resolver tries to resolve. Expects a PARAMETER_VALUE under PARAMETER_ID
framePointer at which frame data can be written.
frame_lengthPointer at which the frame data length can be written.
Returns
sl_status_t following the attribute_resolver_function_t return codes.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ configuration_parameter_attributes

const attribute_store_type_t configuration_parameter_attributes[]
static
Initial value:
= {ATTRIBUTE(PARAMETER_SIZE),
ATTRIBUTE(PARAMETER_FORMAT),
ATTRIBUTE(PARAMETER_NAME),
ATTRIBUTE(PARAMETER_INFO),
ATTRIBUTE(PARAMETER_VALUE),
ATTRIBUTE(PARAMETER_MIN_VALUE),
ATTRIBUTE(PARAMETER_MAX_VALUE),
ATTRIBUTE(PARAMETER_DEFAULT_VALUE),
ATTRIBUTE(PARAMETER_ADVANCED),
ATTRIBUTE(PARAMETER_READ_ONLY),
ATTRIBUTE(PARAMETER_ALTERING_CAPABILITIES)}
#define ATTRIBUTE(type)
Definition: zwave_command_class_configuration_control.c:41

◆ default_attributes

const attribute_store_type_t default_attributes[] = {ATTRIBUTE(NEXT_SUPPORTED_PARAMETER_ID), ATTRIBUTE(BULK_SUPPORT)}
static