Add deprecated shims for LiveWindowSendable and NamedSendable. (#834)

This will help prevent old code from breaking (not all cases, but should help).
This commit is contained in:
Peter Johnson
2017-12-13 23:45:12 -08:00
committed by GitHub
parent 7f074563d0
commit de134a5c60
6 changed files with 222 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2016-2017 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
/**
* The interface for sendable objects that gives the sendable a default name in the Smart
* Dashboard.
* @deprecated Use Sendable directly instead
*/
@Deprecated
public interface NamedSendable extends Sendable {
/**
* The name of the subtable.
*
* @return the name of the subtable of SmartDashboard that the Sendable object will use.
*/
String getName();
@Override
default void setName(String name) {
}
@Override
default String getSubsystem() {
return "";
}
@Override
default void setSubsystem(String subsystem) {
}
@Override
default void initSendable(SendableBuilder builder) {
}
}

View File

@@ -0,0 +1,57 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.livewindow;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.Sendable;
/**
* Live Window Sendable is a special type of object sendable to the live window.
* @deprecated Use Sendable directly instead
*/
@Deprecated
public interface LiveWindowSendable extends Sendable {
/**
* Update the table for this sendable object with the latest values.
*/
void updateTable();
/**
* Start having this sendable object automatically respond to value changes reflect the value on
* the table.
*/
void startLiveWindowMode();
/**
* Stop having this sendable object automatically respond to value changes.
*/
void stopLiveWindowMode();
@Override
default String getName() {
return "";
}
@Override
default void setName(String name) {
}
@Override
default String getSubsystem() {
return "";
}
@Override
default void setSubsystem(String subsystem) {
}
@Override
default void initSendable(SendableBuilder builder) {
builder.setUpdateTable(this::updateTable);
}
}