Class OOCSISync

java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<java.lang.Integer>
nl.tue.id.oocsi.client.behavior.OOCSISync

public class OOCSISync
extends OOCSISystemCommunicator<java.lang.Integer>
OOCSISync is a system-level primitive that allows for easy synchronization between different OOCSI clients on the same channel. Synchronization is on triggers, not on data, for which we have OOCSIVote.
Author:
matsfunk
  • Nested Class Summary

    Nested classes/interfaces inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator

    OOCSISystemCommunicator.SystemFilter<K>
  • Field Summary

    Fields inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator

    channelName, client, HANDLE
  • Constructor Summary

    Constructors
    Constructor Description
    OOCSISync​(OOCSIClient client, java.lang.String channelName)
    creates a synchronization process among OOCSI clients on the same channel with a default of 2 secs between pulses.
    OOCSISync​(OOCSIClient client, java.lang.String channelName, int periodMS)
    creates a synchronization process among OOCSI clients on the same channel with a given time between pulses.
    OOCSISync​(OOCSIClient client, java.lang.String channelName, int periodMS, Handler handler)
    creates a synchronization process among OOCSI clients on the same channel with a given time between pulses and a callback to trigger at every pulse.
  • Method Summary

    Modifier and Type Method Description
    int getCycle()
    return the current cycle count
    int getProgress()
    return the cycle progress (an integer value from 0 - 19)
    int getResolution()
    returns the resolution of this synchronization process
    boolean isRunning()
    check if this system process is running
    boolean isSynced()
    are we synchronized to the channel?
    void reset()
    reset dynamic properties
    void setResolution​(int resolution)
    set the resolution of this synchronization process (20 works well, but 100 gives nicer output for using in visuals); rule of thumb: the smaller the resolution, the faster the synchornization
    void start()
    start the synchronization process
    void stop()
    stop the synchronization process

    Methods inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator

    addFilter, getHandle, message, message, message, subscribe, triggerHandler, updateFilter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OOCSISync

      public OOCSISync​(OOCSIClient client, java.lang.String channelName)
      creates a synchronization process among OOCSI clients on the same channel with a default of 2 secs between pulses. starts automatically.
      Parameters:
      client -
      channelName -
    • OOCSISync

      public OOCSISync​(OOCSIClient client, java.lang.String channelName, int periodMS)
      creates a synchronization process among OOCSI clients on the same channel with a given time between pulses. starts automatically.
      Parameters:
      client -
      channelName -
      periodMS -
    • OOCSISync

      public OOCSISync​(OOCSIClient client, java.lang.String channelName, int periodMS, Handler handler)
      creates a synchronization process among OOCSI clients on the same channel with a given time between pulses and a callback to trigger at every pulse. starts automatically.
      Parameters:
      client -
      channelName -
      periodMS -
      handler -
  • Method Details

    • start

      public void start()
      start the synchronization process
    • stop

      public void stop()
      stop the synchronization process
    • reset

      public void reset()
      reset dynamic properties
    • getProgress

      public int getProgress()
      return the cycle progress (an integer value from 0 - 19)
      Returns:
    • getCycle

      public int getCycle()
      return the current cycle count
      Returns:
    • getResolution

      public int getResolution()
      returns the resolution of this synchronization process
      Returns:
    • setResolution

      public void setResolution​(int resolution)
      set the resolution of this synchronization process (20 works well, but 100 gives nicer output for using in visuals); rule of thumb: the smaller the resolution, the faster the synchornization
      Parameters:
      resolution -
    • isRunning

      public boolean isRunning()
      check if this system process is running
      Returns:
    • isSynced

      public boolean isSynced()
      are we synchronized to the channel?
      Returns: