pack and write to a binary file. :param fid: :param data: data to send, if multiple elements are sent at the same time, they should be encapsuled either in a list or a tuple :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. should be the same length as th
(fid, data, format_char_sequence, endian_character="<")
| 86 | |
| 87 | |
| 88 | def write_next_bytes(fid, data, format_char_sequence, endian_character="<"): |
| 89 | """pack and write to a binary file. |
| 90 | :param fid: |
| 91 | :param data: data to send, if multiple elements are sent at the same time, |
| 92 | they should be encapsuled either in a list or a tuple |
| 93 | :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. |
| 94 | should be the same length as the data list or tuple |
| 95 | :param endian_character: Any of {@, =, <, >, !} |
| 96 | """ |
| 97 | if isinstance(data, (list, tuple)): |
| 98 | bytes = struct.pack(endian_character + format_char_sequence, *data) |
| 99 | else: |
| 100 | bytes = struct.pack(endian_character + format_char_sequence, data) |
| 101 | fid.write(bytes) |
| 102 | |
| 103 | |
| 104 | def read_cameras_text(path): |
no outgoing calls
no test coverage detected