def test_application_pdu_segmented_long_mic(dev_key): bogus_long_message = AccessMessage( src=0x0003, dst=0x1201, ttl=0x04, payload=bytes(range(21)) ) segments = list( bogus_long_message.segments(dev_key, seq=0x3129AB, iv_index=0x12345678) ) assert len(segments) == 3 assert segments[0] == bytes.fromhex("80a6ac023008177a35ada597ba2ad9a4") assert segments[1] == bytes.fromhex("80a6ac227785110a8afb1ae2fcd561fd") assert segments[2] == bytes.fromhex("80a6ac424e48e5be9e")
def _send(self, payload, *destinations, device_key=False): with self._seq_update(): for dst in destinations: access_message = AccessMessage(self._src, dst, ttl=2, payload=payload) print('%04x -> %04x @ %5d %s' % (self._src, dst, self._seq, payload.hex())) self._seq = self._client.send(access_message, self._seq, device_key=device_key)
def app_sar_message(): payload = bytes.fromhex("510c00000000020b0c1f00efcdab071b1c") return AccessMessage(src=1234, dst=4321, ttl=1, payload=payload)
def config_appkey_add_message(): payload = bytes.fromhex("0056341263964771734fbd76e3b40519d1d94a48") return AccessMessage(src=0x0003, dst=0x1201, ttl=0x04, payload=payload)
def config_appkey_status_message(): payload = bytes.fromhex("800300563412") return AccessMessage(src=0x1201, dst=0x0003, ttl=0x0B, payload=payload)
def health_current_status_message(): payload = bytes.fromhex("0400000000") return AccessMessage(src=0x1201, dst=0xFFFF, ttl=0x03, payload=payload)