Z-Wave Protocol Controller Reference
Command Classes utils

Utils for Command Classes handlers. More...

Collaboration diagram for Command Classes utils:

Classes

struct  zwave_minimum_frame
 

‍Minimal Z-Wave Frame that can be sent (Command Class / Command).

More...
 

Macros

#define FAHRENHEIT_TO_DEGREES(value)   ((value - 32.0) * 5 / 9);
 
#define DEGREES_TO_FAHRENHEIT(value)   (value * 9 / 5.0) + 32;
 
#define PROBE_BACK_OFF   500
 

Typedefs

typedef struct zwave_minimum_frame zwave_minimum_frame_t
 

‍Minimal Z-Wave Frame that can be sent (Command Class / Command).

More...
 

Functions

attribute_store_node_t zwave_command_class_get_endpoint_node (const zwave_controller_connection_info_t *connection_info)
 Find the Z-Wave Endpoint ID Node attribute based on a const zwave_controller_connection_info_t object. More...
 
attribute_store_node_t zwave_command_class_get_node_id_node (const zwave_controller_connection_info_t *connection_info)
 Find the Z-Wave NodeID Node attribute based on a const zwave_controller_connection_info_t object. More...
 
zwave_cc_version_t zwave_command_class_get_version_from_node (attribute_store_node_t node, zwave_command_class_t command_class)
 Find the version of the command class by navigating up to the endpoint from a given attribute store node. More...
 
bool has_reports_to_follow (attribute_store_node_t node)
 Verifies if a node has some Reports to Follow. More...
 
reports_to_follow_t get_reports_to_follow (attribute_store_node_t node)
 Gets the number of Reports to Follow for a node. More...
 
sl_status_t set_reports_to_follow (attribute_store_node_t node, reports_to_follow_t reports_to_follow)
 Places a ATTRIBUTE_REPORTS_TO_FOLLOW attribute under an attribute if it does not exist and set it to the requested reports_to_follow value. More...
 
void set_command_status_value (attribute_store_node_t command_status_node, command_status_values_t reported, command_status_values_t desired)
 Set the desired and reported value of a command_status_t type of node. More...
 
sl_status_t zwave_command_class_send_report (const zwave_controller_connection_info_t *connection_info, const uint16_t report_size, const uint8_t *const report_data)
 function to send report frames with default tx options. More...
 
bool is_zwave_command_class_filtered_for_root_device (zwave_command_class_t command_class, attribute_store_node_t updated_node)
 function helper function to help Command Classes decide if they should create the supporting node attributes on Command Class version attribute update. More...
 
bool is_using_zpc_highest_security_class (const zwave_controller_connection_info_t *connection)
 function helper function that determines if a transmission was done using the ZPC's highest security class More...
 
int32_t command_class_get_int32_value (uint8_t size, uint8_t precision, const uint8_t *value)
 Parse a value and pack it into a uint32. More...
 
int32_t get_signed_value_from_frame_and_size (const uint8_t *frame, uint8_t size)
 Extracts a 1,2 or 4 bytes signed value from a frame. More...
 
uint32_t get_unsigned_value_from_frame_and_size (const uint8_t *frame, uint8_t size)
 Extracts a 1,2 or 4 bytes unsigned value from a frame. More...
 
int16_t zwave_temperature_to_ucl_temperature (int32_t zwave_value, uint8_t zwave_precision, uint8_t zwave_scale)
 Convert a value from the Z-Wave world (precision = [0..7] and C° + F) into a UCL (Zigbee) world (precision = 2 and C°) More...
 
int32_t ucl_temperature_to_zwave_temperature (int16_t ucl_value, uint8_t zwave_precision, uint8_t zwave_scale)
 Convert a value from the UCL world (Zigbee) (precision = 2 and C°) to the ZWave world (precision = [0..7] and C° + F) More...
 
uint8_t time_to_zwave_duration (clock_time_t time)
 Converts a clock_time_t duration to a Z-Wave Command Class duration byte. More...
 
clock_time_t zwave_duration_to_time (uint8_t zwave_duration)
 Converts a duration byte encoded for a Z-Wave command class and returns its corresponding value in clock_time_t. More...
 
bool is_actuator_command_class (zwave_command_class_t command_class)
 Verifies if a Command Class is an actuator Command Class. More...
 
zwave_role_type_t get_zwave_node_role_type (zwave_node_id_t node_id)
 Provides the Role Type of a node. More...
 
