PyXR

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



0001 ### BITPIM
0002 ###
0003 ### Copyright (C) 2003-2004 Roger Binns <rogerb@rogerbinns.com>
0004 ###
0005 ### This program is free software; you can redistribute it and/or modify
0006 ### it under the terms of the BitPim license as detailed in the LICENSE file.
0007 ###
0008 ### $Id: com_lgvx4500.py 3918 2007-01-19 05:15:12Z djpham $
0009 
0010 """Communicate with the LG VX4500 cell phone
0011 
0012 The VX4500 is substantially similar to the VX4400
0013 
0014 """
0015 
0016 # standard modules
0017 import time
0018 import cStringIO
0019 import sha
0020 
0021 # my modules
0022 import common
0023 import copy
0024 import p_lgvx4500
0025 import com_lgvx4400
0026 import com_brew
0027 import com_phone
0028 import com_lg
0029 import helpids
0030 import prototypes
0031 
0032 class Phone(com_lgvx4400.Phone):
0033     "Talk to the LG VX4500 cell phone"
0034 
0035     desc="LG-VX4500"
0036     helpid=helpids.ID_PHONE_LGVX4500
0037     protocolclass=p_lgvx4500
0038     serialsname='lgvx4500'
0039 
0040     # more VX4500 indices
0041     imagelocations=(
0042         # offset, index file, files location, type, maximumentries
0043         ( 10, "download/dloadindex/brewImageIndex.map", "brew/shared", "images", 30) ,
0044         )
0045 
0046     ringtonelocations=(
0047         # offset, index file, files location, type, maximumentries
0048         ( 50, "download/dloadindex/brewRingerIndex.map", "user/sound/ringer", "ringers", 30),
0049         )
0050 
0051     builtinimages= ('Foliage', 'Castle', 'Dandelion', 'Golf course', 'Icicles', 
0052                     'Orangutan', 'Lake', 'Golden Gate', 'Desert')
0053 
0054     builtinringtones= ('Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6',
0055                        'Ring 7', 'Ring 8', 'Annen Polka', 'Pachelbel Canon', 
0056                        'Hallelujah', 'La Traviata', 'Leichte Kavallerie Overture', 
0057                        'Mozart Symphony No.40', 'Bach Minuet', 'Farewell', 
0058                        'Mozart Piano Sonata', 'Sting', 'O solemio', 
0059                        'Pizzicata Polka', 'Stars and Stripes Forever', 
0060                        'Pineapple Rag', 'When the Saints Go Marching In', 'Latin', 
0061                        'Carol 1', 'Carol 2', 'Chimes high', 'Chimes low', 'Ding', 
0062                        'TaDa', 'Notify', 'Drum', 'Claps', 'Fanfare', 'Chord high', 
0063                        'Chord low') 
0064                        
0065     
0066     def __init__(self, logtarget, commport):
0067         com_lgvx4400.Phone.__init__(self,logtarget,commport)
0068         self.mode=self.MODENONE
0069 
0070     def makeentry(self, counter, entry, dict):
0071         e=com_lgvx4400.Phone.makeentry(self, counter, entry, dict)
0072         e.entrysize=0x202
0073         #e.unknown20c="\x00\x00\x00\x00\x00\x31\x02"
0074         return e
0075 
0076     my_model='VX4500'
0077 
0078     def getphoneinfo(self, phone_info):
0079         self.log('Getting Phone Info')
0080         try:
0081             s=self.getfilecontents('brew/version.txt')
0082             if s[:6]=='VX4500':
0083                 phone_info.model=self.my_model
0084                 phone_info.manufacturer=Profile.phone_manufacturer
0085                 req=p_brew.firmwarerequest()
0086                 res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse)
0087                 phone_info.append('Firmware Version:', res.firmware)
0088                 s=self.getfilecontents("nvm/$SYS.ESN")[85:89]
0089                 txt='%02X%02X%02X%02X'%(ord(s[3]), ord(s[2]), ord(s[1]), ord(s[0]))
0090                 phone_info.append('ESN:', txt)
0091                 txt=self.getfilecontents("nvm/nvm/nvm_0000")[457:467]
0092                 phone_info.append('Phone Number:', txt)
0093         except:
0094             if __debug__:
0095                 raise
0096 
0097 
0098 parentprofile=com_lgvx4400.Profile
0099 class Profile(parentprofile):
0100     protocolclass=Phone.protocolclass
0101     serialsname=Phone.serialsname
0102     phone_manufacturer='LG Electronics Inc'
0103     phone_model='VX4500'
0104 
0105     # no direct usb interface
0106     usbids=com_lgvx4400.Profile.usbids_usbtoserial
0107 
0108     WALLPAPER_WIDTH=120
0109     WALLPAPER_HEIGHT=131
0110     MAX_WALLPAPER_BASENAME_LENGTH=19
0111     WALLPAPER_FILENAME_CHARS="abcdefghijklmnopqrstuvwxyz0123456789 ."
0112     WALLPAPER_CONVERT_FORMAT="bmp"
0113 
0114     MAX_RINGTONE_BASENAME_LENGTH=19
0115     RINGTONE_FILENAME_CHARS="abcdefghijklmnopqrstuvxwyz0123456789 ."
0116 
0117     imageorigins={}
0118     imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
0119     def GetImageOrigins(self):
0120         return self.imageorigins
0121 
0122     # our targets are the same for all origins
0123     imagetargets={}
0124     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
0125                                       {'width': 120, 'height': 131, 'format': "BMP"}))
0126     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid",
0127                                       {'width': 120, 'height': 131, 'format': "BMP"}))
0128     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen",
0129                                       {'width': 120, 'height': 160, 'format': "BMP"}))
0130 
0131     def GetTargetsForImageOrigin(self, origin):
0132         return self.imagetargets
0133     
0134     _supportedsyncs=(
0135         ('phonebook', 'read', None),  # all phonebook reading
0136         ('calendar', 'read', None),   # all calendar reading
0137         ('wallpaper', 'read', None),  # all wallpaper reading
0138         ('ringtone', 'read', None),   # all ringtone reading
0139         ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
0140         ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
0141         ('wallpaper', 'write', 'MERGE'),      # merge and overwrite wallpaper
0142         ('wallpaper', 'write', 'OVERWRITE'),
0143         ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
0144         ('ringtone', 'write', 'OVERWRITE'),
0145         ('memo', 'read', None),     # all memo list reading DJP
0146         ('memo', 'write', 'OVERWRITE'),  # all memo list writing DJP
0147         ('call_history', 'read', None),
0148         ('sms', 'read', None),
0149         ('sms', 'write', 'OVERWRITE'),
0150        )
0151 
0152     def __init__(self):
0153         parentprofile.__init__(self)
0154 

Generated by PyXR 0.9.4