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

Source Code for Module phones.com_lgvx8300

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2005 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 VX8300 cell phone 
 10   
 11   
 12  The code in this file mainly inherits from VX8100 code and then extends where 
 13  the 8300 has different functionality 
 14   
 15  """ 
 16   
 17  # standard modules 
 18  import time 
 19  import cStringIO 
 20  import sha 
 21   
 22  # my modules 
 23  import common 
 24  import commport 
 25  import copy 
 26  import com_lgvx4400 
 27  import p_brew 
 28  import p_lgvx8300 
 29  import com_lgvx8100 
 30  import com_brew 
 31  import com_phone 
 32  import com_lg 
 33  import prototypes 
 34  import bpcalendar 
 35  import call_history 
 36  import sms 
 37  import memo 
 38  import fileinfo 
 39  import helpids 
 40   
41 -class Phone(com_lg.LGUncountedIndexedMedia, com_lgvx8100.Phone):
42 "Talk to the LG VX8300 cell phone" 43 44 desc="LG-VX8300" 45 helpid=helpids.ID_PHONE_LGVX8300 46 protocolclass=p_lgvx8300 47 serialsname='lgvx8300' 48 49 external_storage_root='mmc1/' 50 51 builtinringtones= ('Low Beep Once', 'Low Beeps', 'Loud Beep Once', 'Loud Beeps', 'VZW Default Ringtone') + \ 52 tuple(['Ringtone '+`n` for n in range(1,11)]) + \ 53 ('No Ring',) 54 55 ringtonelocations= ( 56 # type index file default dir external dir max type Index 57 ( 'ringers', 'dload/myringtone.dat','brew/16452/lk/mr','mmc1/ringers', 100, 0x01, None), 58 ( 'sounds', 'dload/mysound.dat', 'brew/16452/ms', '', 100, 0x02, None), 59 ( 'mp3', 'dload/my_mp3.dat', 'mmc1/my_mp3', '', 100, 0x15, None), 60 #( 'music', 'dload/sd_music.dat', 'mmc1/my_music', '', 100, 0x14, None), # .wma files 61 ) 62 63 calendarlocation="sch/schedule.dat" 64 calendarexceptionlocation="sch/schexception.dat" 65 calenderrequiresreboot=1 66 memolocation="sch/memo.dat" 67 68 builtinwallpapers = () # none 69 70 wallpaperlocations= ( 71 # type index file default dir external dir max type Index 72 ( 'images', 'dload/image.dat', 'brew/16452/mp', '', 100, 0x00, None), 73 ( 'images(sd)', 'dload/sd_image.dat', 'mmc1/my_pix', '', 100, 0x10, None), 74 ( 'video', 'dload/video.dat', 'brew/16452/mf', '', 100, 0x03, None), 75 ( 'video(sd)', 'dload/sd_video.dat', 'mmc1/my_flix', '', 100, 0x13, None), 76 ) 77
78 - def __init__(self, logtarget, commport):
79 com_lgvx8100.Phone.__init__(self, logtarget, commport) 80 p_brew.PHONE_ENCODING=self.protocolclass.PHONE_ENCODING 81 self.mode=self.MODENONE
82
83 - def get_esn(self, data=None):
84 # return the ESN of this phone 85 return self.get_brew_esn()
86
87 - def setDMversion(self):
88 _fw_version=self.get_firmware_version()[-1] 89 # T83VZV04 uses DMv5 90 self._DMv5=self.my_model=='VX8300' and _fw_version>'3' 91 if self._DMv5: 92 # assume that it takes about 30 seconds for T83VZV04 to kick out of DM 93 self._timeout = 30
94
95 - def get_detect_data(self, res):
96 com_lgvx8100.Phone.get_detect_data(self, res) 97 res[self.esn_file_key]=self.get_esn()
98 99 my_model='VX8300'
100 101 # Fundamentals: 102 # - get_esn - Brew 103 # - getgroups - same as LG VX-8100 104 # - getwallpaperindices - LGUncountedIndexedMedia 105 # - getringtoneindices - LGUncountedIndexedMedia 106 # - DM Version - 4 to access brew/16452/lk/mr on newer firmwares 107 108 parentprofile=com_lgvx8100.Profile
109 -class Profile(parentprofile):
110 protocolclass=Phone.protocolclass 111 serialsname=Phone.serialsname 112 113 BP_Calendar_Version=3 114 phone_manufacturer='LG Electronics Inc' 115 phone_model='VX8300' 116 117 WALLPAPER_WIDTH=275 118 WALLPAPER_HEIGHT=175 119 MAX_WALLPAPER_BASENAME_LENGTH=32 120 WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ." 121 WALLPAPER_CONVERT_FORMAT="jpg" 122 123 # the 8300 uses "W" for wait in the dialstring, it does not support "T" 124 DIALSTRING_CHARS="[^0-9PW#*]" 125 126 MAX_RINGTONE_BASENAME_LENGTH=32 127 RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ." 128 129 imageorigins={} 130 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 131 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video")) 132 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images(sd)")) 133 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video(sd)"))
134 - def GetImageOrigins(self):
135 return self.imageorigins
136 137 ringtoneorigins=('ringers', 'sounds', 'mp3') 138 excluded_ringtone_origins=('sounds', 'mp3') 139 140 # our targets are the same for all origins 141 imagetargets={} 142 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 143 {'width': 176, 'height': 184, 'format': "JPEG"})) 144 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 145 {'width': 96, 'height': 81, 'format': "JPEG"})) 146
147 - def GetTargetsForImageOrigin(self, origin):
148 return self.imagetargets
149
150 - def QueryAudio(self, origin, currentextension, afi):
151 # we don't modify any of these 152 if afi.format in ("MIDI", "QCP", "PMD", "WMA"): 153 return currentextension, afi 154 # examine mp3 155 if afi.format=="MP3": 156 if afi.channels==1 and 8<=afi.bitrate<=64 and 16000<=afi.samplerate<=22050: 157 return currentextension, afi 158 # convert it 159 return ("mp3", fileinfo.AudioFileInfo(afi, **{'format': 'MP3', 'channels': 1, 'bitrate': 32, 'samplerate': 22050}))
160
161 - def __init__(self):
162 parentprofile.__init__(self)
163 164 _supportedsyncs=( 165 ('phonebook', 'read', None), # all phonebook reading 166 ('calendar', 'read', None), # all calendar reading 167 ('wallpaper', 'read', None), # all wallpaper reading 168 ('ringtone', 'read', None), # all ringtone reading 169 ('call_history', 'read', None),# all call history list reading 170 ('sms', 'read', None), # all SMS list reading 171 ('memo', 'read', None), # all memo list reading 172 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 173 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 174 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 175 ('wallpaper', 'write', 'OVERWRITE'), 176 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 177 ('ringtone', 'write', 'OVERWRITE'), 178 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 179 ('memo', 'write', 'OVERWRITE'), # all memo list writing 180 ) 181 182 field_color_data={ 183 'phonebook': { 184 'name': { 185 'first': 1, 'middle': 1, 'last': 1, 'full': 1, 186 'nickname': 0, 'details': 1 }, 187 'number': { 188 'type': 5, 'speeddial': 5, 'number': 5, 'details': 5 }, 189 'email': 2, 190 'address': { 191 'type': 0, 'company': 0, 'street': 0, 'street2': 0, 192 'city': 0, 'state': 0, 'postalcode': 0, 'country': 0, 193 'details': 0 }, 194 'url': 0, 195 'memo': 0, 196 'category': 1, 197 'wallpaper': 0, 198 'ringtone': 2, 199 'storage': 0, 200 }, 201 'calendar': { 202 'description': True, 'location': False, 'allday': False, 203 'start': True, 'end': True, 'priority': False, 204 'alarm': True, 'vibrate': True, 205 'repeat': True, 206 'memo': False, 207 'category': False, 208 'wallpaper': False, 209 'ringtone': True, 210 }, 211 'memo': { 212 'subject': True, 213 'date': True, 214 'secret': False, 215 'category': False, 216 'memo': True, 217 }, 218 'todo': { 219 'summary': False, 220 'status': False, 221 'due_date': False, 222 'percent_complete': False, 223 'completion_date': False, 224 'private': False, 225 'priority': False, 226 'category': False, 227 'memo': False, 228 }, 229 }
230