mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-29 01:58:54 +00:00
18 lines
388 B
TypeScript
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);
|
||
|
}
|