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.wpilibj;
006
007/**
008 * DigitalSource Interface. The DigitalSource represents all the possible inputs for a counter or a
009 * quadrature encoder. The source may be either a digital input or an analog input. If the caller
010 * just provides a channel, then a digital input will be constructed and freed when finished for the
011 * source. The source can either be a digital input or analog trigger but not both.
012 */
013public abstract class DigitalSource implements AutoCloseable {
014  public abstract boolean isAnalogTrigger();
015
016  public abstract int getChannel();
017
018  /**
019   * If this is an analog trigger.
020   *
021   * @return true if this is an analog trigger.
022   */
023  public abstract int getAnalogTriggerTypeForRouting();
024
025  /**
026   * The channel routing number.
027   *
028   * @return channel routing number
029   */
030  public abstract int getPortHandleForRouting();
031
032  @Override
033  public void close() {}
034}