View Single Post
Posts: 27 | Thanked: 14 times | Joined on May 2011
#1
Hi there, i am a bloody beginner when it comes to Python/Dbus . I thought the best way to learn something about this is to read a lot about it and then try to code a simple application like i did when i learned java and C#.
But somehow this time it seems to be not that easy to learn just by reading and doing - maybe it just looks so complicated because I’ve never used Dbus before? (Python seems to be very easy).
The little application i want to make is something that gets a signal from Dbus if someone is calling and pushes the information’s (name of the caller/phone number…) to my computer where a little server is running that shows a notification and maybe mutes the system sounds. The problem here is not the server side but the „client“ on the n900.

What i’ve found out so far is that I can use dbus-monitor to watch for events. I also read that it’s possible with dbus-scripts to directly start a script by an incoming call but the problem here is that dbus-scripts can’t forward arguments like an array or variant (got that from the wiki page) which are needed for getting the phone number of the caller i think.

After playing with dbus-monitor I think the relevant event is this one:

Code:
signal sender=:1.19 -> dest=(null destination) serial=156 path=/org/freedesktop/Telepathy/Connection/ring/tel/ring; interface=org.freedesktop.Telepathy.Connection.Interface.Requests; member=NewChannels
   array [
      struct {
         object path "/org/freedesktop/Telepathy/Connection/ring/tel/ring/incoming1097983067"
         array [
            dict entry(
               string "org.freedesktop.Telepathy.Channel.InitiatorID"
               variant                   string "0123456789"   <-- phone number here 
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.TargetHandleType"
               variant                   uint32 1
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.TargetHandle"
               variant                   uint32 4
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.TargetID"
               variant                   string "0123456789" 
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.Requested"
               variant                   boolean false
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia.ImmutableStreams"
               variant                   boolean true
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.ChannelType"
               variant                   string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.InitiatorHandle"
               variant                   uint32 4
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.Interfaces"
               variant                   array [
                     string "org.freedesktop.Telepathy.Channel.Interface.DTMF"
                     string "org.freedesktop.Telepathy.Channel.Interface.Hold"
                     string "com.Nokia.Telepathy.Channel.Interface.DialStrings"
                     string "org.freedesktop.Telepathy.Channel.Interface.Group"
                     string "org.freedesktop.Telepathy.Channel.Interface.CallState"
                     string "com.nokia.Telepathy.Channel.Interface.Emergency"
                     string "com.nokia.Telepathy.Channel.Interface.ConferenceMember"
                  ]
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia.InitialAudio"
               variant                   boolean true
            )
            dict entry(
               string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia.InitialVideo"
               variant                   boolean false
            )
         ]
      }
   ]

So now my question is how is it possible to catch such an event with Python and read the information of it so that I can use it in my program?
I hope someone can point me into the right direction, give me some hints or help me with a little advice so that I can learn a bit and soon be able to do more with the almighty n900…
Any help is much appreciated!

Oh and i'm really sorry for my bad english