diff --git a/tools/wireshark/dissector.cpp b/tools/wireshark/dissector.cpp index 58157999..e7b03416 100644 --- a/tools/wireshark/dissector.cpp +++ b/tools/wireshark/dissector.cpp @@ -1,5 +1,25 @@ +/* + * WiVRn VR streaming + * Copyright (C) 2024 Guillaume Meunier + * Copyright (C) 2024 Patrick Nicolas + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include +#include #include #include @@ -150,7 +170,16 @@ struct tree_traits>> static void dissect(proto_tree *tree, tvbuff_t *tvb, int& start) { - proto_tree_add_item(tree, field_handle, tvb, start, sizeof(T), ENC_LITTLE_ENDIAN); + std::string s = abbrev.value; + auto member = s.substr(s.find_last_of('.') + 1); + + if (std::is_same_v && member.starts_with("angle")) + { + float value = tvb_get_ieee_float(tvb, start, ENC_LITTLE_ENDIAN) * 180 / M_PI; + proto_tree_add_float_format_value(tree, field_handle, tvb, start, sizeof(T), value, "%f deg", value); + } + else + proto_tree_add_item(tree, field_handle, tvb, start, sizeof(T), ENC_LITTLE_ENDIAN); start += sizeof(T); }