Package phones :: Module com_lgvx6000
[hide private]
[frames] | no frames]

Source Code for Module phones.com_lgvx6000

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 
  4  ### 
  5  ### This program is free software; you can redistribute it and/or modify 
  6  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  7  ### 
  8  ### $Id: com_lgvx6000.py 3918 2007-01-19 05:15:12Z djpham $ 
  9   
 10  """Communicate with the LG VX6000 cell phone 
 11   
 12  The VX6000 is substantially similar to the VX4400 except that it supports more 
 13  image formats, has wallpapers in no less than 5 locations and puts things in 
 14  slightly different directories. 
 15   
 16  The code in this file mainly inherits from VX4400 code and then extends where 
 17  the 6000 has extra functionality 
 18   
 19  """ 
 20   
 21  # standard modules 
 22  import time 
 23  import cStringIO 
 24  import sha 
 25   
 26  # my modules 
 27  import common 
 28  import copy 
 29  import p_lgvx6000 
 30  import com_lgvx4400 
 31  import com_brew 
 32  import com_phone 
 33  import com_lg 
 34  import prototypes 
 35  import helpids 
 36   
37 -class Phone(com_lgvx4400.Phone):
38 "Talk to the LG VX6000 cell phone" 39 40 desc="LG-VX6000" 41 helpid=helpids.ID_PHONE_LGVX6000 42 protocolclass=p_lgvx6000 43 serialsname='lgvx6000' 44 45 # more VX6000 indices 46 imagelocations=( 47 # offset, index file, files location, type, maximumentries 48 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 49 ( 0xc8, "download/dloadindex/mmsImageIndex.map", "brew/shared/mms", "mms", 20), 50 ( 0xdc, "download/dloadindex/mmsDrmImageIndex.map", "brew/shared/mms/d", "drm", 20), 51 ( 0x82, None, None, "camera", 20) # nb camera must be last 52 ) 53 54 ringtonelocations=( 55 # offset, index file, files location, type, maximumentries 56 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 57 ( 150, "download/dloadindex/mmsRingerIndex.map", "mms/sound", "mms", 20), 58 ( 180, "download/dloadindex/mmsDrmRingerIndex.map", "mms/sound/drm", "drm", 20) 59 ) 60 61 builtinimages= ('Beach Ball', 'Towerbridge', 'Sunflower', 'Beach', 62 'Fish', 'Sea', 'Snowman') 63 64 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 65 'Annen Polka', 'Leichte Kavallerie Overture', 'CanCan', 66 'Paganini', 'Bubble', 'Fugue', 67 'Polka', 'Mozart Symphony No. 40', 'Cuckoo Waltz', 'Rodetzky', 68 'Funicula', 'Hallelujah', 'Trumpets', 'Trepak', 'Prelude', 'Mozart Aria', 69 'William Tell overture', 'Spring', 'Slavonic', 'Fantasy') 70 71
72 - def __init__(self, logtarget, commport):
73 com_lgvx4400.Phone.__init__(self,logtarget,commport) 74 self.mode=self.MODENONE
75
76 - def getcameraindex(self):
77 index={} 78 try: 79 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 80 g=self.protocolclass.campicsdat() 81 g.readfrombuffer(buf, logtitle="Read camera index") 82 for i in g.items: 83 if len(i.name): 84 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 85 # we currently use the filesystem name rather than rename in camera 86 # since the latter doesn't include the file extension which then makes 87 # life less pleasant once the file ends up on the computer 88 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 89 except com_brew.BrewNoSuchFileException: 90 # if the phone has no pictures it may not have a a cam/pics.dat file 91 pass 92 return index
93 94 my_model='VX6000'
95 - def eval_detect_data(self, res):
96 # Brute force: do not look into bpinfo data, which may incorrectly 97 # identify this as a VX6000. Probably can/should be handled more gracefully 98 # in the superclass. 99 found=False 100 if res.get(self.brew_version_txt_key, None) is not None: 101 found=res[self.brew_version_txt_key][:len(self.my_model)]==self.my_model 102 if found: 103 res['model']=self.my_model 104 res['manufacturer']='LG Electronics Inc' 105 s=res.get(self.esn_file_key, None) 106 if s: 107 res['esn']=self.get_esn(s)
108 109 parentprofile=com_lgvx4400.Profile
110 -class Profile(parentprofile):
111 protocolclass=Phone.protocolclass 112 serialsname=Phone.serialsname 113 phone_manufacturer='LG Electronics Inc' 114 phone_model='VX6000' 115 116 # use for auto-detection 117 ## if __debug__: 118 ## phone_manufacturer='LG Electronics Inc.' 119 ## phone_model='VX6000 102' 120 121 WALLPAPER_WIDTH=120 122 WALLPAPER_HEIGHT=131 123 MAX_WALLPAPER_BASENAME_LENGTH=32 124 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 125 WALLPAPER_CONVERT_FORMAT="bmp" 126 127 MAX_RINGTONE_BASENAME_LENGTH=32 128 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 129 130 # nb we don't allow save to camera so it isn't listed here 131 imageorigins={} 132 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 133 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 134 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm"))
135 - def GetImageOrigins(self):
136 return self.imageorigins
137 138 ringtoneorigins=('ringers', 'mms', 'drm') 139 excluded_ringtone_origins=('mms', 'drm') 140 excluded_wallpaper_origins=('mms', 'drm') 141 142 # our targets are the same for all origins 143 imagetargets={} 144 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 145 {'width': 120, 'height': 131, 'format': "BMP"})) 146 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 147 {'width': 120, 'height': 131, 'format': "BMP"})) 148 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 149 {'width': 120, 'height': 160, 'format': "BMP"})) 150
151 - def GetTargetsForImageOrigin(self, origin):
152 return self.imagetargets
153 154 _supportedsyncs=( 155 ('phonebook', 'read', None), # all phonebook reading 156 ('calendar', 'read', None), # all calendar reading 157 ('wallpaper', 'read', None), # all wallpaper reading 158 ('ringtone', 'read', None), # all ringtone reading 159 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 160 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 161 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 162 ('wallpaper', 'write', 'OVERWRITE'), 163 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 164 ('ringtone', 'write', 'OVERWRITE'), 165 ('memo', 'read', None), # all memo list reading DJP 166 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 167 ('call_history', 'read', None), 168 ('sms', 'read', None), 169 ('sms', 'write', 'OVERWRITE'), 170 ) 171
172 - def __init__(self):
173 parentprofile.__init__(self)
174