Beispiel #1
0
    def test_empty_data(self):
        alp_action_bytes = [0x20, 0x40, 0x00, 0x00]

        parser = Parser()
        cmd = parser.parse(ConstBitStream(bytes=alp_action_bytes),
                           len(alp_action_bytes))
        self.assertEqual(cmd.actions[0].operation.op, 32)
        self.assertEqual(len(cmd.actions[0].operation.operand.data), 0)
Beispiel #2
0
  def test_empty_data(self):
    alp_action_bytes = [
      0x20,
      0x40,
      0x00,
      0x00
    ]

    parser = Parser()
    cmd = parser.parse(ConstBitStream(bytes=alp_action_bytes), len(alp_action_bytes))
    self.assertEqual(cmd.actions[0].operation.op, 32)
    self.assertEqual(len(cmd.actions[0].operation.operand.data), 0)
Beispiel #3
0
    0x24,
    0x8a,
    0xb6,
    0x00,
    0x52,
    0x0b,
    0x35,
    0x2c,  # ID
    0x20,  # action=32/ReturnFileData
    0x40,  # File ID
    0x00,  # offset
    0x00  # length
]

parser = Parser()

(cmds, info) = parser.parse(part1)
pprint(info)
for cmd in cmds:
    pprint(cmd.as_dict())

(cmds, info) = parser.parse(part2)
pprint(info)
for cmd in cmds:
    pprint(cmd.as_dict())

(cmds, info) = parser.parse(part3)
pprint(info)
for cmd in cmds:
    pprint(cmd.as_dict())
Beispiel #4
0
      0x00,                                           # offset
      0x04,                                           # length
      0x00, 0xf3, 0x00, 0x00,                         # data

      0xd7,                                           # interface start
      0x04, 0x00, 0x00, 0x00                          # fifo config
]

part3 = [
      0x20,                                           # addressee
      0x24, 0x8a, 0xb6, 0x00, 0x52, 0x0b, 0x35, 0x2c, # ID
      0x20,                                           # action=32/ReturnFileData
      0x40,                                           # File ID
      0x00,                                           # offset
      0x00                                            # length
    ]

parser = Parser()

(cmds, info) = parser.parse(part1)
pprint(info)
for cmd in cmds: pprint(cmd.as_dict())

(cmds, info) = parser.parse(part2)
pprint(info)
for cmd in cmds: pprint(cmd.as_dict())

(cmds, info) = parser.parse(part3)
pprint(info)
for cmd in cmds: pprint(cmd.as_dict())