Hi guys
Please excuse me if this sounds stupid, I've only just taken up Python and came across Construct.
It already seems perfect for my task of defining command/response frames in a serial protocol I'm working with.
My problem is that I don't know how to use Enums in the way that I am used to in other languages eg. C#, Java or C for that matter.
It might be explained in the documentation - if so, I'm just to thick to understand it. :)
Having the different possible commands defined like this:
FrameCmd = Enum(Byte('Command'),
ReadAbsoluteData=0x00,
WriteAbsoluteData=0x01,
ReadDataBlock=0x04,
WriteDataBlock=0x05,
ReadNewTelegram=0x07,
MakeNewDataBlock=0x08,
DeleteDataBlock=0x09,
)
I would expect to be able to use it as such:
TransmitCommand(FrameCmd.ReadDataBlock)
or in a test like such:
if FrameCmd.ReadDataBlock == .... :
Does anyone know how to use Enums in Construct like so?