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 information.
012 */
013public final class ConnectionInfo {
014  /**
015   * The remote identifier (as set on the remote node by
016   * {@link NetworkTableInstance#setNetworkIdentity(String)}).
017   */
018  public final String remote_id;
019
020  /**
021   * The IP address of the remote node.
022   */
023  public final String remote_ip;
024
025  /**
026   * The port number of the remote node.
027   */
028  public final int remote_port;
029
030  /**
031   * The last time any update was received from the remote node (same scale as
032   * returned by {@link NetworkTablesJNI#now()}).
033   */
034  public final long last_update;
035
036  /**
037   * The protocol version being used for this connection.  This is in protocol
038   * layer format, so 0x0200 = 2.0, 0x0300 = 3.0).
039   */
040  public final int protocol_version;
041
042  /** Constructor.
043   * This should generally only be used internally to NetworkTables.
044   * @param remote_id Remote identifier
045   * @param remote_ip Remote IP address
046   * @param remote_port Remote port number
047   * @param last_update Last time an update was received
048   * @param protocol_version The protocol version used for the connection
049   */
050  public ConnectionInfo(String remote_id, String remote_ip, int remote_port, long last_update, int protocol_version) {
051    this.remote_id = remote_id;
052    this.remote_ip = remote_ip;
053    this.remote_port = remote_port;
054    this.last_update = last_update;
055    this.protocol_version = protocol_version;
056  }
057}