import 'dart:io'; import 'package:dbus/dbus.dart'; class ComExampleTest extends DBusObject { /// Creates a new object to expose on [path]. ComExampleTest({DBusObjectPath path = const DBusObjectPath.unchecked('/')}) : super(path); /// Implementation of com.example.Test.Hello() Future doHello() async { return DBusMethodErrorResponse.failed('com.example.Test.Hello() not implemented'); } @override List introspect() { return [DBusIntrospectInterface('com.example.Test', methods: [DBusIntrospectMethod('Hello', args: [DBusIntrospectArgument(DBusSignature('s'), DBusArgumentDirection.out, name: 'value')])])]; } @override Future handleMethodCall(DBusMethodCall methodCall) async { if (methodCall.interface == 'com.example.Test') { if (methodCall.name == 'Hello') { if (methodCall.values.isNotEmpty) { return DBusMethodErrorResponse.invalidArgs(); } return doHello(); } else { return DBusMethodErrorResponse.unknownMethod(); } } else { return DBusMethodErrorResponse.unknownInterface(); } } @override Future getProperty(String interface, String name) async { if (interface == 'com.example.Test') { return DBusMethodErrorResponse.unknownProperty(); } else { return DBusMethodErrorResponse.unknownProperty(); } } @override Future setProperty(String interface, String name, DBusValue value) async { if (interface == 'com.example.Test') { return DBusMethodErrorResponse.unknownProperty(); } else { return DBusMethodErrorResponse.unknownProperty(); } } }