How to convert ` b’\x00\x00\x00\x00\x00\x00\x00\x01′ c_ubyte_Array_64 in python. I could find any resources only so any help would really appreciated.
I have to send this message which should be of type c_ubyte_Array_64
import ctypes
messages = {
"RESET": b'\x00\x00\x00\x00\x00\x00\x00\x01',
}
ba = bytearray(messages['RESET'])
I tried it in the above manner but it gives me this error
TypeError: expected c_ubyte_Array_64 instance, got bytearray
>Solution :
The way to convert:
(ctypes.c_ubyte * 64)(*[ctypes.c_ubyte(x) for x in ba])