PM-8200 SMS Support Added
Jordan Foley <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
I have finally been able to read off the text messages off of my phone
and import them into BitPim. Not all of the data in a sms is decoded but
most of it looks constant between messages so I do not mess with it and
I already have all of the info needed to display it for BitPim, until I
add support to write to the phone I will not worry about it. The PM-8200
does not have a subject line on the phone so instead I made the subject
in this format:
(Message #)-(Phone Number)-(First 12 letters of message)
This makes reading of text messages easier, but I do not know if BitPim
has a default subject for phones that do not have them. I was able to
test the if message was read code and I know that works but I do not
know about priority. All of my messages but the ones from sprint carry a
value of 100 in that slot but the ones from sprint carry a 200 so I just
guessed this is priority. The code that I have written so far only reads
the messages that are in the Inbox, I have not added support for any
other folders yet, that is my next thing to work on. Also this code
should work on any phone that uses the com_sanyonewer code but I am
unable to test that so it would be nice if this could be tested. Also
this should just drop into com_sanyo without a problem and I will modify
my code and add that when I am finished with the PM-8200.
Here are the diffs for the files that I changed so that hopefully this
can be committed into CVS
p_sanyonewer.p
319,380d318
< PACKET messagerequest:
< * sanyoheader {'packettype': 0x0c,
< 'command': 0xe1} +header
< 1 UINT slot
< 501 UNKNOWN +pad
<
< PACKET messageentry:
< 1 UINT slot
< 1 UINT read
< 1 UINT counter
< 3 UNKNOWN pad1
< 1 UINT dunno1
< 1 UINT dunno2
< 1 UINT dunno3
< 1 UNKNOWN pad2
< 1 UINT dunno4
< 1 UINT dunno5
< 1 UNKNOWN pad3
< 1 UINT message_len
< 255 STRING message "Text of the notification"
< 1 UNKNOWN pad4
< 1 UINT year
< 1 UINT month
< 1 UINT day
< 1 UINT hour
< 1 UINT minute
< 1 UINT second
< 1 UINT callback_len
< 34 STRING callback
< 1 UINT phonenum_len
< 37 STRING phonenum
< 1 UINT dunno6
< 1 UINT priority
< 3 UNKNOWN pad6
< 1 UINT dunno7
< 1 UINT dunno8
<
< PACKET messageresponse:
< * sanyoheader header
< * messageentry entry
< 151 UNKNOWN pad
<
< PACKET foldernamerequest:
< * sanyoheader {'packettype': 0x0b,
< 'command': 0xef} +header
< 1 UINT index
< 501 UNKNOWN +pad
<
< PACKET foldernameentry:
< 1 UINT index
< 1 UINT flag "0 if empty, 1 in use"
< 1 UINT autofile "If 1, autofile messages with keyword"
< 1 UINT notify
< 1 UINT icon
< 13 STRING {'raiseonunterminatedread': False} name "Name of the folder"
< 3 UNKNOWN +pad
< 14 STRING {'raiseonunterminatedread': False} keyword
<
< PACKET foldernameresponse:
< * sanyoheader header
< * foldernameentry entry
< 467 UNKNOWN pad
com_sanyonewer.py
24c24
< import sms
---
>
62,89d61
<
< def getsms(self, result):
< gsms = {}
< self.log("Getting sms entries")
< req=self.protocolclass.messagerequest()
< for slot in range(200):
< req.slot=slot
< res=self.sendpbcommand(req,
self.protocolclass.messageresponse)
< if res.entry.dunno4==2:
< entry=sms.SMSEntry()
< entry.folder=entry.Folder_Inbox
< entry.datetime="200%d%02d%02dT%02d%02d%02d" %
((res.entry.year, res.entry.month, res.entry.day, res.entry.hour,
res.entry.minute, res.entry.second))
< if res.entry.read==17:
< entry.read=1
< else:
< entry.read=0
< entry._from=res.entry.phonenum
< entry.callback=res.entry.callback
< entry.subject="%d-%s-%s" % ((res.entry.counter,
res.entry.phonenum, res.entry.message[:12]))
< self.log(res.entry.message[:8])
< if res.entry.priority==100:
< entry.priority=sms.SMSEntry.Priority_Normal
< if res.entry.priority==200:
< entry.priority=sms.SMSEntry.Priority_High
< entry.text=unicode(res.entry.message, errors='ignore')
< gsms[entry.id]=entry
< result['sms']=gsms
< return result
106d77
< ('sms', 'read', None),
hopefully these files work for everyone else and I will get back to
coding new things for my phone.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click