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

Source Code for Module phones.com_lgvx5300

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2005 Simon Capper <skyjunky@sbcglobal.net> 
  4  ### Copyright (C) 2006 Bart Massey <bitpim@po8.org> 
  5  ### 
  6  ### This program is free software; you can redistribute it and/or modify 
  7  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  8  ### 
  9  ### $Id: com_lgvx5300.py 4360 2007-08-17 03:39:44Z djpham $ 
 10   
 11  """Communicate with the LG VX5300 cell phone 
 12   
 13   
 14  For now, this is just a copy of the LG VX8300 stuff with the 
 15  names changed so that the phone will work. 
 16   
 17  """ 
 18   
 19  # standard modules 
 20  import time 
 21  import cStringIO 
 22  import sha 
 23   
 24  # my modules 
 25  import common 
 26  import commport 
 27  import copy 
 28  import com_lgvx4400 
 29  import p_brew 
 30  import p_lgvx5300 
 31  import com_lgvx8300 
 32  import com_brew 
 33  import com_phone 
 34  import com_lg 
 35  import prototypes 
 36  import bpcalendar 
 37  import call_history 
 38  import sms 
 39  import memo 
 40  import fileinfo 
 41  import helpids 
 42   
 43  parentphone=com_lgvx8300.Phone 
