Exemple #1
0
def main():
    #ncp16 & 2 bytes
    #message = [0x1, 0x5d]
    message = [0x09, 0x20, 0x0e, 0x05, 0x18, 0x26, 0x09, 0x0a, 0x01]
    message = [0x09, 0x2a, 0x0e, 0x05, 0x18, 0x26, 0x09, 0x0a, 0x01]
    message = [0x09, 0x34, 0x0e, 0x05, 0x18, 0x26, 0x09, 0x0a, 0x01]
    #message = [0, 0xF8]
    #message = reverse_bits(message)
    crc_bit, crc_int = ncp16(message)
    print 'CRC bit: %s' % crc_bit
    print 'CRC int: %s' % crc_int
    print byteify(crc_bit)
Exemple #2
0
 def test_message5(self):
     crc_bit, crc_int = ncp16(self.message5)
     self.assertListEqual(byteify(crc_bit), [0xA2, 0x70])
Exemple #3
0
 def test_message4(self):
     crc_bit, crc_int = ncp16(self.message4)
     self.assertListEqual(byteify(crc_bit), [0x80, 0x72])
Exemple #4
0
 def test_message3(self):
     crc_bit, crc_int = ncp16(self.message3)
     self.assertListEqual(byteify(crc_bit), [0x7F, 0x8B])
Exemple #5
0
 def test_message2(self):
     crc_bit, crc_int = ncp16(self.message2)
     self.assertListEqual(byteify(crc_bit), [0x00, 0x60])
Exemple #6
0
 def test_message1(self):
     crc_bit, crc_int = ncp16(self.message1)
     self.assertListEqual(byteify(crc_bit), [0xB8, 0xF0])