Tagged: D-Bus Toggle Comment Threads | Keyboard Shortcuts

  • Akarsh Simha 1:38 am on January 2, 2014 Permalink
    Tags: , D-Bus, , , , , , scripting, shell scripting   

    Astro-scripting using KStars' D-Bus interface 

    I was telling Henry about
    an interesting use case of KStars a few days ago, and he
    suggested that I blog about it.

    I encountered this problem while preparing for a Practical Amateur Astronomy workshop that we were organizing. We had made lists of
    various celestial objects for people to observe, along with some
    hand-written descriptions. We edited the lists collaboratively on
    Google Spreadsheets, and at some point I declared the lists final and
    made a CSV export. I wanted the lists to be organized by constellation
    and also have some more vital information about the objects filled in.

    Enter KStars and D-Bus. KStars has D-Bus interface functions that let
    you access many of its features. I use qdbus to access
    them over the shell. (Note that the following is known to work on
    GNU/Linux. I am entirely unsure about Windows and Mac
    platforms). Here’s a brief example of making KStars point towards M

    qdbus org.kde.kstars /KStars org.kde.kstars.lookTowards "M 33"

    (Note: Due to some bug in KStars at the moment, you need to invoke the
    above multiple times to get the object in the center)

    Then, let’s say we want to query information on NGC 2903. We can do so
    by using:

    $ qdbus org.kde.kstars /KStars org.kde.kstars.getObjectDataXML "NGC 2903"

    and KStars outputs an XML blurb describing the object.

    One can now use tools like xmlstarlet to work with the
    XML on the command line.

    There. That has all the information I need to complete the
    checklists. So I went ahead and wrote a small shell script to order
    the objects by constellation and typeset a table using LaTeX. The
    results look like this:


    Many more wonderful things are possible because of the D-Bus
    interface. In fact, my Logbook project
    relies heavily on KStars’ D-Bus interface. The Logbook project uses
    KStars to produce amateur astronomers’ logbooks complete with fine and
    coarse finder charts, relevant data and DSS imagery.

    One can use qdbusviewer and qdbus to further
    explore the available D-Bus methods in KStars and profit from
    scripting using KStars.

  • Akarsh Simha 2:56 pm on April 14, 2008 Permalink
    Tags: D-Bus,   

    DBus for MCabber 

    I desperately wanted this, so I coded it over a night. Comment on this post if you want a tarball.

    Now I can set the mcabber status to the current playing track from mocp using a script. 😀

  • Akarsh Simha 5:25 pm on December 11, 2007 Permalink
    Tags: D-Bus   

    DBus Example Code 

    I’m trying to learn to use DBus GLib API in C and found it difficult to get good documentation or a tutorial easily. The D-Bus Tutorial will help you write the simplest possible DBus program and then leaves you! Atleast, so I felt. So here’s some code that I wrote to illustrate subscribing to remote signals using DBus. I’m a newbie programmer, so please suggest better code and help me!

    You can find the code here: Signals with DBus.

    Sorry for the inconvenience of having it as .odt – wordpress doesn’t allow extensions like .txt or .cpp. However the file doesn’t have any formatting and you can just open it with any text editor, or mv it to a .cpp

    • Arun Chaganty 6:14 pm on December 11, 2007 Permalink | Log in to Reply

      a) Your really jobless to setup a blog
      b) Use the pkg-config tool to include the required libs/cflags. Put this line in your gcc command (anywhere)
      `pkg-config –cflags –libs dbus-1 dbus-glib-1`

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc