PyXR

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



0001 ### BITPIM
0002 ###
0003 ### Copyright (C) 2006 Simon Capper <skyjunky@sbcglobal.net>
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 
0009 """Communicate with the LG 6200 (Sprint) cell phone"""
0010 
0011 # standard modules
0012 import re
0013 import time
0014 import cStringIO
0015 import sha
0016 
0017 # my modules
0018 import p_lglg6200
0019 import p_brew
0020 import common
0021 import commport
0022 import com_brew
0023 import com_phone
0024 import com_lg
0025 import com_lgvx4400
0026 import com_lgpm225
0027 import prototypes
0028 import call_history
0029 import sms
0030 import fileinfo
0031 import memo
0032 
0033 
0034 class Phone(com_lgpm225.Phone):
0035     "Talk to the LG 6200 cell phone"
0036 
0037     desc="LG 6200"
0038     helpid=None
0039     protocolclass=p_lglg6200
0040     serialsname='lg6200'
0041 
0042     # read only locations, for regular ringers/wallpaper this phone stores
0043     # the information in a different location
0044     imagelocations=(
0045         # offset, index file, files location, type, maximumentries
0046         (0x600, "setas/dcamIndex.map", "Dcam/Wallet", "camera", 50, 6),
0047         )
0048 
0049     ringtonelocations=(
0050         # offset, index file, files location, type, maximumentries
0051         (0x1100, "setas/voicememoRingerIndex.map", "VoiceDB/All/Memos", "voice_memo", 50, 11),
0052         )
0053 
0054     builtinimages=()
0055 
0056     builtinringtones=( 'Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6',
0057                        'Alert 1', 'Alert 2', 'Alert 3', 'Alert 4', 'Alert 5', 'Alert 6',
0058                        'Jazztic', 'Rock & Roll', 'Grand waltz', 'Toccata and Fugue',
0059                        'Sunday afternoon', 'Bumble bee', 'Circus band', 'Cuckoo waltz',
0060                        'Latin', 'CanCan', 'Play tag', 'Eine kleine Nacht', 'Symphony No.25 in G Minor',
0061                        'Capriccio a minor', 'Moon light', 'A nameless girl', 'From the new world', 
0062                        'They called me Elvis')
0063 
0064     def __init__(self, logtarget, commport):
0065         "Calls all the constructors and sets initial modes"
0066         com_phone.Phone.__init__(self, logtarget, commport)
0067         com_brew.BrewProtocol.__init__(self)
0068         com_lg.LGPhonebook.__init__(self)
0069         self.log("Attempting to contact phone")
0070         self._cal_has_voice_id=hasattr(self.protocolclass, 'cal_has_voice_id') \
0071                                 and self.protocolclass.cal_has_voice_id
0072         self.mode=self.MODENONE
0073 
0074 
0075 #----- Phone Detection -----------------------------------------------------------
0076 
0077     # this phone has no version file, but the string is in one of the nvm files
0078     brew_version_file='nvm/nvm/nvm_lg_param'
0079     brew_version_txt_key='LG6200_version_data'
0080     my_model='LG_LG6200' 
0081 
0082     def eval_detect_data(self, res):
0083         found=False
0084         if res.get(self.brew_version_txt_key, None) is not None:
0085             found=res[self.brew_version_txt_key][0x5b1:0x5b1+len(self.my_model)]==self.my_model
0086         if found:
0087             res['model']=self.my_model
0088             res['manufacturer']='LG Electronics Inc'
0089             s=res.get(self.esn_file_key, None)
0090             if s:
0091                 res['esn']=self.get_esn(s)
0092 
0093     def getphoneinfo(self, phone_info):
0094         self.log('Getting Phone Info')
0095         try:
0096             s=self.getfilecontents(self.brew_version_file)
0097             if s[0x5b1:0x5b1+len(self.my_model)]==self.my_model:
0098                 phone_info.append('Model:', self.my_model)
0099                 phone_info.append('ESN:', self.get_brew_esn())
0100                 req=p_brew.firmwarerequest()
0101                 #res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse)
0102                 #phone_info.append('Firmware Version:', res.firmware)
0103                 txt=self.getfilecontents("nvm/nvm/nvm_0000")[0x241:0x24b]
0104                 phone_info.append('Phone Number:', txt)
0105         except:
0106             pass
0107         return
0108 
0109 
0110 parentprofile=com_lgpm225.Profile
0111 class Profile(parentprofile):
0112     protocolclass=Phone.protocolclass
0113     serialsname=Phone.serialsname
0114     BP_Calendar_Version=3
0115     phone_manufacturer='LG Electronics Inc'
0116     phone_model='LG_LG6200'      # from Sasktel (Bell Mobility)
0117     brew_required=True
0118     RINGTONE_LIMITS= {
0119         'MAXSIZE': 250000
0120     }
0121 
0122     WALLPAPER_WIDTH=160
0123     WALLPAPER_HEIGHT=120
0124     MAX_WALLPAPER_BASENAME_LENGTH=30
0125     WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .-_"
0126     WALLPAPER_CONVERT_FORMAT="jpg"
0127     
0128     MAX_RINGTONE_BASENAME_LENGTH=30
0129     RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .-_"
0130     DIALSTRING_CHARS="[^0-9PT#*]"
0131 
0132     # our targets are the same for all origins
0133     imagetargets={}
0134     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
0135                                       {'width': 128, 'height': 160, 'format': "JPEG"}))
0136 
0137     _supportedsyncs=(
0138         ('phonebook', 'read', None),  # all phonebook reading
0139         ('calendar', 'read', None),   # all calendar reading
0140         ('wallpaper', 'read', None),  # all wallpaper reading
0141         ('ringtone', 'read', None),   # all ringtone reading
0142         ('call_history', 'read', None),# all call history list reading
0143         ('memo', 'read', None),        # all memo list reading
0144         ('sms', 'read', None),         # all SMS list reading
0145         ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
0146         ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
0147         ('wallpaper', 'write', 'MERGE'),      # merge and overwrite wallpaper
0148         ('wallpaper', 'write', 'OVERWRITE'),
0149         ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
0150         ('ringtone', 'write', 'OVERWRITE'),
0151         ('memo', 'write', 'OVERWRITE'),       # all memo list writing
0152         ('sms', 'write', 'OVERWRITE'),        # all SMS list writing
0153         )
0154 

Generated by PyXR 0.9.4