ICatchPancamSession class

  1. package com.icatchtek.pancam.customer;
  2. public final class ICatchPancamSession extends java.lang.Object {
  3. ...
  4. }

This class is used to establish a session with a specific camera. The connection to the camera can be through the network or through USB. This is the most basic and important entry class in the Streaming SDK. When programming an App, you need to consider creating an instance of this class at the beginning and then set a communication type. and then you can get other different types of The instance to do specific things. For example, get the ICatchIPancamPreview instance and use the methods provided to get the real-time preview stream from the camera. You can use multiple session instances to establish connections with multiple cameras at the same time. For indoor monitoring scene, users may control multiple cameras in different locations through a terminal (an application).

Public methods

1. createSession

  1. public static ICatchPancamSession createSession()

This is a static method used to create an instance of this class, which will be the starting point for App programming.

2. getSessionID

  1. @Deprecated
  2. public int getSessionID()

3. addEventListener

  1. public static boolean addEventListener(int eventID,
  2. ICatchIPancamListener listener,
  3. boolean forAllSession)
  4. throws com.icatchtek.reliant.customer.exception.IchListenerExistsException

Add event listener for specific event, which can be used to add a listeners for all Session, or for non-session instances note:
1. There are some events that are not tied to a specific session, such as events that are reports by LAN device scanning and discovery services, you need to use this method and set the forAllSession parameter to false.
2. When forAllSession is true, it provides the ability to listen to the same event for all Sessions, which may help the App handle some specific logic.
Parameters:

  • eventID - The eventID.
  • listener - The event listener
  • forAllSession - Whether to listen to all session instances. If false, it means to listenen to non-session instance.

Returns:
Return true on success, otherwise false.
Throws:

  • com.icatchtek.reliant.customer.exception.IchListenerExistsException - Indicates that under the same conditions (The same eventID and The same forAllSession setting), the same listener has already been registered.

4. delEventListener

  1. public static boolean delEventListener(int eventID,
  2. ICatchIPancamListener listener,
  3. boolean forAllSession)
  4. throws com.icatchtek.reliant.customer.exception.IchListenerNotExistsException

Remove the listener registered through the method addEventListener. Note that its three parameters need to be the same with when registering.
Parameters:

  • eventID - The eventID.
  • listener - The listener iteself to be removed.
  • forAllSession - The same with addEventListener.

Returns:
Return true on success, otherwise false.
Throws:

  • com.icatchtek.reliant.customer.exception.IchListenerNotExistsException - Indicates the listener does not exists(maybe you do not add it).

5. finalize

  1. public void finalize()

The finalize method.
Overrides:
finalize in class java.lang.Object

6. prepareSession

  1. public boolean prepareSession(com.icatchtek.reliant.customer.transport.ICatchITransport transport,
  2. ICatchGLColor defaultColor,
  3. ICatchGLDisplayPPI displayPPI)
  4. throws com.icatchtek.reliant.customer.exception.IchTransportException

Initialize and set up a session with the camera, including setting the transmission type(mainly USB or network), setting the default color used when drawing, and setting the default PPI of the drawing surface.
Parameters:

  • transport - Indicate how this session wil establish a connection with the camera.
  • defaultColor - When no picture needs to be displayed on the drawing surface, or you want to clear the content of the drawing surface, The SdK will use the default color to drawing.
  • displayPPI - Screen display resolution in pixels per inch.

Returns:
Returns true on success, otherwise false.
Throws:

  • com.icatchtek.reliant.customer.exception.IchTransportException - Failed to set the transmission type, either because an unsupported transmission type is used or because the related initialization fails. For example, The USB transmission is set, but the user forgets to manually connect the camera with the mobile phone or computer through a USB cable.

7. destroySession

  1. public boolean destroySession()
  2. throws com.icatchtek.reliant.customer.exception.IchInvalidSessionException

Release this session and it’s related resources, after you doing this, the instances obtained after the previous prepareSession() call will no longer be valid, such as image, preview, videoPlayback.
Returns:
Returns true on success, otherwise false.
Throws:

  • com.icatchtek.reliant.customer.exception.IchInvalidSessionException - Indicates that this is an invalid session, and it often happens that this session has not been initialized when this method is called.

8. getInfo

  1. public ICatchPancamInfo getInfo()

Get info instance, which is mainly used to get camera and SDK related information. For example, users can get the version number of this SDK through method provided by it.
Returns:
info instance

9. getControl

  1. public ICatchIPancamControl getControl()

Get control instance, which is mainly used to control the behaviour of the camera or the SDK, currently it can be used to add or remove event listener belongs to this session.
Returns:
control instance

10. getImage

  1. public ICatchIPancamImage getImage()

Get image instance, which is mainly used to render picture, Using the normal image or panorama image.
Returns:
image instance

11. getPreview

  1. public ICatchIPancamPreview getPreview()

Get preview instance, which is mainly used to get or render real-time preview stream from the camera.
Returns:
preview instance

12. getVideoPlayback

  1. public ICatchIPancamVideoPlayback getVideoPlayback()

Get video playback instance, which is mainly used to get or render video stream from the camera.
Returns:
video playback instance