appkit  1.5.1
RoadNarrows Robotics Application Kit
rnr::SessionWin Class Reference

#include <SessionWin.h>

Inheritance diagram for rnr::SessionWin:
rnr::Session

Public Types

enum  VideoSrcType {
  VideoSrcTypeDevice = 0,
  VideoSrcTypeUdp,
  VideoSrcTypeFile,
  VideoSrcTypeNumOf
}
 Video source types. More...
 

Public Member Functions

 SessionWin (int nSessionId=0, const std::string &strSessionName="Session", Win *pWin=NULL)
 Default initialization contructor. More...
 
 ~SessionWin ()
 Destructor.
 
void setWin (Win *pWin)
 Set session's window. More...
 
WingetWin ()
 Get the session window object. More...
 
Winwin ()
 Get the session window object. More...
 
VideoSrcType getVideoSrcType ()
 Get the video source type. More...
 
void setVideoSrcType (VideoSrcType eVideoSrcType)
 Set the video source type. More...
 
int setVideoDevice (const std::string &strVideoDevName)
 Set the video device name. More...
 
std::string getVideoDevName ()
 Get the video device name. More...
 
int getVideoIndex ()
 Get the video device index. More...
 
int getVideoIndex (const std::string &strVideoDevName)
 Get the video index associated with the device. More...
 
int getVideoPort ()
 Get the video stream port. More...
 
void setVideoPort (int nVideoPort)
 Set the video stream port. More...
 
- Public Member Functions inherited from rnr::Session
 Session (int nSessionId=0, const std::string &strSessionName="Session")
 Default initialization contructor. More...
 
 ~Session ()
 Destructor.
 
StateMachsm ()
 Session's state machine. More...
 
int getSessionId () const
 Get session id. More...
 
std::string getSessionName () const
 Get session name. More...
 
void setContext (void *pContext)
 Set state relevant context. More...
 
void * getContext ()
 Get state relevant context. More...
 
void setError (int ecode, const char *sFmt,...)
 Set session error. More...
 
void setFatal (int ecode, const char *sFmt,...)
 Set session fatal error. More...
 
int getErrorCode ()
 Get the last error code. More...
 
std::string getErrorMsg ()
 Get the last error message. More...
 
bool isFatal ()
 Test if session is in fatal condition. More...
 

Static Public Attributes

static const VideoSrcType VideoSrcTypeDft = VideoSrcTypeDevice
 
static const char *const VideoDevNameDft = "/dev/video0"
 
static const int VideoIndexDft = 0
 
static const int VideoPortDft = 4000
 

Protected Attributes

Winm_pWin
 application main gui window
 
VideoSrcType m_eVideoSrcType
 video source type
 
std::string m_strVideoDevName
 video device name
 
int m_nVideoIndex
 video index (device minor number)
 
int m_nVideoPort
 video stream UDP/IP port
 
- Protected Attributes inherited from rnr::Session
int m_nSessionId
 session id
 
std::string m_strSessionName
 session name
 
StateMach m_sm
 session state machine
 
void * m_pContext
 state specific data
 
int m_ecode
 last error code
 
char m_bufErrorMsg [256]
 error message
 
bool m_bHasFatal
 does [not] have fatal condition
 

Detailed Description

Workflow Session Class

Session state persist throughout the livetime of an application. A series of workflow states, each with its on finite state machine, is supportedc.

Definition at line 86 of file SessionWin.h.

Member Enumeration Documentation

Video source types.

Enumerator
VideoSrcTypeDevice 

source direct from video device

VideoSrcTypeUdp 

source from UDP stream

VideoSrcTypeFile 

source from file

VideoSrcTypeNumOf 

number of video source types

Definition at line 92 of file SessionWin.h.

93  {
94  VideoSrcTypeDevice = 0, ///< source direct from video device
95  VideoSrcTypeUdp, ///< source from UDP stream
96  VideoSrcTypeFile, ///< source from file
97  VideoSrcTypeNumOf ///< number of video source types
98  };
number of video source types
Definition: SessionWin.h:97
source from UDP stream
Definition: SessionWin.h:95
source direct from video device
Definition: SessionWin.h:94

Constructor & Destructor Documentation

rnr::SessionWin::SessionWin ( int  nSessionId = 0,
const std::string &  strSessionName = "Session",
Win pWin = NULL 
)
inline

Default initialization contructor.

Parameters
nSessionIdSession id.
strSessionNameSession name.
pWinPointer to created window.

Definition at line 112 of file SessionWin.h.

114  :
115  Session(nSessionId, strSessionName),
116  m_pWin(pWin),
117  m_eVideoSrcType(VideoSrcTypeDft),
118  m_strVideoDevName(VideoDevNameDft),
120  m_nVideoPort(VideoPortDft)
121  {
122  }
std::string m_strVideoDevName
video device name
Definition: SessionWin.h:253
int m_nVideoPort
video stream UDP/IP port
Definition: SessionWin.h:255
Win * m_pWin
application main gui window
Definition: SessionWin.h:251
Session(int nSessionId=0, const std::string &strSessionName="Session")
Default initialization contructor.
Definition: Session.h:93
int m_nVideoIndex
video index (device minor number)
Definition: SessionWin.h:254
const int VideoIndexDft
default video index
Definition: Camera.h:114
VideoSrcType m_eVideoSrcType
video source type
Definition: SessionWin.h:252

