balena-supervisor/test/lib/dbus/utils.ts
Felipe Lalanne 819e184095 Setup environment for dbus tests
Change-type: patch
2022-10-17 11:24:15 -03:00

18 lines
388 B
TypeScript

import * as DBus from 'dbus';
export function createSystemInterface(
svc: DBus.DBusService | string,
objName: string,
ifaceName: string,
) {
const service = ((s: DBus.DBusService | string) => {
if (typeof s === 'string') {
return DBus.registerService('system', s);
}
return s;
})(svc);
const obj = service.createObject(objName);
return obj.createInterface(ifaceName);
}