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

Source Code for Module phones.com_lglx5450

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 
  4  ### Copyright (C) 2005 Simon Capper <skyjunky@sbcglobal.net> 
  5  ### 
  6  ### This program is free software; you can redistribute it and/or modify 
  7  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  8  ### 
  9  ### $Id: com_lglx5450.py 3918 2007-01-19 05:15:12Z djpham $ 
 10   
 11  """Communicate with the LG LX5450 cell phone 
 12   
 13  The LX5450 is substantially similar to the VX4400 except that it supports more 
 14  image formats, has wallpapers in no less than 4 locations and puts things in 
 15  slightly different directories. It is almost identical to the vx6000. 
 16   
 17  The code in this file mainly inherits from VX4400 code and then extends where 
 18  the 5450 has extra functionality 
 19   
 20  """ 
 21   
 22  # standard modules 
 23  import time 
 24  import cStringIO 
 25  import sha 
 26   
 27  # my modules 
 28  import common 
 29  import copy 
 30  import p_lglx5450 
 31  import com_lgvx4400 
 32  import com_brew 
 33  import com_phone 
 34  import com_lg 
 35  import prototypes 
 36   
37 -class Phone(com_lgvx4400.Phone):
38 "Talk to the LG LX5450 cell phone" 39 40 desc="LG-LX5450" 41 helpid=None 42 protocolclass=p_lglx5450 43 serialsname='lglx5450' 44 45 # more LX5450 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', 'Fish', 62 'Sea', 'Snowman') 63 64 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 65 'Annen Polka', 'Beethoven Symphony No. 9', 'Pachelbel Canon', 66 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 67 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 68 'Mozart Piano Sonata', 'Sting', 'Trout', 'O solemio', 69 'Pizzicata Polka', 'Stars and Stripes Forever', 70 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 71 'Carol 1', 'Carol 2') 72 73
74 - def __init__(self, logtarget, commport):
75 com_lgvx4400.Phone.__init__(self,logtarget,commport) 76 self.mode=self.MODENONE
77
78 - def getcameraindex(self):
79 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 80 index={} 81 g=self.protocolclass.campicsdat() 82 g.readfrombuffer(buf, logtitle="Camera index") 83 for i in g.items: 84 if len(i.name): 85 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 86 # we currently use the filesystem name rather than rename in camera 87 # since the latter doesn't include the file extension which then makes 88 # life less pleasant once the file ends up on the computer 89 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 90 return index
91
92 - def eval_detect_data(self, res):
93 found=False 94 if res.get(self.brew_version_txt_key, None) is not None: 95 found=res[self.brew_version_txt_key][:len(self.my_version_txt)]==self.my_version_txt 96 if found: 97 res['model']=self.my_model 98 res['manufacturer']='LG Electronics Inc' 99 s=res.get(self.esn_file_key, None) 100 if s: 101 res['esn']=self.get_esn(s)
102 103 104 my_version_txt='AX545V' 105 my_model='LX5450'
106 107 parentprofile=com_lgvx4400.Profile
108 -class Profile(parentprofile):
109 protocolclass=Phone.protocolclass 110 serialsname=Phone.serialsname 111 phone_manufacturer='LG Electronics Inc' 112 phone_model='LX5450' 113 114 WALLPAPER_WIDTH=120 115 WALLPAPER_HEIGHT=131 116 MAX_WALLPAPER_BASENAME_LENGTH=32 117 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 118 WALLPAPER_CONVERT_FORMAT="bmp" 119 120 MAX_RINGTONE_BASENAME_LENGTH=32 121 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 122 123 # nb we don't allow save to camera so it isn't listed here 124 imageorigins={} 125 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 126 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 127 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm"))
128 - def GetImageOrigins(self):
129 return self.imageorigins
130 131 ringtoneorigins=('ringers', 'mms', 'drm') 132 excluded_ringtone_origins=('mms', 'drm') 133 excluded_wallpaper_origins=('mms', 'drm') 134 135 # our targets are the same for all origins 136 imagetargets={} 137 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 138 {'width': 120, 'height': 131, 'format': "BMP"})) 139
140 - def GetTargetsForImageOrigin(self, origin):
141 return self.imagetargets
142 143 _supportedsyncs=( 144 ('sms', 'read', None), 145 ('sms', 'write', 'OVERWRITE'), 146 ('phonebook', 'read', None), # all phonebook reading 147 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 148 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 149 ('calendar', 'read', None), # all calendar reading 150 ('wallpaper', 'read', None), # all wallpaper reading 151 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 152 ('wallpaper', 'write', 'OVERWRITE'), 153 ('ringtone', 'read', None), # all ringtone reading 154 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 155 ('ringtone', 'write', 'OVERWRITE'), 156 ('memo', 'read', None), # all memo list reading DJP 157 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 158 ('call_history', 'read', None), 159 ) 160
161 - def __init__(self):
162 parentprofile.__init__(self)
163