Emitters
- class usb_construct.emitters.descriptor.ComplexDescriptorEmitter(collection=None)
Base class for emitting complex descriptors, which contain nested subordinates.
Helpers for creating construct-related emitters.
- class usb_construct.emitters.construct_interop.ConstructEmitter(struct: Struct)
Class that creates a simple emitter based on a construct struct.
Examples
For example, if we have a construct format that looks like the following:
MyStruct = struct( 'a' / Int8 'b' / Int8 )
We could create emit an object like follows:
emitter = ConstructEmitter(MyStruct) emitter.a = 0xab emitter.b = 0xcd my_bytes = emitter.emit() # '«Í'
- usb_construct.emitters.construct_interop.emitter_for_format(construct_format: Struct)
Creates a factory method for the relevant construct format.