iIgnore folders which can not be properly converted to unicode (bug #602).
[wammu.git] / Wammu / Memory.py
blobc4a73cb4c137ab4dc4e10343afb62102ded5e1d4
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Memory reader
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
10 Copyright © 2003 - 2008 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 more details.
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 '''
26 import Wammu.Reader
27 import Wammu.Utils
28 import Wammu
29 if Wammu.gammu_error == None:
30 import gammu
32 class GetMemory(Wammu.Reader.Reader):
33 def __init__(self, win, sm, datatype, type):
34 Wammu.Reader.Reader.__init__(self, win, sm)
35 self.datatype = datatype
36 self.type = type
38 def FallBackStatus(self):
39 if self.type in ['MC', 'DC', 'RC']:
40 # guess smaller values for calls, as this memory is usually much smaller
41 return 40
42 else:
43 return Wammu.Reader.Reader.FallBackStatus(self)
45 def GetStatus(self):
46 status = self.sm.GetMemoryStatus(Type = self.type)
47 return status['Used']
49 def GetNextStart(self):
50 return self.sm.GetNextMemory(Start = True, Type = self.type)
52 def GetNext(self, location):
53 return self.sm.GetNextMemory(Location = location, Type = self.type)
55 def Get(self, location):
56 return self.sm.GetMemory(Location = location, Type = self.type)
58 def Parse(self, value):
59 Wammu.Utils.ParseMemoryEntry(value, self.win.cfg)
61 def Send(self, data):
62 self.SendData([self.datatype, self.type], data)