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

Source Code for Module phones.com_samsungspha460

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2005 Stephen Wood <saw@bitpim.org> 
  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_samsungspha460.py 3918 2007-01-19 05:15:12Z djpham $ 
  9   
 10  """Communicate with a Samsung SPH-A460""" 
 11   
 12  import sha 
 13  import re 
 14  import struct 
 15   
 16  import common 
 17  import commport 
 18  import p_samsungspha460 
 19  import p_brew 
 20  import com_brew 
 21  import com_phone 
 22  import com_samsung_packet 
 23  import prototypes 
 24  import helpids 
 25   
 26  numbertypetab=('home','office','cell','pager','fax','none') 
 27   
28 -class Phone(com_samsung_packet.Phone):
29 "Talk to a Samsung SPH-A460 phone" 30 31 desc="SPH-A460" 32 helpid=helpids.ID_PHONE_SAMSUNGOTHERS 33 protocolclass=p_samsungspha460 34 serialsname='spha460' 35 __groups_range=xrange(5) 36 37 imagelocations=() 38 # offset, index file, files location, type, maximumentries 39 40 __ams_index_file="ams/AmsRegistry" 41
42 - def __init__(self, logtarget, commport):
43 com_samsung_packet.Phone.__init__(self, logtarget, commport) 44 self.numbertypetab=numbertypetab 45 self.mode=self.MODENONE
46
47 - def getfundamentals(self, results):
48 """Gets information fundamental to interopating with the phone and UI.""" 49 50 # use a hash of ESN and other stuff (being paranoid) 51 self.log("Retrieving fundamental phone information") 52 self.log("Phone serial number") 53 print "Calling setmode MODEMODEM" 54 self.setmode(self.MODEMODEM) 55 print "Getting serial number" 56 results['uniqueserial']=sha.new(self.get_esn()).hexdigest() 57 58 self.log("Reading group information") 59 print "Getting Groups" 60 results['groups']=self.read_groups() 61 print "Got Groups" 62 63 self.log("Fundamentals retrieved") 64 return results
65
66 - def savegroups(self, data):
67 """Write the groups, sending only those groups that have had 68 a name change. (So that ringers don't get messed up)""" 69 groups=data['groups'] 70 71 groups_onphone=self.read_groups() # Get groups on phone 72 73 keys=groups.keys() 74 keys.sort() 75 76 for k in keys: 77 if groups[k]['name']!=groups_onphone[k]['name']: 78 if groups[k]['name']!="Unassigned": 79 req=self.protocolclass.groupnamesetrequest() 80 req.gid=k 81 req.groupname=groups[k]['name'] 82 # Response will have ERROR, even though it works 83 self.sendpbcommand(req, self.protocolclass.unparsedresponse, ignoreerror=True)
84 85 getwallpapers=None 86 getringtones=None
87
88 -class Profile(com_samsung_packet.Profile):
89 protocolclass=Phone.protocolclass 90 serialsname=Phone.serialsname 91 phone_manufacturer='SAMSUNG' 92 phone_model='SPH-A460/148' 93
94 - def __init__(self):
97 98 _supportedsyncs=( 99 ('phonebook', 'read', None), # all phonebook reading 100 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 101 ('calendar', 'read', None), # all calendar reading 102 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 103 ('todo', 'read', None), # all todo list reading 104 ('todo', 'write', 'OVERWRITE'), # only overwriting calendar 105 )
106