comparison sirf.py @ 4:2fde8c382dae

SiRF uses a 15 bit checksum, see section 1-2
author Daniel O'Connor <darius@dons.net.au>
date Wed, 20 Jun 2012 16:48:55 +0930
parents 387e6e928567
children f3547b32c7c5
comparison
equal deleted inserted replaced
3:387e6e928567 4:2fde8c382dae
240 dlen = len(data) 240 dlen = len(data)
241 out = [ 0xa0, 0xa2 ] 241 out = [ 0xa0, 0xa2 ]
242 out.append((dlen & 0xff00) >> 8) 242 out.append((dlen & 0xff00) >> 8)
243 out.append(dlen & 0xff) 243 out.append(dlen & 0xff)
244 out.extend(data) 244 out.extend(data)
245 out.append((cksum & 0xff00) >> 8) 245 out.append((cksum & 0x7f00) >> 8) # 15 bit checksum
246 out.append(cksum & 0xff) 246 out.append(cksum & 0xff)
247 out.extend([0xb0, 0xb3]) 247 out.extend([0xb0, 0xb3])
248 return out 248 return out
249 249
250 @classmethod 250 @classmethod