Member Function Documentation

std::string rnr::SessionWin::getVideoDevName ( )
inline

Get the video device name.

Returns
String.

Definition at line 206 of file SessionWin.h.

References m_strVideoDevName.

207  {
208  return m_strVideoDevName;
209  }
std::string m_strVideoDevName
video device name
Definition: SessionWin.h:253
int rnr::SessionWin::getVideoIndex ( )
inline

Get the video device index.

Returns
Integer index.

Definition at line 216 of file SessionWin.h.

References m_nVideoIndex.

217  {
218  return m_nVideoIndex;
219  }
int m_nVideoIndex
video index (device minor number)
Definition: SessionWin.h:254
int rnr::SessionWin::getVideoIndex ( const std::string &  strVideoDevName)

Get the video index associated with the device.

Parameters
strVideoDevNameVideo camera device name.
Returns
Returns video index on success, RC_ERROR(-1) on failure.
int rnr::SessionWin::getVideoPort ( )
inline

Get the video stream port.

Returns
UDP port.

Definition at line 235 of file SessionWin.h.

References m_nVideoPort.

236  {
237  return m_nVideoPort;
238  }
int m_nVideoPort
video stream UDP/IP port
Definition: SessionWin.h:255
VideoSrcType rnr::SessionWin::getVideoSrcType ( )
inline

Get the video source type.

Returns
Return one of VideoSrcType.

Definition at line 177 of file SessionWin.h.

References m_eVideoSrcType.

178  {
179  return m_eVideoSrcType;
180  }
VideoSrcType m_eVideoSrcType
video source type
Definition: SessionWin.h:252
Win* rnr::SessionWin::getWin ( )
inline

Get the session window object.

Returns
Pointer to the window object.

Definition at line 157 of file SessionWin.h.

References m_pWin.

158  {
159  return m_pWin;
160  }
Win * m_pWin
application main gui window
Definition: SessionWin.h:251
int SessionWin::setVideoDevice ( const std::string &  strVideoDevName)

Set the video device name.

The video index (device minor number) is determined and also set.

Parameters
strVideoDevNameVideo device name.

Definition at line 77 of file SessionWin.cxx.

Referenced by setVideoSrcType().

78 {
79  m_strVideoDevName = strVideoDevName;
81 
82  if( m_nVideoIndex < 0 )
83  {
84  setError(RC_ERROR, "'%s': Failed to set video index (device minor).",
85  m_strVideoDevName.c_str());
86  return RC_ERROR;
87  }
88  else
89  {
90  return OK;
91  }
92 }
void setError(int ecode, const char *sFmt,...)
Set session error.
Definition: Session.cxx:72
int getVideoIndex()
Get the video device index.
Definition: SessionWin.h:216
std::string m_strVideoDevName
video device name
Definition: SessionWin.h:253
int m_nVideoIndex
video index (device minor number)
Definition: SessionWin.h:254
void rnr::SessionWin::setVideoPort ( int  nVideoPort)
inline

Set the video stream port.

Parameters
nVideoPortUDP port.

Definition at line 245 of file SessionWin.h.

References m_nVideoPort.

246  {
247  m_nVideoPort = nVideoPort;
248  }
int m_nVideoPort
video stream UDP/IP port
Definition: SessionWin.h:255
void rnr::SessionWin::setVideoSrcType ( VideoSrcType  eVideoSrcType)
inline

Set the video source type.

Parameters
eVideoSrcTypeOne of VideoSrcType.

Definition at line 187 of file SessionWin.h.

References m_eVideoSrcType, and setVideoDevice().

188  {
189  m_eVideoSrcType = eVideoSrcType;
190  }
VideoSrcType m_eVideoSrcType
video source type
Definition: SessionWin.h:252
void rnr::SessionWin::setWin ( Win pWin)
inline

Set session's window.

The session own the window object and will delete it window replacement or on session object deletion.

Parameters
pWinPointer to window object.

Definition at line 143 of file SessionWin.h.

References m_pWin.

144  {
145  if( m_pWin != NULL )
146  {
147  delete m_pWin;
148  }
149  m_pWin = pWin;
150  }
Win * m_pWin
application main gui window
Definition: SessionWin.h:251
Win& rnr::SessionWin::win ( )
inline

Get the session window object.

Returns
Reference to the window object. Cannot be null.

Definition at line 167 of file SessionWin.h.

References m_pWin.

Referenced by rnr::StateWin::destroyGuiInterface(), and rnr::StateWin::showGuiInterface().

168  {
169  return *m_pWin;
170  }
Win * m_pWin
application main gui window
Definition: SessionWin.h:251

The documentation for this class was generated from the following files: