PyXR

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



0001 ### BITPIM
0002 ###
0003 ### Copyright (C) 2007 Joe Pham <djpham@bitpim.org>
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 ### $Id: com_motov3m.py 4537 2007-12-30 03:32:13Z djpham $
0009 
0010 """Communicate with Motorola phones using AT commands"""
0011 
0012 import common
0013 import com_motov710 as v710
0014 import helpids
0015 import fileinfo
0016 import p_motov3m
0017 import prototypes
0018 
0019 parentphone=v710.Phone
0020 class Phone(parentphone):
0021     desc='Moto-V3m'
0022     helpid=helpids.ID_PHONE_MOTOV3M
0023     protocolclass=p_motov3m
0024     serialsname='motov3m'
0025     builtinringtones=(
0026         (0, ('Silent',)),
0027         (5, ('Vibe Dot', 'Vibe Dash', 'Vibe Dot Dot', 'Vibe Dot Dash',
0028              'Vibe Pulse')),
0029         )
0030 
0031     def __init__(self, logtarget, commport):
0032         parentphone.__init__(self, logtarget, commport)
0033 
0034     def _get_wallpaper_index(self):
0035         res={}
0036         _files=self.listfiles(self.protocolclass.WP_PATH).keys()
0037         _files.sort()
0038         for _index,_filename in enumerate(_files):
0039             _name=common.basename(_filename)
0040             if self.protocolclass.valid_wp_filename(_name):
0041                 res[_index]={ 'name': _name,
0042                               'filename': _filename,
0043                               'origin': 'images' }
0044         return res
0045 
0046     def _get_ringtone_index(self):
0047         res={}
0048         # first the builtin ones
0049         for _l in self.builtinringtones:
0050             _idx=_l[0]
0051             for _e in _l[1]:
0052                 res[_idx]={ 'name': _e, 'origin': 'builtin' }
0053                 _idx+=1
0054         # now the custome one
0055         _buf=prototypes.buffer(self.getfilecontents(
0056             self.protocolclass.RT_INDEX_FILE))
0057         _idx_file=self.protocolclass.ringtone_index_file()
0058         _idx_file.readfrombuffer(_buf, logtitle='Read ringtone index file')
0059         for _entry in _idx_file.items:
0060             _filename=self.decode_utf16(_entry.name)
0061             _name=common.basename(_filename)
0062             if self.protocolclass.valid_rt_filename(_name):
0063                 res[_entry.index]={ 'name': _name,
0064                                     'filename': _filename,
0065                                     'type': _entry.ringtone_type,
0066                                     'origin': 'ringers' }
0067         return res
0068 
0069 
0070 #-------------------------------------------------------------------------------
0071 parentprofile=v710.Profile
0072 class Profile(parentprofile):
0073     serialsname=Phone.serialsname
0074 
0075     # use for auto-detection
0076     phone_manufacturer='Motorola'
0077     phone_model='V3m '
0078     common_model_name='V3m'
0079     generic_phone_model='Motorola CDMA V3m Phone'
0080 
0081     # fill in the list of ringtone/sound origins on your phone
0082     ringtoneorigins=('ringers',)
0083 
0084     # our targets are the same for all origins
0085     imagetargets={}
0086     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
0087                                       {'width': 176, 'height': 184, 'format': "JPEG"}))
0088     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd",
0089                                       {'width': 96, 'height': 72, 'format': "JPEG"}))
0090     imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen",
0091                                       {'width': 176, 'height': 220, 'format': "JPEG"}))
0092 
0093     _supportedsyncs=(
0094         ('phonebook', 'read', None),  # all phonebook reading
0095         ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
0096         ('calendar', 'read', None),   # all calendar reading
0097         ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
0098         ('wallpaper', 'read', None),  # all wallpaper reading
0099         ('wallpaper', 'write', 'OVERWRITE'),
0100         ('sms', 'read', None),     # all SMS list reading DJP
0101         )
0102 

Generated by PyXR 0.9.4