This is a kind of follow-up from my last question if this can help you.
I'm defining a few ctype structures
class EthercatDatagram(Structure):
_fields_ = [("header", EthercatDatagramHeader),
("packet_data_length", c_int),
("packet_data", POINTER(c_ubyte)),
("work_count", c_ushort)]
class EthercatPacket(Structure):
_fields_ = [("ether_header", ETH_HEADER),
("Ethercat_header", EthercatHeader),
("data", POINTER(EthercatDatagram))]
note that this is parsed correctly by python, the missing classes are defined elsewhere. My problem is when I call the following code
packet = EthercatPacket()
ethercap.RecvPacket(byref(packet))
print packet.data.header
This is incorrect. As I understand the problem, data is some kind of pointer so it isn't (really) mapped to EthercatDatagram, hence, the parser doesn't know the underlying header field.
is there some way to read that field as well as any other field represented by POINTER()?