Package smartcard :: Package reader :: Module Reader
[hide private]
[frames] | no frames]

Source Code for Module smartcard.reader.Reader

 1  """Smart card Reader abstract class. 
 2   
 3  __author__ = "gemalto http://www.gemalto.com" 
 4   
 5  Copyright 2001-2012 gemalto 
 6  Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com 
 7   
 8  This file is part of pyscard. 
 9   
10  pyscard is free software; you can redistribute it and/or modify 
11  it under the terms of the GNU Lesser General Public License as published by 
12  the Free Software Foundation; either version 2.1 of the License, or 
13  (at your option) any later version. 
14   
15  pyscard is distributed in the hope that it will be useful, 
16  but WITHOUT ANY WARRANTY; without even the implied warranty of 
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
18  GNU Lesser General Public License for more details. 
19   
20  You should have received a copy of the GNU Lesser General Public License 
21  along with pyscard; if not, write to the Free Software 
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
23  """ 
24   
25   
26 -class Reader(object):
27 """Reader abstract class. 28 29 The reader class is responsible for creating connections 30 with a card. 31 32 Known subclasses: PCSCReader 33 """ 34
35 - def __init__(self, readername):
36 """Constructs a new reader and store readername.""" 37 self.name = readername
38
39 - def addtoreadergroup(self, groupname):
40 """Add reader to a reader group.""" 41 pass
42
43 - def removefromreadergroup(self, groupname):
44 """Remove reader from a reader group.""" 45 pass
46
47 - def createConnection(self):
48 """Returns a card connection thru reader.""" 49 pass
50
51 - def __eq__(self, other):
52 """Returns True if self==other (same name).""" 53 if type(other) == type(self): 54 return self.name == other.name 55 else: 56 return False
57
58 - def __hash__(self):
59 """Returns a hash value for this object (self.name is unique).""" 60 return hash(self.name)
61
62 - def __repr__(self):
63 """Returns card reader name string for `object` calls.""" 64 return "'%s'" % self.name
65
66 - def __str__(self):
67 """Returns card reader name string for str(object) calls.""" 68 return self.name
69