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

Source Code for Module phones.com_motov3m

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2007 Joe Pham <djpham@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_motov3m.py 4537 2007-12-30 03:32:13Z djpham $ 
  9   
 10  """Communicate with Motorola phones using AT commands""" 
 11   
 12  import common 
 13  import com_motov710 as v710 
 14  import helpids 
 15  import fileinfo 
 16  import p_motov3m 
 17  import prototypes 
 18   
 19  parentphone=v710.Phone 
20 -class Phone(parentphone):
21 desc='Moto-V3m' 22 helpid=helpids.ID_PHONE_MOTOV3M 23 protocolclass=p_motov3m 24 serialsname='motov3m' 25 builtinringtones=( 26 (0, ('Silent',)), 27 (5, ('Vibe Dot', 'Vibe Dash', 'Vibe Dot Dot', 'Vibe Dot Dash', 28 'Vibe Pulse')), 29 ) 30
31 - def __init__(self, logtarget, commport):
32 parentphone.__init__(self, logtarget, commport)
33
34 - def _get_wallpaper_index(self):
35 res={} 36 _files=self.listfiles(self.protocolclass.WP_PATH).keys() 37 _files.sort() 38 for _index,_filename in enumerate(_files): 39 _name=common.basename(_filename) 40 if self.protocolclass.valid_wp_filename(_name): 41 res[_index]={ 'name': _name, 42 'filename': _filename, 43 'origin': 'images' } 44 return res
45
46 - def _get_ringtone_index(self):
47 res={} 48 # first the builtin ones 49 for _l in self.builtinringtones: 50 _idx=_l[0] 51 for _e in _l[1]: 52 res[_idx]={ 'name': _e, 'origin': 'builtin' } 53 _idx+=1 54 # now the custome one 55 _buf=prototypes.buffer(self.getfilecontents( 56 self.protocolclass.RT_INDEX_FILE)) 57 _idx_file=self.protocolclass.ringtone_index_file() 58 _idx_file.readfrombuffer(_buf, logtitle='Read ringtone index file') 59 for _entry in _idx_file.items: 60 _filename=self.decode_utf16(_entry.name) 61 _name=common.basename(_filename) 62 if self.protocolclass.valid_rt_filename(_name): 63 res[_entry.index]={ 'name': _name, 64 'filename': _filename, 65 'type': _entry.ringtone_type, 66 'origin': 'ringers' } 67 return res
68 69 70 #------------------------------------------------------------------------------- 71 parentprofile=v710.Profile
72 -class Profile(parentprofile):
73 serialsname=Phone.serialsname 74 75 # use for auto-detection 76 phone_manufacturer='Motorola' 77 phone_model='V3m ' 78 common_model_name='V3m' 79 generic_phone_model='Motorola CDMA V3m Phone' 80 81 # fill in the list of ringtone/sound origins on your phone 82 ringtoneorigins=('ringers',) 83 84 # our targets are the same for all origins 85 imagetargets={} 86 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 87 {'width': 176, 'height': 184, 'format': "JPEG"})) 88 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 89 {'width': 96, 'height': 72, 'format': "JPEG"})) 90 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 91 {'width': 176, 'height': 220, 'format': "JPEG"})) 92 93 _supportedsyncs=( 94 ('phonebook', 'read', None), # all phonebook reading 95 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 96 ('calendar', 'read', None), # all calendar reading 97 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 98 ('wallpaper', 'read', None), # all wallpaper reading 99 ('wallpaper', 'write', 'OVERWRITE'), 100 ('sms', 'read', None), # all SMS list reading DJP 101 )
102