0001 ### BITPIM 0002 ### 0003 ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 0004 ### Copyright (C) 2005 Simon Capper <skyjunky@sbcglobal.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_lglx5450.py 3918 2007-01-19 05:15:12Z djpham $ 0010 0011 """Communicate with the LG LX5450 cell phone 0012 0013 The LX5450 is substantially similar to the VX4400 except that it supports more 0014 image formats, has wallpapers in no less than 4 locations and puts things in 0015 slightly different directories. It is almost identical to the vx6000. 0016 0017 The code in this file mainly inherits from VX4400 code and then extends where 0018 the 5450 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 copy 0030 import p_lglx5450 0031 import com_lgvx4400 0032 import com_brew 0033 import com_phone 0034 import com_lg 0035 import prototypes 0036 0037 class Phone(com_lgvx4400.Phone): 0038 "Talk to the LG LX5450 cell phone" 0039 0040 desc="LG-LX5450" 0041 helpid=None 0042 protocolclass=p_lglx5450 0043 serialsname='lglx5450' 0044 0045 # more LX5450 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', 'Fish', 0062 'Sea', 'Snowman') 0063 0064 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 0065 'Annen Polka', 'Beethoven Symphony No. 9', 'Pachelbel Canon', 0066 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 0067 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 0068 'Mozart Piano Sonata', 'Sting', 'Trout', 'O solemio', 0069 'Pizzicata Polka', 'Stars and Stripes Forever', 0070 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 0071 'Carol 1', 'Carol 2') 0072 0073 0074 def __init__(self, logtarget, commport): 0075 com_lgvx4400.Phone.__init__(self,logtarget,commport) 0076 self.mode=self.MODENONE 0077 0078 def getcameraindex(self): 0079 buf=prototypes.buffer(self.getfilecontents("cam/pics.dat")) 0080 index={} 0081 g=self.protocolclass.campicsdat() 0082 g.readfrombuffer(buf, logtitle="Camera index") 0083 for i in g.items: 0084 if len(i.name): 0085 # index[i.index]={'name': i.name, 'date': i.taken, 'origin': 'camera' } 0086 # we currently use the filesystem name rather than rename in camera 0087 # since the latter doesn't include the file extension which then makes 0088 # life less pleasant once the file ends up on the computer 0089 index[i.index]={'name': "pic%02d.jpg"%(i.index,), 'date': i.taken, 'origin': 'camera' } 0090 return index 0091 0092 def eval_detect_data(self, res): 0093 found=False 0094 if res.get(self.brew_version_txt_key, None) is not None: 0095 found=res[self.brew_version_txt_key][:len(self.my_version_txt)]==self.my_version_txt 0096 if found: 0097 res['model']=self.my_model 0098 res['manufacturer']='LG Electronics Inc' 0099 s=res.get(self.esn_file_key, None) 0100 if s: 0101 res['esn']=self.get_esn(s) 0102 0103 0104 my_version_txt='AX545V' 0105 my_model='LX5450' 0106 0107 parentprofile=com_lgvx4400.Profile 0108 class Profile(parentprofile): 0109 protocolclass=Phone.protocolclass 0110 serialsname=Phone.serialsname 0111 phone_manufacturer='LG Electronics Inc' 0112 phone_model='LX5450' 0113 0114 WALLPAPER_WIDTH=120 0115 WALLPAPER_HEIGHT=131 0116 MAX_WALLPAPER_BASENAME_LENGTH=32 0117 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0118 WALLPAPER_CONVERT_FORMAT="bmp" 0119 0120 MAX_RINGTONE_BASENAME_LENGTH=32 0121 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0122 0123 # nb we don't allow save to camera so it isn't listed here 0124 imageorigins={} 0125 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 0126 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 0127 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm")) 0128 def GetImageOrigins(self): 0129 return self.imageorigins 0130 0131 ringtoneorigins=('ringers', 'mms', 'drm') 0132 excluded_ringtone_origins=('mms', 'drm') 0133 excluded_wallpaper_origins=('mms', 'drm') 0134 0135 # our targets are the same for all origins 0136 imagetargets={} 0137 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 0138 {'width': 120, 'height': 131, 'format': "BMP"})) 0139 0140 def GetTargetsForImageOrigin(self, origin): 0141 return self.imagetargets 0142 0143 _supportedsyncs=( 0144 ('sms', 'read', None), 0145 ('sms', 'write', 'OVERWRITE'), 0146 ('phonebook', 'read', None), # all phonebook reading 0147 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 0148 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 0149 ('calendar', 'read', None), # all calendar reading 0150 ('wallpaper', 'read', None), # all wallpaper reading 0151 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 0152 ('wallpaper', 'write', 'OVERWRITE'), 0153 ('ringtone', 'read', None), # all ringtone reading 0154 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 0155 ('ringtone', 'write', 'OVERWRITE'), 0156 ('memo', 'read', None), # all memo list reading DJP 0157 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 0158 ('call_history', 'read', None), 0159 ) 0160 0161 def __init__(self): 0162 parentprofile.__init__(self) 0163 0164
Generated by PyXR 0.9.4