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

No data recieved from subscribeSignal method. #107

Closed
yash1200 opened this issue Sep 14, 2020 · 6 comments
Closed

No data recieved from subscribeSignal method. #107

yash1200 opened this issue Sep 14, 2020 · 6 comments

Comments

@yash1200
Copy link
Contributor

With the help of example/signal.dart, I was able to write this function but still no value is being recieved from it.

var client = DBusClient.system();
var object = DBusRemoteObject(
  client,
  'org.freedesktop.UPower',
  DBusObjectPath('/org/freedesktop/UPower/devices/DisplayDevice'),
);
var stream = object.subscribeSignal('org.freedesktop.UPower.Device', 'State');
await for (var signal in stream) {
  var state = (signal.values[0] as DBusUint64).value;
  print('State is : $state!');
}
@robert-ancell
Copy link
Collaborator

Looking at the UPower D-Bus interface using D-Feet shows it doesn't have a State signal, but instead a State property. The documentation confirm this.

With the following code I can monitor state changes as I connect and disconnect the power on my laptop. Hope this helps!

var client = DBusClient.system();
var object = DBusRemoteObject(client, 'org.freedesktop.UPower', DBusObjectPath('/org/freedesktop/UPower/devices/DisplayDevice'));

var state = await object.getProperty('org.freedesktop.UPower.Device', 'State');
print ('state: ${state}');
var stream = object.subscribePropertiesChanged();
await for (var signal in stream) {
  var state = signal.changedProperties['State'];
  if (state != null) {
    print ('state: ${state}');
  }
}

@robert-ancell
Copy link
Collaborator

This might help! https://pub.dev/packages/upower

@yash1200
Copy link
Contributor Author

That's great. Thank you for this plugin. I made a PR with the help of your code here . Thank you for your help :).

@robert-ancell
Copy link
Collaborator

@yash1200 see canonical/upower.dart#3 for monitoring the state (see example/monitor-state.dart).

@yash1200
Copy link
Contributor Author

That's great. Till when can we expect the stable release of these plugins ?

@robert-ancell
Copy link
Collaborator

That's great. Till when can we expect the stable release of these plugins ?

I don't have a schedule for a stable release, but I'm looking at:

  • If I'm happy with the API and I feel it's complete (I think we're very close to that).
  • If the feedback from other developers (like you, thanks!) suggests there's not issues with the current API.

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

2 participants