7 Tests the XBee ZB (ZigBee) implementation class for API compliance 14 Tests ZigBee-specific features 22 Packets with null-terminated fields 23 should be properly parsed 25 expected_data =
'\x01\x02\x03\x04' 27 node_identifier =
'\x95' +
'\x00' * 21 + expected_data + terminator +
'\x00' * 8
29 data = self.zigbee._split_response(node_identifier)
31 self.assertEqual(data[
'node_id'], expected_data)
34 data =
'\x95\x00\x13\xa2\x00\x40\x52\x2b\xaa\x7d\x84\x02\x7d\x84\x00\x13\xa2\x00\x40\x52\x2b\xaa\x20\x00\xff\xfe\x01\x01\xc1\x05\x10\x1e' 35 info = self.zigbee._split_response(data)
37 'id':
'node_id_indicator',
38 'sender_addr_long':
'\x00\x13\xa2\x00\x40\x52\x2b\xaa',
39 'sender_addr':
'\x7d\x84',
41 'source_addr':
'\x7d\x84',
42 'source_addr_long':
'\x00\x13\xa2\x00\x40\x52\x2b\xaa',
44 'parent_source_addr':
'\xff\xfe',
45 'device_type':
'\x01',
46 'source_event':
'\x01',
47 'digi_profile_id':
'\xc1\x05',
48 'manufacturer_id':
'\x10\x1e',
51 self.assertEqual(info, expected_info)
54 data =
'\x95\x00\x13\xa2\x00\x40\x52\x2b\xaa\x7d\x84\x02\x7d\x84\x00\x13\xa2\x00\x40\x52\x2b\xaaCoordinator\x00\xff\xfe\x01\x01\xc1\x05\x10\x1e' 55 info = self.zigbee._split_response(data)
57 'id':
'node_id_indicator',
58 'sender_addr_long':
'\x00\x13\xa2\x00\x40\x52\x2b\xaa',
59 'sender_addr':
'\x7d\x84',
61 'source_addr':
'\x7d\x84',
62 'source_addr_long':
'\x00\x13\xa2\x00\x40\x52\x2b\xaa',
63 'node_id':
'Coordinator',
64 'parent_source_addr':
'\xff\xfe',
65 'device_type':
'\x01',
66 'source_event':
'\x01',
67 'digi_profile_id':
'\xc1\x05',
68 'manufacturer_id':
'\x10\x1e',
71 self.assertEqual(info, expected_info)
75 Test parsing ZigBee specific IO data 82 data =
'\x01\x08\x00\x0e\x08\x00\x00\x00\x02P\x02\x06' 83 expected_results = [{
'dio-11':
True,
87 results = self.zigbee._parse_samples(data)
88 self.assertEqual(results, expected_results)
def test_parse_dio_adc(self)
def test_split_node_identification_identifier(self)
def test_split_node_identification_identifier2(self)
def test_null_terminated_field(self)