Example #1
0
def relay_definition_message():
    header = h.token('\xa5\xc0')
    any_char = h.ch_range('\x00', '\xff')

    parser = h.sequence(header, h.uint8(), h.uint8(), h.uint8(), h.uint8(),
                        h.many1(any_char))

    return parser
Example #2
0
def relay_operate_configuration():
    header = h.token('\xa5\xce')
    length = h.uint8()
    breaker_bits = h.uint8()
    remote_bits = h.uint16()
    remote_pulse = h.uint8()
    reserved = h.uint8()

    parser = h.sequence(
        header, length, breaker_bits, remote_bits, remote_pulse, reserved,
        h.repeat_n(h.uint8(), 2),
        h.repeat_n(h.sequence(h.uint8(), h.uint8(), h.uint8()), 32), h.uint8())
    return parser
Example #3
0
def fast_meter_message():
    header = h.token('\xa5\xd1')
    any_char = h.ch_range('\x00', '\xff')

    parser = h.sequence(header, h.uint8(), h.ch('\x00'),
                        h.repeat_n(h.uint32(), 7), h.uint64(),
                        h.repeat_n(any_char, 167), any_char)
    return parser
Example #4
0
def peak_fast_meter_configuration_block():
    header = h.token("\xa5\xc3")
    length = h.uint8()
    scale_factors = h.uint8()
    analog = h.uint8()
    samples = h.uint8()
    digital = h.uint8()
    analog_offset = h.uint16()
    timestamp_offset = h.uint16()
    digital_offset = h.uint16()
    analog_signal = h.repeat_n(h.uint8(), 10)
    all_signals = h.repeat_n(analog_signal, 5)
    checksum = h.ch_range('\x00', '\xff')
    calculation_blocks = h.uint8()
    parser = h.sequence(header, length, h.uint8(), h.uint8(), scale_factors,
                        analog, samples, digital, calculation_blocks,
                        analog_offset, timestamp_offset, digital_offset,
                        all_signals, checksum)

    return parser
Example #5
0
def fast_message_block():
    header = h.token('\xa5\x46')
    length = h.uint8()
    routing_address = h.repeat_n(h.uint8(), 5)
    status = h.uint8()
    function_code = h.uint8()
    sequence_byte = h.uint8()
    response_number = h.uint8()
    any_value = h.many1(h.ch_range('\x00', '\xff'))
    crc = h.uint16()

    parser = h.sequence(header, length, routing_address, status, function_code,
                        sequence_byte, response_number, any_value)

    return parser
Example #6
0
 def setUpClass(cls):
     cls.parser = h.int_range(h.uint8(), 3, 10)
Example #7
0
 def setUpClass(cls):
     cls.parser = h.uint8()
Example #8
0
 def setUpClass(cls):
     cls.parser = h.int_range(h.uint8(), 3, 10)
Example #9
0
 def setUpClass(cls):
     cls.parser = h.uint8()
Example #10
0
import hammer as h

abcd = h.sequence(h.many1(h.uint8()), h.many(h.uint16()),
                  h.sequence(h.uint8()))
efgh = h.sequence(h.many1(h.uint8()), h.many(h.uint16()),
                  h.sequence(h.uint8()))