forked from osmocom/wireshark
Adding Flow Measurement and Occupancy Sensing Clusters for Zigbee
Change-Id: I5b43c02a75ae2ade1d389d01f352b1500417779d Reviewed-on: https://code.wireshark.org/review/12696 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
714c59777a
commit
5667cf9c92
|
@ -1292,6 +1292,266 @@ proto_reg_handoff_zbee_zcl_press_meas(void)
|
|||
);
|
||||
} /*proto_reg_handoff_zbee_zcl_press_meas*/
|
||||
|
||||
/* ########################################################################## */
|
||||
/* #### (0x0404) FLOW MEASUREMENT CLUSTER ################################### */
|
||||
/* ########################################################################## */
|
||||
|
||||
/*************************/
|
||||
/* Defines */
|
||||
/*************************/
|
||||
|
||||
#define ZBEE_ZCL_FLOW_MEAS_NUM_GENERIC_ETT 1
|
||||
#define ZBEE_ZCL_FLOW_MEAS_NUM_ETT ZBEE_ZCL_FLOW_MEAS_NUM_GENERIC_ETT
|
||||
|
||||
/* Attributes */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MEASURED_VALUE 0x0000 /* Measured Value */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_MEASURED_VALUE 0x0001 /* Min Measured Value */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_MEASURED_VALUE 0x0002 /* Max Measured Value */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOLERANCE 0x0003 /* Tolerance */
|
||||
|
||||
/* Server Commands Received - None */
|
||||
|
||||
/* Server Commands Generated - None */
|
||||
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOO_LOW_VALUE 0x0000 /* Too Low Value */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_INVALID_VALUE 0xffff /* Invalid Value */
|
||||
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_LO_VALUE 0x0000 /* Minimum Value (Low Bound) */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_HI_VALUE 0xfffd /* Minimum Value (High Bound) */
|
||||
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_LO_VALUE 0x0001 /* Maximum Value (Low Bound) */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_HI_VALUE 0xfffe /* Maximum Value (High Bound) */
|
||||
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOL_LO_VALUE 0x0000 /* Tolerance (Low Bound) */
|
||||
#define ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOL_HI_VALUE 0x0800 /* Tolerance (Low Bound) */
|
||||
|
||||
/*************************/
|
||||
/* Function Declarations */
|
||||
/*************************/
|
||||
|
||||
void proto_register_zbee_zcl_flow_meas(void);
|
||||
void proto_reg_handoff_zbee_zcl_flow_meas(void);
|
||||
|
||||
/* Command Dissector Helpers */
|
||||
static void dissect_zcl_flow_meas_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
|
||||
|
||||
/* Private functions prototype */
|
||||
static void decode_flow_meas_value (gchar *s, guint16 value);
|
||||
static void decode_flow_meas_min_value (gchar *s, guint16 value);
|
||||
static void decode_flow_meas_max_value (gchar *s, guint16 value);
|
||||
static void decode_flow_meas_tolerance (gchar *s, guint16 value);
|
||||
|
||||
/*************************/
|
||||
/* Global Variables */
|
||||
/*************************/
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
static int proto_zbee_zcl_flow_meas = -1;
|
||||
|
||||
static int hf_zbee_zcl_flow_meas_attr_id = -1;
|
||||
static int hf_zbee_zcl_flow_meas_measured_value = -1;
|
||||
static int hf_zbee_zcl_flow_meas_min_measured_value = -1;
|
||||
static int hf_zbee_zcl_flow_meas_max_measured_value = -1;
|
||||
static int hf_zbee_zcl_flow_meas_tolerance = -1;
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_zbee_zcl_flow_meas = -1;
|
||||
|
||||
/* Attributes */
|
||||
static const value_string zbee_zcl_flow_meas_attr_names[] = {
|
||||
{ ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MEASURED_VALUE, "Measured Value" },
|
||||
{ ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_MEASURED_VALUE, "Min Measured Value" },
|
||||
{ ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_MEASURED_VALUE, "Max Measured Value" },
|
||||
{ ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOLERANCE, "Tolerance" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*************************/
|
||||
/* Function Bodies */
|
||||
/*************************/
|
||||
|
||||
/**
|
||||
*ZigBee ZCL Flow Measurement cluster dissector for wireshark.
|
||||
*
|
||||
*@param tvb pointer to buffer containing raw packet.
|
||||
*@param pinfo pointer to packet information fields
|
||||
*@param tree pointer to data tree Wireshark uses to display packet.
|
||||
*/
|
||||
static int
|
||||
dissect_zbee_zcl_flow_meas(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
|
||||
{
|
||||
return tvb_captured_length(tvb);
|
||||
} /*dissect_zbee_zcl_flow_meas*/
|
||||
|
||||
/**
|
||||
*This function is called by ZCL foundation dissector in order to decode
|
||||
*
|
||||
*@param tree pointer to data tree Wireshark uses to display packet.
|
||||
*@param tvb pointer to buffer containing raw packet.
|
||||
*@param offset pointer to buffer offset
|
||||
*@param attr_id attribute identifier
|
||||
*@param data_type attribute data type
|
||||
*/
|
||||
static void
|
||||
dissect_zcl_flow_meas_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
|
||||
{
|
||||
/* Dissect attribute data type and data */
|
||||
switch ( attr_id ) {
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MEASURED_VALUE:
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_flow_meas_measured_value, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
|
||||
*offset += 2;
|
||||
break;
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_MEASURED_VALUE:
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_flow_meas_min_measured_value, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
|
||||
*offset += 2;
|
||||
break;
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_MEASURED_VALUE:
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_flow_meas_max_measured_value, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
|
||||
*offset += 2;
|
||||
break;
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOLERANCE:
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_flow_meas_tolerance, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
|
||||
*offset += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
dissect_zcl_attr_data(tvb, tree, offset, data_type);
|
||||
break;
|
||||
}
|
||||
} /*dissect_zcl_flow_meas_attr_data*/
|
||||
|
||||
/**
|
||||
*This function decodes flow value
|
||||
*
|
||||
*@param s string to display
|
||||
*@param value value to decode
|
||||
*/
|
||||
static void
|
||||
decode_flow_meas_value(gchar *s, guint16 value)
|
||||
{
|
||||
if (value == ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOO_LOW_VALUE)
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "Value too low to be measured");
|
||||
else if (value == ZBEE_ZCL_ATTR_ID_FLOW_MEAS_INVALID_VALUE)
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "Invalid value");
|
||||
else
|
||||
/* calculate flow value from measured value according to doc 07-5123-04 */
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "%d (=%f [m^3/h])", value, value/10.0);
|
||||
|
||||
return;
|
||||
} /*decode_flow_meas_value*/
|
||||
|
||||
/**
|
||||
*This function decodes minimum flow value
|
||||
*
|
||||
*@param s string to display
|
||||
*@param value value to decode
|
||||
*/
|
||||
static void
|
||||
decode_flow_meas_min_value(gchar *s, guint16 value)
|
||||
{
|
||||
if ( (value > ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_LO_VALUE) ||
|
||||
(value > ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MIN_HI_VALUE) )
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
|
||||
else
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "%d (=%f [m^3/h])", value, value/10.0);
|
||||
|
||||
return;
|
||||
} /*decode_flow_meas_min_value*/
|
||||
|
||||
/**
|
||||
*This function decodes maximum flow value
|
||||
*
|
||||
*@param s string to display
|
||||
*@param value value to decode
|
||||
*/
|
||||
static void
|
||||
decode_flow_meas_max_value(gchar *s, guint16 value)
|
||||
{
|
||||
if ( (value < ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_LO_VALUE) ||
|
||||
(value > ZBEE_ZCL_ATTR_ID_FLOW_MEAS_MAX_HI_VALUE) )
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
|
||||
else
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "%d (=%f [m^3/h])", value, value/10.0);
|
||||
|
||||
return;
|
||||
} /*decode_flow_meas_max_value*/
|
||||
|
||||
/**
|
||||
*This function decodes tolerance value
|
||||
*
|
||||
*@param s string to display
|
||||
*@param value value to decode
|
||||
*/
|
||||
static void
|
||||
decode_flow_meas_tolerance(gchar *s, guint16 value)
|
||||
{
|
||||
if (value > ZBEE_ZCL_ATTR_ID_FLOW_MEAS_TOL_HI_VALUE)
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "Out of range");
|
||||
else
|
||||
g_snprintf(s, ITEM_LABEL_LENGTH, "%d", value);
|
||||
|
||||
return;
|
||||
} /*decode_flow_meas_tolerance*/
|
||||
|
||||
/**
|
||||
*This function registers the ZCL Flow Measurement dissector
|
||||
*
|
||||
*/
|
||||
void
|
||||
proto_register_zbee_zcl_flow_meas(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
|
||||
{ &hf_zbee_zcl_flow_meas_attr_id,
|
||||
{ "Attribute", "zbee_zcl_meas_sensing.flowmeas.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_flow_meas_attr_names),
|
||||
0x00, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_flow_meas_measured_value,
|
||||
{ "Measured Value", "zbee_zcl_meas_sensing.flowmeas.attr.value", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_flow_meas_value),
|
||||
0x00, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_flow_meas_min_measured_value,
|
||||
{ "Min Measured Value", "zbee_zcl_meas_sensing.flowmeas.attr.value.min", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_flow_meas_min_value),
|
||||
0x00, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_flow_meas_max_measured_value,
|
||||
{ "Max Measured Value", "zbee_zcl_meas_sensing.flowmeas.attr.value.max", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_flow_meas_max_value),
|
||||
0x00, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_flow_meas_tolerance,
|
||||
{ "Tolerance", "zbee_zcl_meas_sensing.flowmeas.attr.tolerance", FT_UINT16, BASE_CUSTOM, CF_FUNC(decode_flow_meas_tolerance),
|
||||
0x00, NULL, HFILL } }
|
||||
};
|
||||
|
||||
/* Register the ZigBee ZCL Flow Measurement cluster protocol name and description */
|
||||
proto_zbee_zcl_flow_meas = proto_register_protocol("ZigBee ZCL Flow Meas.", "ZCL Flow Meas.", ZBEE_PROTOABBREV_ZCL_FLOWMEAS);
|
||||
proto_register_field_array(proto_zbee_zcl_flow_meas, hf, array_length(hf));
|
||||
|
||||
/* Register the ZigBee ZCL Flow Measurement dissector. */
|
||||
register_dissector(ZBEE_PROTOABBREV_ZCL_FLOWMEAS, dissect_zbee_zcl_flow_meas, proto_zbee_zcl_flow_meas);
|
||||
|
||||
} /*proto_register_zbee_zcl_flow_meas*/
|
||||
|
||||
|
||||
/**
|
||||
*Hands off the ZCL Flow Measurement dissector.
|
||||
*
|
||||
*/
|
||||
void
|
||||
proto_reg_handoff_zbee_zcl_flow_meas(void)
|
||||
{
|
||||
zbee_zcl_init_cluster( proto_zbee_zcl_flow_meas,
|
||||
ett_zbee_zcl_flow_meas,
|
||||
ZBEE_ZCL_CID_FLOW_MEASUREMENT,
|
||||
hf_zbee_zcl_flow_meas_attr_id,
|
||||
-1, -1,
|
||||
(zbee_zcl_fn_attr_data)dissect_zcl_flow_meas_attr_data
|
||||
);
|
||||
} /*proto_reg_handoff_zbee_zcl_flow_meas*/
|
||||
|
||||
/* ########################################################################## */
|
||||
/* #### (0x0405) RELATIVE HUMIDITY MEASUREMENT CLUSTER ###################### */
|
||||
|
@ -1601,6 +1861,206 @@ proto_reg_handoff_zbee_zcl_relhum_meas(void)
|
|||
);
|
||||
} /*proto_reg_handoff_zbee_zcl_relhum_meas*/
|
||||
|
||||
|
||||
/* ########################################################################## */
|
||||
/* #### (0x0406) OCCUPANCY SENSING CLUSTER ################################## */
|
||||
/* ########################################################################## */
|
||||
|
||||
/*************************/
|
||||
/* Defines */
|
||||
/*************************/
|
||||
|
||||
#define ZBEE_ZCL_OCC_SEN_NUM_GENERIC_ETT 2
|
||||
#define ZBEE_ZCL_OCC_SEN_NUM_ETT ZBEE_ZCL_OCC_SEN_NUM_GENERIC_ETT
|
||||
|
||||
/* Attributes */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_OCCUPANCY 0x0000 /* Occupancy */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_OCC_SENSOR_TYPE 0x0001 /* Occupancy Sensor Type */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_OCC_TO_UNOCC_DELAY 0x0010 /* PIR Occupied to Unoccupied Delay */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_DELAY 0x0011 /* PIR Unoccupied to Occupied Delay */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_THOLD 0x0012 /* PIR Unoccupied to Occupied Threshold */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_OCC_TO_UNOCC_DELAY 0x0020 /* Ultrasonic Occupied to Unoccupied Threshold */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_DELAY 0x0021 /* Ultrasonic Unoccupied to Occupied Delay */
|
||||
#define ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_THOLD 0x0022 /* Ultrasonic Unoccupied to Occupied Threshold */
|
||||
|
||||
/* Server Commands Received - None */
|
||||
|
||||
/* Server Commands Generated - None */
|
||||
|
||||
/* Occupancy Mask fields */
|
||||
#define ZBEE_ZCL_OCCUPANCY_SENSED_OCC 0x01 /* Sensed Occupancy */
|
||||
|
||||
/* Sensed Occupancy Values */
|
||||
#define ZBEE_ZCL_OCCUPANCY_SENSED_OCC_UNOCCUPIED 0x00 /* Occupied */
|
||||
#define ZBEE_ZCL_OCCUPANCY_SENSED_OCC_OCCUPIED 0x01 /* Unoccupied */
|
||||
|
||||
/* Occupancy Sensor Type */
|
||||
#define ZBEE_ZCL_OCC_SENSOR_TYPE_PIR 0x00 /* PIR */
|
||||
#define ZBEE_ZCL_OCC_SENSOR_TYPE_USONIC 0x01 /* Ultrasonic */
|
||||
#define ZBEE_ZCL_OCC_SENSOR_TYPE_PIR_AND_USONIC 0x02 /* PIR and Ultrasonic */
|
||||
|
||||
/*************************/
|
||||
/* Function Declarations */
|
||||
/*************************/
|
||||
|
||||
void proto_register_zbee_zcl_occ_sen(void);
|
||||
void proto_reg_handoff_zbee_zcl_occ_sen(void);
|
||||
|
||||
/* Command Dissector Helpers */
|
||||
static void dissect_zcl_occ_sen_attr_data (proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type);
|
||||
|
||||
/*************************/
|
||||
/* Global Variables */
|
||||
/*************************/
|
||||
|
||||
/* Initialize the protocol and registered fields */
|
||||
static int proto_zbee_zcl_occ_sen = -1;
|
||||
|
||||
static int hf_zbee_zcl_occ_sen_attr_id = -1;
|
||||
static int hf_zbee_zcl_occ_sen_occupancy = -1;
|
||||
static int hf_zbee_zcl_occ_sen_occ_sensor_type = -1;
|
||||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_zbee_zcl_occ_sen = -1;
|
||||
static gint ett_zbee_zcl_occ = -1;
|
||||
|
||||
/* Attributes */
|
||||
static const value_string zbee_zcl_occ_sen_attr_names[] = {
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_OCCUPANCY, "Occupancy" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_OCC_SENSOR_TYPE, "Occupancy Sensor Type" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_OCC_TO_UNOCC_DELAY, "PIR Occupied to Unoccupied Delay" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_DELAY, "PIR Unoccupied to Occupied Delay" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_THOLD, "PIR Unoccupied to Occupied Threshold" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_OCC_TO_UNOCC_DELAY, "Ultrasonic Occupied to Unoccupied Threshold" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_DELAY, "Ultrasonic Unoccupied to Occupied Delay" },
|
||||
{ ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_THOLD, "Ultrasonic Unoccupied to Occupied Threshold" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Sensed Occupancy Values */
|
||||
static const value_string zbee_zcl_occ_sen_sensed_occ_names[] = {
|
||||
{ ZBEE_ZCL_OCCUPANCY_SENSED_OCC_UNOCCUPIED, "Unoccupied" },
|
||||
{ ZBEE_ZCL_OCCUPANCY_SENSED_OCC_OCCUPIED, "Occupied" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Occupancy Sensor types */
|
||||
static const value_string zbee_zcl_occ_sen_sensor_type_names[] = {
|
||||
{ ZBEE_ZCL_OCC_SENSOR_TYPE_PIR, "PIR" },
|
||||
{ ZBEE_ZCL_OCC_SENSOR_TYPE_USONIC, "Ultrasonic" },
|
||||
{ ZBEE_ZCL_OCC_SENSOR_TYPE_PIR_AND_USONIC, "PIR and Ultrasonic" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*************************/
|
||||
/* Function Bodies */
|
||||
/*************************/
|
||||
|
||||
/**
|
||||
*ZigBee ZCL Occupancy Sensing cluster dissector for wireshark.
|
||||
*
|
||||
*@param tvb pointer to buffer containing raw packet.
|
||||
*@param pinfo pointer to packet information fields
|
||||
*@param tree pointer to data tree Wireshark uses to display packet.
|
||||
*/
|
||||
static int
|
||||
dissect_zbee_zcl_occ_sen(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_)
|
||||
{
|
||||
return tvb_captured_length(tvb);
|
||||
} /*dissect_zbee_zcl_occ_sen*/
|
||||
|
||||
/**
|
||||
*This function is called by ZCL foundation dissector in order to decode
|
||||
*
|
||||
*@param tree pointer to data tree Wireshark uses to display packet.
|
||||
*@param tvb pointer to buffer containing raw packet.
|
||||
*@param offset pointer to buffer offset
|
||||
*@param attr_id attribute identifier
|
||||
*@param data_type attribute data type
|
||||
*/
|
||||
static void
|
||||
dissect_zcl_occ_sen_attr_data(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint16 attr_id, guint data_type)
|
||||
{
|
||||
static const int *occupancy[] = {
|
||||
&hf_zbee_zcl_occ_sen_occupancy,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Dissect attribute data type and data */
|
||||
switch ( attr_id ) {
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_OCCUPANCY:
|
||||
proto_tree_add_bitmask(tree, tvb, *offset, hf_zbee_zcl_occ_sen_occupancy, ett_zbee_zcl_occ, occupancy, ENC_LITTLE_ENDIAN);
|
||||
*offset += 1;
|
||||
break;
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_OCC_SENSOR_TYPE:
|
||||
proto_tree_add_item(tree, hf_zbee_zcl_occ_sen_occ_sensor_type, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
|
||||
*offset += 1;
|
||||
break;
|
||||
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_OCC_TO_UNOCC_DELAY:
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_DELAY:
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_PIR_UNOCC_TO_OCC_THOLD:
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_OCC_TO_UNOCC_DELAY:
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_DELAY:
|
||||
case ZBEE_ZCL_ATTR_ID_OCC_SEN_USONIC_UNOCC_TO_OCC_THOLD:
|
||||
default:
|
||||
dissect_zcl_attr_data(tvb, tree, offset, data_type);
|
||||
break;
|
||||
}
|
||||
} /*dissect_zcl_occ_sen_attr_data*/
|
||||
|
||||
/**
|
||||
*This function registers the ZCL Occupancy Sensing dissector
|
||||
*
|
||||
*/
|
||||
void
|
||||
proto_register_zbee_zcl_occ_sen(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
|
||||
{ &hf_zbee_zcl_occ_sen_attr_id,
|
||||
{ "Attribute", "zbee_zcl_meas_sensing.occsen.attr_id", FT_UINT16, BASE_HEX, VALS(zbee_zcl_occ_sen_attr_names),
|
||||
0x00, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_occ_sen_occupancy,
|
||||
{ "Occupancy", "zbee_zcl_meas_sensing.occsen.attr.occupancy", FT_UINT8, BASE_HEX, VALS(zbee_zcl_occ_sen_sensed_occ_names),
|
||||
ZBEE_ZCL_OCCUPANCY_SENSED_OCC, NULL, HFILL } },
|
||||
|
||||
{ &hf_zbee_zcl_occ_sen_occ_sensor_type,
|
||||
{ "Occupancy Sensor Type", "zbee_zcl_meas_sensing.occsen.attr.occ_sensor_type", FT_UINT8, BASE_HEX, VALS(zbee_zcl_occ_sen_sensor_type_names),
|
||||
0x00, NULL, HFILL } }
|
||||
};
|
||||
|
||||
|
||||
/* Register the ZigBee ZCL Occupancy Sensing cluster protocol name and description */
|
||||
proto_zbee_zcl_occ_sen = proto_register_protocol("ZigBee ZCL Occupancy Sensing", "ZCL Occupancy Sensing", ZBEE_PROTOABBREV_ZCL_OCCSEN);
|
||||
proto_register_field_array(proto_zbee_zcl_occ_sen, hf, array_length(hf));
|
||||
|
||||
/* Register the ZigBee ZCL Occupancy Sensing dissector. */
|
||||
register_dissector(ZBEE_PROTOABBREV_ZCL_OCCSEN, dissect_zbee_zcl_occ_sen, proto_zbee_zcl_occ_sen);
|
||||
|
||||
} /*proto_register_zbee_zcl_occ_sen*/
|
||||
|
||||
|
||||
/**
|
||||
*Hands off the ZCL Occupancy Sensing dissector.
|
||||
*
|
||||
*/
|
||||
void
|
||||
proto_reg_handoff_zbee_zcl_occ_sen(void)
|
||||
{
|
||||
zbee_zcl_init_cluster( proto_zbee_zcl_occ_sen,
|
||||
ett_zbee_zcl_occ_sen,
|
||||
ZBEE_ZCL_CID_ILLUMINANCE_LEVEL_SENSING,
|
||||
hf_zbee_zcl_occ_sen_attr_id,
|
||||
-1, -1,
|
||||
(zbee_zcl_fn_attr_data)dissect_zcl_occ_sen_attr_data
|
||||
);
|
||||
} /*proto_reg_handoff_zbee_zcl_occ_sen*/
|
||||
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
|
|
|
@ -1143,8 +1143,10 @@
|
|||
#define ZBEE_PROTOABBREV_ZCL_ILLUMMEAS "zbee_zcl_meas_sensing.illummeas"
|
||||
#define ZBEE_PROTOABBREV_ZCL_ILLUMLEVELSEN "zbee_zcl_meas_sensing.illumlevelsen"
|
||||
#define ZBEE_PROTOABBREV_ZCL_PRESSMEAS "zbee_zcl_meas_sensing.pressmeas"
|
||||
#define ZBEE_PROTOABBREV_ZCL_FLOWMEAS "zbee_zcl_meas_sensing.flowmeas"
|
||||
#define ZBEE_PROTOABBREV_ZCL_RELHUMMEAS "zbee_zcl_meas_sensing.relhummeas"
|
||||
#define ZBEE_PROTOABBREV_ZCL_TEMPMEAS "zbee_zcl_meas_sensing.tempmeas"
|
||||
#define ZBEE_PROTOABBREV_ZCL_OCCSEN "zbee_zcl_meas_sensing.occsen"
|
||||
#define ZBEE_PROTOABBREV_ZCL_CAL "zbee_zcl_se.cal"
|
||||
#define ZBEE_PROTOABBREV_ZCL_KE "zbee_zcl_se.ke"
|
||||
#define ZBEE_PROTOABBREV_ZCL_MSG "zbee_zcl_se.msg"
|
||||
|
|
Loading…
Reference in New Issue