getProperty method

  1. @override
Future<DBusMethodResponse> getProperty(
  1. String interface,
  2. String name
)

Called when a property is requested on this object. On success, return DBusGetPropertyResponse.

Implementation

@override
Future<DBusMethodResponse> getProperty(String interface, String name) async {
  log('Requested property $name from $interface',
      name: 'audio_service_mpris');

  if (interface == 'org.mpris.MediaPlayer2') {
    DBusValue value;

    if (name == 'CanQuit') {
      value = getCanQuit();
    } else if (name == 'Fullscreen') {
      value = getFullscreen();
    } else if (name == 'CanSetFullscreen') {
      value = getCanSetFullscreen();
    } else if (name == 'CanRaise') {
      value = getCanRaise();
    } else if (name == 'HasTrackList') {
      value = getHasTrackList();
    } else if (name == 'Identity') {
      value = getIdentity();
    } else if (name == 'DesktopEntry') {
      value = getDesktopEntry();
    } else if (name == 'SupportedUriSchemes') {
      value = getSupportedUriSchemes();
    } else if (name == 'SupportedMimeTypes') {
      value = getSupportedMimeTypes();
    } else {
      return DBusMethodErrorResponse.unknownProperty();
    }

    return DBusMethodSuccessResponse([DBusVariant(value)]);
  } else if (interface == 'org.mpris.MediaPlayer2.Player') {
    DBusValue value;

    if (name == 'PlaybackStatus') {
      value = _getPlaybackStatus();
    } else if (name == 'LoopStatus') {
      value = getLoopStatus();
    } else if (name == 'Rate') {
      value = getRate();
    } else if (name == 'Metadata') {
      value = getMetadata();
    } else if (name == 'Volume') {
      value = getVolume();
    } else if (name == 'Position') {
      value = getPosition();
    } else if (name == 'MinimumRate') {
      value = getMinimumRate();
    } else if (name == 'MaximumRate') {
      value = getMaximumRate();
    } else if (name == 'CanGoNext') {
      value = getCanGoNext();
    } else if (name == 'CanGoPrevious') {
      value = getCanGoPrevious();
    } else if (name == 'CanPlay') {
      value = getCanPlay();
    } else if (name == 'CanPause') {
      value = getCanPause();
    } else if (name == 'CanSeek') {
      value = getCanSeek();
    } else if (name == 'CanControl') {
      value = getCanControl();
    } else {
      return DBusMethodErrorResponse.unknownProperty();
    }

    return DBusMethodSuccessResponse([DBusVariant(value)]);
  } else {
    return DBusMethodErrorResponse.unknownProperty();
  }
}