How to visualize data from google protocol buffer?

徘徊边缘 提交于 2019-12-03 01:29:35

One GUI I just came across is protobufeditor -- it seems pretty powerful for browsing generic data. It is written in Java, so one cannot easily use/extend it from C++. (And it is not particularly polished at this point, e.g., one needs to maximize the main window to get a semi-useful layout of the sub-windows.) So this is a rather temporary solution.

Wireshark has a protobuf plugin that lets you visualize the contents of protobuf messages. I'd also dig in to the DebugString() in google/protobuf/message.h or message_lite.h (I forget which off the top of my head) and see if you can easily dress that up for presentation to a user.

http://code.google.com/p/protobuf-wireshark/

fejd

If you want to write it yourself, one option could be to use Python/PySide together with QML, process your data and store it in a QAbstractListModel which is connected to your QML ListView. Depending on the complexity of your data, the list view delegate should hopefully be able to visualize it.

This question might be useful in that case: How to provide data from PySide QAbstractItemModel subclass to QML ListView?

If XML is an option, the QML XmlListModel is very neat and easy to use.

I was working on such a solution last year using Qt. Unfortunately, the application is not yet complete, but I think I was at the point where one could more or less successfully visualize data from a generic protocol buffer stream. You can check out the code at

https://github.com/oneamtu/QProtoViewer

Again this is not a out-of-the-box solution, and you'll have to work to make it fit your own needs/project. I'd be more than happy to help if you choose to do so.

One option is Protocol Buffer Workbench. A nice feature with this tool is that you can use it to easily convert JSON to an encoded protocol buffer and vice versa.

If you want you can use web ui to compose a protobuf message

https://github.com/Groterik/protobuf-webui

It is python project and it has a sample that executes http server composing desired message type of imported protobuf module. But it is python, so you can write simple workaround that imports compiled protobuf module dynamically and chooses message type in runtime.

You can overload postprocessing method so it would do some useful work with message (store to file, send by network, etc)

To resolve binary representation without schema is hard. But if you'd like just to have a better view of pb's text format or DebugString(), you can try the Protobuf Visualizer:

http://codingstory.com/pv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!