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

Source Code for Module phones.com_lglx5550

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2006 Simon Capper <skyjunky@sbcglobal.net> 
  4  ### 
  5  ### This program is free software; you can redistribute it and/or modify 
  6  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  7  ### 
  8   
  9  """Communicate with the LG LX5550 cell phone 
 10   
 11  The LX5550 is substantially similar to the VX4400 
 12   
 13  """ 
 14   
 15  # standard modules 
 16  import time 
 17  import cStringIO 
 18  import sha 
 19   
 20  # my modules 
 21  import common 
 22  import copy 
 23  import p_lglx5550 
 24  import com_lgvx4400 
 25  import com_brew 
 26  import com_phone 
 27  import com_lg 
 28  import prototypes 
 29  import sms 
 30   
31 -class Phone(com_lgvx4400.Phone):
32 "Talk to the LG LX5550 cell phone" 33 34 desc="LG-LX5550" 35 helpid=None 36 protocolclass=p_lglx5550 37 serialsname='lglx5550' 38 39 # more LX5550 indices 40 imagelocations=( 41 # offset, index file, files location, type, maximumentries 42 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 43 ) 44 45 ringtonelocations=( 46 # offset, index file, files location, type, maximumentries 47 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 48 ) 49 50 builtinimages= ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 51 'Orangutan', 'Lake') 52 53 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 54 'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 55 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 56 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 57 'Mozart Piano Sonata', 'Sting', 'O Solemio', 58 'Pizzicato Polka', 'Stars and Stripes Forever', 59 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 60 'Carol 1', 'Carol 2') 61 62
63 - def __init__(self, logtarget, commport):
64 com_lgvx4400.Phone.__init__(self,logtarget,commport) 65 self.mode=self.MODENONE
66
67 - def _getquicktext(self):
68 quicks=[] 69 quicks=com_lgvx4400.Phone._getquicktext(self) 70 built_in=['Yes', 'No', 'Call Me', 'Need Directions', 'Where are you?', 71 'Will Call you later', 'Busy', 'On My way', 'Will arive in 15 minutes', 72 'Thank you', 'Love you'] 73 for s in built_in: 74 quicks.append({ 'text': s, 'type': sms.CannedMsgEntry.builtin_type }) 75 return quicks
76
77 - def eval_detect_data(self, res):
78 found=False 79 if res.get(self.brew_version_txt_key, None) is not None: 80 found=res[self.brew_version_txt_key][:len(self.my_version_txt)]==self.my_version_txt 81 if found: 82 res['model']=self.my_model 83 res['manufacturer']='LG Electronics Inc' 84 s=res.get(self.esn_file_key, None) 85 if s: 86 res['esn']=self.get_esn(s)
87 88 my_version_txt='AX5550' 89 my_model='LX5550' 90
91 - def getphoneinfo(self, phone_info):
92 self.log('Getting Phone Info') 93 try: 94 s=self.getfilecontents('brew/version.txt') 95 if s[:6]=='AX5550': 96 phone_info.model=self.my_model 97 phone_info.manufacturer=Profile.phone_manufacturer 98 req=p_brew.firmwarerequest() 99 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 100 phone_info.append('Firmware Version:', res.firmware) 101 s=self.getfilecontents("nvm/$SYS.ESN")[85:89] 102 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0])) 103 phone_info.append('ESN:', txt) 104 txt=self.getfilecontents("nvm/nvm/nvm_0000")[577:587] 105 phone_info.append('Phone Number:', txt) 106 except: 107 if __debug__: 108 raise
109 110 111 parentprofile=com_lgvx4400.Profile
112 -class Profile(parentprofile):
113 protocolclass=Phone.protocolclass 114 serialsname=Phone.serialsname 115 phone_manufacturer='LG Electronics Inc' 116 phone_model='LX5550' 117 118 # no direct usb interface 119 usbids=com_lgvx4400.Profile.usbids_usbtoserial 120 121 # delay in rebooting the phone after a send data and delay between offline and reboot in seconds. 122 reboot_delay=3 123 124 WALLPAPER_WIDTH=120 125 WALLPAPER_HEIGHT=131 126 MAX_WALLPAPER_BASENAME_LENGTH=19 127 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 128 WALLPAPER_CONVERT_FORMAT="jpg" 129 130 MAX_RINGTONE_BASENAME_LENGTH=19 131 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 132 133 imageorigins={} 134 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
135 - def GetImageOrigins(self):
136 return self.imageorigins
137 138 # our targets are the same for all origins 139 imagetargets={} 140 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 141 {'width': 120, 'height': 131, 'format': "BMP"})) 142 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 143 {'width': 120, 'height': 131, 'format': "BMP"})) 144 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 145 {'width': 120, 'height': 160, 'format': "BMP"})) 146
147 - def GetTargetsForImageOrigin(self, origin):
148 return self.imagetargets
149 150 _supportedsyncs=( 151 ('phonebook', 'read', None), # all phonebook reading 152 ('calendar', 'read', None), # all calendar reading 153 ('wallpaper', 'read', None), # all wallpaper reading 154 ('ringtone', 'read', None), # all ringtone reading 155 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 156 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 157 # some uncertainty over wallpaper write, more testing required 158 #('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 159 #('wallpaper', 'write', 'OVERWRITE'), 160 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 161 ('ringtone', 'write', 'OVERWRITE'), 162 ('memo', 'read', None), # all memo list reading DJP 163 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 164 ('call_history', 'read', None), 165 ('sms', 'read', None), 166 ('sms', 'write', 'OVERWRITE'), 167 ) 168
169 - def __init__(self):
170 parentprofile.__init__(self)
171