Changeset 3538 for pykocard/trunk
- Timestamp:
- 04/21/10 03:01:09 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykocard/trunk/pykocard/cartadistcrs.py
r3537 r3538 72 72 self.tcrs.flushInput() 73 73 74 # Identifies the terminal 75 self.versionNumber = self.version() 76 self.serialNumber = self.serial() 77 self.logDebug("%s terminal detected on device %s with serial number %s" \ 78 % (self.versionNumber, 79 self.device, 80 self.serialNumber)) 81 74 82 def __del__(self) : 75 83 """Ensures the serial link is closed on deletion.""" … … 79 87 """Closes the serial link if it is open.""" 80 88 if self.tcrs is not None : 89 self.logDebug("Closing serial link...") 81 90 self.tcrs.close() 82 91 self.tcrs = None 92 self.logDebug("Serial link closed.") 83 93 84 94 def logDebug(self, message) : … … 98 108 self.tcrs.flush() 99 109 self.lastcommand = command 110 return = self.tcrs.readline(eol=self.tcrsprompt)[:-len(self.tcrsprompt)] 100 111 112 def help(self) : 113 """Returns the list of commands supported by the TCRS.""" 114 result = self.sendCommand("help") 115 self.logDebug("Supported commands : %s" % result) 116 return result 101 117 118 def version(self) : 119 """Returns the TCRS' version string.""" 120 return self.sendCommand("version") 121 122 def serial(self) : 123 """Returns the TCRS' serial number.'""" 124 return self.sendCommand("serial") 125 126 if __name__ == "__main__" : 127 # Minimal testing 128 tcrs = CartadisTCRS("/dev/ttyS0", debug=True) 129 tcrs.help() 130 tcrs.close()