Ejemplo n.º 1
0
        public static bool init()
        {
            DCAMAPI_INIT param = new DCAMAPI_INIT(0);

            m_lasterr  = dcamapi.init(ref param);
            m_devcount = (m_lasterr.failed() ? 0 : param.iDeviceCount);

            return(!m_lasterr.failed());
        }
Ejemplo n.º 2
0
        public bool dev_close()
        {
            if (m_hdcam == IntPtr.Zero)
            {
                return(true);    // already closed
            }
            m_lasterr = dcamdev.close(m_hdcam);
            if (!m_lasterr.failed())
            {
                m_hdcam = IntPtr.Zero;
            }

            return(!m_lasterr.failed());
        }
Ejemplo n.º 3
0
        public MyDcamWait(ref MyDcam mydcam)
        {
            if (mydcam.m_hdcam == IntPtr.Zero)
            {
                // mydcam should have valid HDCAM handle.
                m_lasterr = DCAMERR.INVALIDHANDLE;
                m_hwait   = IntPtr.Zero;
            }
            else
            {
                DCAMWAIT_OPEN param = new DCAMWAIT_OPEN(0);
                param.hdcam = mydcam.m_hdcam;

                m_lasterr = dcamwait.open(ref param);
                if (!m_lasterr.failed())
                {
                    m_hwait        = param.hwait;
                    m_supportevent = param.supportevent;
                }
                else
                {
                    m_hwait        = IntPtr.Zero;
                    m_supportevent = 0;
                }
            }

            m_timeout = 1000;        // 1 second
        }
Ejemplo n.º 4
0
        public bool setgetvalue(ref double value)
        {
            DCAMPROPOPTION _option = DCAMPROPOPTION.NONE;

            m_lasterr = dcamprop.setgetvalue(m_hdcam, m_idProp, ref value, _option);
            return(!m_lasterr.failed());
        }
Ejemplo n.º 5
0
        public bool start(DCAMWAIT eventmask, ref DCAMWAIT eventhappened)
        {
            if (m_hwait == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDWAITHANDLE;
            }
            else
            {
                DCAMWAIT_START param = new DCAMWAIT_START(eventmask);
                param.timeout = m_timeout;
                m_lasterr     = dcamwait.start(m_hwait, ref param);
                if (!m_lasterr.failed())
                {
                    eventhappened = new DCAMWAIT(param.eventhappened);
                }
            }

            return(!m_lasterr.failed());
        }
Ejemplo n.º 6
0
        public string getname()
        {
            string name = "";

            m_lasterr = dcamprop.getname(m_hdcam, m_idProp, ref name);
            if (m_lasterr.failed())
            {
                name = "";
            }
            return(name);
        }
Ejemplo n.º 7
0
        public bool dev_open(int iCamera)
        {
            DCAMDEV_OPEN param = new DCAMDEV_OPEN(iCamera);

            m_lasterr = dcamdev.open(ref param);
            if (m_lasterr.failed())
            {
                m_hdcam = IntPtr.Zero;
            }
            else
            {
                if (m_hdcam != IntPtr.Zero)
                {
                    dcamdev.close(m_hdcam);
                }
                m_hdcam = param.hdcam;
            }

            return(!m_lasterr.failed());
        }
Ejemplo n.º 8
0
        public string getvaluetext(double value)
        {
            string ret;

            ret = "";

            m_lasterr = dcamprop.getvaluetext(m_hdcam, m_idProp, value, ref ret);
            if (m_lasterr.failed())
            {
                ret = value.ToString();
            }
            return(ret);
        }
Ejemplo n.º 9
0
        // dcamdev_getcapability() is not supported in this code
        // dev_getcapability( ByRef param As DCAMDEV_CAPABILITY) As Integer

        // ---------------- buffer allocation and get ----------------

        public bool buf_alloc(int framecount)
        {
            if (m_hdcam == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDHANDLE;
            }
            else
            {
                m_lasterr = dcambuf.alloc(m_hdcam, framecount);
            }

            return(!m_lasterr.failed());
        }
Ejemplo n.º 10
0
        public DCAMCAP_STATUS cap_status()
        {
            DCAMCAP_STATUS stat = DCAMCAP_STATUS.ERROR;

            if (m_hdcam == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDHANDLE;
            }
            else
            {
                m_lasterr = dcamcap.status(m_hdcam, ref stat);
                if (m_lasterr.failed())
                {
                    stat = DCAMCAP_STATUS.ERROR;
                }
            }

            return(stat);
        }
Ejemplo n.º 11
0
        public string dev_getstring(DCAMIDSTR iString)
        {
            string ret;

            ret = "";

            if (m_hdcam == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDHANDLE;
            }
            else
            {
                m_lasterr = dcamdev.getstring(m_hdcam, iString, ref ret);
                if (m_lasterr.failed())
                {
                    ret = "";   // return empty string when error happened.
                }
            }

            return(ret);
        }
Ejemplo n.º 12
0
        public bool cap_transferinfo(ref int nNewestFrameIndex, ref int nFrameCount)
        {
            if (m_hdcam == IntPtr.Zero)
            {
                m_lasterr = DCAMERR.INVALIDHANDLE;
            }
            else
            {
                DCAMCAP_TRANSFERINFO param = new DCAMCAP_TRANSFERINFO(0);
                m_lasterr = dcamcap.transferinfo(m_hdcam, ref param);
                if (!m_lasterr.failed())
                {
                    nNewestFrameIndex = param.nNewestFrameIndex;
                    nFrameCount       = param.nFrameCount;
                    return(true);
                }
            }

            nNewestFrameIndex = -1;
            nFrameCount       = 0;
            return(false);
        }
Ejemplo n.º 13
0
 public bool setvalue(double value)
 {
     m_lasterr = dcamprop.setvalue(m_hdcam, m_idProp, value);
     return(!m_lasterr.failed());
 }
Ejemplo n.º 14
0
 public static bool uninit()
 {
     m_lasterr = dcamapidll.dcamapi_uninit();
     return(!m_lasterr.failed());
 }
Ejemplo n.º 15
0
 public bool update_attr()
 {
     m_attr.iProp = m_idProp;
     m_lasterr    = dcamprop.getattr(m_hdcam, ref m_attr);
     return(!m_lasterr.failed());
 }
Ejemplo n.º 16
0
 public bool getvalue(ref double value)
 {
     m_lasterr = dcamprop.getvalue(m_hdcam, m_idProp, ref value);
     return(!m_lasterr.failed());
 }
Ejemplo n.º 17
0
 public bool nextid()
 {
     m_lasterr = dcamprop.getnextid(m_hdcam, ref m_idProp, 0);
     return(!m_lasterr.failed());
 }
Ejemplo n.º 18
0
 public bool queryvalue_next(ref double value)
 {
     m_lasterr = dcamprop.queryvalue(m_hdcam, m_idProp, ref value, DCAMPROPOPTION.NEXT);
     return(!m_lasterr.failed());
 }
Ejemplo n.º 19
0
 public bool queryvalue(ref double value, DCAMPROPOPTION _option)
 {
     m_lasterr = dcamprop.queryvalue(m_hdcam, m_idProp, ref value, _option);
     return(!m_lasterr.failed());
 }