@tanislav000/bluez
Version:
Bluez5 D-Bus bindings for easy to use bluetooth access in Node.js
40 lines • 2.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrgFreedesktopDBusProperties = void 0;
const utilts_1 = require("../utilts");
/**
* Service: org.bluez
* ObjectPath: /org/bluez/hci0/-
* Interface: org.freedesktop.DBus.Properties
*/
class OrgFreedesktopDBusProperties extends utilts_1.LooselyTypedEmitter {
static Connect(bus, objectPath, xml) {
return bus.getProxyObject("org.bluez", objectPath, xml).then((obj) => new OrgFreedesktopDBusProperties(obj));
}
constructor(dbusObject) {
super();
this.dbusObject = dbusObject;
this.thisDBusInterface = this.dbusObject.getInterface("org.freedesktop.DBus.Properties");
// forward all signals
this.on("newListener", this.thisDBusInterface.addListener.bind(this.thisDBusInterface));
this.on("removeListener", this.thisDBusInterface.removeListener.bind(this.thisDBusInterface));
}
/***** Methods *****/
//@method({ name: 'Get', inSignature: 'ss', outSignature: 'v' })
Get(interface_, name) {
return this.thisDBusInterface
.Get((0, utilts_1.wrapDbusSignature)(interface_, "s"), (0, utilts_1.wrapDbusSignature)(name, "s"))
.then((0, utilts_1.unwrapDbusSignature)("v"));
}
//@method({ name: 'Set', inSignature: 'ssv', outSignature: '' })
Set(interface_, name, value) {
return this.thisDBusInterface.Set((0, utilts_1.wrapDbusSignature)(interface_, "s"), (0, utilts_1.wrapDbusSignature)(name, "s"), (0, utilts_1.wrapDbusSignature)(value, "v"));
}
//@method({ name: 'GetAll', inSignature: 's', outSignature: 'a{sv}' })
GetAll(interface_) {
return this.thisDBusInterface.GetAll((0, utilts_1.wrapDbusSignature)(interface_, "s")).then((0, utilts_1.unwrapDbusSignature)("a{sv}"));
}
}
exports.OrgFreedesktopDBusProperties = OrgFreedesktopDBusProperties;
OrgFreedesktopDBusProperties.DbusInterfaceName = "org.freedesktop.DBus.Properties";
//# sourceMappingURL=DBus-Properties.js.map