appkit  1.5.1
RoadNarrows Robotics Application Kit
SessionWin.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Application Tool Kit
4 //
5 // Library: librnr_win
6 //
7 // File: SessionWin.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2013-07-13 14:12:15 -0600 (Sat, 13 Jul 2013) $
12  * $Rev: 3126 $
13  *
14  * \brief SessionWin class implementation.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  *
19  * \par Copyright
20  * \h_copy 2012-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Permission is hereby granted, without written agreement and without
28  * license or royalty fees, to use, copy, modify, and distribute this
29  * software and its documentation for any purpose, provided that
30  * (1) The above copyright notice and the following two paragraphs
31  * appear in all copies of the source code and (2) redistributions
32  * including binaries reproduces these notices in the supporting
33  * documentation. Substantial modifications to this software may be
34  * copyrighted by their authors and need not follow the licensing terms
35  * described here, provided that the new terms are clearly indicated in
36  * all files where they apply.
37  *
38  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43  * THE POSSIBILITY OF SUCH DAMAGE.
44  *
45  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50  *
51  * @EulaEnd@
52  */
53 ////////////////////////////////////////////////////////////////////////////////
54 
55 #include <stdarg.h>
56 #include <string.h>
57 #include <errno.h>
58 
59 #include <string>
60 
61 #include "rnr/rnrconfig.h"
62 #include "rnr/log.h"
63 
64 #include "rnr/appkit/Camera.h"
65 #include "rnr/appkit/SessionWin.h"
66 
67 using namespace std;
68 using namespace rnr;
69 
70 
71 //------------------------------------------------------------------------------
72 // SessionWin Class
73 //------------------------------------------------------------------------------
74 
75 const char * const SessionWin::VideoDevNameDft = "/dev/video0";
76 
77 int SessionWin::setVideoDevice(const std::string &strVideoDevName)
78 {
79  m_strVideoDevName = strVideoDevName;
80  m_nVideoIndex = getVideoIndex(m_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 }
93 
94 int SessionWin::getVideoIndex(const string &strVideoDevName)
95 {
96  return Camera::getVideoIndex(strVideoDevName);
97 }
Video and still image camera base class.
SessionWin derived class.
RoadNarrows Robotics.
Definition: Camera.h:74