Table Of Contents

Boolean

class Boolean(name, value=False)

Bases: BitPacket.BitField.BitField

This class represents a boolean field. It is a convenient class to represent True and False values.

Initialize the field with the given name. The default value is False.

disable()

Set the value to False.

enable()

Set the value to True.

str_eng_value()

Returns a text string with True or False.

str_value()

Returns a text string with True or False.

Flag

class Flag(name, value=0)

Bases: BitPacket.BitField.BitField

This class represents a boolean field. It is a convenient class to represent True and False values.

Initialize the field with the given name. The default value is Inactive.

Active = 1
Inactive = 0
activate()

Activate the flag.

deactivate()

Deactivate the flag.

str_eng_value()

Returns a text string with Active or Inactive.

str_value()

Returns a text string with Active or Inactive.

Mask

class Mask(name, value, **kwargs)

Bases: BitPacket.BitField.BitField

This class represents a bit mask field. Each bit has a unique meaning. Bit masks can be set, unset and tested.

Initialize the field with the given name and value. The list of all masks and their values are be given in kwargs with an arbitrary number of arguments (FLAG_1 = 0x01, FLAG_2 = 0x02 ...).

is_set(mask)

Tests whether the given bit mask is set. That is, all the given bits must be set.

mask(mask)

Mask the given bits in mask. The current bits will be kept and the new ones will be additionally masked.

str_eng_value()

Returns a text string with all the bit mask names that are set. Bit masks names are separated by |.

str_value()

Returns a human-readable representation of the hexadecimal value of this field.

unmask(mask)

Unmask the given bits in mask. The current bits will be kept and the new ones will be additionally unmasked.