setProperty method

  1. @override
Future<DBusMethodResponse> setProperty(
  1. String interface,
  2. String name,
  3. DBusValue value
)

Called when a property is set on this object. On success, return DBusMethodSuccessResponse.

Implementation

@override
Future<DBusMethodResponse> setProperty(
    String interface, String name, DBusValue value) async {
  if (interface == 'org.mpris.MediaPlayer2') {
    if (name == 'CanQuit') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'Fullscreen') {
      if (value.signature != DBusSignature('b')) {
        return DBusMethodErrorResponse.invalidArgs();
      }
      return setFullscreen(value.asBoolean());
    } else if (name == 'CanSetFullscreen') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanRaise') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'HasTrackList') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'Identity') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'DesktopEntry') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'SupportedUriSchemes') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'SupportedMimeTypes') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else {
      return DBusMethodErrorResponse.unknownProperty();
    }
  } else if (interface == 'org.mpris.MediaPlayer2.Player') {
    if (name == 'PlaybackStatus') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'LoopStatus') {
      if (value.signature != DBusSignature('s')) {
        return DBusMethodErrorResponse.invalidArgs();
      }
      return setLoopStatus(value.asString());
    } else if (name == 'Rate') {
      if (value.signature != DBusSignature('d')) {
        return DBusMethodErrorResponse.invalidArgs();
      }
      return setRate(value.asDouble());
    } else if (name == 'Metadata') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'Volume') {
      if (value.signature != DBusSignature('d')) {
        return DBusMethodErrorResponse.invalidArgs();
      }
      return setVolume(value.asDouble());
    } else if (name == 'Position') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'MinimumRate') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'MaximumRate') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanGoNext') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanGoPrevious') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanPlay') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanPause') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanSeek') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else if (name == 'CanControl') {
      return DBusMethodErrorResponse.propertyReadOnly();
    } else {
      return DBusMethodErrorResponse.unknownProperty();
    }
  } else {
    return DBusMethodErrorResponse.unknownProperty();
  }
}