Changeset 45:72d5105fcb72 in xplra for misc
- Timestamp:
- 02/16/13 09:02:30 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/client.py
r39 r45 443 443 print >> sys.stderr, "Error code:", result 444 444 445 def do_register_hotkeys(self, args): 446 words = self._splitArgs(args) 447 if not words: 448 print >> sys.stderr, "Missing parameters" 449 return False 450 451 self._writeU8(0x51) 452 self._writeU32(len(words)) 453 for word in words: 454 self._writeU16(int(word, 16)) 455 self._flush() 456 457 result = self._readU8() 458 if result!=0: 459 print >> sys.stderr, "Error code:", result 460 461 def do_query_hotkeys(self, args): 462 self._writeU8(0x52) 463 self._flush() 464 465 result = self._readU8() 466 if result==0: 467 length = self._readU32() 468 values = [] 469 for i in range(0, length): 470 values.append(self._readU8()) 471 print values 472 else: 473 print >> sys.stderr, "Error code:", result 474 475 def do_unregister_hotkeys(self, args): 476 self._writeU8(0x53) 477 self._flush() 478 479 result = self._readU8() 480 if result!=0: 481 print >> sys.stderr, "Error code:", result 482 445 483 def _writeU8(self, x): 446 484 """Write the given value as an unsigned, 8-bit value.""" 447 485 self._stream.write(struct.pack("B", x)) 486 487 def _writeU16(self, x): 488 """Write the given value as an unsigned, 16-bit value.""" 489 self._stream.write(struct.pack("H", x)) 448 490 449 491 def _writeS32(self, x):
Note:
See TracChangeset
for help on using the changeset viewer.