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

Source Code for Module phones.com_lgux5000

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