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