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

Source Code for Module phones.com_lgvx4500

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 
  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  ### $Id: com_lgvx4500.py 3918 2007-01-19 05:15:12Z djpham $ 
  9   
 10  """Communicate with the LG VX4500 cell phone 
 11   
 12  The VX4500 is substantially similar to the VX4400 
 13   
 14  """ 
 15   
 16  # standard modules 
 17  import time 
 18  import cStringIO 
 19  import sha 
 20   
 21  # my modules 
 22  import common 
 23  import copy 
 24  import p_lgvx4500 
 25  import com_lgvx4400 
 26  import com_brew 
 27  import com_phone 
 28  import com_lg 
 29  import helpids 
 30  import prototypes 
 31   
32 -class Phone(com_lgvx4400.Phone):
33 "Talk to the LG VX4500 cell phone" 34 35 desc="LG-VX4500" 36 helpid=helpids.ID_PHONE_LGVX4500 37 protocolclass=p_lgvx4500 38 serialsname='lgvx4500' 39 40 # more VX4500 indices 41 imagelocations=( 42 # offset, index file, files location, type, maximumentries 43 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 44 ) 45 46 ringtonelocations=( 47 # offset, index file, files location, type, maximumentries 48 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 49 ) 50 51 builtinimages= ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 52 'Orangutan', 'Lake', 'Golden Gate', 'Desert') 53 54 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 55 'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 56 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 57 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 58 'Mozart Piano Sonata', 'Sting', 'O solemio', 59 'Pizzicata Polka', 'Stars and Stripes Forever', 60 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 61 'Carol 1', 'Carol 2', 'Chimes high', 'Chimes low', 'Ding', 62 'TaDa', 'Notify', 'Drum', 'Claps', 'Fanfare', 'Chord high', 63 'Chord low') 64 65
66 - def __init__(self, logtarget, commport):
67 com_lgvx4400.Phone.__init__(self,logtarget,commport) 68 self.mode=self.MODENONE
69
70 - def makeentry(self, counter, entry, dict):
71 e=com_lgvx4400.Phone.makeentry(self, counter, entry, dict) 72 e.entrysize=0x202 73 #e.unknown20c="\x00\x00\x00\x00\x00\x31\x02" 74 return e
75 76 my_model='VX4500' 77
78 - def getphoneinfo(self, phone_info):
79 self.log('Getting Phone Info') 80 try: 81 s=self.getfilecontents('brew/version.txt') 82 if s[:6]=='VX4500': 83 phone_info.model=self.my_model 84 phone_info.manufacturer=Profile.phone_manufacturer 85 req=p_brew.firmwarerequest() 86 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 87 phone_info.append('Firmware Version:', res.firmware) 88 s=self.getfilecontents("nvm/$SYS.ESN")[85:89] 89 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0])) 90 phone_info.append('ESN:', txt) 91 txt=self.getfilecontents("nvm/nvm/nvm_0000")[457:467] 92 phone_info.append('Phone Number:', txt) 93 except: 94 if __debug__: 95 raise
96 97 98 parentprofile=com_lgvx4400.Profile
99 -class Profile(parentprofile):
100 protocolclass=Phone.protocolclass 101 serialsname=Phone.serialsname 102 phone_manufacturer='LG Electronics Inc' 103 phone_model='VX4500' 104 105 # no direct usb interface 106 usbids=com_lgvx4400.Profile.usbids_usbtoserial 107 108 WALLPAPER_WIDTH=120 109 WALLPAPER_HEIGHT=131 110 MAX_WALLPAPER_BASENAME_LENGTH=19 111 WALLPAPER_FILENAME_CHARS="abcdefghijklmnopqrstuvwxyz0123456789 ." 112 WALLPAPER_CONVERT_FORMAT="bmp" 113 114 MAX_RINGTONE_BASENAME_LENGTH=19 115 RINGTONE_FILENAME_CHARS="abcdefghijklmnopqrstuvxwyz0123456789 ." 116 117 imageorigins={} 118 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
119 - def GetImageOrigins(self):
120 return self.imageorigins
121 122 # our targets are the same for all origins 123 imagetargets={} 124 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 125 {'width': 120, 'height': 131, 'format': "BMP"})) 126 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 127 {'width': 120, 'height': 131, 'format': "BMP"})) 128 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 129 {'width': 120, 'height': 160, 'format': "BMP"})) 130
131 - def GetTargetsForImageOrigin(self, origin):
132 return self.imagetargets
133 134 _supportedsyncs=( 135 ('phonebook', 'read', None), # all phonebook reading 136 ('calendar', 'read', None), # all calendar reading 137 ('wallpaper', 'read', None), # all wallpaper reading 138 ('ringtone', 'read', None), # all ringtone reading 139 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 140 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 141 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 142 ('wallpaper', 'write', 'OVERWRITE'), 143 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 144 ('ringtone', 'write', 'OVERWRITE'), 145 ('memo', 'read', None), # all memo list reading DJP 146 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 147 ('call_history', 'read', None), 148 ('sms', 'read', None), 149 ('sms', 'write', 'OVERWRITE'), 150 ) 151
152 - def __init__(self):
153 parentprofile.__init__(self)
154