Package phones ::
Module com_lgvx8700
|
|
1
2
3
4
5
6
7
8
9
10
11 """
12 Communicate with the LG VX8700 cell phone
13 """
14
15
16 import common
17 import com_phone
18 import com_brew
19 import prototypes
20 import commport
21 import p_brew
22 import helpids
23 import com_lgvx8300
24 import com_lgvx8500
25 import p_lgvx8700
26
27 DEBUG1=False
28
29 parentphone=com_lgvx8500.Phone
30 -class Phone(com_brew.RealBrewProtocol2, parentphone):
31 "Talk to LG VX-8700 cell phone"
32
33 desc="LG-VX8700"
34 helpid=helpids.ID_PHONE_LGVX8700
35 protocolclass=p_lgvx8700
36 serialsname='lgvx8700'
37
38 my_model='VX8700'
39 builtinringtones= ('Low Beep Once', 'Low Beeps', 'Loud Beep Once', 'Loud Beeps', 'Door Bell', 'VZW Default Ringtone') + \
40 tuple(['Ringtone '+`n` for n in range(1,12)]) + \
41 ('No Ring',)
42
43 ringtonelocations= (
44
45 ('ringers', 'dload/myringtone.dat','brew/mod/10889/ringtones', '', 100, 0x01, 100),
46 ( 'sounds', 'dload/mysound.dat', 'brew/mod/18067', '', 100, 0x02, None),
47 ( 'sounds(sd)', 'dload/sd_sound.dat', 'mmc1/my_sounds', '', 100, 0x02, None),
48 ( 'music', 'dload/efs_music.dat', 'my_music', '', 100, 0x104, None),
49 ( 'music(sd)', 'dload/sd_music.dat', 'mmc1/my_music', '', 100, 0x14, None),
50 )
51
52 wallpaperlocations= (
53
54 ( 'images', 'dload/image.dat', 'brew/mod/10888', '', 100, 0x00, 100),
55 ( 'images(sd)', 'dload/sd_image.dat', 'mmc1/my_pix', '', 100, 0x10, None),
56 ( 'video', 'dload/video.dat', 'brew/mod/10890', '', 100, 0x03, None),
57 ( 'video(sd)', 'dload/sd_video.dat', 'mmc1/my_flix', '', 100, 0x13, None),
58 )
59
60
61 - def __init__(self, logtarget, commport):
63
66
67
68
69
70
71
72
88
90 "Saves out the phonebook"
91 res=com_lgvx8300.Phone.savephonebook(self, data)
92
93 _buf=prototypes.buffer(self.getfilecontents(self.protocolclass.pb_file_name))
94 _pb_entries=self.protocolclass.pbfile()
95 _pb_entries.readfrombuffer(_buf, logtitle="Read phonebook file "+self.protocolclass.pb_file_name)
96 _rt_index=data.get('ringtone-index', {})
97 _wp_index=data.get('wallpaper-index', {})
98
99 self._update_pb_info(_pb_entries, data)
100
101 self._write_path_index(_pb_entries, 'ringtone',
102 _rt_index,
103 self.protocolclass.RTPathIndexFile,
104 (0xffff,))
105
106 self._write_path_index(_pb_entries, 'wallpaper',
107 _wp_index,
108 self.protocolclass.WPPathIndexFile,
109 (0, 0xffff,))
110 return res
111
112
127
147
150
151
152
158
165
166
167 parentprofile=com_lgvx8500.Profile
169 protocolclass=Phone.protocolclass
170 serialsname=Phone.serialsname
171
172 BP_Calendar_Version=3
173 phone_manufacturer='LG Electronics Inc'
174 phone_model='VX8700'
175
176 WALLPAPER_WIDTH=240
177 WALLPAPER_HEIGHT=320
178
179 imageorigins={}
180 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
181 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))
182 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images(sd)"))
183 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video(sd)"))
184
185
186 imagetargets={}
187 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen",
188 {'width': 238, 'height': 246, 'format': "JPEG"}))
189 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
190 {'width': 240, 'height': 274, 'format': "JPEG"}))
191 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid",
192 {'width': 120, 'height': 100, 'format': "JPEG"}))
193
194 _supportedsyncs=(
195 ('phonebook', 'read', None),
196 ('calendar', 'read', None),
197 ('wallpaper', 'read', None),
198 ('ringtone', 'read', None),
199 ('call_history', 'read', None),
200 ('sms', 'read', None),
201 ('memo', 'read', None),
202 ('phonebook', 'write', 'OVERWRITE'),
203 ('calendar', 'write', 'OVERWRITE'),
204 ('wallpaper', 'write', 'MERGE'),
205 ('wallpaper', 'write', 'OVERWRITE'),
206 ('ringtone', 'write', 'MERGE'),
207 ('ringtone', 'write', 'OVERWRITE'),
208 ('sms', 'write', 'OVERWRITE'),
209 ('memo', 'write', 'OVERWRITE'),
210 ('t9_udb', 'write', 'OVERWRITE'),
211 )
212 if __debug__:
213 _supportedsyncs+=(
214 ('t9_udb', 'read', 'OVERWRITE'),
215 )
216
217
220
222 "Assigns groups based on category data"
223
224 pad=[]
225 keys=data['groups'].keys()
226 keys.sort()
227 for k in keys:
228 if k:
229 name=data['groups'][k]['name']
230 pad.append(name)
231
232 groups=helper.getmostpopularcategories(self.protocolclass.MAX_PHONEBOOK_GROUPS, data['phonebook'], ["No Group"], 32, pad)
233
234
235 groups.sort()
236
237
238 newgroups={}
239
240
241 newgroups[0]={'name': 'No Group', 'user_added': 0}
242
243
244 for name in groups:
245
246 if name=="No Group": continue
247 key,value=self._getgroup(name, data['groups'])
248 if key is not None and key!=0:
249 newgroups[key]=value
250
251 for name in groups:
252 key,value=self._getgroup(name, newgroups)
253 if key is None:
254 for key in range(1,100000):
255 if key not in newgroups:
256 newgroups[key]={'name': name, 'user_added': 1}
257 break
258
259
260 if data['groups']!=newgroups:
261 data['groups']=newgroups
262 data['rebootphone']=True
263