All Projects → sidorares → Dbus Native

sidorares / Dbus Native

Licence: other
D-bus protocol client and server for node.js written in native javascript

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Dbus Native

Linux notification center
A notification daemon/center for linux
Stars: ✭ 545 (+142.22%)
Mutual labels:  dbus
Python Dbus Next
🚌 The next great DBus library for Python with asyncio support
Stars: ✭ 95 (-57.78%)
Mutual labels:  dbus
Wpantund
Wireless Network Interface Daemon for Low-Power Wireless SoCs
Stars: ✭ 133 (-40.89%)
Mutual labels:  dbus
Stratisd
Easy to use local storage management for Linux.
Stars: ✭ 592 (+163.11%)
Mutual labels:  dbus
Imbmw
BMW iBus .NET MF SDK and hardware
Stars: ✭ 50 (-77.78%)
Mutual labels:  dbus
Go Systemd
Go bindings to systemd socket activation, journal, D-Bus, and unit files
Stars: ✭ 1,756 (+680.44%)
Mutual labels:  dbus
Go Keyring
Cross-platform keyring interface for Go
Stars: ✭ 351 (+56%)
Mutual labels:  dbus
Dunst
Lightweight and customizable notification daemon
Stars: ✭ 2,864 (+1172.89%)
Mutual labels:  dbus
Zabbix Module Systemd
Native systemd monitoring for Zabbix
Stars: ✭ 81 (-64%)
Mutual labels:  dbus
Browser Media Keys
Lets you control many web players using the media keys on your keyboard.
Stars: ✭ 125 (-44.44%)
Mutual labels:  dbus
Eyerest
通过定时锁定屏幕,提醒用户休息的软件
Stars: ✭ 24 (-89.33%)
Mutual labels:  dbus
Dbus Cxx
DBus-cxx provides an object-oriented interface to DBus
Stars: ✭ 33 (-85.33%)
Mutual labels:  dbus
Kdeconnect Chrome Extension
A browser extension to send pages and content from your browser to connected KDE Connect devices.
Stars: ✭ 124 (-44.89%)
Mutual labels:  dbus
Jde
Linux desktop environment built with HTML5, CSS, JavaScript and Python.
Stars: ✭ 591 (+162.67%)
Mutual labels:  dbus
Ruby Dbus
A Ruby binding for DBus
Stars: ✭ 142 (-36.89%)
Mutual labels:  dbus
Taffybar
A gtk based status bar for tiling window managers such as XMonad
Stars: ✭ 502 (+123.11%)
Mutual labels:  dbus
Qmlnotify
Awesome notification server in QML
Stars: ✭ 114 (-49.33%)
Mutual labels:  dbus
Python Omxplayer Wrapper
📺 Control OMXPlayer, the Raspberry Pi media player, from Python
Stars: ✭ 213 (-5.33%)
Mutual labels:  dbus
Openvpn3 Linux
OpenVPN 3 Linux client
Stars: ✭ 186 (-17.33%)
Mutual labels:  dbus
Signal Cli
signal-cli provides an unofficial commandline and dbus interface for signalapp/libsignal-service-java
Stars: ✭ 2,117 (+840.89%)
Mutual labels:  dbus

node-dbus

Greenkeeper badge 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:

  • socket - unix socket path
  • port - TCP port
  • host - TCP host
  • busAddress - encoded bus address. Default is DBUS_SESSION_BUS_ADDRESS environment variable. See http://dbus.freedesktop.org/doc/dbus-specification.html#addresses
  • authMethods - array of authentication methods, which are attempted in the order provided (default:['EXTERNAL', 'DBUS_COOKIE_SHA1', 'ANONYMOUS'])
  • ayBuffer - boolean (default:true): if true 'ay' dbus fields are returned as buffers
  • ReturnLongjs - boolean (default:false): if true 64 bit dbus fields (x/t) are read out as Long.js objects, otherwise they are converted to numbers (which should be good up to 53 bits)
  • ( TODO: add/document option to use adress from X11 session )

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); });

Note on INT64 'x' and UINT64 't'

Long.js is used for 64 Bit support. https://github.com/dcodeIO/long.js The following javascript types can be marshalled into 64 bit dbus fields:

  • typeof 'number' up to 53bits
  • typeof 'string' (consisting of decimal digits with no separators or '0x' prefixed hexadecimal) up to full 64bit range
  • Long.js objects (or object with compatible properties)

By default 64 bit dbus fields are unmarshalled into a 'number' (with precision loss beyond 53 bits). Use {ReturnLongjs:true} option to return the actual Long.js object and preserve the entire 64 bits.

Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].