0001 ### BITPIM 0002 ### 0003 ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 0004 ### 0005 ### This program is free software; you can redistribute it and/or modify 0006 ### it under the terms of the BitPim license as detailed in the LICENSE file. 0007 ### 0008 ### $Id: com_lgvx6000.py 3918 2007-01-19 05:15:12Z djpham $ 0009 0010 """Communicate with the LG VX6000 cell phone 0011 0012 The VX6000 is substantially similar to the VX4400 except that it supports more 0013 image formats, has wallpapers in no less than 5 locations and puts things in 0014 slightly different directories. 0015 0016 The code in this file mainly inherits from VX4400 code and then extends where 0017 the 6000 has extra functionality 0018 0019 """ 0020 0021 # standard modules 0022 import time 0023 import cStringIO 0024 import sha 0025 0026 # my modules 0027 import common 0028 import copy 0029 import p_lgvx6000 0030 import com_lgvx4400 0031 import com_brew 0032 import com_phone 0033 import com_lg 0034 import prototypes 0035 import helpids 0036 0037 class Phone(com_lgvx4400.Phone): 0038 "Talk to the LG VX6000 cell phone" 0039 0040 desc="LG-VX6000" 0041 helpid=helpids.ID_PHONE_LGVX6000 0042 protocolclass=p_lgvx6000 0043 serialsname='lgvx6000' 0044 0045 # more VX6000 indices 0046 imagelocations=( 0047 # offset, index file, files location, type, maximumentries 0048 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 0049 ( 0xc8, "download/dloadindex/mmsImageIndex.map", "brew/shared/mms", "mms", 20), 0050 ( 0xdc, "download/dloadindex/mmsDrmImageIndex.map", "brew/shared/mms/d", "drm", 20), 0051 ( 0x82, None, None, "camera", 20) # nb camera must be last 0052 ) 0053 0054 ringtonelocations=( 0055 # offset, index file, files location, type, maximumentries 0056 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 0057 ( 150, "download/dloadindex/mmsRingerIndex.map", "mms/sound", "mms", 20), 0058 ( 180, "download/dloadindex/mmsDrmRingerIndex.map", "mms/sound/drm", "drm", 20) 0059 ) 0060 0061 builtinimages= ('Beach Ball', 'Towerbridge', 'Sunflower', 'Beach', 0062 'Fish', 'Sea', 'Snowman') 0063 0064 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 0065 'Annen Polka', 'Leichte Kavallerie Overture', 'CanCan', 0066 'Paganini', 'Bubble', 'Fugue', 0067 'Polka', 'Mozart Symphony No. 40', 'Cuckoo Waltz', 'Rodetzky', 0068 'Funicula', 'Hallelujah', 'Trumpets', 'Trepak', 'Prelude', 'Mozart Aria', 0069 'William Tell overture', 'Spring', 'Slavonic', 'Fantasy') 0070 0071 0072 def __init__(self, logtarget, commport): 0073 com_lgvx4400.Phone.__init__(self,logtarget,commport) 0074 self.mode=self.MODENONE 0075 0076 def getcameraindex(self): 0077 index={} 0078 try: 0079 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 0080 g=self.protocolclass.campicsdat() 0081 g.readfrombuffer(buf, logtitle="Read camera index") 0082 for i in g.items: 0083 if len(i.name): 0084 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 0085 # we currently use the filesystem name rather than rename in camera 0086 # since the latter doesn't include the file extension which then makes 0087 # life less pleasant once the file ends up on the computer 0088 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 0089 except com_brew.BrewNoSuchFileException: 0090 # if the phone has no pictures it may not have a a cam/pics.dat file 0091 pass 0092 return index 0093 0094 my_model='VX6000' 0095 def eval_detect_data(self, res): 0096 # Brute force: do not look into bpinfo data, which may incorrectly 0097 # identify this as a VX6000. Probably can/should be handled more gracefully 0098 # in the superclass. 0099 found=False 0100 if res.get(self.brew_version_txt_key, None) is not None: 0101 found=res[self.brew_version_txt_key][:len(self.my_model)]==self.my_model 0102 if found: 0103 res['model']=self.my_model 0104 res['manufacturer']='LG Electronics Inc' 0105 s=res.get(self.esn_file_key, None) 0106 if s: 0107 res['esn']=self.get_esn(s) 0108 0109 parentprofile=com_lgvx4400.Profile 0110 class Profile(parentprofile): 0111 protocolclass=Phone.protocolclass 0112 serialsname=Phone.serialsname 0113 phone_manufacturer='LG Electronics Inc' 0114 phone_model='VX6000' 0115 0116 # use for auto-detection 0117 ## if __debug__: 0118 ## phone_manufacturer='LG Electronics Inc.' 0119 ## phone_model='VX6000 102' 0120 0121 WALLPAPER_WIDTH=120 0122 WALLPAPER_HEIGHT=131 0123 MAX_WALLPAPER_BASENAME_LENGTH=32 0124 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0125 WALLPAPER_CONVERT_FORMAT="bmp" 0126 0127 MAX_RINGTONE_BASENAME_LENGTH=32 0128 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0129 0130 # nb we don't allow save to camera so it isn't listed here 0131 imageorigins={} 0132 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 0133 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 0134 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm")) 0135 def GetImageOrigins(self): 0136 return self.imageorigins 0137 0138 ringtoneorigins=('ringers', 'mms', 'drm') 0139 excluded_ringtone_origins=('mms', 'drm') 0140 excluded_wallpaper_origins=('mms', 'drm') 0141 0142 # our targets are the same for all origins 0143 imagetargets={} 0144 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 0145 {'width': 120, 'height': 131, 'format': "BMP"})) 0146 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 0147 {'width': 120, 'height': 131, 'format': "BMP"})) 0148 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 0149 {'width': 120, 'height': 160, 'format': "BMP"})) 0150 0151 def GetTargetsForImageOrigin(self, origin): 0152 return self.imagetargets 0153 0154 _supportedsyncs=( 0155 ('phonebook', 'read', None), # all phonebook reading 0156 ('calendar', 'read', None), # all calendar reading 0157 ('wallpaper', 'read', None), # all wallpaper reading 0158 ('ringtone', 'read', None), # all ringtone reading 0159 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 0160 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 0161 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 0162 ('wallpaper', 'write', 'OVERWRITE'), 0163 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 0164 ('ringtone', 'write', 'OVERWRITE'), 0165 ('memo', 'read', None), # all memo list reading DJP 0166 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 0167 ('call_history', 'read', None), 0168 ('sms', 'read', None), 0169 ('sms', 'write', 'OVERWRITE'), 0170 ) 0171 0172 def __init__(self): 0173 parentprofile.__init__(self) 0174 0175
Generated by PyXR 0.9.4