Nautical Poseidon Mythology

    dbus-native-windows

    0.2.1 • Public • Published

    node-dbus

    D-bus protocol client and server for node.js

    Build Status

    Installation

    npm install dbus-native

    or

    git clone https://github.com/sidorares/node-dbus # clone the repo 
    cd node-dbus
    npm install # install dependencies 
    sudo cp examples/com.github.sidorares.dbus.Example.conf /etc/dbus-1/system.d/ # if you want to test examples/service.js 

    Usage

    Short example using desktop notifications service

    var dbus = require('dbus-native');
    var sessionBus = dbus.sessionBus();
    sessionBus.getService('org.freedesktop.Notifications').getInterface(
        '/org/freedesktop/Notifications',
        'org.freedesktop.Notifications', function(err, notifications) {
     
        // dbus signals are EventEmitter events
        notifications.on('ActionInvoked', function() {
            console.log('ActionInvoked', arguments);
        });
        notifications.on('NotificationClosed', function() {
            console.log('NotificationClosed', arguments);
        });
        notifications.Notify('exampl', 0, '', 'summary 3', 'new message text', ['xxx yyy', 'test2', 'test3', 'test4'], [],  5, function(err, id) {
           //setTimeout(function() { n.CloseNotification(id, console.log); }, 4000);
        });
    });

    API

    Low level messaging: bus connection

    connection = dbus.createClient(options)

    options:

    connection has only one method, message(msg)

    message fields:

    • type - methodCall, methodReturn, error or signal
    • path - object path
    • interface
    • destination
    • sender
    • member
    • serial
    • signature
    • body
    • errorName
    • replySerial

    connection signals:

    • connect - emitted after successful authentication
    • message
    • error

    example:

    var dbus = require('dbus-native');
    var conn = dbus.createConnection();
    conn.message({
        path:'/org/freedesktop/DBus',
        destination: 'org.freedesktop.DBus',
        'interface': 'org.freedesktop.DBus',
        member: 'Hello',
        type: dbus.messageType.methodCall
    });
    conn.on('message', function(msg) { console.log(msg); });

    Links

    Install

    npm i dbus-native-windows

    DownloadsWeekly Downloads

    2

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • mspanc