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