DefinitelyTyped/types/dbus/dbus-tests.ts
2019-05-15 09:00:07 -07:00

20 lines
652 B
TypeScript

import * as DBus from "dbus";
const dbus = DBus.getBus("system");
dbus.getInterface("org.bluez", "/org/bluez/hci0", "org.bluez.Media1", (err, iface) => {});
dbus.getInterface("org.bluez", "/org/bluez/hci0", "org.bluez.Adapter1", (err, iface) => {
if (!err) {
iface.setProperty("Powered", true, err => {});
}
});
dbus.disconnect();
const agentPath = "/test/my/agent";
const agentService = DBus.registerService("system", agentPath.split("/").slice(1).join("."));
const agentObj = agentService.createObject(agentPath);
const agentIface = agentObj.createInterface("org.bluez.Agent1");
agentIface.addMethod("Release", {in: "", out: ""}, () => {});