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()); }
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()); }
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 }
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()); }
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()); }
public string getname() { string name = ""; m_lasterr = dcamprop.getname(m_hdcam, m_idProp, ref name); if (m_lasterr.failed()) { name = ""; } return(name); }
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()); }
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); }
// 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()); }
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); }
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); }
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); }
public bool setvalue(double value) { m_lasterr = dcamprop.setvalue(m_hdcam, m_idProp, value); return(!m_lasterr.failed()); }
public static bool uninit() { m_lasterr = dcamapidll.dcamapi_uninit(); return(!m_lasterr.failed()); }
public bool update_attr() { m_attr.iProp = m_idProp; m_lasterr = dcamprop.getattr(m_hdcam, ref m_attr); return(!m_lasterr.failed()); }
public bool getvalue(ref double value) { m_lasterr = dcamprop.getvalue(m_hdcam, m_idProp, ref value); return(!m_lasterr.failed()); }
public bool nextid() { m_lasterr = dcamprop.getnextid(m_hdcam, ref m_idProp, 0); return(!m_lasterr.failed()); }
public bool queryvalue_next(ref double value) { m_lasterr = dcamprop.queryvalue(m_hdcam, m_idProp, ref value, DCAMPROPOPTION.NEXT); return(!m_lasterr.failed()); }
public bool queryvalue(ref double value, DCAMPROPOPTION _option) { m_lasterr = dcamprop.queryvalue(m_hdcam, m_idProp, ref value, _option); return(!m_lasterr.failed()); }