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

Source Code for Module phones.com_lglg6200

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2006 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 6200 (Sprint) cell phone""" 
 10   
 11  # standard modules 
 12  import re 
 13  import time 
 14  import cStringIO 
 15  import sha 
 16   
 17  # my modules 
 18  import p_lglg6200 
 19  import p_brew 
 20  import common 
 21  import commport 
 22  import com_brew 
 23  import com_phone 
 24  import com_lg 
 25  import com_lgvx4400 
 26  import com_lgpm225 
 27  import prototypes 
 28  import call_history 
 29  import sms 
 30  import fileinfo 
 31  import memo 
 32   
 33   
34 -class Phone(com_lgpm225.Phone):
35 "Talk to the LG 6200 cell phone" 36 37 desc="LG 6200" 38 helpid=None 39 protocolclass=p_lglg6200 40 serialsname='lg6200' 41 42 # read only locations, for regular ringers/wallpaper this phone stores 43 # the information in a different location 44 imagelocations=( 45 # offset, index file, files location, type, maximumentries 46 (0x600, "setas/dcamIndex.map", "Dcam/Wallet", "camera", 50, 6), 47 ) 48 49 ringtonelocations=( 50 # offset, index file, files location, type, maximumentries 51 (0x1100, "setas/voicememoRingerIndex.map", "VoiceDB/All/Memos", "voice_memo", 50, 11), 52 ) 53 54 builtinimages=() 55 56 builtinringtones=( 'Ring 1', 'Ring 2', 'Ring 3', 'Ring 4', 'Ring 5', 'Ring 6', 57 'Alert 1', 'Alert 2', 'Alert 3', 'Alert 4', 'Alert 5', 'Alert 6', 58 'Jazztic', 'Rock & Roll', 'Grand waltz', 'Toccata and Fugue', 59 'Sunday afternoon', 'Bumble bee', 'Circus band', 'Cuckoo waltz', 60 'Latin', 'CanCan', 'Play tag', 'Eine kleine Nacht', 'Symphony No.25 in G Minor', 61 'Capriccio a minor', 'Moon light', 'A nameless girl', 'From the new world', 62 'They called me Elvis') 63
64 - def __init__(self, logtarget, commport):
65 "Calls all the constructors and sets initial modes" 66 com_phone.Phone.__init__(self, logtarget, commport) 67 com_brew.BrewProtocol.__init__(self) 68 com_lg.LGPhonebook.__init__(self) 69 self.log("Attempting to contact phone") 70 self._cal_has_voice_id=hasattr(self.protocolclass, 'cal_has_voice_id') \ 71 and self.protocolclass.cal_has_voice_id 72 self.mode=self.MODENONE
73 74 75 #----- Phone Detection ----------------------------------------------------------- 76 77 # this phone has no version file, but the string is in one of the nvm files 78 brew_version_file='nvm/nvm/nvm_lg_param' 79 brew_version_txt_key='LG6200_version_data' 80 my_model='LG_LG6200' 81
82 - def eval_detect_data(self, res):
83 found=False 84 if res.get(self.brew_version_txt_key, None) is not None: 85 found=res[self.brew_version_txt_key][0x5b1:0x5b1+len(self.my_model)]==self.my_model 86 if found: 87 res['model']=self.my_model 88 res['manufacturer']='LG Electronics Inc' 89 s=res.get(self.esn_file_key, None) 90 if s: 91 res['esn']=self.get_esn(s)
92
93 - def getphoneinfo(self, phone_info):
94 self.log('Getting Phone Info') 95 try: 96 s=self.getfilecontents(self.brew_version_file) 97 if s[0x5b1:0x5b1+len(self.my_model)]==self.my_model: 98 phone_info.append('Model:', self.my_model) 99 phone_info.append('ESN:', self.get_brew_esn()) 100 req=p_brew.firmwarerequest() 101 #res=self.sendbrewcommand(req, self.protocolclass.firmwareresponse) 102 #phone_info.append('Firmware Version:', res.firmware) 103 txt=self.getfilecontents("nvm/nvm/nvm_0000")[0x241:0x24b] 104 phone_info.append('Phone Number:', txt) 105 except: 106 pass 107 return
108 109 110 parentprofile=com_lgpm225.Profile
111 -class Profile(parentprofile):
112 protocolclass=Phone.protocolclass 113 serialsname=Phone.serialsname 114 BP_Calendar_Version=3 115 phone_manufacturer='LG Electronics Inc' 116 phone_model='LG_LG6200' # from Sasktel (Bell Mobility) 117 brew_required=True 118 RINGTONE_LIMITS= { 119 'MAXSIZE': 250000 120 } 121 122 WALLPAPER_WIDTH=160 123 WALLPAPER_HEIGHT=120 124 MAX_WALLPAPER_BASENAME_LENGTH=30 125 WALLPAPER_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .-_" 126 WALLPAPER_CONVERT_FORMAT="jpg" 127 128 MAX_RINGTONE_BASENAME_LENGTH=30 129 RINGTONE_FILENAME_CHARS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .-_" 130 DIALSTRING_CHARS="[^0-9PT#*]" 131 132 # our targets are the same for all origins 133 imagetargets={} 134 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 135 {'width': 128, 'height': 160, 'format': "JPEG"})) 136 137 _supportedsyncs=( 138 ('phonebook', 'read', None), # all phonebook reading 139 ('calendar', 'read', None), # all calendar reading 140 ('wallpaper', 'read', None), # all wallpaper reading 141 ('ringtone', 'read', None), # all ringtone reading 142 ('call_history', 'read', None),# all call history list reading 143 ('memo', 'read', None), # all memo list reading 144 ('sms', 'read', None), # all SMS list reading 145 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 146 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 147 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 148 ('wallpaper', 'write', 'OVERWRITE'), 149 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 150 ('ringtone', 'write', 'OVERWRITE'), 151 ('memo', 'write', 'OVERWRITE'), # all memo list writing 152 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 153 )
154