001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package org.wpilib.networktables;
006
007/** NetworkTables Connection information. */
008public final class ConnectionInfo {
009  /**
010   * The remote identifier (as set on the remote node by {@link
011   * NetworkTableInstance#startClient(String)}).
012   */
013  public final String remoteId;
014
015  /** The IP address of the remote node. */
016  public final String remoteIp;
017
018  /** The port number of the remote node. */
019  public final int remotePort;
020
021  /**
022   * The last time any update was received from the remote node (same scale as returned by {@link
023   * NetworkTablesJNI#now()}).
024   */
025  public final long lastUpdate;
026
027  /**
028   * The protocol version being used for this connection. This is in protocol layer format, so
029   * 0x0200 = 2.0, 0x0300 = 3.0).
030   */
031  public final int protocolVersion;
032
033  /**
034   * Constructor. This should generally only be used internally to NetworkTables.
035   *
036   * @param remoteId Remote identifier
037   * @param remoteIp Remote IP address
038   * @param remotePort Remote port number
039   * @param lastUpdate Last time an update was received
040   * @param protocolVersion The protocol version used for the connection
041   */
042  public ConnectionInfo(
043      String remoteId, String remoteIp, int remotePort, long lastUpdate, int protocolVersion) {
044    this.remoteId = remoteId;
045    this.remoteIp = remoteIp;
046    this.remotePort = remotePort;
047    this.lastUpdate = lastUpdate;
048    this.protocolVersion = protocolVersion;
049  }
050}