bool is_portable_end_node (attribute_store_node_t node)
 Verifies if a Node is a Portable End Node. (PS / PEN Role type) More...
 

Detailed Description

Utils for Command Classes handlers.

This module provides some utilities helping with functionalities relating to command classes

Macro Definition Documentation

◆ DEGREES_TO_FAHRENHEIT

#define DEGREES_TO_FAHRENHEIT (   value)    (value * 9 / 5.0) + 32;

◆ FAHRENHEIT_TO_DEGREES

#define FAHRENHEIT_TO_DEGREES (   value)    ((value - 32.0) * 5 / 9);

◆ PROBE_BACK_OFF

#define PROBE_BACK_OFF   500

Additional delay in ms to wait before issuing a Get Command after a node has finished a transition.

Typedef Documentation

◆ zwave_minimum_frame_t

‍Minimal Z-Wave Frame that can be sent (Command Class / Command).

Function Documentation

◆ command_class_get_int32_value()

int32_t command_class_get_int32_value ( uint8_t  size,
uint8_t  precision,
const uint8_t *  value 
)

Parse a value and pack it into a uint32.

Parameters
size
precision
value
Returns
value * 1000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_reports_to_follow()

reports_to_follow_t get_reports_to_follow ( attribute_store_node_t  node)

Gets the number of Reports to Follow for a node.

Parameters
nodeAttribute Store node under which we want to check if there are some reports to follow.
Returns
A value if there is at least 1 report to follow. 0 otherwise
Here is the caller graph for this function:

◆ get_signed_value_from_frame_and_size()

int32_t get_signed_value_from_frame_and_size ( const uint8_t *  frame,
uint8_t  size 
)

Extracts a 1,2 or 4 bytes signed value from a frame.

Parameters
[in]framePointer to the frame data where the value is stored
[in]sizeSize of the value (1, 2 or 4 bytes)
Returns
Parsed value at the frame pointer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_unsigned_value_from_frame_and_size()

uint32_t get_unsigned_value_from_frame_and_size ( const uint8_t *  frame,
uint8_t  size 
)

Extracts a 1,2 or 4 bytes unsigned value from a frame.

Parameters
[in]framePointer to the frame data where the value is stored
[in]sizeSize of the value (1, 2 or 4 bytes)
Returns
Parsed value at the frame pointer.
Here is the caller graph for this function:

◆ get_zwave_node_role_type()

zwave_role_type_t get_zwave_node_role_type ( zwave_node_id_t  node_id)

Provides the Role Type of a node.

Parameters
node_idThe node ID which Role Type is requested for
Returns
the Role Type of a node
Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_reports_to_follow()

bool has_reports_to_follow ( attribute_store_node_t  node)

Verifies if a node has some Reports to Follow.

Parameters
nodeAttribute Store node under which we want to check if there are some reports to follow.
Returns
true if there is at least 1 report to follow. False otherwise

◆ is_actuator_command_class()

bool is_actuator_command_class ( zwave_command_class_t  command_class)

Verifies if a Command Class is an actuator Command Class.

Parameters
command_classThe Command Class to verify
Returns
true if the Command Class is an actuator Command Class, false otherwise
Here is the caller graph for this function:

◆ is_portable_end_node()

bool is_portable_end_node ( attribute_store_node_t  node)

Verifies if a Node is a Portable End Node. (PS / PEN Role type)

Parameters
nodeAny attribute store node under the NodeID node
Returns
true if the Role type of the node is ROLE_TYPE_END_NODE_PORTABLE, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_using_zpc_highest_security_class()

bool is_using_zpc_highest_security_class ( const zwave_controller_connection_info_t connection)

function helper function that determines if a transmission was done using the ZPC's highest security class

Parameters
connectionPointer to Controller connection info to check against.
Returns
true if the using our highest security class, false otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_zwave_command_class_filtered_for_root_device()

bool is_zwave_command_class_filtered_for_root_device ( zwave_command_class_t  command_class,
attribute_store_node_t  updated_node 
)

function helper function to help Command Classes decide if they should create the supporting node attributes on Command Class version attribute update.

Parameters
command_classThe Command Class that is to be verified
updated_nodeAttribute Store node that was updated. (it can be anything under an endpoint.)
Returns
true if the handler must not create attributes and filter the command class. false if the handler must go ahead and create its attributes.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_command_status_value()

