|
Z-Wave Protocol Controller Reference
|
#include "zwave_command_class_indicator.h"#include "ZW_classcmd.h"#include "zwave_command_handler.h"#include "platform_exec.h"#include "zwave_unid.h"#include "zwave_command_class_indices.h"#include "zwave_command_classes_utils.h"#include "zwave_controller_connection_info.h"#include "zwave_tx.h"#include "script_defines.h"#include "ctimer.h"#include "dotdot_mqtt_generated_commands.h"#include "sl_log.h"Macros | |
| #define | LOG_TAG "zwave_command_class_indicator" |
Functions | |
| static void | call_external_blinker (unsigned int on_time_ms, unsigned int off_time_ms, unsigned int num_cycles) |
| static void | indicator_sequence_timout_callback (void *ptr) |
| static void | update_indicator (void) |
| static void | publish_generated_identify_command (const zwave_controller_connection_info_t *info) |
| Publishes that a node has sent us (generated) an identify command. More... | |
| static void | set_indicator_value0 (uint8_t value) |
| static uint8_t | get_indicator_value0 (void) |
| static sl_status_t | zwave_command_class_indicator_handle_set (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data) |
| static bool | zwave_command_class_indicator_get_object_count (int *obj_count, uint8_t cmd_properties, uint16_t frame_length) |
| static bool | zwave_command_class_indicator_get_indicator_values (int obj_count, const VG_INDICATOR_SET_V3_VG *vg_array, uint8_t *on_off_period_length, uint8_t *on_off_num_cycles, uint8_t *on_time) |
| static sl_status_t | zwave_command_class_indicator_handle_setV3 (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length) |
| static sl_status_t | zwave_command_class_indicator_handle_get (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length) |
| static sl_status_t | zwave_command_class_indicator_handle_getV3 (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length) |
| static sl_status_t | zwave_command_class_indicator_handle_supported_getV3 (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length) |
| sl_status_t | zwave_command_class_indicator_support_handler (const zwave_controller_connection_info_t *connection_info, const uint8_t *frame_data, uint16_t frame_length) |
| Handles incoming indicator encapsulated commands. More... | |
| sl_status_t | zwave_command_class_indicator_init () |
| setup for indicator command class More... | |
Variables | |
| static uint8_t | g_on_off_period_length = 0 |
| static uint8_t | g_on_off_num_cycles = 0 |
| static uint8_t | g_on_time = 0 |
| static char * | g_node_identify_script = IDENTIFY_SCRIPT_PATH |
| static struct ctimer | g_indicator_timer |
| #define LOG_TAG "zwave_command_class_indicator" |
|
static |
Call external script/application to control the indicator LED.
| on_time_ms | ON duration (in milliseconds) for a single blink cycle. If on_time_ms is zero the indicator should be turned off. |
| off_time_ms | OFF duration (in milliseconds) for a single blink cycle. |
| num_cycles | Number of blink cycles. If num_cycles is zero the indicator LED should blink "forever" or until the next time this function is called. |
|
static |
Maps the three version 3 indicator properties stored in the global variables g_on_off_period_length, g_on_off_num_cycles and g_on_time to a single indicator value.
|
static |
Called on timeout of the timer controlling the length of the full blink sequence.
Will reset all Node Identify properties to default values such that the INDICATOR_GET command will reflect that the indicator is no longer active.
Please note: The timer is a "best effort" approximation to reflect the status of the externally controlled LED. Since the external blinker is running free after it has been started we do not know exactly if it has blinked the requested number of times when this timeout occurs since the external blink timers could have drifted a bit.
We do not try to stop the LED from here - it's controlled by an external script that we expect to terminate at the "right" time. We only reset the internal state variables to reflect the the LED is expected to no longer be active.
The timer is not started if the client has requested an unlimited number of blink cycles (g_on_off_num_cycles == 0xFF). In that case there will be no timeout.
|
static |
Publishes that a node has sent us (generated) an identify command.
| info | Connection info object |
|
static |
Maps a single indicator value to the three version 3 indicator properties stored in the global variables g_on_off_period_length, g_on_off_num_cycles and g_on_time.
Used for backward compatibility with the version 1 command class. The single indicator value is either the version 1 indicator value or the version 3 Indicator0 value.
| value | The value of the indicator. We're assuming Indicator0 to be a binary indicator (a more advanced extension could be to map to a multilevel indicator where the value controls e.g. the blink frequency). value is interpreted like this:
|
|
static |
Calls call_external_blinker after calculating the parameters to pass.
Uses the global variables g_on_off_period_length, g_on_off_num_cycles and g_on_time (set by Indicator Command Class commands) to calculate the values to pass to call_external_blinker. In addition it updates the g_indicator_timer timer.
Should be called whenever a SET command is received.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |