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

Source Code for Module phones.com_sanyo3100

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2005 Stephen Wood <sawecw@users.sf.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  ### $Id: com_sanyo3100.py 4528 2007-12-26 05:51:17Z sawecw $ 
  9   
 10  """Talk to the Sanyo SCP-3100 cell phone""" 
 11  # standard modules 
 12  import re 
 13  import time 
 14  import sha 
 15   
 16  # my modules 
 17  import common 
 18  import com_sanyo8300 
 19  import p_brew 
 20  import p_sanyo8300 
 21  import p_sanyo3100 
 22  import commport 
 23  import com_brew 
 24  import com_phone 
 25  import com_sanyo 
 26  import com_sanyomedia 
 27  import com_sanyonewer 
 28  import prototypes 
 29  import bpcalendar 
 30   
 31  numbertypetab=( 'cell', 'home', 'office', 'pager', 
 32                      'fax', 'data', 'none' ) 
33 34 -class Phone(com_sanyo8300.Phone):
35 "Talk to the Sanyo PM3100 cell phone" 36 37 desc="SCP3100" 38 # WOrking directories 1,2,4 39 FIRST_MEDIA_DIRECTORY=1 40 LAST_MEDIA_DIRECTORY=2 41 42 imagelocations=( 43 # offset, directory #, indexflag, type, maximumentries 44 ) 45 46 protocolclass=p_sanyo3100 47 serialsname='scp3100' 48 49 builtinringtones=( 'None', 'Vibrate', '', '', '', '', '', '', '', 50 'Tone 1', 'Tone 2', 'Tone 3', 'Tone 4', 'Tone 5', 51 'Tone 6', 'Tone 7', 'Tone 8', 52 '', '', '', '', '', 53 '', '', '', 54 '', '', '', '', 55 'Hungarian Dance No.5', 'Asian Jingle', 56 'Ska Big Band', 'Habanera', 'Clair de Lune', 57 'Nocturne', 'Techno Beat', 'Jazz Melody','','','','','','','','','','','','','','','','','','','Ringer & Voice') 58 59 calendar_defaultringtone=4 60 calendar_defaultcaringtone=4 61
62 - def __init__(self, logtarget, commport):
63 com_sanyo8300.Phone.__init__(self, logtarget, commport) 64 self.mode=self.MODENONE 65 self.numbertypetab=numbertypetab
66 67 # Phone Detection-----------------------------------------------------------
68 - def is_mode_brew(self):
69 # Borrowed from the VX4400 70 req=self.protocolclass.firmwarerequest() 71 respc=p_brew.testing0cresponse 72 for baud in 0, 38400, 115200: 73 if baud: 74 if not self.comm.setbaudrate(baud): 75 continue 76 try: 77 self.sendbrewcommand(req, respc, callsetmode=False) 78 return True 79 except com_phone.modeignoreerrortypes: 80 pass 81 return False
82 - def check_my_phone(self, res):
83 # check if this is an 6600 84 try: 85 _req=self.protocolclass.sanyofirmwarerequest() 86 _resp=self.sendbrewcommand(_req, self.protocolclass.sanyofirmwareresponse) 87 if _resp.phonemodel[:len(self.detected_model)]==self.detected_model: 88 # yup, this's it! 89 res['model']=self.my_model 90 res['manufacturer']=self.my_manufacturer 91 res['esn']=self.get_esn() 92 except: 93 if __debug__: 94 raise
95 96 @classmethod
97 - def detectphone(_, coms, likely_ports, res, _module, _log):
98 if not likely_ports: 99 # cannot detect any likely ports 100 return None 101 for port in likely_ports: 102 if not res.has_key(port): 103 res[port]={ 'mode_modem': None, 'mode_brew': None, 104 'manufacturer': None, 'model': None, 105 'firmware_version': None, 'esn': None, 106 'firmwareresponse': None } 107 try: 108 if res[port]['mode_brew']==False or \ 109 res[port]['model']: 110 # either phone is not in BREW, or a model has already 111 # been found, not much we can do now 112 continue 113 p=_module.Phone(_log, commport.CommConnection(_log, port, timeout=1)) 114 if res[port]['mode_brew'] is None: 115 res[port]['mode_brew']=p.is_mode_brew() 116 if res[port]['mode_brew']: 117 p.check_my_phone(res[port]) 118 p.comm.close() 119 except com_brew.BrewBadBrewCommandException: 120 pass 121 except: 122 if __debug__: 123 raise
124 125 my_model='SCP3100' 126 detected_model='SCP-3100/US' 127 my_manufacturer='SANYO'
128 129 parentprofile=com_sanyo8300.Profile
130 -class Profile(parentprofile):
131 132 protocolclass=Phone.protocolclass 133 serialsname=Phone.serialsname 134 phone_manufacturer=Phone.my_manufacturer 135 phone_model=Phone.my_model 136 137 _supportedsyncs=( 138 ('phonebook', 'read', None), # all phonebook reading 139 ('calendar', 'read', None), # all calendar reading 140 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 141 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 142 ('wallpaper', 'read', None), # all wallpaper reading 143 ('ringtone', 'read', None), # all ringtone reading 144 ('call_history', 'read', None),# all call history list reading 145 ('sms', 'read', None), # Read sms messages 146 ('todo', 'read', None), # Read todos 147 ) 148 149 # which usb ids correspond to us 150 usbids=( ( 0x0474, 0x071F, 1),) # VID=Sanyo, 151 deviceclasses=("serial",) 152
153 - def __init__(self):
154 parentprofile.__init__(self) 155 com_sanyonewer.Profile.__init__(self) 156 self.numbertypetab=numbertypetab
157