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

Source Code for Module phones.com_samsungscha930

  1  ### BITPIM 
  2  ### 
  3  ### Copyright (C) 2006 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_samsungscha930.py 4174 2007-04-01 19:13:48Z djpham $ 
  9   
 10  """Communicate with the Samsung SCH-A930 Phone""" 
 11   
 12  # System Models 
 13  import fnmatch 
 14   
 15  # BitPim modules 
 16  import common 
 17  import com_samsungscha950 as com_a950 
 18  import p_samsungscha950 as p_a950 
 19  import p_samsungscha930 as p_a930 
 20  import helpids 
 21   
22 -class Phone(com_a950.Phone):
23 desc='SCH-A930' 24 helpid=helpids.ID_PHONE_SAMSUNGSCHA930 25 protocolclass=p_a930 26 serialsname='scha930' 27 28 # Detection stuff 29 my_model='SCH-A930/DM' 30 my_manufacturer='SAMSUNG' 31 detected_model='A930' 32 33 ringtone_noring_range='range_tones_preloaded_el_15' 34 ringtone_default_range='range_tones_preloaded_el_01' 35 builtin_ringtones={ 36 'VZW Default Tone': ringtone_default_range, 37 'Melody 1': 'range_tones_preloaded_el_05', 38 'Melody 2': 'range_tones_preloaded_el_06', 39 'Melody 3': 'range_tones_preloaded_el_07', 40 'Melody 4': 'range_tones_preloaded_el_08', 41 'Melody 5': 'range_tones_preloaded_el_09', 42 'Melody 6': 'range_tones_preloaded_el_10', 43 'Bell 1': 'range_tones_preloaded_el_02', 44 'Bell 2': 'range_tones_preloaded_el_03', 45 'Bell 3': 'range_tones_preloaded_el_04', 46 'Beep Once': 'range_tones_preloaded_el_11', 47 'No Ring': ringtone_noring_range, 48 } 49 builtin_sounds={ 50 'Birthday': 'range_sound_preloaded_el_birthday', 51 'Clapping': 'range_sound_preloaded_el_clapping', 52 'Crowd Roar': 'range_sound_preloaded_el_crowed_roar', 53 'Rainforest': 'range_sound_preloaded_el_rainforest', 54 'Train': 'range_sound_preloaded_el_train', 55 # same as ringtones ?? 56 'Sound Beep Once': 'range_sound_preloaded_el_beep_once', 57 'Sound No Ring': 'range_sound_preloaded_el_no_rings', 58 } 59 builtin_wallpapers={ 60 'Preloaded1': 'range_f_wallpaper_preloaded_el_01', 61 'Preloaded2': 'range_f_wallpaper_preloaded_el_02', 62 'Preloaded3': 'range_f_wallpaper_preloaded_el_03', 63 'Preloaded4': 'range_f_wallpaper_preloaded_el_04', 64 'Preloaded5': 'range_f_wallpaper_preloaded_el_05', 65 'Preloaded6': 'range_f_wallpaper_preloaded_el_06', 66 'Preloaded7': 'range_f_wallpaper_preloaded_el_07', 67 'Preloaded8': 'range_f_wallpaper_preloaded_el_08', 68 } 69 70 # adding video to the wallpaper stuff
71 - def _get_video_index(self, idx, result):
72 # just scan the dir for *.3g2 files 73 _files=self.listfiles(self.protocolclass.FLIX_PATH) 74 for _,_f in _files.items(): 75 _filename=_f['name'] 76 _name=common.basename(_filename) 77 if fnmatch.fnmatch(_name, '*.3g2'): 78 result[idx]= { 'name': _name, 79 'filename': _filename, 80 'origin': 'video', 81 } 82 idx+=1 83 return idx
84
85 - def get_wallpaper_index(self):
86 _res={} 87 _idx=self._get_file_wallpaper_index(0, _res) 88 self._get_video_index(_idx, _res) 89 return _res
90
91 - def savewallpapers(self, fundamentals, merge):
92 # send wallpapers to the phone 93 """Save ringtones to the phone""" 94 self.log('Writing wallpapers to the phone') 95 try: 96 _del_list, _new_list=self._get_del_new_list('wallpaper-index', 97 'wallpapers', 98 merge, 99 fundamentals, 100 ('video',)) 101 if __debug__: 102 self.log('Delete list: '+','.join(_del_list)) 103 self.log('New list: '+','.join(_new_list)) 104 self._replace_files('wallpaper-index', 'wallpapers', 105 _new_list, fundamentals) 106 self._del_files('wallpaper-index', 107 _del_list, fundamentals) 108 self._add_files('wallpaper-index', 'wallpapers', 109 _new_list, fundamentals) 110 self._update_media_index(self.protocolclass.WPictureIndexFile, 111 self.protocolclass.WPictureIndexEntry, 112 [self.protocolclass.PIC_PATH, 113 self.protocolclass.PIC_PATH2], 114 self.protocolclass.PIC_EXCLUDED_FILES, 115 self.protocolclass.PIC_INDEX_FILE_NAME) 116 fundamentals['rebootphone']=True 117 except: 118 if __debug__: 119 raise 120 return fundamentals
121 122 #------------------------------------------------------------------------------- 123 parentprofile=com_a950.Profile
124 -class Profile(parentprofile):
125 serialsname=Phone.serialsname 126 # For phone detection 127 phone_manufacturer=Phone.my_manufacturer 128 phone_model=Phone.my_model 129 # "Warning" media size limit 130 RINGTONE_LIMITS= { 131 'MAXSIZE': 290000 132 } 133 134 # fill in the list of ringtone/sound origins on your phone 135 ringtoneorigins=('ringers',) 136 # all dumped in "images" 137 imageorigins={} 138 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 139 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))
140 - def GetImageOrigins(self):
141 return self.imageorigins
142 143 # our targets are the same for all origins 144 imagetargets={} 145 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 146 {'width': 176, 'height': 186, 'format': "JPEG"})) 147 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 148 {'width': 128, 'height': 96, 'format': "JPEG"})) 149 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen", 150 {'width': 176, 'height': 220, 'format': "JPEG"}))
151 - def __init__(self):
152 parentprofile.__init__(self)
153 154 _supportedsyncs=( 155 ('phonebook', 'read', None), # all phonebook reading 156 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 157 ('calendar', 'read', None), # all calendar reading 158 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 159 ('ringtone', 'read', None), # all ringtone reading 160 ('ringtone', 'write', 'MERGE'), 161 ('wallpaper', 'read', None), # all wallpaper reading 162 ('wallpaper', 'write', None), 163 ('memo', 'read', None), # all memo list reading DJP 164 ('memo', 'write', 'OVERWRITE'), # all memo list writing DJP 165 ('call_history', 'read', None),# all call history list reading 166 ('sms', 'read', None), # all SMS list reading DJP 167 )
168