001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2017-2018. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.networktables;
009
010/**
011 * NetworkTables Connection notification.
012 */
013public final class ConnectionNotification {
014  /**
015   *  Listener that was triggered.
016   */
017  public final int listener;
018
019  /**
020   * True if event is due to connection being established.
021   */
022  public final boolean connected;
023
024  /**
025   * Connection information.
026   */
027  public final ConnectionInfo conn;
028
029  /** Constructor.
030   * This should generally only be used internally to NetworkTables.
031   * @param inst Instance
032   * @param listener Listener that was triggered
033   * @param connected Connected if true
034   * @param conn Connection information
035   */
036  public ConnectionNotification(NetworkTableInstance inst, int listener, boolean connected, ConnectionInfo conn) {
037    this.inst = inst;
038    this.listener = listener;
039    this.connected = connected;
040    this.conn = conn;
041  }
042
043  private final NetworkTableInstance inst;
044
045  public NetworkTableInstance getInstance() {
046    return inst;
047  }
048}