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

Source Code for Module phones.com_lgvx9700

  1  #!/usr/bin/env python 
  2   
  3  ### BITPIM 
  4  ### 
  5  ### Copyright (C) 2008 Nathan Hjelm <hjelmn@users.sourceforge.net> 
  6  ### 
  7  ### This program is free software; you can redistribute it and/or modify 
  8  ### it under the terms of the BitPim license as detailed in the LICENSE file. 
  9  ### 
 10  ### $Id: com_lgvx9700.py 4678 2008-08-13 23:46:56Z djpham $ 
 11   
 12   
 13   
 14  """ 
 15  Communicate with the LG VX9700 cell phone. 
 16  """ 
 17   
 18  # BitPim modules 
 19  import common 
 20  import com_brew 
 21  import prototypes 
 22  import com_lgvx10000 
 23  import p_lgvx9700 
 24  import helpids 
 25  import sms 
 26   
 27  #------------------------------------------------------------------------------- 
 28  parentphone=com_lgvx10000.Phone 
29 -class Phone(parentphone):
30 desc="LG-VX9700 (Dare)" 31 helpid=helpids.ID_PHONE_LGVX9700 32 protocolclass=p_lgvx9700 33 serialsname='lgvx9700' 34 35 my_model='VX9700' 36 builtinringtones= ('Low Beep Once', 'Low Beeps', 'Loud Beep Once', 'Loud Beeps', 'VZW Default Ringtone', 37 'Home Phone', 'Simple Beep', 'Short Note Beep', 'Old Bell', 'Move Bell', 'Wahwah', 38 'Just Fine', 'Froggy Night', 'Whistling Wizard', 'Like a Movie', 'Deep Blue Sea', 39 'Sweet & Twenty', 'Funky Band', 'Why Not', 'Mystique', 'Evening Grow', 'This Time', 40 'Hawaiian Punch', 'L.O.V.E.', 'Night Sky', 'No Ring',) 41
42 - def setDMversion(self):
43 self._DMv5=False 44 self._DMv6=True 45 self._timeout=5 # Assume a quick timeout on newer phones
46 47 # Fundamentals: 48 # - get_esn - same as LG VX-8300 49 # - getgroups - same as LG VX-8700 50 # - getwallpaperindices - LGUncountedIndexedMedia 51 # - getringtoneindices - LGUncountedIndexedMedia 52 # - DM Version - 6 53 # - phonebook - same as LG VX-8550 54 # - SMS - same dir structure as the VX-8800 55
56 - def _getoutboxmessage(self, sf):
57 entry=sms.SMSEntry() 58 entry.folder=entry.Folder_Sent 59 entry.datetime="%d%02d%02dT%02d%02d%02d" % ((sf.timesent)) 60 # add all the recipients 61 for r in sf.recipients: 62 if r.number: 63 confirmed=(r.status==5) 64 confirmed_date=None 65 if confirmed: 66 confirmed_date="%d%02d%02dT%02d%02d%02d" % r.timereceived 67 entry.add_recipient(r.number, confirmed, confirmed_date) 68 entry.subject=sf.subject 69 txt="" 70 if sf.num_msg_elements==1 and not sf.messages[0].binary: 71 txt=self._get_text_from_sms_msg_without_header(sf.messages[0].msg, sf.messages[0].length) 72 else: 73 for i in range(sf.num_msg_elements): 74 txt+=self._get_text_from_sms_msg_with_header(sf.messages[i].msg, sf.messages[i].length) 75 entry.text=unicode(txt, errors='ignore') 76 if sf.priority==0: 77 entry.priority=sms.SMSEntry.Priority_Normal 78 else: 79 entry.priority=sms.SMSEntry.Priority_High 80 entry.locked=sf.locked 81 entry.callback=sf.callback 82 return entry
83
84 - def _getinboxmessage(self, sf):
85 entry=sms.SMSEntry() 86 entry.folder=entry.Folder_Inbox 87 entry.datetime="%d%02d%02dT%02d%02d%02d" % (sf.GPStime) 88 entry._from=sf.sender if sf.sender else sf.sender_name 89 entry.subject=sf.subject 90 entry.locked=sf.locked 91 if sf.priority==0: 92 entry.priority=sms.SMSEntry.Priority_Normal 93 else: 94 entry.priority=sms.SMSEntry.Priority_High 95 entry.read=sf.read 96 txt="" 97 _decode_func=self._get_text_from_sms_msg_with_header if \ 98 sf.msgs[1].msg_length else \ 99 self._get_text_from_sms_msg_without_header 100 for _entry in sf.msgs: 101 if _entry.msg_length: 102 txt+=_decode_func(_entry.msg_data.msg, _entry.msg_length) 103 entry.text=unicode(txt, errors='ignore') 104 entry.callback=sf.callback 105 return entry
106 107 #------------------------------------------------------------------------------- 108 parentprofile=com_lgvx10000.Profile
109 -class Profile(parentprofile):
110 protocolclass=Phone.protocolclass 111 serialsname=Phone.serialsname 112 113 BP_Calendar_Version=3 114 phone_manufacturer='LG Electronics Inc' 115 phone_model='VX9700' 116 # inside screen resoluation 117 WALLPAPER_WIDTH = 400 118 WALLPAPER_HEIGHT = 240 119 120 imageorigins={} 121 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images")) 122 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video")) 123 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images(sd)")) 124 imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video(sd)")) 125 126 # our targets are the same for all origins 127 imagetargets={} 128 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd", 129 {'width': 240, 'height': 400, 'format': "JPEG"})) 130 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper", 131 {'width': 400, 'height': 240, 'format': "JPEG"})) 132 imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid", 133 {'width': 120, 'height': 100, 'format': "JPEG"})) 134 135 _supportedsyncs=( 136 ('phonebook', 'read', None), # all phonebook reading 137 ('calendar', 'read', None), # all calendar reading 138 ('wallpaper', 'read', None), # all wallpaper reading 139 ('ringtone', 'read', None), # all ringtone reading 140 ('call_history', 'read', None),# all call history list reading 141 ('sms', 'read', None), # all SMS list reading 142 ('memo', 'read', None), # all memo list reading 143 ('phonebook', 'write', 'OVERWRITE'), # only overwriting phonebook 144 ('calendar', 'write', 'OVERWRITE'), # only overwriting calendar 145 ('wallpaper', 'write', 'MERGE'), # merge and overwrite wallpaper 146 ('wallpaper', 'write', 'OVERWRITE'), 147 ('ringtone', 'write', 'MERGE'), # merge and overwrite ringtone 148 ('ringtone', 'write', 'OVERWRITE'), 149 ('sms', 'write', 'OVERWRITE'), # all SMS list writing 150 ('memo', 'write', 'OVERWRITE'), # all memo list writing 151 ## ('playlist', 'read', 'OVERWRITE'), 152 ## ('playlist', 'write', 'OVERWRITE'), 153 ('t9_udb', 'write', 'OVERWRITE'), 154 ) 155 if __debug__: 156 _supportedsyncs+=( 157 ('t9_udb', 'read', 'OVERWRITE'), 158 )
159