0001 ### BITPIM 0002 ### 0003 ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 0004 ### Copyright (C) 2004 John O'Shaughnessy <oshinfo@comcast.net> 0005 ### 0006 ### This program is free software; you can redistribute it and/or modify 0007 ### it under the terms of the BitPim license as detailed in the LICENSE file. 0008 ### 0009 ### $Id: com_lgvx6100.py 3918 2007-01-19 05:15:12Z djpham $ 0010 0011 """Communicate with the LG VX6100 cell phone 0012 0013 The VX6100 is substantially similar to the VX4400 except that it supports more 0014 image formats, has wallpapers in no less than 5 locations and puts things in 0015 slightly different directories. 0016 0017 The code in this file mainly inherits from VX4400 code and then extends where 0018 the 6100 has extra functionality 0019 0020 """ 0021 0022 # standard modules 0023 import time 0024 import cStringIO 0025 import sha 0026 0027 # my modules 0028 import common 0029 import commport 0030 import copy 0031 import p_brew 0032 import p_lgvx6100 0033 import com_lgvx4400 0034 import com_brew 0035 import com_phone 0036 import com_lg 0037 import prototypes 0038 import call_history 0039 import helpids 0040 0041 class Phone(com_lgvx4400.Phone): 0042 "Talk to the LG VX6100 cell phone" 0043 0044 desc="LG-VX6100" 0045 helpid=helpids.ID_PHONE_LGVX6100 0046 protocolclass=p_lgvx6100 0047 serialsname='lgvx6100' 0048 0049 # more VX6100 indices 0050 imagelocations=( 0051 # offset, index file, files location, type, maximumentries 0052 ( 16, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 60) , 0053 ( 200, "download/dloadindex/mmsImageIndex.map", "brew/shared/mms", "mms", 30), 0054 ( 240, "download/dloadindex/mmsDrmImageIndex.map", "brew/shared/mms/d", "drm", 20), 0055 ( 130, None, None, "camera", 60) # nb camera must be last 0056 ) 0057 0058 ringtonelocations=( 0059 # offset, index file, files location, type, maximumentries 0060 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 60), 0061 ( 150, "download/dloadindex/mmsRingerIndex.map", "mms/sound", "mms", 20), 0062 ( 180, "download/dloadindex/mmsDrmRingerIndex.map", "mms/sound/drm", "drm", 20) 0063 ) 0064 0065 builtinimages= ('Sport', 'Butterfly', 'Cake', 'Niagara Falls', 'Rockefeller', 0066 'Statue of Liberty', 'The Capital', 'Scenary','White Bear', 'Yacht' ) 0067 0068 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'VZW Default Tone', 0069 'Farewell', 'Arabesque', 0070 'Piano Sonata', 'Latin', 'When The Saints', 'Bach Cello Suite', 0071 'Speedy Way', 'Cancan', 'Sting', 'Toccata and Fugue', 0072 'Mozart Symphony 40', 'Nutcracker March', 'Funiculi', 'Polka', 0073 'Hallelujah', 'Mozart Aria', 0074 'Leichte', 'Spring', 'Slavonic', 'Fantasy', 'Chimes High', 0075 'Chimes Low', 'Ding', 'Tada', 'Notify', 'Drum', 'Claps', 'Fanfare', 0076 'Chord High', 'Chord Low') 0077 0078 0079 def __init__(self, logtarget, commport): 0080 com_lgvx4400.Phone.__init__(self,logtarget,commport) 0081 self.mode=self.MODENONE 0082 0083 def makeentry(self, counter, entry, dict): 0084 e=com_lgvx4400.Phone.makeentry(self, counter, entry, dict) 0085 e.entrysize=0x202 0086 return e 0087 0088 def getcameraindex(self): 0089 index={} 0090 try: 0091 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 0092 g=self.protocolclass.campicsdat() 0093 g.readfrombuffer(buf, logtitle="Read camera index") 0094 for i in g.items: 0095 if len(i.name): 0096 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 0097 # we currently use the filesystem name rather than rename in camera 0098 # since the latter doesn't include the file extension which then makes 0099 # life less pleasant once the file ends up on the computer 0100 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 0101 except com_brew.BrewNoSuchFileException: 0102 # if the phone has no pictures it may not have a a cam/pics.dat file 0103 pass 0104 return index 0105 0106 my_model='VX6100' 0107 0108 def getphoneinfo(self, phone_info): 0109 self.log('Getting Phone Info') 0110 try: 0111 s=self.getfilecontents('brew/version.txt') 0112 if s[:6]=='VX6100': 0113 phone_info.append('Model:', "VX6100") 0114 req=p_brew.firmwarerequest() 0115 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 0116 phone_info.append('Firmware Version:', res.firmware) 0117 s=self.getfilecontents("nvm/$SYS.ESN")[85:89] 0118 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0])) 0119 phone_info.append('ESN:', txt) 0120 txt=self.getfilecontents("nvm/nvm/nvm_0000")[577:587] 0121 phone_info.append('Phone Number:', txt) 0122 except: 0123 pass 0124 return 0125 0126 parentprofile=com_lgvx4400.Profile 0127 class Profile(parentprofile): 0128 protocolclass=Phone.protocolclass 0129 serialsname=Phone.serialsname 0130 phone_manufacturer='LG Electronics Inc' 0131 phone_model='VX6100' 0132 0133 WALLPAPER_WIDTH=132 0134 WALLPAPER_HEIGHT=148 0135 MAX_WALLPAPER_BASENAME_LENGTH=24 0136 WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ." 0137 WALLPAPER_CONVERT_FORMAT="jpg" 0138 0139 MAX_RINGTONE_BASENAME_LENGTH=24 0140 RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ ." 0141 0142 ringtoneorigins=('ringers', 'mms', 'drm') 0143 excluded_ringtone_origins=('mms', 'drm') 0144 0145 # nb we don't allow save to camera so it isn't listed here 0146 imageorigins={} 0147 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 0148 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 0149 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm")) 0150 def GetImageOrigins(self): 0151 return self.imageorigins 0152 0153 # our targets are the same for all origins 0154 imagetargets={} 0155 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 0156 {'width': 132, 'height': 148, 'format': "JPEG"})) 0157 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 0158 {'width': 132, 'height': 148, 'format': "JPEG"})) 0159 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 0160 {'width': 128, 'height': 160, 'format': "JPEG"})) 0161 # can the outside lcd display images? 0162 #imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 0163 # {'width': 96, 'height': 64, 'format': "JPEG"})) 0164 0165 _supportedsyncs=( 0166 ('phonebook', 'read', None), # all phonebook reading 0167 ('calendar', 'read', None), # all calendar reading 0168 ('wallpaper', 'read', None), # all wallpaper reading 0169 ('ringtone', 'read', None), # all ringtone reading 0170 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 0171 ('call_history', 'read', None),# all call history list reading 0172 ('sms', 'read', None), # all SMS list reading 0173 ('memo', 'read', None), # all memo list reading 0174 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 0175 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 0176 ('wallpaper', 'write', 'OVERWRITE'), 0177 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 0178 ('ringtone', 'write', 'OVERWRITE'), 0179 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 0180 ('memo', 'write', 'OVERWRITE'), # all memo list writing 0181 ) 0182 0183 def __init__(self): 0184 parentprofile.__init__(self) 0185 0186
Generated by PyXR 0.9.4