| 1 | import struct |
| 2 | |
| 3 | def get_bytes(): |
| 4 | return struct.pack('<bhi', 123, 456, 789) |
| 5 | |
| 6 | def set_bytes(bytedata): |
| 7 | print('Got this raw data from QML:', bytedata) |
| 8 | a, b, c = struct.unpack('<hhI', bytedata) |
| 9 | print('Got this data (unpacked) from QML:', a, b, hex(c)) |
| 10 | return a == 1337 and b == -4711 and c == 0xcafebabe |