All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.agora.rtm.JoinTopicOptions Maven / Gradle / Ivy

package io.agora.rtm;

import io.agora.common.internal.CalledByNative;
import io.agora.rtm.RtmConstants.RtmMessagePriority;
import io.agora.rtm.RtmConstants.RtmMessageQos;

/**
 * Join topic options.
 */
public class JoinTopicOptions {
  /**
   * The qos of rtm message.
   */
  private RtmMessageQos messageQos;

  /**
   * The priority of rtm message.
   */
  private RtmMessagePriority priority;

  /**
   * The metaData of topic.
   */
  private String topicMeta = "";

  /**
   * The rtm data will sync with media
   */
  private boolean syncWithMedia;

  /**
   * The default Constructor of {@code JoinTopicOptions}.
   */
  public JoinTopicOptions() {
    this.messageQos = RtmMessageQos.UNORDERED;
    this.priority = RtmMessagePriority.NORMAL;
    this.syncWithMedia = false;
  }

  /**
   * Constructs a new {@code JoinTopicOptions} object with message qos and
   * priority.
   *
   * @param qos      The quality of service for messages sent on the topic
   * @param priority The priority of the topic message
   */
  public JoinTopicOptions(RtmMessageQos qos, RtmMessagePriority priority) {
    this.messageQos = qos;
    this.priority = priority;
  }

  /**
   * Constructs a new {@code JoinTopicOptions} object with the specified
   * parameters.
   *
   * @param qos           The quality of service for messages sent on the topic
   * @param priority      The priority of the topic message
   * @param syncWithMedia Indicates whether to synchronize with media
   */
  public JoinTopicOptions(RtmMessageQos qos, RtmMessagePriority priority, boolean syncWithMedia) {
    this.messageQos = qos;
    this.priority = priority;
    this.syncWithMedia = syncWithMedia;
  }

  /**
   * Create a new {@code JoinTopicOptions} object with the specified parameters
   *
   * @param qos           The quality of service for messages sent on the topic
   * @param priority      The priority of the topic message
   * @param syncWithMedia Indicates whether to synchronize with media
   * @param topicMeta     The metaData of current topic
   */
  public JoinTopicOptions(
      RtmMessageQos qos, RtmMessagePriority priority, boolean syncWithMedia, String topicMeta) {
    this.messageQos = qos;
    this.priority = priority;
    this.syncWithMedia = syncWithMedia;
    this.topicMeta = topicMeta;
  }

  public void setMessageQos(RtmMessageQos messageQos) {
    this.messageQos = messageQos;
  }

  public void setPriority(RtmMessagePriority priority) {
    this.priority = priority;
  }

  public void setSyncWithMedia(boolean syncWithMedia) {
    this.syncWithMedia = syncWithMedia;
  }

  public void setTopicMeta(String topicMeta) {
    this.topicMeta = topicMeta;
  }

  @CalledByNative
  public int getMessageQos() {
    return RtmMessageQos.getValue(messageQos);
  }

  @CalledByNative
  public int getMessagePriority() {
    return RtmMessagePriority.getValue(priority);
  }

  @CalledByNative
  public boolean getSyncWithMedia() {
    return this.syncWithMedia;
  }

  @CalledByNative
  public String getTopicMeta() {
    return this.topicMeta;
  }

  @Override
  public String toString() {
    return "JoinTopicOptions {messageQos: " + messageQos + ", priority: " + priority
        + ", syncWithMedia: " + syncWithMedia + ", topicMeta: " + topicMeta + "}";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy