Package phones ::
Module com_motok1m
|
|
1
2
3
4
5
6
7
8
9
10 """Communicate with Motorola K1m phones using AT commands"""
11
12
13 import common
14 import com_motov710m
15 import prototypes
16 import p_motok1m
17 import helpids
18
19 parentphone=com_motov710m.Phone
21 desc='Moto-K1m'
22 helpid=helpids.ID_PHONE_MOTOK1M
23 serialsname='motok1m'
24 protocolclass=p_motok1m
25
26 builtinringtones=(
27 (0, ('No Ring',)),
28 )
29
30 - def __init__(self, logtarget, commport):
32
33
61
63 """Retrieve ringtones data"""
64 self.log('Reading ringtones')
65 self.setmode(self.MODEOBEX)
66 _res={}
67 _rt_index=fundamentals.get('ringtone-index', {})
68 for _entry in _rt_index.values():
69 if _entry.has_key('filename'):
70 try:
71 _res[_entry['name']]=self.obex.getfilecontents(
72 self.protocolclass.OBEXName(_entry['filename']))
73 except:
74 self.log('Failed to read media file %s'%_entry['filename'])
75 fundamentals['ringtone']=_res
76 self.setmode(self.MODEMODEM)
77 return fundamentals
78
80 """Save ringtones to the phone"""
81 self.log('Writing ringtones to the phone')
82 self.setmode(self.MODEPHONEBOOK)
83 self.setmode(self.MODEBREW)
84 try:
85 _del_list, _new_list=self._get_del_new_list('ringtone-index',
86 'ringtone',
87 merge,
88 fundamentals,
89 frozenset(['sounds']))
90
91 self._replace_files('ringtone-index', 'ringtone',
92 _new_list, fundamentals)
93
94 self.setmode(self.MODEOBEX)
95 self._del_files('ringtone-index', 'audio',
96 _del_list, fundamentals)
97
98 self._add_files('ringtone-index', 'ringtone', 'audio',
99 _new_list, fundamentals)
100 except:
101 if __debug__:
102 self.setmode(self.MODEMODEM)
103 raise
104 self.setmode(self.MODEMODEM)
105 return fundamentals
106
107
108
109 parentprofile=com_motov710m.Profile
111 serialsname=Phone.serialsname
112 usbids=( ( 0x22B8, 0x2A64, 1),)
113
114
115 ringtoneorigins=('ringers', 'sounds')
116
117 excluded_ringtone_origins=()
118 imageorigins={}
119 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
120 excluded_wallpaper_origins=()
121
122 phone_manufacturer='Motorola'
123 phone_model='K1m'
124 common_model_name='K1m'
125 generic_phone_model='Motorola CDMA K1m phone'
126
127
128 imagetargets={}
129 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
130 {'width': 176, 'height': 184, 'format': "JPEG"}))
131 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd",
132 {'width': 96, 'height': 67, 'format': "JPEG"}))
133 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen",
134 {'width': 176, 'height': 220, 'format': "JPEG"}))
135
136 field_color_data=parentprofile.field_color_data
137 field_color_data.update({
138 'phonebook': {
139 'name': {
140 'first': 1, 'middle': 1, 'last': 1, 'full': 1,
141 'nickname': 0, 'details': 1 },
142 'number': {
143 'type': 5, 'speeddial': 5, 'number': 5,
144 'details': 5,
145 'ringtone': 5, 'wallpaper': 5 },
146 'email': 2,
147 'email_details': {
148 'emailspeeddial': 2, 'emailringtone': 2,
149 'emailwallpaper': 2 },
150 'address': {
151 'type': 0, 'company': 0, 'street': 0, 'street2': 0,
152 'city': 0, 'state': 0, 'postalcode': 0, 'country': 0,
153 'details': 0 },
154 'url': 0,
155 'memo': 0,
156 'category': 1,
157 'wallpaper': 1,
158 'ringtone': 1,
159 'storage': 0,
160 }})
161