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); /// Gets value of property com.example.Test.ByteProperty Future getByteProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.ByteProperty not implemented'); } /// Sets property com.example.Test.ByteProperty Future setByteProperty(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.ByteProperty not implemented'); } /// Gets value of property com.example.Test.BooleanProperty Future getBooleanProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.BooleanProperty not implemented'); } /// Sets property com.example.Test.BooleanProperty Future setBooleanProperty(bool value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.BooleanProperty not implemented'); } /// Gets value of property com.example.Test.Int16Property Future getInt16Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Int16Property not implemented'); } /// Sets property com.example.Test.Int16Property Future setInt16Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Int16Property not implemented'); } /// Gets value of property com.example.Test.Uint16Property Future getUint16Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Uint16Property not implemented'); } /// Sets property com.example.Test.Uint16Property Future setUint16Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Uint16Property not implemented'); } /// Gets value of property com.example.Test.Int32Property Future getInt32Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Int32Property not implemented'); } /// Sets property com.example.Test.Int32Property Future setInt32Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Int32Property not implemented'); } /// Gets value of property com.example.Test.Uint32Property Future getUint32Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Uint32Property not implemented'); } /// Sets property com.example.Test.Uint32Property Future setUint32Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Uint32Property not implemented'); } /// Gets value of property com.example.Test.Int64Property Future getInt64Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Int64Property not implemented'); } /// Sets property com.example.Test.Int64Property Future setInt64Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Int64Property not implemented'); } /// Gets value of property com.example.Test.Uint64Property Future getUint64Property() async { return DBusMethodErrorResponse.failed('Get com.example.Test.Uint64Property not implemented'); } /// Sets property com.example.Test.Uint64Property Future setUint64Property(int value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.Uint64Property not implemented'); } /// Gets value of property com.example.Test.DoubleProperty Future getDoubleProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.DoubleProperty not implemented'); } /// Sets property com.example.Test.DoubleProperty Future setDoubleProperty(double value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.DoubleProperty not implemented'); } /// Gets value of property com.example.Test.StringProperty Future getStringProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.StringProperty not implemented'); } /// Sets property com.example.Test.StringProperty Future setStringProperty(String value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.StringProperty not implemented'); } /// Gets value of property com.example.Test.ObjectPathProperty Future getObjectPathProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.ObjectPathProperty not implemented'); } /// Sets property com.example.Test.ObjectPathProperty Future setObjectPathProperty(DBusObjectPath value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.ObjectPathProperty not implemented'); } /// Gets value of property com.example.Test.SignatureProperty Future getSignatureProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.SignatureProperty not implemented'); } /// Sets property com.example.Test.SignatureProperty Future setSignatureProperty(DBusSignature value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.SignatureProperty not implemented'); } /// Gets value of property com.example.Test.VariantProperty Future getVariantProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.VariantProperty not implemented'); } /// Sets property com.example.Test.VariantProperty Future setVariantProperty(DBusValue value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.VariantProperty not implemented'); } /// Gets value of property com.example.Test.UnixFdProperty Future getUnixFdProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.UnixFdProperty not implemented'); } /// Sets property com.example.Test.UnixFdProperty Future setUnixFdProperty(ResourceHandle value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.UnixFdProperty not implemented'); } /// Gets value of property com.example.Test.StructProperty Future getStructProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.StructProperty not implemented'); } /// Sets property com.example.Test.StructProperty Future setStructProperty(List value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.StructProperty not implemented'); } /// Gets value of property com.example.Test.ArrayProperty Future getArrayProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.ArrayProperty not implemented'); } /// Sets property com.example.Test.ArrayProperty Future setArrayProperty(List value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.ArrayProperty not implemented'); } /// Gets value of property com.example.Test.DictProperty Future getDictProperty() async { return DBusMethodErrorResponse.failed('Get com.example.Test.DictProperty not implemented'); } /// Sets property com.example.Test.DictProperty Future setDictProperty(Map value) async { return DBusMethodErrorResponse.failed('Set com.example.Test.DictProperty not implemented'); } @override List introspect() { return [DBusIntrospectInterface('com.example.Test', properties: [DBusIntrospectProperty('ByteProperty', DBusSignature('y'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('BooleanProperty', DBusSignature('b'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Int16Property', DBusSignature('n'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Uint16Property', DBusSignature('q'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Int32Property', DBusSignature('i'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Uint32Property', DBusSignature('u'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Int64Property', DBusSignature('x'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('Uint64Property', DBusSignature('t'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('DoubleProperty', DBusSignature('d'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('StringProperty', DBusSignature('s'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('ObjectPathProperty', DBusSignature('o'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('SignatureProperty', DBusSignature('g'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('VariantProperty', DBusSignature('v'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('UnixFdProperty', DBusSignature('h'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('StructProperty', DBusSignature('(si)'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('ArrayProperty', DBusSignature('ay'), access: DBusPropertyAccess.readwrite), DBusIntrospectProperty('DictProperty', DBusSignature('a{sv}'), access: DBusPropertyAccess.readwrite)])]; } @override Future handleMethodCall(DBusMethodCall methodCall) async { if (methodCall.interface == 'com.example.Test') { return DBusMethodErrorResponse.unknownMethod(); } else { return DBusMethodErrorResponse.unknownInterface(); } } @override Future getProperty(String interface, String name) async { if (interface == 'com.example.Test') { if (name == 'ByteProperty') { return getByteProperty(); } else if (name == 'BooleanProperty') { return getBooleanProperty(); } else if (name == 'Int16Property') { return getInt16Property(); } else if (name == 'Uint16Property') { return getUint16Property(); } else if (name == 'Int32Property') { return getInt32Property(); } else if (name == 'Uint32Property') { return getUint32Property(); } else if (name == 'Int64Property') { return getInt64Property(); } else if (name == 'Uint64Property') { return getUint64Property(); } else if (name == 'DoubleProperty') { return getDoubleProperty(); } else if (name == 'StringProperty') { return getStringProperty(); } else if (name == 'ObjectPathProperty') { return getObjectPathProperty(); } else if (name == 'SignatureProperty') { return getSignatureProperty(); } else if (name == 'VariantProperty') { return getVariantProperty(); } else if (name == 'UnixFdProperty') { return getUnixFdProperty(); } else if (name == 'StructProperty') { return getStructProperty(); } else if (name == 'ArrayProperty') { return getArrayProperty(); } else if (name == 'DictProperty') { return getDictProperty(); } else { return DBusMethodErrorResponse.unknownProperty(); } } else { return DBusMethodErrorResponse.unknownProperty(); } } @override Future setProperty(String interface, String name, DBusValue value) async { if (interface == 'com.example.Test') { if (name == 'ByteProperty') { if (value.signature != DBusSignature('y')) { return DBusMethodErrorResponse.invalidArgs(); } return setByteProperty(value.asByte()); } else if (name == 'BooleanProperty') { if (value.signature != DBusSignature('b')) { return DBusMethodErrorResponse.invalidArgs(); } return setBooleanProperty(value.asBoolean()); } else if (name == 'Int16Property') { if (value.signature != DBusSignature('n')) { return DBusMethodErrorResponse.invalidArgs(); } return setInt16Property(value.asInt16()); } else if (name == 'Uint16Property') { if (value.signature != DBusSignature('q')) { return DBusMethodErrorResponse.invalidArgs(); } return setUint16Property(value.asUint16()); } else if (name == 'Int32Property') { if (value.signature != DBusSignature('i')) { return DBusMethodErrorResponse.invalidArgs(); } return setInt32Property(value.asInt32()); } else if (name == 'Uint32Property') { if (value.signature != DBusSignature('u')) { return DBusMethodErrorResponse.invalidArgs(); } return setUint32Property(value.asUint32()); } else if (name == 'Int64Property') { if (value.signature != DBusSignature('x')) { return DBusMethodErrorResponse.invalidArgs(); } return setInt64Property(value.asInt64()); } else if (name == 'Uint64Property') { if (value.signature != DBusSignature('t')) { return DBusMethodErrorResponse.invalidArgs(); } return setUint64Property(value.asUint64()); } else if (name == 'DoubleProperty') { if (value.signature != DBusSignature('d')) { return DBusMethodErrorResponse.invalidArgs(); } return setDoubleProperty(value.asDouble()); } else if (name == 'StringProperty') { if (value.signature != DBusSignature('s')) { return DBusMethodErrorResponse.invalidArgs(); } return setStringProperty(value.asString()); } else if (name == 'ObjectPathProperty') { if (value.signature != DBusSignature('o')) { return DBusMethodErrorResponse.invalidArgs(); } return setObjectPathProperty(value.asObjectPath()); } else if (name == 'SignatureProperty') { if (value.signature != DBusSignature('g')) { return DBusMethodErrorResponse.invalidArgs(); } return setSignatureProperty(value.asSignature()); } else if (name == 'VariantProperty') { if (value.signature != DBusSignature('v')) { return DBusMethodErrorResponse.invalidArgs(); } return setVariantProperty(value.asVariant()); } else if (name == 'UnixFdProperty') { if (value.signature != DBusSignature('h')) { return DBusMethodErrorResponse.invalidArgs(); } return setUnixFdProperty(value.asUnixFd()); } else if (name == 'StructProperty') { if (value.signature != DBusSignature('(si)')) { return DBusMethodErrorResponse.invalidArgs(); } return setStructProperty(value.asStruct()); } else if (name == 'ArrayProperty') { if (value.signature != DBusSignature('ay')) { return DBusMethodErrorResponse.invalidArgs(); } return setArrayProperty(value.asByteArray().toList()); } else if (name == 'DictProperty') { if (value.signature != DBusSignature('a{sv}')) { return DBusMethodErrorResponse.invalidArgs(); } return setDictProperty(value.asStringVariantDict()); } else { return DBusMethodErrorResponse.unknownProperty(); } } else { return DBusMethodErrorResponse.unknownProperty(); } } @override Future getAllProperties(String interface) async { var properties = {}; if (interface == 'com.example.Test') { properties['ByteProperty'] = (await getByteProperty()).returnValues[0]; properties['BooleanProperty'] = (await getBooleanProperty()).returnValues[0]; properties['Int16Property'] = (await getInt16Property()).returnValues[0]; properties['Uint16Property'] = (await getUint16Property()).returnValues[0]; properties['Int32Property'] = (await getInt32Property()).returnValues[0]; properties['Uint32Property'] = (await getUint32Property()).returnValues[0]; properties['Int64Property'] = (await getInt64Property()).returnValues[0]; properties['Uint64Property'] = (await getUint64Property()).returnValues[0]; properties['DoubleProperty'] = (await getDoubleProperty()).returnValues[0]; properties['StringProperty'] = (await getStringProperty()).returnValues[0]; properties['ObjectPathProperty'] = (await getObjectPathProperty()).returnValues[0]; properties['SignatureProperty'] = (await getSignatureProperty()).returnValues[0]; properties['VariantProperty'] = (await getVariantProperty()).returnValues[0]; properties['UnixFdProperty'] = (await getUnixFdProperty()).returnValues[0]; properties['StructProperty'] = (await getStructProperty()).returnValues[0]; properties['ArrayProperty'] = (await getArrayProperty()).returnValues[0]; properties['DictProperty'] = (await getDictProperty()).returnValues[0]; } return DBusMethodSuccessResponse([DBusDict.stringVariant(properties)]); } }