startServiceByName method

Future<DBusStartServiceByNameReply> startServiceByName(
  1. String name
)

Starts the service with name.

Implementation

Future<DBusStartServiceByNameReply> startServiceByName(String name) async {
  var result = await callMethod(
      destination: 'org.freedesktop.DBus',
      path: DBusObjectPath('/org/freedesktop/DBus'),
      interface: 'org.freedesktop.DBus',
      name: 'StartServiceByName',
      values: [DBusString(name), DBusUint32(0)],
      replySignature: DBusSignature('u'));
  var returnCode = result.returnValues[0].asUint32();
  switch (returnCode) {
    case 1:
      return DBusStartServiceByNameReply.success;
    case 2:
      return DBusStartServiceByNameReply.alreadyRunning;
    default:
      throw 'org.freedesktop.DBus.StartServiceByName returned unknown return code: $returnCode';
  }
}