44 -class Phone(parentphone):
45 "Talk to the LG VX5300 cell phone" 46 47 desc="LG-VX5300" 48 helpid=helpids.ID_PHONE_LGVX5300 49 protocolclass=p_lgvx5300 50 serialsname='lgvx5300' 51 my_model='VX5300' 52 53 external_storage_root='mmc1/' 54 55 builtinringtones= ('Low Beep Once', 'Low Beeps', 'Loud Beep Once', 'Loud Beeps', 'VZW Default Ringtone') + \ 56 tuple(['Ringtone '+`n` for n in range(1,11)]) + \ 57 ('No Ring',) 58 59 ringtonelocations= ( 60 # type index file default dir external dir max type Index 61 ( 'ringers', 'dload/myringtone.dat','brew/16452/lk/mr','mmc1/ringers', 100, 0x01, None), 62 ( 'sounds', 'dload/mysound.dat', 'brew/16452/ms', '', 100, 0x02, None), 63 ( 'mp3', 'dload/my_mp3.dat', 'mmc1/my_mp3', '', 100, 0x15, None), 64 ) 65 66 calendarlocation="sch/schedule.dat" 67 calendarexceptionlocation="sch/schexception.dat" 68 calenderrequiresreboot=1 69 memolocation="sch/memo.dat" 70 71 builtinwallpapers = () # none 72 73 wallpaperlocations= ( 74 # type index file default dir external dir max type Index 75 ( 'images', 'dload/image.dat', 'brew/16452/mp', '', 100, 0x00, None), 76 ( 'video', 'dload/video.dat', 'brew/16452/mf', '', 100, 0x03, None), 77 ) 78
79 - def setDMversion(self):
80 _fw_version=self.get_firmware_version()[-1] 81 # T53VZV04 uses DMv5 82 self._DMv5=self.my_model=='VX5300' and _fw_version>'3' 83 if self._DMv5: 84 self._timeout = 20
85 86 # Fundamentals: 87 # - get_esn - same as LG VX-8300 88 # - getgroups - same as LG VX-8100 89 # - getwallpaperindices - LGNewIndexedMedia2 90 # - getringtoneindices - LGNewIndexedMedia2 91 # - DM Version - T53VZV01 - T53VZV03: N/A, T53VZV04: 5 92 93 parentprofile=com_lgvx8300.Profile
94 -class Profile(parentprofile):
95 protocolclass=Phone.protocolclass 96 serialsname=Phone.serialsname 97 98 BP_Calendar_Version=3 99 phone_manufacturer='LG Electronics Inc' 100 phone_model='VX5300' 101 102 WALLPAPER_WIDTH=275 103 WALLPAPER_HEIGHT=175 104 MAX_WALLPAPER_BASENAME_LENGTH=32 105 WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ." 106 WALLPAPER_CONVERT_FORMAT="jpg" 107 108 # the 5300 uses "W" for wait in the dialstring, it does not support "T" 109 DIALSTRING_CHARS="[^0-9PW#*]" 110 111 MAX_RINGTONE_BASENAME_LENGTH=32 112 RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ." 113 114 imageorigins={} 115 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 116 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))
117 - def GetImageOrigins(self):
118 return self.imageorigins
119 120 ringtoneorigins=('ringers', 'sounds', 'mp3') 121 excluded_ringtone_origins=('sounds', 'mp3') 122 123 # our targets are the same for all origins 124 imagetargets={} 125 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 126 {'width': 176, 'height': 184, 'format': "JPEG"})) 127 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 128 {'width': 96, 'height': 81, 'format': "JPEG"})) 129
130 - def GetTargetsForImageOrigin(self, origin):
131 return self.imagetargets
132
133 - def QueryAudio(self, origin, currentextension, afi):
134 # we don't modify any of these 135 if afi.format in ("MIDI", "QCP", "PMD", "WMA"): 136 return currentextension, afi 137 # examine mp3 138 if afi.format=="MP3": 139 if afi.channels==1 and 8<=afi.bitrate<=64 and 16000<=afi.samplerate<=22050: 140 return currentextension, afi 141 # convert it 142 return ("mp3", fileinfo.AudioFileInfo(afi, **{'format': 'MP3', 'channels': 1, 'bitrate': 32, 'samplerate': 22050}))
143
144 - def __init__(self):
145 parentprofile.__init__(self)
146 147 _supportedsyncs=( 148 ('phonebook', 'read', None), # all phonebook reading 149 ('calendar', 'read', None), # all calendar reading 150 ('wallpaper', 'read', None), # all wallpaper reading 151 ('ringtone', 'read', None), # all ringtone reading 152 ('call_history', 'read', None),# all call history list reading 153 ('sms', 'read', None), # all SMS list reading 154 ## ('memo', 'read', None), # all memo list reading 155 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 156 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 157 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 158 ('wallpaper', 'write', 'OVERWRITE'), 159 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 160 ('ringtone', 'write', 'OVERWRITE'), 161 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 162 ## ('memo', 'write', 'OVERWRITE'), # all memo list writing 163 ) 164 165 field_color_data={ 166 'phonebook': { 167 'name': { 168 'first': 1, 'middle': 1, 'last': 1, 'full': 1, 169 'nickname': 0, 'details': 1 }, 170 'number': { 171 'type': 5, 'speeddial': 5, 'number': 5, 'details': 5 }, 172 'email': 2, 173 'address': { 174 'type': 0, 'company': 0, 'street': 0, 'street2': 0, 175 'city': 0, 'state': 0, 'postalcode': 0, 'country': 0, 176 'details': 0 }, 177 'url': 0, 178 'memo': 0, 179 'category': 1, 180 'wallpaper': 0, 181 'ringtone': 2, 182 'storage': 0, 183 }, 184 'calendar': { 185 'description': True, 'location': False, 'allday': False, 186 'start': True, 'end': True, 'priority': False, 187 'alarm': True, 'vibrate': True, 188 'repeat': True, 189 'memo': False, 190 'category': False, 191 'wallpaper': False, 192 'ringtone': True, 193 }, 194 'memo': { 195 'subject': False, 196 'date': False, 197 'secret': False, 198 'category': False, 199 'memo': False, 200 }, 201 'todo': { 202 'summary': False, 203 'status': False, 204 'due_date': False, 205 'percent_complete': False, 206 'completion_date': False, 207 'private': False, 208 'priority': False, 209 'category': False, 210 'memo': False, 211 }, 212 }
213