Support of ZCL enhancements

The following ZCL enhancements are supported:
OnOff cluster, attribute 0x4003 (StartupOnOff)
Level cluster, attribute 0x4000 (StartupCurrentLevel)
Color cluster, attribute 0x4010 (StartUp-ColorTemperature-Mireds)

Change-Id: I19665c8c921522e742c282b073231d1151aabe4e
Reviewed-on: https://code.wireshark.org/review/29331
Reviewed-by: Kenneth Soerensen <knnthsrnsn@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Paul Zander 2018-08-29 07:33:46 +02:00 committed by Anders Broman
parent 81392814ef
commit d1749f7c02
2 changed files with 79 additions and 1 deletions

View File

@ -3208,6 +3208,7 @@ proto_reg_handoff_zbee_zcl_scenes(void)
#define ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL 0x4000
#define ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME 0x4001
#define ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME 0x4002
#define ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF 0x4003
/* Server Commands Received */
#define ZBEE_ZCL_ON_OFF_CMD_OFF 0x00 /* Off */
@ -3245,6 +3246,7 @@ static int hf_zbee_zcl_on_off_attr_onoff = -1;
static int hf_zbee_zcl_on_off_attr_globalscenecontrol = -1;
static int hf_zbee_zcl_on_off_attr_ontime = -1;
static int hf_zbee_zcl_on_off_attr_offwaittime = -1;
static int hf_zbee_zcl_on_off_attr_startuponoff = -1;
static int hf_zbee_zcl_on_off_srv_rx_cmd_id = -1;
static int hf_zbee_zcl_on_off_effect_identifier = -1;
@ -3266,6 +3268,7 @@ static const value_string zbee_zcl_on_off_attr_names[] = {
{ ZBEE_ZCL_ON_OFF_ATTR_ID_GLOBALSCENECONTROL, "GlobalSceneControl" },
{ ZBEE_ZCL_ON_OFF_ATTR_ID_ONTIME, "OnTime" },
{ ZBEE_ZCL_ON_OFF_ATTR_ID_OFFWAITTIME, "OffWaitTime" },
{ ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF, "StartUpOnOff" },
{ 0, NULL }
};
@ -3320,6 +3323,15 @@ static const range_string zbee_zcl_on_off_effect_variant_reserved_names[] = {
{ 0, 0, NULL }
};
static const range_string zbee_zcl_on_off_startup_on_off_names[] = {
{ 0x00, 0x00, "Set the OnOff attribute to Off" },
{ 0x01, 0x01, "Set the OnOff attribute to On" },
{ 0x02, 0x02, "Toggle the OnOff attribute" },
{ 0x03, 0xFE, "Reserved" },
{ 0xFF, 0xFF, "Set the OnOff attribute to its previous value" },
{ 0, 0, NULL }
};
/*************************/
/* Function Bodies */
/*************************/
@ -3452,6 +3464,11 @@ dissect_zcl_on_off_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, gui
*offset += 2;
break;
case ZBEE_ZCL_ON_OFF_ATTR_ID_STARTUPONOFF:
proto_tree_add_item(tree, hf_zbee_zcl_on_off_attr_startuponoff, tvb, *offset, 1, ENC_NA);
*offset += 1;
break;
default:
dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
break;
@ -3496,6 +3513,10 @@ proto_register_zbee_zcl_on_off(void)
{ "Off Wait Time", "zbee_zcl_general.onoff.attr.offwaittime", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_zcl_time_in_100ms),
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_on_off_attr_startuponoff,
{ "Startup On Off", "zbee_zcl_general.onoff.attr.startuponoff", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_startup_on_off_names),
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_on_off_effect_identifier,
{ "Effect Identifier", "zbee_zcl_general.onoff.effect_identifier", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_on_off_effect_identifier_names),
0x00, NULL, HFILL } },
@ -4374,6 +4395,7 @@ proto_reg_handoff_zbee_zcl_time(void)
#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME 0x0001 /* Remaining Time */
#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME 0x0010 /* OnOff Transition Time */
#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL 0x0011 /* On Level */
#define ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL 0x4000 /* Startup Level */
/* Server Commands Received */
#define ZBEE_ZCL_CMD_ID_LEVEL_CONTROL_MOVE_TO_LEVEL 0x00 /* Move to Level */
@ -4405,6 +4427,7 @@ static int hf_zbee_zcl_level_control_attr_current_level = -1;
static int hf_zbee_zcl_level_control_attr_remaining_time = -1;
static int hf_zbee_zcl_level_control_attr_onoff_transmit_time = -1;
static int hf_zbee_zcl_level_control_attr_on_level = -1;
static int hf_zbee_zcl_level_control_attr_startup_level = -1;
static int hf_zbee_zcl_level_control_level = -1;
static int hf_zbee_zcl_level_control_move_mode = -1;
static int hf_zbee_zcl_level_control_rate = -1;
@ -4422,6 +4445,7 @@ static const value_string zbee_zcl_level_control_attr_names[] = {
{ ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_REMAINING_TIME, "Remaining Time" },
{ ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ONOFF_TRANSIT_TIME, "OnOff Transition Time" },
{ ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_ON_LEVEL, "On Level" },
{ ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL, "Startup Level" },
{ 0, NULL }
};
@ -4445,6 +4469,13 @@ static const value_string zbee_zcl_level_control_move_step_mode_values[] = {
{ 0, NULL }
};
static const range_string zbee_zcl_level_control_startup_level_names[] = {
{ 0x00, 0x00, "Set the CurrentLevel attribute to the minimum" },
{ 0x01, 0xFE, "Set the CurrentLevel attribute to this value" },
{ 0xFF, 0xFF, "Set the CurrentLevel attribute to its previous value" },
{ 0, 0, NULL }
};
/*************************/
/* Function Bodies */
/*************************/
@ -4650,6 +4681,11 @@ dissect_zcl_level_control_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offs
*offset += 1;
break;
case ZBEE_ZCL_ATTR_ID_LEVEL_CONTROL_STARTUP_LEVEL:
proto_tree_add_item(tree, hf_zbee_zcl_level_control_attr_startup_level, tvb, *offset, 1, ENC_NA);
*offset += 1;
break;
default:
dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
break;
@ -4695,6 +4731,10 @@ proto_register_zbee_zcl_level_control(void)
{ "On Level", "zbee_zcl_general.level_control.attr.on_level", FT_UINT8, BASE_DEC, NULL,
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_level_control_attr_startup_level,
{ "Startup Level", "zbee_zcl_general.level_control.attr.startup_level", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, RVALS(zbee_zcl_level_control_startup_level_names),
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_level_control_level,
{ "Level", "zbee_zcl_general.level_control.level", FT_UINT8, BASE_DEC, NULL,
0x00, NULL, HFILL } },

View File

@ -90,6 +90,7 @@
#define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_CAPABILITIES 0x400a /* Color Capabilities */
#define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MIN 0x400b /* Color Temperature Physical Min */
#define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MAX 0x400c /* Color Temperature Physical Max */
#define ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE 0x4010 /* Startup Color Temperature */
/* Server Commands Received */
#define ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE 0x00 /* Move to Hue */
@ -202,6 +203,7 @@ static int hf_zbee_zcl_color_control_attr_color_capabilities_xy = -1;
static int hf_zbee_zcl_color_control_attr_color_capabilities_ct = -1;
static int hf_zbee_zcl_color_control_attr_color_temperature_phys_min = -1;
static int hf_zbee_zcl_color_control_attr_color_temperature_phys_max = -1;
static int hf_zbee_zcl_color_control_attr_startup_color_temperature = -1;
static int hf_zbee_zcl_color_control_hue = -1;
static int hf_zbee_zcl_color_control_direction = -1;
static int hf_zbee_zcl_color_control_transit_time = -1;
@ -290,6 +292,7 @@ static const value_string zbee_zcl_color_control_attr_names[] = {
{ ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_CAPABILITIES, "Color Capabilities" },
{ ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MIN, "Color Temperature Physical Min" },
{ ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COLOR_TEMPERATURE_PHYS_MAX, "Color Temperature Physical Max" },
{ ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE, "Startup Color Temperature" },
{ 0, NULL }
};
@ -878,7 +881,33 @@ decode_color_temperature(gchar *s, guint16 value)
{
g_snprintf(s, ITEM_LABEL_LENGTH, "%d [Mired] (%d [K])", value, 1000000/value);
return;
} /*decode_power_conf_voltage*/
} /*decode_color_temperature*/
/*FUNCTION:------------------------------------------------------
* NAME
* decode_startup_color_temperature
* DESCRIPTION
* this function decodes color temperature values
* PARAMETERS
* guint *s - string to display
* guint16 value - value to decode
* RETURNS
* none
*---------------------------------------------------------------
*/
static void
decode_startup_color_temperature(gchar *s, guint16 value)
{
if (value == 0xffff)
{
g_snprintf(s, ITEM_LABEL_LENGTH, "Set the Color Temperature attribute to its previous value");
}
else
{
decode_color_temperature(s, value);
}
return;
} /*decode_startup_color_temperature*/
/**
*This function is called by ZCL foundation dissector in order to decode
@ -1145,6 +1174,11 @@ dissect_zcl_color_control_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offs
*offset += 2;
break;
case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_STARTUP_COLOR_TEMPERATURE:
proto_tree_add_item(tree, hf_zbee_zcl_color_control_attr_startup_color_temperature, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
*offset += 2;
break;
case ZBEE_ZCL_ATTR_ID_COLOR_CONTROL_COMPENSATION_TEXT:
default:
dissect_zcl_attr_data(tvb, tree, offset, data_type, client_attr);
@ -1380,6 +1414,10 @@ proto_register_zbee_zcl_color_control(void)
{ "Color Temperature", "zbee_zcl_lighting.color_control.attr.color_temperature_physical_max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_color_temperature),
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_color_control_attr_startup_color_temperature,
{ "Startup Color Temparature", "zbee_zcl_lighting.color_control.attr.startup_color_temperature", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_startup_color_temperature),
0x00, NULL, HFILL } },
{ &hf_zbee_zcl_color_control_hue,
{ "Hue", "zbee_zcl_lighting.color_control.hue", FT_UINT8, BASE_DEC, NULL,
0x00, NULL, HFILL } },