Esempio n. 1
0
 public void SplitRatesReadResponse(string received, ref LMDAQ.RatesStatus p)
 {
     try
     {
         string[] ff = received.Split('=');
         string[] txt = ff[1].Split(',');
         for (int i = 1; i <= NC.ChannelCount && i < txt.Length; i++)
         {
             int r;
             bool b = Int32.TryParse(txt[i], out r);
             if (b)
                 p.channels[i] = r;
         }
     }
     catch (Exception e)
     {
         commlog.TraceEvent(LogLevels.Error, 893, "SplitRatesReadResponse barfed on:" + received + "; " + e.Message);
     }
 }
Esempio n. 2
0
        public void GenerateReport(LMDAQ.HVControl.HVCalibrationParameters hvc, List<HVControl.HVStatus> HVSteps, DateTime time, String instId)
        {

            TabularReport t = new TabularReport(typeof(HVVals), NC.App.Loggers);  // default file output type is CSV
            try
            {
                t.CreateOutputFile(NC.App.Opstate.Measurement.AcquireState.lm.Results, instId + " HV " + time.ToString("yyyyMMddHHmmss"), null);

                t.rows = new Row[HVSteps.Count + 4 + 2];  // header, steps, space, header, current params, space, header, config
               // first, the column header
                int cols = System.Enum.GetValues(typeof(HVVals)).Length;
                int i = 0;

                // now for each hvcalib row
                for (i = 0; i < HVSteps.Count; i++)
                {
                    HVControl.HVStatus h = HVSteps[i];
                    Row row = CreateRow(h, i);
                    t.rows[i] = row;
                }

                // then do the current parameters
                t.rows[i++] = new Row(); 
                t.rows[i] = new Row(); t.rows[i++].GenFromEnum(typeof(HVCalibVals));
                t.rows[i++] = CreateRow(hvc, i);
                t.rows[i++] = new Row(); 

                // lastly, add the full software version state
                t.rows[i] = new Row(); t.rows[i++].Add(0, "Software application configuration details");
                Row[] temp = AnalysisDefs.SimpleReport.GenSoftwareConfigRows();
                Array.Resize(ref  t.rows, temp.Length + t.rows.Length + 2);
                Array.Copy(temp, 0, t.rows, i, temp.Length);

                t.CreateReport(3);

            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            finally
            {
                t.CloseOutputFile();
            }
        }
Esempio n. 3
0
 public void SplitHVCalibResponse(string received, ref LMDAQ.HVControl.HVStatus hvst)
 {
     try
     {
         hvst.Extract(received);
     }
     catch (Exception e)
     {
         commlog.TraceEvent(LogLevels.Error, 892, "SplitHVCalibResponse barfed on:" + received + "; " + e.Message);
     }
 }
Esempio n. 4
0
 public void SplitPowerReadResponse(string received, ref LMDAQ.PowerStatus p)
 {
     try
     {
         string[] aaa = received.Split('=');
         string[] txt = aaa[1].Split(',');
         int r;
         bool b = Int32.TryParse(txt[0], out r);
         if (b) p.ACPresent = r;
         b = Int32.TryParse(txt[1], out r);
         if (b) p.batteryPresent = r;
         b = Int32.TryParse(txt[2], out r);
         if (b) p.batterylevelPct = r;
     }
     catch (Exception e)
     {
         commlog.TraceEvent(LogLevels.Error, 892, "SplitPowerReadResponse barfed on:" + received + "; " + e.Message);
     }
 }
Esempio n. 5
0
        internal Thread ProcessUserCommand(LMMMLingo.OpDesc cmdt, string tline, LMDAQ.DAQControl control, ref bool keepgoing)
        {
            Thread t = null;
            // each prompt command might have a '=' followed by a single numeric argument e.g. cmd = 1
            Int32 arg = 0;
            bool hasarg = ParsePrompt(tline, cmdt, ref arg);

            // if we didnt get an arg but one is required for the operation (5 or 6 commands, see the list) 
            // then go get the config value from the config state and use it for arg

            if (cmdt.needsArg && !hasarg) // use the lambda to get the config value
                arg = cmdt.cfgInt32.Value;

            keepgoing = true;
            switch (cmdt.tok)
            {
                case LMMMLingo.Tokens.quit: // quit console prompt
                    Console.WriteLine(NC.App.AbbrName + "> Be seeing you . . .");
                    keepgoing = false;
                    break;
                case LMMMLingo.Tokens.lm:  // set or show cur LM #
                    try
                    {
                        CurrentLM = arg;
                        Console.WriteLine(NC.App.AbbrName + ">LM= " + arg);
                    }
                    catch (Exception e)
                    {
                        commlog.TraceEvent(LogLevels.Error, 361, "Current instrument and measurement undefined or incomplete: " + e.Message);
                    }
                    break;
                case LMMMLingo.Tokens.help:
                    //Console.Write(NC.App.AbbrName + ">");
                    foreach (string s in cmdprocessor.CmdPromptHelp) Console.WriteLine(s);
                    break;
                case LMMMLingo.Tokens.config:  //
                    //Console.Write(NC.App.AbbrName + ">");
                    NCCConfig.Config.ShowCfg(NC.App.Config, NC.App.AppContext.Verbose() == System.Diagnostics.TraceEventType.Verbose);
                    break;
                case LMMMLingo.Tokens.stop:  // mostly for stopping an assay, might work for HV Calib too but must test it
                    Console.Write(NC.App.AbbrName + ">");
                    control.StopCurrentAction(); // NEXT: see if this works for HV Calib 
                    break;
                case LMMMLingo.Tokens.assay:
                    if (hasarg)
                    {
                        NC.App.Opstate.Measurement.MeasurementId.MeasOption = (AssaySelector.MeasurementOption)arg;
                        Console.WriteLine(NC.App.AbbrName + ">assay type= " + arg + " (" + ((AssaySelector.MeasurementOption)arg).ToString() + ")");
                    }
                    else
                    {
                        t = control.AssayOperation();
                    }
                    break;
                case LMMMLingo.Tokens.hvcalib:
                    t = control.HVCalibOperation();
                    break;
                case LMMMLingo.Tokens.broadcast:  // UDP "NDAC Control"
                    {
                        NCC.NCCAction x = NC.App.Opstate.Action;
                        NC.App.Opstate.Action = NCC.NCCAction.Discover;
                        control.StartLMDAQServer(null);
                        Console.WriteLine(NC.App.AbbrName + "> Broadcasting to LM instruments. . .");
                        PostLMMMCommand(cmdt.tok);
                        Console.WriteLine(NC.App.AbbrName + "> Sent broadcast. Waiting for LM instruments to connect"); 
                        control.PrepSRDAQHandler();
                        control.ConnectSRInstruments();
                        NC.App.Opstate.Action = x;
                    }
                    break;
                default:
                    try
                    {
                        FormatAndSendLMMMCommand(cmdt.tok, arg, CurrentLM);
                    }
                    catch (Exception e)
                    {
                        commlog.TraceEvent(LogLevels.Error, 360, "Current instrument and measurement undefined or incomplete: " + e.Message);
                    }
                    break;
            }
            return t;
        }
Esempio n. 6
0
        // 
        // cStatus = 0,0,2,500,506,2500,200,0 as of Dec 2010 rev HW
        public void SplitCStatusResponse(string received, ref LMDAQ.LMInstrStatus st)
        {
            try
            {
                string[] text = received.Split('=');
                string[] sval = text[1].Split(',');

                // debug/verbose on the box, not the app
                bool state;
                if (Convert.ToInt32(sval[0]) == 1) state = true; else state = false;
                st.debug = state;

                // input path
                st.inputPath = Convert.ToInt32(sval[1]);  // 0 or 1

                // led output state
                st.leds = Convert.ToInt32(sval[2]);  // 0 or 2

                // hv setpoint
                st.setpoint = Convert.ToInt32(sval[3]);

                // hv
                st.hv = Convert.ToInt32(sval[4]);

                // LLD max
                st.MaxLLD = Convert.ToInt32(sval[5]);
                // LLD mv
                st.LLD = Convert.ToInt32(sval[6]);
                // u3 ????
                st.u1 = Convert.ToInt32(sval[7]);

            }
            catch (Exception e)
            {
                commlog.TraceEvent(LogLevels.Error, 890, "SplitCStatusResponse barfed on:" + received + "; " + e.Message);
            }

        }
Esempio n. 7
0
 public void SplitPowerReadResponse(string received, ref LMDAQ.PowerStatus p)
 {
     cmdprocessor.SplitPowerReadResponse(received, ref p);
 }
Esempio n. 8
0
 public void SplitRatesReadResponse(string received,  ref LMDAQ.RatesStatus p)
 {
     cmdprocessor.SplitRatesReadResponse(received, ref p);
 }
Esempio n. 9
0
 public void SplitHVCalibResponse(string received, ref LMDAQ.HVControl.HVStatus hvst)
 {
     cmdprocessor.SplitHVCalibResponse(received, ref hvst);
 }
Esempio n. 10
0
 public void SplitCStatusResponse(string received, ref LMDAQ.LMInstrStatus st)
 {
     cmdprocessor.SplitCStatusResponse(received, ref st);
 }
Esempio n. 11
0
 public void AppendHVCalibration(LMDAQ.HVControl.HVStatus hvst)
 {
     ctrlHVCalib.AddStepData(hvst);
 }