Update changelog.
[wammu.git] / Wammu / Info.py
blobc32ea5a20496dbc0a60cd2c184818628f1a1b200
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Phone information reader
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
10 Copyright © 2003 - 2009 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.Thread
27 if Wammu.gammu_error == None:
28 import gammu
30 class GetInfo(Wammu.Thread.Thread):
31 def Run(self):
32 self.ShowProgress(0)
34 progress = 12
36 data = []
38 if self.canceled:
39 self.Canceled()
40 return
42 try:
43 Manufacturer = self.sm.GetManufacturer()
44 data.append({'Name': _('Manufacturer'), 'Value': Manufacturer, 'Synced': True})
45 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
46 pass
47 except gammu.GSMError, val:
48 self.ShowError(val[0])
50 if self.canceled:
51 self.Canceled()
52 return
54 self.ShowProgress(1*100/progress)
55 try:
56 Model = self.sm.GetModel()
57 data.append({'Name': _('Model (Gammu identification)'), 'Value': Model[0], 'Synced': True})
58 data.append({'Name': _('Model (real)'), 'Value': Model[1], 'Synced': True})
59 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
60 pass
61 except gammu.GSMError, val:
62 self.ShowError(val[0])
64 if self.canceled:
65 self.Canceled()
66 return
68 self.ShowProgress(2*100/progress)
69 try:
70 Firmware = self.sm.GetFirmware()
71 data.append({'Name': _('Firmware'), 'Value': Firmware[0], 'Synced': True})
72 if Firmware[1] != '':
73 data.append({'Name': _('Firmware date'), 'Value': Firmware[1], 'Synced': True})
74 if Firmware[2] != 0.0:
75 data.append({'Name': _('Firmware (numeric)'), 'Value': str(Firmware[2]), 'Synced': True})
76 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
77 pass
78 except gammu.GSMError, val:
79 self.ShowError(val[0])
81 if self.canceled:
82 self.Canceled()
83 return
85 self.ShowProgress(3*100/progress)
86 try:
87 IMEI = self.sm.GetIMEI()
88 data.append({'Name': _('Serial number (IMEI)'), 'Value': IMEI, 'Synced': True})
89 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
90 pass
91 except gammu.GSMError, val:
92 self.ShowError(val[0])
94 if self.canceled:
95 self.Canceled()
96 return
98 self.ShowProgress(4*100/progress)
99 try:
100 OriginalIMEI = self.sm.GetOriginalIMEI()
101 data.append({'Name': _('Original IMEI'), 'Value': OriginalIMEI, 'Synced': True})
102 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
103 pass
104 except gammu.GSMError, val:
105 self.ShowError(val[0])
107 if self.canceled:
108 self.Canceled()
109 return
111 self.ShowProgress(5*100/progress)
112 try:
113 ProductCode = self.sm.GetProductCode()
114 data.append({'Name': _('Product code'), 'Value': ProductCode, 'Synced': True})
115 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
116 pass
117 except gammu.GSMError, val:
118 self.ShowError(val[0])
120 if self.canceled:
121 self.Canceled()
122 return
124 self.ShowProgress(6*100/progress)
125 try:
126 SIMIMSI = self.sm.GetSIMIMSI()
127 data.append({'Name': _('SIM IMSI'), 'Value': SIMIMSI, 'Synced': True})
128 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
129 pass
130 except gammu.GSMError, val:
131 self.ShowError(val[0])
133 if self.canceled:
134 self.Canceled()
135 return
137 self.ShowProgress(7*100/progress)
138 try:
139 SMSC = self.sm.GetSMSC()
140 data.append({'Name': _('SMSC'), 'Value': SMSC['Number'], 'Synced': True})
141 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
142 pass
143 except gammu.GSMError, val:
144 self.ShowError(val[0])
146 if self.canceled:
147 self.Canceled()
148 return
150 self.ShowProgress(8*100/progress)
151 try:
152 info = self.sm.GetHardware()
153 data.append({'Name': _('Hardware'), 'Value': info, 'Synced': True})
154 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
155 pass
156 except gammu.GSMError, val:
157 self.ShowError(val[0])
159 if self.canceled:
160 self.Canceled()
161 return
163 self.ShowProgress(9*100/progress)
164 try:
165 info = self.sm.GetManufactureMonth()
166 data.append({'Name': _('Manufacture month'), 'Value': info, 'Synced': True})
167 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
168 pass
169 except gammu.GSMError, val:
170 self.ShowError(val[0])
172 if self.canceled:
173 self.Canceled()
174 return
176 self.ShowProgress(10*100/progress)
177 try:
178 info = self.sm.GetPPM()
179 data.append({'Name': _('Language packs in phone'), 'Value': info, 'Synced': True})
180 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
181 pass
182 except gammu.GSMError, val:
183 self.ShowError(val[0])
185 if self.canceled:
186 self.Canceled()
187 return
189 self.ShowProgress(100)
190 self.SendData(['info','phone'], data)