/**************************************************************************** * @fn GetStringValue * @brief 获取String型参数值 * @param strKey IN 参数键值,具体键值名称参考HikCameraNode.xls文档 * @param strValue OUT 返回值 * @return 成功:0;错误:-1 ****************************************************************************/ public int GetStringValue(string strKey, ref string strValue) { MyCamera.MVCC_STRINGVALUE stParam = new MyCamera.MVCC_STRINGVALUE(); int nRet = m_pCSI.MV_CC_GetStringValue_NET(strKey, ref stParam); if (MyCamera.MV_OK != nRet) { return(CO_FAIL); } strValue = stParam.chCurValue; return(CO_OK); }
// Get the value of various feature nodes static int GetParameters(ref MyCamera device) { if (null == device) { return(MyCamera.MV_E_PARAMETER); } int nRet = MyCamera.MV_OK; // Get value of Integer nodes. Such as, 'width' etc. MyCamera.MVCC_INTVALUE stIntVal = new MyCamera.MVCC_INTVALUE(); nRet = device.MV_CC_GetIntValue_NET("Width", ref stIntVal); if (MyCamera.MV_OK != nRet) { Console.WriteLine("Get width failed:{0:x8}", nRet); return(nRet); } Console.WriteLine("Current Width:{0:d}", stIntVal.nCurValue); // Get value of Enum nodes. Such as, 'TriggerMode' etc. MyCamera.MVCC_ENUMVALUE stEnumVal = new MyCamera.MVCC_ENUMVALUE(); nRet = device.MV_CC_GetEnumValue_NET("TriggerMode", ref stEnumVal); if (MyCamera.MV_OK != nRet) { Console.WriteLine("Get Trigger Mode failed:{0:x8}", nRet); return(nRet); } Console.WriteLine("Current TriggerMode:{0:d}", stEnumVal.nCurValue); // Get value of float nodes. Such as, 'AcquisitionFrameRate' etc. MyCamera.MVCC_FLOATVALUE stFloatVal = new MyCamera.MVCC_FLOATVALUE(); nRet = device.MV_CC_GetFloatValue_NET("AcquisitionFrameRate", ref stFloatVal); if (MyCamera.MV_OK != nRet) { Console.WriteLine("Get AcquisitionFrameRate failed:{0:x8}", nRet); return(nRet); } Console.WriteLine("Current AcquisitionFrameRate:{0:f}Fps", stFloatVal.fCurValue); // Get value of bool nodes. Such as, 'AcquisitionFrameRateEnable' etc. bool bBoolVal = false; nRet = device.MV_CC_GetBoolValue_NET("AcquisitionFrameRateEnable", ref bBoolVal); if (MyCamera.MV_OK != nRet) { Console.WriteLine("Get AcquisitionFrameRateEnable failed:{0:x8}", nRet); return(nRet); } Console.WriteLine("Current AcquisitionFrameRateEnable:{0:d}", bBoolVal); // Get value of String nodes. Such as, 'DeviceUserID' etc. MyCamera.MVCC_STRINGVALUE stStrVal = new MyCamera.MVCC_STRINGVALUE(); nRet = device.MV_CC_GetStringValue_NET("DeviceUserID", ref stStrVal); if (MyCamera.MV_OK != nRet) { Console.WriteLine("Get DeviceUserID failed:{0:x8}", nRet); return(nRet); } Console.WriteLine("Current DeviceUserID:{0:s}", stStrVal.chCurValue); return(MyCamera.MV_OK); }