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

ProxyObject or Interface went away event missing #103

Open
KryQ opened this issue Jan 27, 2022 · 0 comments
Open

ProxyObject or Interface went away event missing #103

KryQ opened this issue Jan 27, 2022 · 0 comments

Comments

@KryQ
Copy link

KryQ commented Jan 27, 2022

Hi
The problem I'm facing is checking if service emitting signals went dark. There seems to not be any event emitted when interface goes down. To make problem worse when service goes back up properties.on("SendBrightness", ()=>{}); does not work anymore.

What I'm doing to circumvent this problem is registering listener on brightness service as usual:

const registerBrightnessService = async () => {
	try {
		// get a proxy object
		const obj = await bus.getProxyObject("me.kryq.brightness", "/me/kryq/brightness");
		const properties = obj.getInterface("me.kryq.brightness");

		properties.on("SendBrightness", ()=>{});
	}
	catch (e) {
		console.log(e.toString());

		setTimeout(registerBrightnessService, 5000);
	}
};

but then listening on the bus for messages:

bus.on("message", (msg:dbus.Message)=> {
		if(msg.interface == "me.kryq.brightness" && msg.member === "SendBrightness") {
			setBrightness(msg.body[0])
				.catch(console.error);
		}
	});

This allows me to listen to messages when service reconnects.

Is there any event I'm missing?
Thanks for help

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