0001 ### BITPIM 0002 ### 0003 ### Copyright (C) 2006 Simon Capper <skyjunky@sbcglobal.net> 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 0009 """Communicate with the LG LX5550 cell phone 0010 0011 The LX5550 is substantially similar to the VX4400 0012 0013 """ 0014 0015 # standard modules 0016 import time 0017 import cStringIO 0018 import sha 0019 0020 # my modules 0021 import common 0022 import copy 0023 import p_lglx5550 0024 import com_lgvx4400 0025 import com_brew 0026 import com_phone 0027 import com_lg 0028 import prototypes 0029 import sms 0030 0031 class Phone(com_lgvx4400.Phone): 0032 "Talk to the LG LX5550 cell phone" 0033 0034 desc="LG-LX5550" 0035 helpid=None 0036 protocolclass=p_lglx5550 0037 serialsname='lglx5550' 0038 0039 # more LX5550 indices 0040 imagelocations=( 0041 # offset, index file, files location, type, maximumentries 0042 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 0043 ) 0044 0045 ringtonelocations=( 0046 # offset, index file, files location, type, maximumentries 0047 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 0048 ) 0049 0050 builtinimages= ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 0051 'Orangutan', 'Lake') 0052 0053 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 0054 'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 0055 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 0056 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 0057 'Mozart Piano Sonata', 'Sting', 'O Solemio', 0058 'Pizzicato Polka', 'Stars and Stripes Forever', 0059 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 0060 'Carol 1', 'Carol 2') 0061 0062 0063 def __init__(self, logtarget, commport): 0064 com_lgvx4400.Phone.__init__(self,logtarget,commport) 0065 self.mode=self.MODENONE 0066 0067 def _getquicktext(self): 0068 quicks=[] 0069 quicks=com_lgvx4400.Phone._getquicktext(self) 0070 built_in=['Yes', 'No', 'Call Me', 'Need Directions', 'Where are you?', 0071 'Will Call you later', 'Busy', 'On My way', 'Will arive in 15 minutes', 0072 'Thank you', 'Love you'] 0073 for s in built_in: 0074 quicks.append({ 'text': s, 'type': sms.CannedMsgEntry.builtin_type }) 0075 return quicks 0076 0077 def eval_detect_data(self, res): 0078 found=False 0079 if res.get(self.brew_version_txt_key, None) is not None: 0080 found=res[self.brew_version_txt_key][:len(self.my_version_txt)]==self.my_version_txt 0081 if found: 0082 res['model']=self.my_model 0083 res['manufacturer']='LG Electronics Inc' 0084 s=res.get(self.esn_file_key, None) 0085 if s: 0086 res['esn']=self.get_esn(s) 0087 0088 my_version_txt='AX5550' 0089 my_model='LX5550' 0090 0091 def getphoneinfo(self, phone_info): 0092 self.log('Getting Phone Info') 0093 try: 0094 s=self.getfilecontents('brew/version.txt') 0095 if s[:6]=='AX5550': 0096 phone_info.model=self.my_model 0097 phone_info.manufacturer=Profile.phone_manufacturer 0098 req=p_brew.firmwarerequest() 0099 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 0100 phone_info.append('Firmware Version:', res.firmware) 0101 s=self.getfilecontents("nvm/$SYS.ESN")[85:89] 0102 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0])) 0103 phone_info.append('ESN:', txt) 0104 txt=self.getfilecontents("nvm/nvm/nvm_0000")[577:587] 0105 phone_info.append('Phone Number:', txt) 0106 except: 0107 if __debug__: 0108 raise 0109 0110 0111 parentprofile=com_lgvx4400.Profile 0112 class Profile(parentprofile): 0113 protocolclass=Phone.protocolclass 0114 serialsname=Phone.serialsname 0115 phone_manufacturer='LG Electronics Inc' 0116 phone_model='LX5550' 0117 0118 # no direct usb interface 0119 usbids=com_lgvx4400.Profile.usbids_usbtoserial 0120 0121 # delay in rebooting the phone after a send data and delay between offline and reboot in seconds. 0122 reboot_delay=3 0123 0124 WALLPAPER_WIDTH=120 0125 WALLPAPER_HEIGHT=131 0126 MAX_WALLPAPER_BASENAME_LENGTH=19 0127 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0128 WALLPAPER_CONVERT_FORMAT="jpg" 0129 0130 MAX_RINGTONE_BASENAME_LENGTH=19 0131 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 0132 0133 imageorigins={} 0134 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 0135 def GetImageOrigins(self): 0136 return self.imageorigins 0137 0138 # our targets are the same for all origins 0139 imagetargets={} 0140 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 0141 {'width': 120, 'height': 131, 'format': "BMP"})) 0142 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 0143 {'width': 120, 'height': 131, 'format': "BMP"})) 0144 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 0145 {'width': 120, 'height': 160, 'format': "BMP"})) 0146 0147 def GetTargetsForImageOrigin(self, origin): 0148 return self.imagetargets 0149 0150 _supportedsyncs=( 0151 ('phonebook', 'read', None), # all phonebook reading 0152 ('calendar', 'read', None), # all calendar reading 0153 ('wallpaper', 'read', None), # all wallpaper reading 0154 ('ringtone', 'read', None), # all ringtone reading 0155 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 0156 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 0157 # some uncertainty over wallpaper write, more testing required 0158 #('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 0159 #('wallpaper', 'write', 'OVERWRITE'), 0160 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 0161 ('ringtone', 'write', 'OVERWRITE'), 0162 ('memo', 'read', None), # all memo list reading DJP 0163 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 0164 ('call_history', 'read', None), 0165 ('sms', 'read', None), 0166 ('sms', 'write', 'OVERWRITE'), 0167 ) 0168 0169 def __init__(self): 0170 parentprofile.__init__(self) 0171
Generated by PyXR 0.9.4