Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen to Methods called on bus #259

Open
ZwiebelTVDE opened this issue Mar 25, 2019 · 0 comments
Open

Listen to Methods called on bus #259

ZwiebelTVDE opened this issue Mar 25, 2019 · 0 comments

Comments

@ZwiebelTVDE
Copy link

I can't seem to figure out how to listen to methods called on the bus.
I can see the needed frames using the command: dbus-monitor --system member=notifyDriverState in the Linux terminal but my code is not working.

The command output looks like this:

method call sender=:1.1 -> dest=foo.bar.ConnectivityController serial=14951 path=/ConnectivityController; interface=foo.bar.DBusConnectivityController; member=notifyDriverState
   string "some string"
   uint32 2 

My code boils down to this:

const dbus = require('dbus-native');
const systemBus = dbus.systemBus();
const connectivityService = systemBus.getService('foo.bar.ConnectivityController');
connectivityService.getInterface('/ConnectivityController', 'foo.bar.DBusConnectivityController', (err, iface)=>{
	if(err|| !iface){
		console.error(
			'Could not query interface foo.bar.DBusConnectivityController, the error was: ${err}'
				? err
				: '(no error)'
		);
		process.exit(1);
	}
	iface.on('notifyDriverState', (somestring, somenumber)=>{
		console.log('Some string: ' + somestring);
		console.log('Some Number: ' + somenumber);
	})
});

I never see the console outputs so I assume the code is somewhat faulty.

Am I doint something wrong or is the problem somewhere in the documentation for this project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant