public abstract class LynxController extends LynxCommExceptionHandler implements Engagable, HardwareDevice, HardwareDeviceHealth, RobotArmingStateNotifier.Callback, RobotArmingStateNotifier
Modifier and Type | Class and Description |
---|---|
class |
LynxController.PretendLynxModule |
HardwareDevice.Manufacturer
HardwareDeviceHealth.HealthStatus
RobotArmingStateNotifier.ARMINGSTATE, RobotArmingStateNotifier.Callback
Modifier and Type | Field and Description |
---|---|
protected Context |
context |
protected HardwareDeviceHealthImpl |
hardwareDeviceHealth |
protected boolean |
isEngaged |
protected boolean |
isHardwareInitialized |
protected boolean |
isHooked |
protected WeakReferenceSet<RobotArmingStateNotifier.Callback> |
registeredCallbacks |
tag
Constructor and Description |
---|
LynxController(Context context,
LynxModule module) |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustHookingToMatchEngagement() |
void |
close()
Closes this device
|
void |
disengage()
Disengage the object from underlying services it uses to render its function.
|
protected void |
doHook() |
protected void |
doUnhook() |
void |
engage()
(Re)enage the object with its underlying services.
|
protected void |
finishConstruction() |
protected void |
floatHardware() |
void |
forgetLastKnown() |
RobotArmingStateNotifier.ARMINGSTATE |
getArmingState()
Returns the current arming state of the object.
|
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
abstract java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
HardwareDeviceHealth.HealthStatus |
getHealthStatus() |
protected java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> |
getHealthStatusOverride() |
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
protected LynxModuleIntf |
getModule() |
SerialNumber |
getSerialNumber()
Returns the serial number of this USB module
|
protected abstract java.lang.String |
getTag() |
int |
getVersion()
Version
|
protected void |
hook() |
protected void |
initializeHardware() |
protected boolean |
isArmed() |
boolean |
isEngaged()
Returns whether the object is currently in the engaged state.
|
protected void |
moduleNowArmedOrPretending() |
protected void |
moduleNowDisarmed() |
void |
onModuleStateChange(RobotArmingStateNotifier module,
RobotArmingStateNotifier.ARMINGSTATE state)
Notifies the callback that a module with which it has registered for notifications
has undergone a change of state.
|
void |
registerCallback(RobotArmingStateNotifier.Callback callback,
boolean doInitialCallback)
Registers a callback for arming state notifications from this module.
|
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
void |
setHealthStatus(HardwareDeviceHealth.HealthStatus status) |
protected void |
setHealthyIfArmed() |
protected void |
unhook() |
void |
unregisterCallback(RobotArmingStateNotifier.Callback callback)
Unregister a callback which has been registered for notifications with this module.
|
handleException, handleSpecificException, handleSpecificException, handleSpecificException, handleSpecificException
protected Context context
protected boolean isHardwareInitialized
protected boolean isEngaged
protected boolean isHooked
protected final WeakReferenceSet<RobotArmingStateNotifier.Callback> registeredCallbacks
protected final HardwareDeviceHealthImpl hardwareDeviceHealth
public LynxController(Context context, LynxModule module)
protected abstract java.lang.String getTag()
getTag
in class LynxCommExceptionHandler
protected void finishConstruction()
public void onModuleStateChange(RobotArmingStateNotifier module, RobotArmingStateNotifier.ARMINGSTATE state)
RobotArmingStateNotifier.Callback
onModuleStateChange
in interface RobotArmingStateNotifier.Callback
module
- the module whose state has changedstate
- the state into which that module has transitioned#registerCallback(Callback)
protected void moduleNowArmedOrPretending()
protected void moduleNowDisarmed()
public SerialNumber getSerialNumber()
RobotArmingStateNotifier
getSerialNumber
in interface RobotArmingStateNotifier
public RobotArmingStateNotifier.ARMINGSTATE getArmingState()
RobotArmingStateNotifier
getArmingState
in interface RobotArmingStateNotifier
public void registerCallback(RobotArmingStateNotifier.Callback callback, boolean doInitialCallback)
RobotArmingStateNotifier
registerCallback
in interface RobotArmingStateNotifier
RobotArmingStateNotifier.unregisterCallback(Callback)
public void unregisterCallback(RobotArmingStateNotifier.Callback callback)
RobotArmingStateNotifier
unregisterCallback
in interface RobotArmingStateNotifier
RobotArmingStateNotifier.registerCallback(Callback, boolean)
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public void close()
HardwareDevice
close
in interface HardwareDevice
public java.lang.String getConnectionInfo()
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
public abstract java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
protected void initializeHardware() throws RobotCoreException, java.lang.InterruptedException
RobotCoreException
java.lang.InterruptedException
protected void floatHardware()
public void forgetLastKnown()
protected void setHealthyIfArmed()
public void setHealthStatus(HardwareDeviceHealth.HealthStatus status)
setHealthStatus
in interface HardwareDeviceHealth
protected java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> getHealthStatusOverride()
public HardwareDeviceHealth.HealthStatus getHealthStatus()
getHealthStatus
in interface HardwareDeviceHealth
public void engage()
Engagable
public void disengage()
Engagable
public boolean isEngaged()
Engagable
protected LynxModuleIntf getModule()
protected void adjustHookingToMatchEngagement()
protected void hook()
protected void unhook()
protected void doHook()
protected void doUnhook()
protected boolean isArmed()