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:
    1. wait until all sync'd device have returned from blockUtilReady()
    2. run EventLoop.loop()
    3. call startBlockingWork() on all sync'd device
    Sync'd devices need to register themselves with the event loop manager Note: the original actual need for 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.
    • 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()