From c2bbeec7aa91cbf1690b4efc7e5505fd0885bad6 Mon Sep 17 00:00:00 2001 From: Marko Durkovic Date: Sat, 3 Jul 2021 14:27:11 +0200 Subject: [PATCH] Make optional connection header fields available --- src/rosbags/rosbag1/reader.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/rosbags/rosbag1/reader.py b/src/rosbags/rosbag1/reader.py index 56661ad9..cdab0ef6 100644 --- a/src/rosbags/rosbag1/reader.py +++ b/src/rosbags/rosbag1/reader.py @@ -69,6 +69,8 @@ class Connection(NamedTuple): msgtype: str md5sum: str msgdef: str + callerid: Optional[str] + latching: Optional[int] indexes: List @@ -490,7 +492,19 @@ class Reader: md5sum = header.get_string('md5sum') msgdef = header.get_string('message_definition') - return conn, Connection(conn, topic, normalize_msgtype(typ), md5sum, msgdef, []) + callerid = header.get_string('callerid') if 'callerid' in header else None + latching = int(header.get_string('latching')) if 'latching' in header else None + + return conn, Connection( + conn, + topic, + normalize_msgtype(typ), + md5sum, + msgdef, + callerid, + latching, + [], + ) def read_chunk_info(self) -> ChunkInfo: """Read chunk info record from current position."""