void set_command_status_value ( attribute_store_node_t  command_status_node,
command_status_values_t  reported,
command_status_values_t  desired 
)

Set the desired and reported value of a command_status_t type of node.

Parameters
command_status_nodeAttribute Store node to set
reportedReported value to set.
desiredDesired value to set.
Here is the caller graph for this function:

◆ set_reports_to_follow()

sl_status_t set_reports_to_follow ( attribute_store_node_t  node,
reports_to_follow_t  reports_to_follow 
)

Places a ATTRIBUTE_REPORTS_TO_FOLLOW attribute under an attribute if it does not exist and set it to the requested reports_to_follow value.

Parameters
nodeAttribute Store node under which to set a reports to follow value.
reports_to_followThe value to set in the ATTRIBUTE_REPORTS_TO_FOLLOW attribute
Returns
sl_status_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_to_zwave_duration()

uint8_t time_to_zwave_duration ( clock_time_t  time)

Converts a clock_time_t duration to a Z-Wave Command Class duration byte.

Refer to "Duration encoding" in the Application Command Class specifications note that value 0xFE is interpreted as unknown here.

Parameters
timeThe system time duration
Returns
uint8_t The corresponding Z-Wave duration encoding.
Here is the caller graph for this function:

◆ ucl_temperature_to_zwave_temperature()

int32_t ucl_temperature_to_zwave_temperature ( int16_t  ucl_value,
uint8_t  zwave_precision,
uint8_t  zwave_scale 
)

Convert a value from the UCL world (Zigbee) (precision = 2 and C°) to the ZWave world (precision = [0..7] and C° + F)

Parameters
ucl_valueCurrent UCL value
zwave_precisionExpected Z-Wave precision
zwave_scaleExpected Z-Wave scale (0 : C°, 1 : F)
Returns
int32_t Z-Wave temperature with given precision and scale.

◆ zwave_command_class_get_endpoint_node()

attribute_store_node_t zwave_command_class_get_endpoint_node ( const zwave_controller_connection_info_t connection_info)

Find the Z-Wave Endpoint ID Node attribute based on a const zwave_controller_connection_info_t object.

Parameters
connection_info
Returns
attribute_store_node_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_get_node_id_node()

attribute_store_node_t zwave_command_class_get_node_id_node ( const zwave_controller_connection_info_t connection_info)

Find the Z-Wave NodeID Node attribute based on a const zwave_controller_connection_info_t object.

Parameters
connection_info
Returns
attribute_store_node_t
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_command_class_get_version_from_node()

zwave_cc_version_t zwave_command_class_get_version_from_node ( attribute_store_node_t  node,
zwave_command_class_t  command_class 
)

Find the version of the command class by navigating up to the endpoint from a given attribute store node.

Parameters
nodeAttribute Store node under the endpoint
command_classCommand class for which we want the version
Returns
zwave_cc_version_t
Here is the caller graph for this function:

◆ zwave_command_class_send_report()

sl_status_t zwave_command_class_send_report ( const zwave_controller_connection_info_t connection_info,
const uint16_t  report_size,
const uint8_t *const  report_data 
)

function to send report frames with default tx options.

Parameters
connection_infoInfo about the connection properties of this frame.
report_sizeThe length of this frame.
report_dataThe data payload of the report frame.
Returns
sl_status_t representing the outcome of sending the report frame.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zwave_duration_to_time()

clock_time_t zwave_duration_to_time ( uint8_t  zwave_duration)

Converts a duration byte encoded for a Z-Wave command class and returns its corresponding value in clock_time_t.

Refer to "Duration encoding" in the Application Command Class specifications note that value 0xFE is interpreted as unknown here.

Parameters
zwave_durationThe value used in the Set / Report.
Returns
clock_time_t The corresponding system duration.
Here is the caller graph for this function:

◆ zwave_temperature_to_ucl_temperature()

int16_t zwave_temperature_to_ucl_temperature ( int32_t  zwave_value,
uint8_t  zwave_precision,
uint8_t  zwave_scale 
)

Convert a value from the Z-Wave world (precision = [0..7] and C° + F) into a UCL (Zigbee) world (precision = 2 and C°)

Parameters
zwave_valueCurrent Z-Wave value
zwave_precisionReported Z-Wave precision
zwave_scaleReported Z-Wave scale (0 : C°, 1 : F)
Returns
int16_t UCL temperature. Rounded down if Z-Wave precision is too high.