1 | initial version |
The flexible way to do this is have a tree item with the raw value (e.g. myproto.rxrssi
) and a tree item hanging from that with the interpretation, based on the actual value (e.g, myproto.rxrssi.reserved
or myproto.rxrssi.rssi
etc.)
For example:
ti = proto_tree_add_item_ret_uint(tree,... hf_myproto_rxrssi,...., &rssi);
subtree = proto_item_add_subtree(ti, ...);
if (rssi >= RSSI_RESERVED_START && rssi < 124) {
ti = proto_tree_add_item(subtree, ... hf_myproto_rxrssi_reserved, ....);
proto_item_set_generated(ti); //optional, this creates square brackets around the field
} else