Reading binary messages

Vikas Saurabh vikas.saurabh at gmail.com
Wed Sep 9 19:34:55 CEST 2009


> is there a way to save/display the raw message so one can maybe extract
> the URL manually somehow?

Although, bluesms.py mentioned at other placed in the thread is
nice...here is a snippet that does exactly what you want to do...
#!/usr/bin/env python
import dbus
import subprocess
bus = dbus.SystemBus()
msgs_obj = bus.get_object("org.freesmartphone.opimd",
"/org/freesmartphone/PIM/Messages")
msgsIFace = dbus.Interface(msgs_obj, "org.freesmartphone.PIM.Messages")
queryPath = msgsIFace.Query({'SMS-alphabet':'binary', 'Direction':'in'})
queryObj = bus.get_object("org.freesmartphone.opimd", queryPath)
queryIFace = dbus.Interface(queryObj, "org.freesmartphone.PIM.MessageQuery")
count = queryIFace.GetResultCount()
msgs = queryIFace.GetMultipleResults(count)
queryIFace.Dispose()
for msg in msgs:
 sender = msg["Sender"]
 smsData = msg["SMS-data"]
 smsStr = ''
 for charData in smsData:
 character = chr(int(charData))
 smsStr = smsStr + character
 msgPath = msg["Path"]
 #subProc = subprocess.Popen(["file", "-bi", "-"],
stdout=subprocess.PIPE, stdin=subprocess.PIPE)
 #msgType = subProc.communicate(smsStr)[0].strip()
 #msgObj = bus.get_object("org.freesmartphone.opimd", msgPath)
 #msgIFace = dbus.Interface(msgObj, "org.freesmartphone.PIM.Message")
 #msgIFace.Update({'SMS-content_mime':msgType})
 print "*****************************"
 print "Sender: " + sender
 print "msgPath: " + msgPath
 print "msgType: " + msgType
 print "content following"
 print smsStr
 print
--Vikas


More information about the community mailing list

AltStyle によって変換されたページ (->オリジナル) /