0001 ### BITPIM 0002 ### 0003 ### Copyright (C) 2006 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_samsungscha930.py 4174 2007-04-01 19:13:48Z djpham $ 0009 0010 """Communicate with the Samsung SCH-A930 Phone""" 0011 0012 # System Models 0013 import fnmatch 0014 0015 # BitPim modules 0016 import common 0017 import com_samsungscha950 as com_a950 0018 import p_samsungscha950 as p_a950 0019 import p_samsungscha930 as p_a930 0020 import helpids 0021 0022 class Phone(com_a950.Phone): 0023 desc='SCH-A930' 0024 helpid=helpids.ID_PHONE_SAMSUNGSCHA930 0025 protocolclass=p_a930 0026 serialsname='scha930' 0027 0028 # Detection stuff 0029 my_model='SCH-A930/DM' 0030 my_manufacturer='SAMSUNG' 0031 detected_model='A930' 0032 0033 ringtone_noring_range='range_tones_preloaded_el_15' 0034 ringtone_default_range='range_tones_preloaded_el_01' 0035 builtin_ringtones={ 0036 'VZW Default Tone': ringtone_default_range, 0037 'Melody 1': 'range_tones_preloaded_el_05', 0038 'Melody 2': 'range_tones_preloaded_el_06', 0039 'Melody 3': 'range_tones_preloaded_el_07', 0040 'Melody 4': 'range_tones_preloaded_el_08', 0041 'Melody 5': 'range_tones_preloaded_el_09', 0042 'Melody 6': 'range_tones_preloaded_el_10', 0043 'Bell 1': 'range_tones_preloaded_el_02', 0044 'Bell 2': 'range_tones_preloaded_el_03', 0045 'Bell 3': 'range_tones_preloaded_el_04', 0046 'Beep Once': 'range_tones_preloaded_el_11', 0047 'No Ring': ringtone_noring_range, 0048 } 0049 builtin_sounds={ 0050 'Birthday': 'range_sound_preloaded_el_birthday', 0051 'Clapping': 'range_sound_preloaded_el_clapping', 0052 'Crowd Roar': 'range_sound_preloaded_el_crowed_roar', 0053 'Rainforest': 'range_sound_preloaded_el_rainforest', 0054 'Train': 'range_sound_preloaded_el_train', 0055 # same as ringtones ?? 0056 'Sound Beep Once': 'range_sound_preloaded_el_beep_once', 0057 'Sound No Ring': 'range_sound_preloaded_el_no_rings', 0058 } 0059 builtin_wallpapers={ 0060 'Preloaded1': 'range_f_wallpaper_preloaded_el_01', 0061 'Preloaded2': 'range_f_wallpaper_preloaded_el_02', 0062 'Preloaded3': 'range_f_wallpaper_preloaded_el_03', 0063 'Preloaded4': 'range_f_wallpaper_preloaded_el_04', 0064 'Preloaded5': 'range_f_wallpaper_preloaded_el_05', 0065 'Preloaded6': 'range_f_wallpaper_preloaded_el_06', 0066 'Preloaded7': 'range_f_wallpaper_preloaded_el_07', 0067 'Preloaded8': 'range_f_wallpaper_preloaded_el_08', 0068 } 0069 0070 # adding video to the wallpaper stuff 0071 def _get_video_index(self, idx, result): 0072 # just scan the dir for *.3g2 files 0073 _files=self.listfiles(self.protocolclass.FLIX_PATH) 0074 for _,_f in _files.items(): 0075 _filename=_f['name'] 0076 _name=common.basename(_filename) 0077 if fnmatch.fnmatch(_name, '*.3g2'): 0078 result[idx]= { 'name': _name, 0079 'filename': _filename, 0080 'origin': 'video', 0081 } 0082 idx+=1 0083 return idx 0084 0085 def get_wallpaper_index(self): 0086 _res={} 0087 _idx=self._get_file_wallpaper_index(0, _res) 0088 self._get_video_index(_idx, _res) 0089 return _res 0090 0091 def savewallpapers(self, fundamentals, merge): 0092 # send wallpapers to the phone 0093 """Save ringtones to the phone""" 0094 self.log('Writing wallpapers to the phone') 0095 try: 0096 _del_list, _new_list=self._get_del_new_list('wallpaper-index', 0097 'wallpapers', 0098 merge, 0099 fundamentals, 0100 ('video',)) 0101 if __debug__: 0102 self.log('Delete list: '+','.join(_del_list)) 0103 self.log('New list: '+','.join(_new_list)) 0104 self._replace_files('wallpaper-index', 'wallpapers', 0105 _new_list, fundamentals) 0106 self._del_files('wallpaper-index', 0107 _del_list, fundamentals) 0108 self._add_files('wallpaper-index', 'wallpapers', 0109 _new_list, fundamentals) 0110 self._update_media_index(self.protocolclass.WPictureIndexFile, 0111 self.protocolclass.WPictureIndexEntry, 0112 [self.protocolclass.PIC_PATH, 0113 self.protocolclass.PIC_PATH2], 0114 self.protocolclass.PIC_EXCLUDED_FILES, 0115 self.protocolclass.PIC_INDEX_FILE_NAME) 0116 fundamentals['rebootphone']=True 0117 except: 0118 if __debug__: 0119 raise 0120 return fundamentals 0121 0122 #------------------------------------------------------------------------------- 0123 parentprofile=com_a950.Profile 0124 class Profile(parentprofile): 0125 serialsname=Phone.serialsname 0126 # For phone detection 0127 phone_manufacturer=Phone.my_manufacturer 0128 phone_model=Phone.my_model 0129 # "Warning" media size limit 0130 RINGTONE_LIMITS= { 0131 'MAXSIZE': 290000 0132 } 0133 0134 # fill in the list of ringtone/sound origins on your phone 0135 ringtoneorigins=('ringers',) 0136 # all dumped in "images" 0137 imageorigins={} 0138 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 0139 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video")) 0140 def GetImageOrigins(self): 0141 return self.imageorigins 0142 0143 # our targets are the same for all origins 0144 imagetargets={} 0145 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 0146 {'width': 176, 'height': 186, 'format': "JPEG"})) 0147 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 0148 {'width': 128, 'height': 96, 'format': "JPEG"})) 0149 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 0150 {'width': 176, 'height': 220, 'format': "JPEG"})) 0151 def __init__(self): 0152 parentprofile.__init__(self) 0153 0154 _supportedsyncs=( 0155 ('phonebook', 'read', None), # all phonebook reading 0156 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 0157 ('calendar', 'read', None), # all calendar reading 0158 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 0159 ('ringtone', 'read', None), # all ringtone reading 0160 ('ringtone', 'write', 'MERGE'), 0161 ('wallpaper', 'read', None), # all wallpaper reading 0162 ('wallpaper', 'write', None), 0163 ('memo', 'read', None), # all memo list reading DJP 0164 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 0165 ('call_history', 'read', None),# all call history list reading 0166 ('sms', 'read', None), # all SMS list reading DJP 0167 ) 0168
Generated by PyXR 0.9.4