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

Source Code for Module phones.com_lgvx6100

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 
  4  ### Copyright (C) 2004 John O'Shaughnessy <oshinfo@comcast.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_lgvx6100.py 3918 2007-01-19 05:15:12Z djpham $ 
 10   
 11  """Communicate with the LG VX6100 cell phone 
 12   
 13  The VX6100 is substantially similar to the VX4400 except that it supports more 
 14  image formats, has wallpapers in no less than 5 locations and puts things in 
 15  slightly different directories. 
 16   
 17  The code in this file mainly inherits from VX4400 code and then extends where 
 18  the 6100 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 commport 
 30  import copy 
 31  import p_brew 
 32  import p_lgvx6100 
 33  import com_lgvx4400 
 34  import com_brew 
 35  import com_phone 
 36  import com_lg 
 37  import prototypes 
 38  import call_history 
 39  import helpids 
 40   
41 -class Phone(com_lgvx4400.Phone):
42 "Talk to the LG VX6100 cell phone" 43 44 desc="LG-VX6100" 45 helpid=helpids.ID_PHONE_LGVX6100 46 protocolclass=p_lgvx6100 47 serialsname='lgvx6100' 48 49 # more VX6100 indices 50 imagelocations=( 51 # offset, index file, files location, type, maximumentries 52 ( 16, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 60) , 53 ( 200, "download/dloadindex/mmsImageIndex.map", "brew/shared/mms", "mms", 30), 54 ( 240, "download/dloadindex/mmsDrmImageIndex.map", "brew/shared/mms/d", "drm", 20), 55 ( 130, None, None, "camera", 60) # nb camera must be last 56 ) 57 58 ringtonelocations=( 59 # offset, index file, files location, type, maximumentries 60 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 60), 61 ( 150, "download/dloadindex/mmsRingerIndex.map", "mms/sound", "mms", 20), 62 ( 180, "download/dloadindex/mmsDrmRingerIndex.map", "mms/sound/drm", "drm", 20) 63 ) 64 65 builtinimages= ('Sport', 'Butterfly', 'Cake', 'Niagara Falls', 'Rockefeller', 66 'Statue of Liberty', 'The Capital', 'Scenary','White Bear', 'Yacht' ) 67 68 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'VZW Default Tone', 69 'Farewell', 'Arabesque', 70 'Piano Sonata', 'Latin', 'When The Saints', 'Bach Cello Suite', 71 'Speedy Way', 'Cancan', 'Sting', 'Toccata and Fugue', 72 'Mozart Symphony 40', 'Nutcracker March', 'Funiculi', 'Polka', 73 'Hallelujah', 'Mozart Aria', 74 'Leichte', 'Spring', 'Slavonic', 'Fantasy', 'Chimes High', 75 'Chimes Low', 'Ding', 'Tada', 'Notify', 'Drum', 'Claps', 'Fanfare', 76 'Chord High', 'Chord Low') 77 78
79 - def __init__(self, logtarget, commport):
80 com_lgvx4400.Phone.__init__(self,logtarget,commport) 81 self.mode=self.MODENONE
82
83 - def makeentry(self, counter, entry, dict):
84 e=com_lgvx4400.Phone.makeentry(self, counter, entry, dict) 85 e.entrysize=0x202 86 return e
87
88 - def getcameraindex(self):
89 index={} 90 try: 91 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 92 g=self.protocolclass.campicsdat() 93 g.readfrombuffer(buf, logtitle="Read camera index") 94 for i in g.items: 95 if len(i.name): 96 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 97 # we currently use the filesystem name rather than rename in camera 98 # since the latter doesn't include the file extension which then makes 99 # life less pleasant once the file ends up on the computer 100 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 101 except com_brew.BrewNoSuchFileException: 102 # if the phone has no pictures it may not have a a cam/pics.dat file 103 pass 104 return index
105 106 my_model='VX6100' 107
108 - def getphoneinfo(self, phone_info):
109 self.log('Getting Phone Info') 110 try: 111 s=self.getfilecontents('brew/version.txt') 112 if s[:6]=='VX6100': 113 phone_info.append('Model:', "VX6100") 114 req=p_brew.firmwarerequest() 115 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 116 phone_info.append('Firmware Version:', res.firmware) 117 s=self.getfilecontents("nvm/$SYS.ESN")[85:89] 118 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0])) 119 phone_info.append('ESN:', txt) 120 txt=self.getfilecontents("nvm/nvm/nvm_0000")[577:587] 121 phone_info.append('Phone Number:', txt) 122 except: 123 pass 124 return
125 126 parentprofile=com_lgvx4400.Profile
127 -class Profile(parentprofile):
128 protocolclass=Phone.protocolclass 129 serialsname=Phone.serialsname 130 phone_manufacturer='LG Electronics Inc' 131 phone_model='VX6100' 132 133 WALLPAPER_WIDTH=132 134 WALLPAPER_HEIGHT=148 135 MAX_WALLPAPER_BASENAME_LENGTH=24 136 WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ." 137 WALLPAPER_CONVERT_FORMAT="jpg" 138 139 MAX_RINGTONE_BASENAME_LENGTH=24 140 RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ." 141 142 ringtoneorigins=('ringers', 'mms', 'drm') 143 excluded_ringtone_origins=('mms', 'drm') 144 145 # nb we don't allow save to camera so it isn't listed here 146 imageorigins={} 147 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 148 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 149 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm"))
150 - def GetImageOrigins(self):
151 return self.imageorigins
152 153 # our targets are the same for all origins 154 imagetargets={} 155 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 156 {'width': 132, 'height': 148, 'format': "JPEG"})) 157 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 158 {'width': 132, 'height': 148, 'format': "JPEG"})) 159 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 160 {'width': 128, 'height': 160, 'format': "JPEG"})) 161 # can the outside lcd display images? 162 #imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 163 # {'width': 96, 'height': 64, 'format': "JPEG"})) 164 165 _supportedsyncs=( 166 ('phonebook', 'read', None), # all phonebook reading 167 ('calendar', 'read', None), # all calendar reading 168 ('wallpaper', 'read', None), # all wallpaper reading 169 ('ringtone', 'read', None), # all ringtone reading 170 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 171 ('call_history', 'read', None),# all call history list reading 172 ('sms', 'read', None), # all SMS list reading 173 ('memo', 'read', None), # all memo list reading 174 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 175 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 176 ('wallpaper', 'write', 'OVERWRITE'), 177 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 178 ('ringtone', 'write', 'OVERWRITE'), 179 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 180 ('memo', 'write', 'OVERWRITE'), # all memo list writing 181 ) 182
183 - def __init__(self):
184 parentprofile.__init__(self)
185