Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OS.js DBus Service Provider

License

os-js/osjs-dbus-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

23 Commits

Repository files navigation

OS.js Logo

OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.

Support Support Donate Donate Community

OS.js DBus Service Provider

Provides DBus for client and server.

Installation

In your initialization scripts:

npm install @osjs/dbus-provider

Usage

// Client
import {DBusServiceProvider} from '@osjs/dbus-provider';
osjs.register(DBusServiceProvider);
// Server
const {DBusServiceProvider} = require('@osjs/dbus-provider/src/server.js');
osjs.register(DBusServiceProvider);

Client Example

const created = dbus => {
 // Send a raw dbus message
 dbus.send({
 path: '/org/freedesctop/DBus',
 destination: 'org.freedesktop.DBus',
 interface: 'org.freedesktop.DBus',
 member: 'AddMatch',
 signature: 's',
 body: [
 'type='signal''
 ]
 });
 // Listen for raw messages
 dbus.on('response', (...args) => console.log(args));
 // Subscribe to some event
 const iface = dbus.interface('org.freedesktop.Notifications', '/org/freedesktop/Notifications', 'org.freedesktop.Notifications');
 iface.subscribe('ActionInvoked', (...args) => {
 console.log(...args);
 });
 // Call some member
 const iface = dbus.interface('org.freedesktop.Notifications', '/org/freedesktop/Notifications', 'org.freedesktop.Notifications');
 iface.call('Notify', 'exampl', 0, '', 'summary 3', 'new message text', ['foo', 'bar'], [], 5)
 .then(response => console.log(response));
 // Get all properties
 const iface = dbus.interface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Devices/4', 'org.freedesktop.NetworkManager.Device');
 iface.props()
 .then(response => console.log(response));
 // Get a property
 const iface = dbus.interface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Devices/4', 'org.freedesktop.NetworkManager.Device');
 iface.get('Managed')
 .then(response => console.log(response));
 // Set a property
 const iface = dbus.interface('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager/Devices/4', 'org.freedesktop.NetworkManager.Device');
 iface.set('Managed', false)
 .then(response => console.log(response));
 // Close the bus
 dbus.close();
};
core.make('osjs/dbus')
 .systemBus()
 .then(created);

TODOs

  • Use internal websocket

Contribution

Documentation

See the Official Manuals for articles, tutorials and guides.

Links

About

OS.js DBus Service Provider

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /