Skip to content

Commit

Permalink
ITS: GeoNetworking: Show CBR (Channel busy ratio) in 0.00[%] format
Browse files Browse the repository at this point in the history
The value is encoded as unsigned int (0..255)
The actual represenation is percentage (0..100)
  • Loading branch information
Szilard Turi-Kovats authored and AndersBroman committed Feb 6, 2025
1 parent 1e0df8c commit 5b83061
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions epan/dissectors/packet-geonw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,12 @@ display_heading( char *result, uint32_t hexver )
snprintf( result, ITEM_LABEL_LENGTH, "%.1f degrees", hexver/10.);
}

static void
display_cbr( char *result, uint8_t hexver )
{
snprintf( result, ITEM_LABEL_LENGTH, "%.2f %% (%u)", hexver * 100.0 / 255.0, hexver);
}

static void
display_elevation( char *result, int32_t hexver )
{
Expand Down Expand Up @@ -3231,12 +3237,12 @@ proto_register_geonw(void)

{ &hf_geonw_dccmco_cbr_l_0_hop,
{ "Local channel busy ratio", "geonw.cbr_l0hop",
FT_UINT8, BASE_DEC, NULL, 0x80,
FT_UINT8, BASE_CUSTOM, CF_FUNC(display_cbr), 0x00,
NULL, HFILL }},

{ &hf_geonw_dccmco_cbr_l_1_hop,
{ "Max neighbouring CBR", "geonw.cbr_l1hop",
FT_UINT8, BASE_DEC, NULL, 0x80,
FT_UINT8, BASE_CUSTOM, CF_FUNC(display_cbr), 0x00,
NULL, HFILL }},

{ &hf_geonw_dccmco_output_power,
Expand Down

0 comments on commit 5b83061

Please sign in to comment.