public class LynxUsbDeviceDelegate extends java.lang.Object implements LynxUsbDevice, HardwareDeviceCloseOnTearDown
RobotArmingStateNotifier.ARMINGSTATE, RobotArmingStateNotifier.Callback
HardwareDevice.Manufacturer
Modifier and Type | Field and Description |
---|---|
protected LynxUsbDeviceImpl |
delegate |
protected boolean |
isOpen |
protected boolean |
releaseOnClose |
static java.lang.String |
TAG |
Constructor and Description |
---|
LynxUsbDeviceDelegate(LynxUsbDeviceImpl lynxUsbDevice) |
Modifier and Type | Method and Description |
---|---|
void |
acquireNetworkTransmissionLock(LynxMessage message) |
void |
addConfiguredModule(LynxModule module) |
void |
arm()
Causes the module to attempt to enter the armed state.
|
void |
armOrPretend()
Causes the module to attempt to enter the armed state, but if that is not possible, to
enter the pretending state.
|
protected void |
assertOpen() |
void |
changeModuleAddress(LynxModule module,
int newAddress,
java.lang.Runnable runnable) |
void |
clearGlobalWarning()
Clears any currently set warning (if permitted) for this source, and zeros
the sources suppression count.
|
void |
close()
Causes the module to attempt to enter the closed state.
|
void |
disarm()
Causes the module to attempt to enter the disarmed state.
|
LynxModuleMetaList |
discoverModules() |
void |
disengage()
Disengage the object from underlying services it uses to render its function.
|
void |
engage()
(Re)enage the object with its underlying services.
|
void |
failSafe() |
RobotArmingStateNotifier.ARMINGSTATE |
getArmingState()
Returns the current arming state of the object.
|
LynxModule |
getConfiguredModule(int moduleAddress) |
java.lang.String |
getConnectionInfo()
Get connection information about this device in a human readable format
|
LynxUsbDeviceImpl |
getDelegationTarget() |
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
java.lang.String |
getGlobalWarning()
Returns the current warning associated with this warning source.
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
RobotUsbModule |
getOwner() |
RobotUsbDevice |
getRobotUsbDevice() |
SerialNumber |
getSerialNumber()
Returns the serial number of this USB module
|
ShutdownReason |
getShutdownReason() |
int |
getVersion()
Version
|
boolean |
isEngaged()
Returns whether the object is currently in the engaged state.
|
boolean |
isSystemSynthetic() |
void |
lockNetworkLockAcquisitions() |
void |
noteMissingModule(LynxModule module,
java.lang.String moduleName) |
void |
pretend()
Causes the module to attempt to enter the pretending state.
|
void |
registerCallback(RobotArmingStateNotifier.Callback callback,
boolean doInitialCallback)
Registers a callback for arming state notifications from this module.
|
void |
releaseNetworkTransmissionLock(LynxMessage message) |
void |
removeConfiguredModule(LynxModule module) |
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
boolean |
setControlHubModuleAddressIfNecessary() |
void |
setGlobalWarning(java.lang.String warning)
Sets the current warning associated with this warning source, if permitted to do so
by the source.
|
void |
setOwner(RobotUsbModule owner) |
void |
setSystemSynthetic(boolean systemSynthetic) |
void |
setThrowOnNetworkLockAcquisition(boolean shouldThrow) |
void |
suppressGlobalWarning(boolean suppress)
Suppress or desupress the contributions of warnings by this source.
|
void |
transmit(LynxMessage message) |
void |
unregisterCallback(RobotArmingStateNotifier.Callback callback)
Unregister a callback which has been registered for notifications with this module.
|
public static java.lang.String TAG
protected LynxUsbDeviceImpl delegate
protected boolean releaseOnClose
protected boolean isOpen
public LynxUsbDeviceDelegate(LynxUsbDeviceImpl lynxUsbDevice)
public LynxUsbDeviceImpl getDelegationTarget()
getDelegationTarget
in interface LynxUsbDevice
public void close()
RobotUsbModule
close
in interface HardwareDevice
close
in interface HardwareDeviceCloseOnTearDown
close
in interface RobotCoreLynxUsbDevice
close
in interface RobotUsbModule
RobotUsbModule
protected void assertOpen()
public void disengage()
Engagable
public void engage()
Engagable
public boolean isEngaged()
Engagable
public RobotUsbDevice getRobotUsbDevice()
getRobotUsbDevice
in interface LynxUsbDevice
public boolean isSystemSynthetic()
isSystemSynthetic
in interface LynxUsbDevice
public void setSystemSynthetic(boolean systemSynthetic)
setSystemSynthetic
in interface LynxUsbDevice
public void failSafe()
failSafe
in interface LynxUsbDevice
failSafe
in interface RobotCoreLynxUsbDevice
public void lockNetworkLockAcquisitions()
lockNetworkLockAcquisitions
in interface RobotCoreLynxUsbDevice
public void setThrowOnNetworkLockAcquisition(boolean shouldThrow)
setThrowOnNetworkLockAcquisition
in interface RobotCoreLynxUsbDevice
public void changeModuleAddress(LynxModule module, int newAddress, java.lang.Runnable runnable)
changeModuleAddress
in interface LynxUsbDevice
public void noteMissingModule(LynxModule module, java.lang.String moduleName)
noteMissingModule
in interface LynxUsbDevice
public void addConfiguredModule(LynxModule module) throws RobotCoreException, java.lang.InterruptedException, LynxNackException
addConfiguredModule
in interface LynxUsbDevice
RobotCoreException
java.lang.InterruptedException
LynxNackException
public LynxModule getConfiguredModule(int moduleAddress)
getConfiguredModule
in interface LynxUsbDevice
public void removeConfiguredModule(LynxModule module)
removeConfiguredModule
in interface LynxUsbDevice
public LynxModuleMetaList discoverModules() throws RobotCoreException, java.lang.InterruptedException
discoverModules
in interface LynxUsbDevice
discoverModules
in interface RobotCoreLynxUsbDevice
RobotCoreException
java.lang.InterruptedException
public void acquireNetworkTransmissionLock(LynxMessage message) throws java.lang.InterruptedException
acquireNetworkTransmissionLock
in interface LynxUsbDevice
java.lang.InterruptedException
public void releaseNetworkTransmissionLock(LynxMessage message) throws java.lang.InterruptedException
releaseNetworkTransmissionLock
in interface LynxUsbDevice
java.lang.InterruptedException
public void transmit(LynxMessage message) throws java.lang.InterruptedException
transmit
in interface LynxUsbDevice
java.lang.InterruptedException
public boolean setControlHubModuleAddressIfNecessary() throws RobotCoreException, java.lang.InterruptedException
setControlHubModuleAddressIfNecessary
in interface LynxUsbDevice
RobotCoreException
java.lang.InterruptedException
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()
HardwareDevice
getVersion
in interface HardwareDevice
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public ShutdownReason getShutdownReason()
public void setOwner(RobotUsbModule owner)
public RobotUsbModule getOwner()
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 void arm() throws RobotCoreException, java.lang.InterruptedException
RobotUsbModule
arm
in interface RobotUsbModule
RobotCoreException
java.lang.InterruptedException
RobotUsbModule
public void pretend() throws RobotCoreException, java.lang.InterruptedException
RobotUsbModule
pretend
in interface RobotUsbModule
RobotCoreException
java.lang.InterruptedException
RobotUsbModule
public void armOrPretend() throws RobotCoreException, java.lang.InterruptedException
RobotUsbModule
armOrPretend
in interface RobotUsbModule
RobotCoreException
java.lang.InterruptedException
RobotUsbModule
public void disarm() throws RobotCoreException, java.lang.InterruptedException
RobotUsbModule
disarm
in interface RobotUsbModule
RobotCoreException
java.lang.InterruptedException
RobotUsbModule
public java.lang.String getGlobalWarning()
GlobalWarningSource
getGlobalWarning
in interface GlobalWarningSource
public void suppressGlobalWarning(boolean suppress)
GlobalWarningSource
GlobalWarningSource.getGlobalWarning()
will always return an empty string. Internally,
a supression count is maintained which is incremented if 'suppress' is true and decremented
if it is false. The initial value of the count is zero; suppression is in effect if the
count is greater than zero.suppressGlobalWarning
in interface GlobalWarningSource
suppress
- whether to suppress or desupress warnings associated with this sourceGlobalWarningSource.clearGlobalWarning()
public void setGlobalWarning(java.lang.String warning)
GlobalWarningSource
setGlobalWarning
in interface GlobalWarningSource
warning
- the warning to be associated with this sourcesGlobalWarningSource.clearGlobalWarning()
public void clearGlobalWarning()
GlobalWarningSource
clearGlobalWarning
in interface GlobalWarningSource
GlobalWarningSource.setGlobalWarning(String)