Example #1
0
        public int ExeMassDataRd(int[] lXferData, string[] lXferFile, ref string Msg, ref bool Result, int Line, ref List <ResultInfo> lResultInfo)
        {
            int        ret    = 0;
            SL_IO_Util Util   = new SL_IO_Util();
            string     RdPath = (lXferFile.Length != 0) ? lXferFile[0] : null;

            if (lXferData.Length == 0 && lXferFile.Length == 0)
            {
                Result = false; ErrResult(MASSDATARDTOKEN, NOPARAMETER, ref Msg, Line); return(SystemInfo.ERROR_DATAWR_NOPARAM);
            }
            if (Util.GetExtName(RdPath) == BMPEXTNAME && lXferData.Length < 2)
            {
                Result = false; ErrResult(DATARDTOKEN, NOPARAMETER, ref Msg, Line); return(SystemInfo.ERROR_DATAWR_NOPARAM);
            }
            if (Util.GetExtName(RdPath) == TXTEXTNAME && lXferData.Length < 1)
            {
                Result = false; ErrResult(DATARDTOKEN, NOPARAMETER, ref Msg, Line); return(SystemInfo.ERROR_DATAWR_NOPARAM);
            }
            if (lXferFile.Length == 0 && lXferData.Length > 1)
            {
                WarnResult(DATARDTOKEN, MUCHPARAMETER, ref Msg, Line);
            }
            ret = MassRdToFile(lXferData, RdPath, ref lResultInfo, ref Msg);
            return((ret != Chip.ERROR_RESULT_OK) ? Chip.ERROR_RESULT_FAIL : Chip.ERROR_RESULT_OK);
        }
Example #2
0
        private bool InstrScopeImage(int Count, string instruCmd, ref string RdStr)
        {
            bool       ret = true;
            string     strPath = null, FileName = null;
            SL_IO_Util IOUtil = new SL_IO_Util();

            byte[]         ScopeScreenResultsArray; // Screen Results array.
            int            g_ScreenLength;
            VisaInstrument visaScope = new VisaInstrument(EquipUtil[Count].getInstrName());

            //ScopeList.SimpleScopeGraph(devices[1], ":DISPLAY:DATA? PNG, SCREEN, COLOR\r\n");
            // Download the screen image.
            // -----------------------------------------------------------
            visaScope.SetTimeoutSeconds(30000);
            visaScope.DoCommand(":STOP");
            visaScope.DoCommand(":HARDcopy:INKSaver OFF");
            // Get the screen data.
            g_ScreenLength = visaScope.DoQueryIEEEBlock(":DISPlay:DATA? PNG, COLor", out ScopeScreenResultsArray);

            if (instruCmd.CompareTo("auto") == 0)
            {
                FileName = "Scope_" + DateTime.Now.ToLocalTime().ToString("yyyyMMdd-HHmmss") + ".png";
            }
            else
            {
                FileName = instruCmd;
            }

            strPath = Setting.ExeScopeDirPath + "\\" + FileName;
            if (IOUtil.isFileExist(strPath))
            {
                IOUtil.FileDelete(strPath);
            }
            if (IOUtil.GetExtName(strPath).CompareTo("png") != 0)
            {
                strPath += ".png";
            }
            FileStream fStream = File.Open(strPath, FileMode.Create);

            fStream.Write(ScopeScreenResultsArray, 0, g_ScreenLength);
            fStream.Close();

            visaScope.DoCommand(":RUN");
            visaScope.Close();
            return(ret);
        }