PyXR

c:\projects\bitpim\src \ phones \ com_lgvx5300.py



0001 ### BITPIM
0002 ###
0003 ### Copyright (C) 2005 Simon Capper <skyjunky@sbcglobal.net>
0004 ### Copyright (C) 2006 Bart Massey <bitpim@po8.org>
0005 ###
0006 ### This program is free software; you can redistribute it and/or modify
0007 ### it under the terms of the BitPim license as detailed in the LICENSE file.
0008 ###
0009 ### $Id: com_lgvx5300.py 4360 2007-08-17 03:39:44Z djpham $
0010 
0011 """Communicate with the LG VX5300 cell phone
0012 
0013 
0014 For now, this is just a copy of the LG VX8300 stuff with the
0015 names changed so that the phone will work.
0016 
0017 """
0018 
0019 # standard modules
0020 import time
0021 import cStringIO
0022 import sha
0023 
0024 # my modules
0025 import common
0026 import commport
0027 import copy
0028 import com_lgvx4400
0029 import p_brew
0030 import p_lgvx5300
0031 import com_lgvx8300
0032 import com_brew
0033 import com_phone
0034 import com_lg
0035 import prototypes
0036 import bpcalendar
0037 import call_history
0038 import sms
0039 import memo
0040 import fileinfo
0041 import helpids
0042 
0043 parentphone=com_lgvx8300.Phone
0044 class Phone(parentphone):
0045     "Talk to the LG VX5300 cell phone"
0046 
0047     desc="LG-VX5300"
0048     helpid=helpids.ID_PHONE_LGVX5300
0049     protocolclass=p_lgvx5300
0050     serialsname='lgvx5300'
0051     my_model='VX5300'
0052 
0053     external_storage_root='mmc1/'
0054 
0055     builtinringtones= ('Low Beep Once', 'Low Beeps', 'Loud Beep Once', 'Loud Beeps', 'VZW Default Ringtone') + \
0056                       tuple(['Ringtone '+`n` for n in range(1,11)]) + \
0057                       ('No Ring',)
0058 
0059     ringtonelocations= (
0060         #  type          index file            default dir        external dir    max  type Index
0061         ( 'ringers',    'dload/myringtone.dat','brew/16452/lk/mr','mmc1/ringers', 100, 0x01, None),
0062         ( 'sounds',     'dload/mysound.dat',   'brew/16452/ms',   '',             100, 0x02, None),
0063         ( 'mp3',        'dload/my_mp3.dat',    'mmc1/my_mp3',     '',             100, 0x15, None),
0064         )
0065 
0066     calendarlocation="sch/schedule.dat"
0067     calendarexceptionlocation="sch/schexception.dat"
0068     calenderrequiresreboot=1
0069     memolocation="sch/memo.dat"
0070 
0071     builtinwallpapers = () # none
0072 
0073     wallpaperlocations= (
0074         #  type          index file            default dir     external dir  max  type Index
0075         ( 'images',     'dload/image.dat',    'brew/16452/mp', '',           100, 0x00, None),
0076         ( 'video',      'dload/video.dat',    'brew/16452/mf', '',           100, 0x03, None),
0077         )
0078 
0079     def setDMversion(self):
0080         _fw_version=self.get_firmware_version()[-1]
0081         # T53VZV04 uses DMv5
0082         self._DMv5=self.my_model=='VX5300' and _fw_version>'3'
0083         if self._DMv5:
0084             self._timeout = 20
0085 
0086     # Fundamentals:
0087     #  - get_esn             - same as LG VX-8300
0088     #  - getgroups           - same as LG VX-8100
0089     #  - getwallpaperindices - LGNewIndexedMedia2
0090     #  - getringtoneindices  - LGNewIndexedMedia2
0091     #  - DM Version          - T53VZV01 - T53VZV03: N/A, T53VZV04: 5
0092 
0093 parentprofile=com_lgvx8300.Profile
0094 class Profile(parentprofile):
0095     protocolclass=Phone.protocolclass
0096     serialsname=Phone.serialsname
0097 
0098     BP_Calendar_Version=3
0099     phone_manufacturer='LG Electronics Inc'
0100     phone_model='VX5300'
0101 
0102     WALLPAPER_WIDTH=275
0103     WALLPAPER_HEIGHT=175
0104     MAX_WALLPAPER_BASENAME_LENGTH=32
0105     WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ."
0106     WALLPAPER_CONVERT_FORMAT="jpg"
0107 
0108     # the 5300 uses "W" for wait in the dialstring, it does not support "T"
0109     DIALSTRING_CHARS="[^0-9PW#*]"
0110 
0111     MAX_RINGTONE_BASENAME_LENGTH=32
0112     RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_() ."
0113 
0114     imageorigins={}
0115     imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
0116     imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))
0117     def GetImageOrigins(self):
0118         return self.imageorigins
0119 
0120     ringtoneorigins=('ringers', 'sounds', 'mp3')
0121     excluded_ringtone_origins=('sounds', 'mp3')
0122 
0123     # our targets are the same for all origins
0124     imagetargets={}
0125     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
0126                                       {'width': 176, 'height': 184, 'format': "JPEG"}))
0127     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd",
0128                                       {'width': 96, 'height': 81, 'format': "JPEG"}))
0129 
0130     def GetTargetsForImageOrigin(self, origin):
0131         return self.imagetargets
0132 
0133     def QueryAudio(self, origin, currentextension, afi):
0134         # we don't modify any of these
0135         if afi.format in ("MIDI", "QCP", "PMD", "WMA"):
0136             return currentextension, afi
0137         # examine mp3
0138         if afi.format=="MP3":
0139             if afi.channels==1 and 8<=afi.bitrate<=64 and 16000<=afi.samplerate<=22050:
0140                 return currentextension, afi
0141         # convert it
0142         return ("mp3", fileinfo.AudioFileInfo(afi, **{'format': 'MP3', 'channels': 1, 'bitrate': 32, 'samplerate': 22050}))
0143 
0144     def __init__(self):
0145         parentprofile.__init__(self)
0146 
0147     _supportedsyncs=(
0148         ('phonebook', 'read', None),  # all phonebook reading
0149         ('calendar', 'read', None),   # all calendar reading
0150         ('wallpaper', 'read', None),  # all wallpaper reading
0151         ('ringtone', 'read', None),   # all ringtone reading
0152         ('call_history', 'read', None),# all call history list reading
0153         ('sms', 'read', None),         # all SMS list reading
0154 ##        ('memo', 'read', None),        # all memo list reading
0155         ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
0156         ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
0157         ('wallpaper', 'write', 'MERGE'),      # merge and overwrite wallpaper
0158         ('wallpaper', 'write', 'OVERWRITE'),
0159         ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
0160         ('ringtone', 'write', 'OVERWRITE'),
0161         ('sms', 'write', 'OVERWRITE'),        # all SMS list writing
0162 ##        ('memo', 'write', 'OVERWRITE'),       # all memo list writing
0163         )
0164 
0165     field_color_data={
0166         'phonebook': {
0167             'name': {
0168                 'first': 1, 'middle': 1, 'last': 1, 'full': 1,
0169                 'nickname': 0, 'details': 1 },
0170             'number': {
0171                 'type': 5, 'speeddial': 5, 'number': 5, 'details': 5 },
0172             'email': 2,
0173             'address': {
0174                 'type': 0, 'company': 0, 'street': 0, 'street2': 0,
0175                 'city': 0, 'state': 0, 'postalcode': 0, 'country': 0,
0176                 'details': 0 },
0177             'url': 0,
0178             'memo': 0,
0179             'category': 1,
0180             'wallpaper': 0,
0181             'ringtone': 2,
0182             'storage': 0,
0183             },
0184         'calendar': {
0185             'description': True, 'location': False, 'allday': False,
0186             'start': True, 'end': True, 'priority': False,
0187             'alarm': True, 'vibrate': True,
0188             'repeat': True,
0189             'memo': False,
0190             'category': False,
0191             'wallpaper': False,
0192             'ringtone': True,
0193             },
0194         'memo': {
0195             'subject': False,
0196             'date': False,
0197             'secret': False,
0198             'category': False,
0199             'memo': False,
0200             },
0201         'todo': {
0202             'summary': False,
0203             'status': False,
0204             'due_date': False,
0205             'percent_complete': False,
0206             'completion_date': False,
0207             'private': False,
0208             'priority': False,
0209             'category': False,
0210             'memo': False,
0211             },
0212         }
0213 

Generated by PyXR 0.9.4