public static class

ItemTrackingManager.Session

extends Object
java.lang.Object
   ↳ com.datalogic.itemtracking.ItemTrackingManager.Session

Class Overview

The item tracking session created by the manager. It is used to control the execution of the item tracking algorithm. The session operates in the following states:

  • STOPPED: This is the initial state where the algorithm is stopped and all internal variables are reset. In this state, registered event listeners will not be triggered. This state is suitable for starting a new session or resetting the algorithm. Transition to STARTED is possible by calling start().
  • STARTED: In this state the algorithm is actively running and registered event listeners are notified whenever a new item tracking event occurs. Transition to STOPPED is possible by calling stop() and transition to PAUSED is possible by calling pause().
  • PAUSED: In this state the algorithm is temporarily paused. Internal variables are preserved, but registered event listeners are not triggered since the algorithm is not running. Transition to STOPPED is possible by calling stop() and transition to STARTED is possible by calling start().

Summary

Nested Classes
enum ItemTrackingManager.Session.State Represents the state of the item tracking session, indicating the current execution status of the item tracking algorithm. 
Public Methods
ItemTrackingManager.Session.State getState()
Retrieves the current state of the item tracking session.
int pause()
Pauses the item tracking algorithm without clearing its internal state.
void release()
Releases the current item tracking session, making it unavailable for further use.
int start()
Starts the item tracking algorithm.
int stop()
Stops the item tracking algorithm and clears its internal state.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public ItemTrackingManager.Session.State getState ()

Added in revision 46

Retrieves the current state of the item tracking session.
The state indicates the current execution status of the item tracking algorithm and can be one of the following:

  • STOPPED: The algorithm is stopped, and all internal variables are reset.
  • STARTED: The algorithm is actively running and processing item tracking events.
  • PAUSED: The algorithm is temporarily paused, preserving its internal state.
This method is useful for determining the current operational state of the session and making decisions about transitioning between states (e.g., starting, stopping, or pausing the algorithm).

Returns

public int pause ()

Added in revision 46

Pauses the item tracking algorithm without clearing its internal state.
This method transitions the algorithm from the STARTED state to the PAUSED state.
In the PAUSED state:

  • The algorithm stops processing item tracking events temporarily.
  • Registered event listeners are not triggered.
  • Internal variables and state are preserved, allowing the algorithm to resume without reinitialization.
Preconditions:
  • The algorithm must be in the STARTED state.
Postconditions:
  • If successful, the algorithm transitions to the PAUSED state.
  • If unsuccessful, an error code is returned, and the state of the algorithm remains unchanged.

Returns
Throws
ItemTrackingException if an error occurs and exceptions are enabled through the ErrorManager singleton. The exception will contain details about the error.

public void release ()

Added in revision 46

Releases the current item tracking session, making it unavailable for further use.
After calling this method:

  • All methods that control the algorithm execution (start(), stop(), and pause()) will fail.
  • The session will no longer be valid, and any attempt to interact with it will result in undefined behavior or errors.
This method is essential for proper resource management. It ensures that the session is cleaned up and resources are freed when the session is no longer needed. Failing to release the session may lead to resource leaks or prevent other applications from creating new sessions. Usage example:
 ItemTrackingManager manager = new ItemTrackingManager();
 ItemTrackingManager.Session session = manager.createSession();

 if (session != null) {
     session.start();
     // Perform item tracking operations...
     session.release(); // Ensure the session is released when done.
 }
 

public int start ()

Added in revision 46

Starts the item tracking algorithm.
This method transitions the algorithm from the STOPPED or PAUSED state to the STARTED state, enabling real-time item tracking.
Preconditions:

Postconditions:
  • If successful, the algorithm will be in the STARTED state, and registered event listeners will begin receiving notifications for item tracking events.
  • If unsuccessful, an error code will be returned, and the state of the algorithm will remain unchanged.

Returns
Throws
ItemTrackingException if an error occurs and exceptions are enabled through the ErrorManager singleton. The exception will contain details about the error.

public int stop ()

Added in revision 46

Stops the item tracking algorithm and clears its internal state.
This method transitions the algorithm from the STARTED or PAUSED state to the STOPPED state, resetting all internal variables.
Preconditions:

Postconditions:
  • If successful, the algorithm will be in the STOPPED state, and all internal variables will be reset to their initial state.
  • If unsuccessful, an error code will be returned, and the state of the algorithm will remain unchanged.

Returns
Throws
ItemTrackingException if an error occurs and exceptions are enabled through the ErrorManager singleton. The exception will contain details about the error.