Пример #1
0
RelativeValueInACurrentRange = Struct(
    "relative_value" /
    DefaultCountValidator(Int8ul, rounding=1, resolution=0.5),
    "minimum_current" /
    DefaultCountValidator(Int16ul, rounding=2, resolution=0.01),
    "maximum_current" /
    DefaultCountValidator(Int16ul, rounding=2, resolution=0.01))

# voltage
Voltage = Struct("voltage" /
                 DefaultCountValidator(Int16ul, resolution=1 / 64), )

AverageVoltage = Struct(
    "voltage_value" / DefaultCountValidator(Int16ul, resolution=1 / 64),
    "sensing_duration" / TimeExponential8, Probe(this))

VoltageRange = Struct(
    "minimum_voltage_value" /
    DefaultCountValidator(Int16ul, resolution=1 / 64),
    "typical_voltage_value" /
    DefaultCountValidator(Int16ul, resolution=1 / 64),
    "maximum_voltage_value" /
    DefaultCountValidator(Int16ul, resolution=1 / 64),
)

VoltageStatistics = Struct(
    "average_voltage_value" /
    DefaultCountValidator(Int16ul, resolution=1 / 64),
    "standard_deviation_voltage_value" /
    DefaultCountValidator(Int16ul, resolution=1 / 64),
Пример #2
0
        "droprelic": actions.droprelic,
        "gatherpoint": actions.gatherpoint,
        "townbell": actions.townbell,
        "resign": actions.resign,
        "tribute": actions.tribute,
        "queue": actions.queue,
        "multiqueue": actions.multiqueue,
        "research": actions.research,
        "sell": actions.sell,
        "buy": actions.buy,
        "backtowork": actions.backtowork,
        "postgame": actions.postgame
    }, default=Struct(
        "unk_action"/Computed(lambda ctx: ctx._.type),
        "bytes"/Bytes(lambda ctx: ctx._._.length - 1),
        Probe()
    ))),
    Padding(4)
)


# Action - length followed by data.
action = "action"/Struct(
    "length"/Int32ul,
    action_data
)


# Synchronization.
sync = "sync"/Struct(
    "time_increment"/Int32ul,