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.hal;
006
007/** A wrapper for the HALControlWord bitfield. */
008public class ControlWord {
009  private boolean m_enabled;
010  private boolean m_autonomous;
011  private boolean m_test;
012  private boolean m_emergencyStop;
013  private boolean m_fmsAttached;
014  private boolean m_dsAttached;
015
016  void update(
017      boolean enabled,
018      boolean autonomous,
019      boolean test,
020      boolean emergencyStop,
021      boolean fmsAttached,
022      boolean dsAttached) {
023    m_enabled = enabled;
024    m_autonomous = autonomous;
025    m_test = test;
026    m_emergencyStop = emergencyStop;
027    m_fmsAttached = fmsAttached;
028    m_dsAttached = dsAttached;
029  }
030
031  /**
032   * Updates from an existing word.
033   *
034   * @param word word to update from
035   */
036  public void update(ControlWord word) {
037    m_enabled = word.m_enabled;
038    m_autonomous = word.m_autonomous;
039    m_test = word.m_test;
040    m_emergencyStop = word.m_emergencyStop;
041    m_fmsAttached = word.m_fmsAttached;
042    m_dsAttached = word.m_dsAttached;
043  }
044
045  public boolean getEnabled() {
046    return m_enabled;
047  }
048
049  public boolean getAutonomous() {
050    return m_autonomous;
051  }
052
053  public boolean getTest() {
054    return m_test;
055  }
056
057  public boolean getEStop() {
058    return m_emergencyStop;
059  }
060
061  public boolean getFMSAttached() {
062    return m_fmsAttached;
063  }
064
065  public boolean getDSAttached() {
066    return m_dsAttached;
067  }
068}