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

Source Code for Module phones.com_lglx260

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com> 
  4  ### Copyright (C) 2005 Simon Capper <skyjunky@sbcglobal.net> 
  5  ### Copyright (C) 2008 Joe Siegrist <joesigrist@gmail.com> 
  6  ### 
  7  ### This program is free software; you can redistribute it and/or modify 
  8  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  9  ### 
 10   
 11  """Communicate with the LG LX260 cell phone 
 12   
 13  The LX260 is like other LG phones, I got this to import and export phonebook data  
 14  which is all I care about at the moment, extending should be straightforward 
 15   
 16   
 17  """ 
 18   
 19  # standard modules 
 20  import time 
 21  import cStringIO 
 22  import sha 
 23   
 24  # my modules 
 25  import common 
 26  import copy 
 27  import p_brew 
 28  import p_lglx260 
 29  import com_lgvx4400 
 30  import com_brew 
 31  import com_phone 
 32  import com_lg 
 33  import prototypes 
 34   
35 -class Phone(com_lgvx4400.Phone):
36 "Talk to the LG LX260 cell phone" 37 38 desc="LG-LX260" 39 helpid=None 40 protocolclass=p_lglx260 41 serialsname='lglx260' 42 43 # more LX260 indices 44 imagelocations=( 45 # offset, index file, files location, type, maximumentries 46 ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) , 47 ( 0xc8, "download/dloadindex/mmsImageIndex.map", "brew/shared/mms", "mms", 20), 48 ( 0xdc, "download/dloadindex/mmsDrmImageIndex.map", "brew/shared/mms/d", "drm", 20), 49 ( 0x82, None, None, "camera", 20) # nb camera must be last 50 ) 51 52 ringtonelocations=( 53 # offset, index file, files location, type, maximumentries 54 ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30), 55 ( 150, "download/dloadindex/mmsRingerIndex.map", "mms/sound", "mms", 20), 56 ( 180, "download/dloadindex/mmsDrmRingerIndex.map", "mms/sound/drm", "drm", 20) 57 ) 58 59 builtinimages= ('Beach Ball', 'Towerbridge', 'Sunflower', 'Beach', 'Fish', 60 'Sea', 'Snowman') 61 62 builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 63 'Annen Polka', 'Beethoven Symphony No. 9', 'Pachelbel Canon', 64 'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 65 'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 66 'Mozart Piano Sonata', 'Sting', 'Trout', 'O solemio', 67 'Pizzicata Polka', 'Stars and Stripes Forever', 68 'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 69 'Carol 1', 'Carol 2') 70 71
72 - def __init__(self, logtarget, commport):
73 com_lgvx4400.Phone.__init__(self,logtarget,commport) 74 self.mode=self.MODENONE
75
76 - def getcameraindex(self):
77 index={} 78 return index
79 80 # this phone lacks groups
81 - def getgroups(self, results):
82 g=self.protocolclass.pbgroups() 83 groups={} 84 #for i in range(len(g.groups)): 85 #if len(g.groups[i].name): # sometimes have zero length names 86 #groups[i]={ 'icon': g.groups[i].icon, 'name': g.groups[i].name } 87 #self.log('Getting group: ' +i) 88 results['groups']=groups 89 return groups
90
91 - def getphoneinfo(self, phone_info):
92 self.log('Getting Phone Info') 93 phone_info.model=self.my_model 94 phone_info.manufacturer=Profile.phone_manufacturer 95 phone_info.append('ESN:', self.get_brew_esn()) 96 req=p_brew.firmwarerequest() 97 res=self.sendbrewcommand(req, p_lglx260.firmwareresponse) 98 phone_info.append('Firmware Version:', res.firmware) 99 s=self.getfilecontents('pim/MyInformation.dat') 100 phone_info.append('Phone Number:', s[363:373]) 101 try: 102 dirlisting=self.getfilesystem('', 1) 103 keys = dirlisting.keys() 104 keys.sort() 105 #dirlisting=self.getfilesystem('nvm/') 106 for i in keys: 107 self.log('file: '+ i) 108 #s=self.getfilecontents(i) 109 except com_brew.BrewNoSuchDirectoryException: 110 self.log('no such directory pim/')
111 #self.log(self.getfilecontents('pim/sp_num.dat')) 112
113 - def eval_detect_data(self, res):
114 found=False 115 try: 116 s=self.getfilecontents('brew/version.txt') 117 if s[:5]==self.my_model: 118 found=True 119 res['model']=self.my_model 120 res['manufacturer']='LG Electronics Inc' 121 res['esn'] = self.get_brew_esn() 122 except: 123 pass 124 return
125 126 my_model='LX260'
127 128 parentprofile=com_lgvx4400.Profile
129 -class Profile(parentprofile):
130 protocolclass=Phone.protocolclass 131 serialsname=Phone.serialsname 132 phone_manufacturer='LG Electronics Inc' 133 phone_model='LX260' 134 135 WALLPAPER_WIDTH=120 136 WALLPAPER_HEIGHT=131 137 MAX_WALLPAPER_BASENAME_LENGTH=32 138 WALLPAPER_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 139 WALLPAPER_CONVERT_FORMAT="bmp" 140 141 MAX_RINGTONE_BASENAME_LENGTH=32 142 RINGTONE_FILENAME_CHARS="_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ." 143 144 # nb we don't allow save to camera so it isn't listed here 145 imageorigins={} 146 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 147 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "mms")) 148 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "drm"))
149 - def GetImageOrigins(self):
150 return self.imageorigins
151 152 ringtoneorigins=('ringers', 'mms', 'drm') 153 excluded_ringtone_origins=('mms', 'drm') 154 excluded_wallpaper_origins=('mms', 'drm') 155 156 # our targets are the same for all origins 157 imagetargets={} 158 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 159 {'width': 120, 'height': 131, 'format': "BMP"})) 160
161 - def GetTargetsForImageOrigin(self, origin):
162 return self.imagetargets
163 164 _supportedsyncs=( 165 ('sms', 'read', None), 166 ('sms', 'write', 'OVERWRITE'), 167 ('phonebook', 'read', None), # all phonebook reading 168 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 169 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 170 ('calendar', 'read', None), # all calendar reading 171 ('wallpaper', 'read', None), # all wallpaper reading 172 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 173 ('wallpaper', 'write', 'OVERWRITE'), 174 ('ringtone', 'read', None), # all ringtone reading 175 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 176 ('ringtone', 'write', 'OVERWRITE'), 177 ('memo', 'read', None), # all memo list reading DJP 178 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 179 ('call_history', 'read', None), 180 ) 181
182 - def __init__(self):
183 parentprofile.__init__(self)
184