aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-synphasor.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-12-12 13:22:05 -0500
committerMichael Mann <mmann78@netscape.net>2016-12-13 22:56:36 +0000
commita869ec6f55160622a90bc437517dee91d57f85d5 (patch)
treeea55cf7ba5f820af87e01d2a28d38d6b6ebe547e /epan/dissectors/packet-synphasor.c
parente150235ef14cf6a9ada7d74c534e4aee469f3ac5 (diff)
Adjust proto_tree_add_[float|double]_format_value calls to use unit string
Several calls to proto_tree_add_[float|double]_xxx could be better served using BASE_UNIT_STRING with a "unit string" in hf_ field. Added a few more "common" unit string values to unit_strings.[ch] Change-Id: Id0da7b579403898d20c2667d6c4abcd59d5a48d4 Reviewed-on: https://code.wireshark.org/review/19241 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-synphasor.c')
-rw-r--r--epan/dissectors/packet-synphasor.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c
index 5de6e233a0..4c37e281cb 100644
--- a/epan/dissectors/packet-synphasor.c
+++ b/epan/dissectors/packet-synphasor.c
@@ -965,17 +965,15 @@ static gint dissect_PHASORS(tvbuff_t *tvb, proto_tree *tree, config_block *block
static gint dissect_DFREQ(tvbuff_t *tvb, proto_tree *tree, config_block *block, gint offset)
{
if (floating_point == block->format_fr) {
- gfloat tmp;
-
- tmp = tvb_get_ntohieee_float(tvb, offset);
- proto_tree_add_float_format_value(tree, hf_synphasor_actual_frequency_value, tvb, offset, 4, tmp, "%fHz", tmp); offset += 4;
+ proto_tree_add_item(tree, hf_synphasor_actual_frequency_value, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
/* The standard doesn't clearly say how to interpret this value, but
* http://www.pes-psrc.org/h/C37_118_H11_FAQ_Jan2008.pdf provides further information.
* --> no scaling factor is applied to DFREQ
*/
- tmp = tvb_get_ntohieee_float(tvb, offset);
- proto_tree_add_float_format_value(tree, hf_synphasor_rate_change_frequency, tvb, offset, 4, tmp, "%fHz/s", tmp); offset += 4;
+ proto_tree_add_item(tree, hf_synphasor_rate_change_frequency, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
}
else {
gint16 tmp;
@@ -1304,8 +1302,8 @@ void proto_register_synphasor(void)
{ &hf_synphasor_num_digital_status_words, { "Number of digital status words", "synphasor.num_digital_status_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_synphasor_rate_of_transmission, { "Rate of transmission", "synphasor.rate_of_transmission", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_synphasor_phasor, { "Phasor", "synphasor.phasor", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_synphasor_actual_frequency_value, { "Actual frequency value", "synphasor.actual_frequency_value", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }},
- { &hf_synphasor_rate_change_frequency, { "Rate of change of frequency", "synphasor.rate_change_frequency", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ { &hf_synphasor_actual_frequency_value, { "Actual frequency value", "synphasor.actual_frequency_value", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz, 0x0, NULL, HFILL }},
+ { &hf_synphasor_rate_change_frequency, { "Rate of change of frequency", "synphasor.rate_change_frequency", FT_FLOAT, BASE_NONE|BASE_UNIT_STRING, &units_hz_s, 0x0, NULL, HFILL }},
{ &hf_synphasor_frequency_deviation_from_nominal, { "Frequency deviation from nominal", "synphasor.frequency_deviation_from_nominal", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_synphasor_analog_value, { "Analog value", "synphasor.analog_value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_synphasor_digital_status_word, { "Digital status word", "synphasor.digital_status_word", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},