Christophe Nowicki

August 29, 2006

Introspection support for DBuzilla

I’ve added methods for parsing D-BUS Introspection Data.

Now you can get informations about available interfaces, methods, signals and properties with the nsIDBusInterface object.

In order to test my methods I wrote an dbus-viwer clone in XUL : http://trac.csquad.org/browser/trunk/examples/dbus-viewer

Here is a screencast (1 Mo) where you can see dbus-viewer in action.

Filed under: Google Summer of Code,Mozilla Firefox — Tags:, — cscm @ 18:14

August 21, 2006

D-BUS for Mozilla project progress #4

Sorry, I did not update my progress since one month.

Here is my current progress on that project :

  • Signals are supported, you can send en receive signals
  • Introspection XML data is now parsed by my component
  • I’ve wrote an dbus-viewer clone in XUL
  • I’ve integrated Threads

But I did not release a 0.1 version because my wrapper produce a dead lock :
If you listen for a signal and call a remote method, you program get locked.
This is a common usage of D-BUS and I think that I can’t release my work without it.

This problem is caused by libdbus witch is not threads “aware” and because I don’t have a shared
lock between my threads.

Havoc Pennington explained me howto solve this issue : integrate libdbus inside my mainloop as glib as done :

GLIB Mainloop integration

This integration is hard because D-BUS is using UNIX file handle and NSPR does not provide functions to handle it.

I did not expect so many technical difficulties, but I stay motivated.
I continue to work on my project (after the end of the summer of code) and I will release version 0.1 as soon as the dead lock issue is solved.

Filed under: Google Summer of Code — Tags:, — cscm @ 06:54

July 18, 2006

D-BUS for Mozilla : version 0.1 is comming … soon!

Ok, boys and girls, version 0.1 is comming! ;0)

This week I was focused on documentation :

I’ve made progress in the wrapper code :

  • Mixed array are now supported : Array(1, ‘string’, 2.3)
  • Threads are now wrapped.
  • Callback are now handled, but not fully : It’s working for the XPCOM part but D-BUS does not call my handle back.

I will release version 0.1 when I find an issue to the callback problems. (I’d like to see asynchronous call and signals managed by 0.1).

Filed under: Google Summer of Code — Tags:, — cscm @ 11:00

July 10, 2006

D-BUS for Mozilla project progress #3

