Package com.qualcomm.robotcore.eventloop
Interface SyncdDevice
-
public interface SyncdDevice
SyncdDevice
is for a device that wants to be in sync with the event loop. If there is sync'd device registered with the event loop manager then the event loop manager will run the event loop in this manner:- wait until all sync'd device have returned from blockUtilReady()
- run EventLoop.loop()
- call startBlockingWork() on all sync'd device
SyncdDevice
per se now lies in the dustbin of time. However, this self-same object and its associated registration mechanism is also used as part of logic used to deal with abnormal device shutdown (e.g.: USB disconnects) and the processing thereof. The interface thus probably now deserves a better name.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SyncdDevice.Manager
static class
SyncdDevice.ShutdownReason
SyncdDevice.ShutdownReason
indicates the health of the shutdown of the device.static interface
SyncdDevice.Syncable
-
Field Summary
Fields Modifier and Type Field Description static int
msAbnormalReopenInterval
When a device shuts down withSyncdDevice.ShutdownReason.ABNORMAL_ATTEMPT_REOPEN
, this is the recommended duration of time to wait before attempting reopen.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RobotUsbModule
getOwner()
Retrieves the owning module of this sync'd device.SyncdDevice.ShutdownReason
getShutdownReason()
Has this device shutdown abnormally? Note that even if this method returns true that a close() will still be necessary to fully clean up associated resources.void
setOwner(RobotUsbModule owner)
Records the owning module of this sync'd device.
-
-
-
Field Detail
-
msAbnormalReopenInterval
static final int msAbnormalReopenInterval
When a device shuts down withSyncdDevice.ShutdownReason.ABNORMAL_ATTEMPT_REOPEN
, this is the recommended duration of time to wait before attempting reopen. It was only heuristically determined, and might thus perhaps be shortened- See Also:
- Constant Field Values
-
-
Method Detail
-
getShutdownReason
SyncdDevice.ShutdownReason getShutdownReason()
Has this device shutdown abnormally? Note that even if this method returns true that a close() will still be necessary to fully clean up associated resources.- Returns:
- whether the device has experienced an abnormal shutdown
-
setOwner
void setOwner(RobotUsbModule owner)
Records the owning module of this sync'd device. The owner of the device is the party that is responsible for the device's lifetime management, and thus who should be involved if the device experiences problems and needs to be shutdown or restarted.- See Also:
getOwner()
-
getOwner
RobotUsbModule getOwner()
Retrieves the owning module of this sync'd device.- Returns:
- the
RobotUsbModule
which is the owner of this device - See Also:
setOwner(RobotUsbModule)
-
-