Here is my current progress on my project :

  • All basic arguments are supported, you can call a method with as many arguments as you want :
        ret = iface.callWithArguments("MethodName", ['arg1', 42, 43.1], 3)
    
  • Array support is limited to basic array (without mixed type)
    // var arg = new Array(1, 'string', 2.3) // does not work yet 
    var arg = new Array(1, 2, 3)
    ret = iface.callWithArguments("MethodName", [arg], 1)
    
  • I’ve started working on callback fonctions for asynchronous call and signals, but without sucess.
  • Exception are now supported
    try {
       ret = iface.call("SomethingGoesWrong")
    } catch (e) {
       e.name // error name, ex: org.freedesktop.DBus.Python.dbus.exceptions.UnknownMethodException
       e.message // error details, ex: SomethingGoesWrong is not a valid method of interface...
    }
    

    It’s working, but I thing that a more precise exception handling system is needed.

  • I continue to work on :

    • callback and signals
    • documentation

    I will release version 0.1 next week.

    Filed under: Google Summer of Code — Tags:, — cscm @ 08:51

    July 2, 2006

    D-BUS for Mozilla project progress #2

    Another point on my progress on the D-BUS for Mozilla projet.
    Now I’am able to return any basic type form D-BUS method call and I’ve started to work on returning Arrays and Dictionaries.
    The next step before the release of version 0.1 (full featured D-BUS client) will be :

    • Method Arguments handling
    • Error handling with exception

    I’ve planned this release in two weeks, soon ! ;0)

    Filed under: Google Summer of Code — Tags:, — cscm @ 20:17

    June 28, 2006

    D-BUS for Mozilla project progress

    My current progress on the project is disappointing, I am blocked on the value returned by an method call.
    I can make a basic D-BUS method call from Javascript, but I’am unable to get his return value.
    Here is the sample of code :

    var comp = Components.classes[nsDBUSContactID];
    var dbus = comp.createInstance();
    var session = dbus.SessionBus();
    var iface = session.FindInterface('org.mozilla.TestService', '/',  'org.mozilla.TestInterface')
    var ret = iface.Call('Hello')
    dump('return value = ' . ret ) 
    

    The ‘ret’ value can be of any kind of type (string, int, array, object, etc…).
    I’ve found the javascript code for managing any type of return value from an XPCOM method, in the mozilla xml-rpc extension :

    /* Create an instance of the given ContractID, with given interface */
    function createInstance(contractId, intf) {
        return Components.classes[contractId].createInstance(Components.interfaces[intf])
    }
    
    /* return type */
    function testReturn(type) {
        const SUPPORTSID = '@mozilla.org/supports-';
        var ret
        switch(type) {
            case 'INT32':
                ret = createInstance(SUPPORTSID + 'PRInt32;1', 
                    'nsISupportsPRInt32')
                ret.data = 65
                break
            case 'STRING':
                ret = createInstance(SUPPORTSID + 'cstring;1', 
                    'nsISupportsCString')
                ret.data = 'arf'
                break
            case 'DOUBLE':
                ret = createInstance(SUPPORTSID + 'double;1', 
                    'nsISupportsDouble')
                ret.data = 2.4
                break
           ....
        }
        return ret;
    }
    

    I’ve wrote the C++ version of this code, but It does not work :
    XPIDL prototype of my method :

    nsISupports Test();

    The C++ implementation :

    NS_IMETHODIMP
    nsDBusImpl::TestSupports(nsISupports **_retval) {
        nsresult rv;
        nsCOMPtr ret = 
            do_CreateInstance("@mozilla.org/supports-PRInt32;1", &rv);
        if (NS_FAILED(rv)) {
            return rv;
        }
        ret->SetData(42);
        // _retval = (nsISupports **) &ret; // Does not work
        // *_retval = ret;  // Segfault
    
        return NS_OK;
    }
    

    I’am stopped by this problem …

    Filed under: Google Summer of Code — Tags:, — cscm @ 09:23

    May 24, 2006

    D-BUS for Mozilla project started

    D-BUS for Mozilla I’ve setup an software developement platform with Trac for the D-BUS for Mozilla project :

    Filed under: Google Summer of Code,Mozilla Firefox — Tags:, — cscm @ 20:37

    Google Summer of Code 2006, application accepted !

    google logo  +  summer  +  laptop

    My proposal for the Google Summer of Code 2006 has been accepted!

    Name
    ----
       Christophe 'CSCMEU' Nowicki
     
    Email
    -----
        cscm at meuh dot dyndns dot org
    
    Project Title
    =============
        Mozilla and D-BUS Integration
    
    Synopsis
    --------
       The goal of this project is to allow Mozilla components to communicate
       through D-BUS ( www.freedesktop.org/wiki/Software/dbus )
       in order to allow better integratation in the Linux Desktop.
    
    Benefits to the Mozilla Community
    ---------------------------------
        Better Integration of the Mozilla Suite Inside the Linux Desktop:
            - possiblity to send and recive messages through D-BUS from Mozilla
            components via XPCOM objects.
            - possiblity to use existants projects like:
                - Avahi ( avahi.org ) for Zeroconf support,
                - Beagle  ( beaglewiki.org ) the query directly beagle from the
                Mozilla Search Bar
                - Other, see list of software supporting D-BUS :
                www.freedesktop.org/wiki/Software_2fDbusProjects
            - possiblity to provide Mozilla services via D-BUS.
    
    Deliverables
    ------------
        - source code of the XPCOM compents under the MPL license
        - documentation of the API
        - sample extension using the XPCOM implementation
    
    Project Details
    ---------------
    
        XPCOM Component
        ~~~~~~~~~~~~~~~
    
        The first step of the project is to allow Mozilla components
        to make D-BUS call :
    
            var DBUS = new Components.Constructor('@mozilla.org/dbus;1', 'nsIDBUS')
            var dbus = new DBUS()
            var bus = dbus.SystemBus()
    
            var dbus_obj = bus.get_object('org.freedesktop.DBus',
                '/org/freedesktop/DBus')
            var dbus_iface = dbus.Interface(dbus_obj, 'org.freedesktop.DBus')
    
            dump( dbus_iface.ListNames() )
    
        My API will be inspired by the Python D-BUS API.
    
        Javascript Events
        ~~~~~~~~~~~~~~~~~
    
        The second step would by to integrate D-BUS inside the Java Script event
        loop.
    
        Difficulties
        ~~~~~~~~~~~~
        The technical difficulties of the project are :
            - the type mapping between the D-BUS API and Mozilla
            - memory management, in order to avoid memory leaks
            - manage DBUS communication channels between componants instances.
    
        The cons against this project are :
            - D-BUS is not working (yet) on Microsoft Windows 
                (comming soon)
    
    
    Project Schedule
    ================
       The project is sized for one person and should be finished at the end of
       Summer Of Code. I estimate the working time like that:
    
        - write specifications of the project ( 10 days )
        - analyse the mozilla architecture / source code to plugin the feature
        nicely ( 10 days )
        - write the XPCOM components ( 15 days )
        - write the documentation ( 5 days )
        - write sample application ( 5  days )
        - debug and integrate the components in the Mozilla source tree, code
        review, etc ( 10 days )
    
        Total estimate : 55 days witch is more or less 3 working month.
    
    Bio
    ===
        I'am a French student in computer science from EPITECH ( www.epitech.net )
        involved in the free and opensource mouvement:
    
            - as an Debian 'Power User' : reporting bug, making packages, writing documentation and helping users on forums
            - as an Developper of the FANI project ( www.fani-project.org ),
            it's an multi operating systems network installer writen in
            XUL and Python.
            - as an half-time engineer and developper working for Easter-eggs
            ( www.easter-eggs.com ), an opensource services company involved
            in free software developpement ( see our projects on
            labs.libre-entreprise.org ).
    
        My curriculum-vitae is available on my blog: www.csquad.org/curriculum-vitae
    
    Best Regards,
    
    Filed under: Google Summer of Code — Tags: — cscm @ 09:43

    Powered by WordPress