123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using Uestc.Auto6.Dso.Core;
- using Uestc.Auto6.Dso.ComModel;
- using UESTC.Auto.SCPIManager;
- namespace Uestc.Auto6.Dso.Scpi
- {
- partial class StubFunc
- {
- /// <summary>
- /// 设置或查询指示器
- /// </summary>
- /// <param name="analyResult"></param>
- /// <returns></returns>
- public static bool scpiSet_MeasureIndicator(SCPICommandProcessFuncParam analyResult)
- {
- if (Presenter == null || analyResult.Tag is not ScpiTagObj tagObj
- || !scpiSet_ParamCheck(analyResult, out string paraStr))
- {
- return false;
- }
- var measure = Presenter.Measure;
- if (shortCMD(paraStr) == "OFF")
- {
- Presenter.Measure.Indicator = 0;
- }
- else if ((!int.TryParse(paraStr.Replace("P", ""), out int index)) || !(index < 1 || index > measure.Length))
- {
- Presenter.Measure.Indicator = index;
- }
- else
- {
- return false;
- }
- return true;
- }
- /// <summary>
- /// 设置或查询指示器
- /// </summary>
- /// <param name="analyResult"></param>
- /// <param name="sendMessage"></param>
- /// <returns></returns>
- public static bool scpiQuy_MeasureIndicator(SCPICommandProcessFuncParam analyResult, ref SCPISendMessage sendMessage)
- {
- if (Presenter == null || analyResult.Tag is not ScpiTagObj tagObj)
- {
- return false;
- }
- var indicator = Presenter.Measure.Indicator;
- string returnStr;
- if (indicator <= 0)
- {
- returnStr = "OFF";
- }
- else
- {
- returnStr = $"P{indicator}";
- }
- sendMessage.SendData = decodeStr(returnStr);
- return true;
- }
- /// <summary>
- /// 设置快速采集类型。
- /// </summary>
- /// <param name="analyResult"></param>
- /// <returns></returns>
- public static bool scpiSet_MeasureUltraAcq(SCPICommandProcessFuncParam analyResult)
- {
- if (Presenter == null || analyResult.Tag is not ScpiTagObj tagObj
- || !scpiSet_ParamCheck(analyResult, out string paraStr))
- {
- return false;
- }
- paraStr = shortCMD(paraStr);
- var measure = Presenter.Measure;
- switch (paraStr)
- {
- case "VERT":
- for (Int32 i = 0; i < measure.Length; i++)
- {
- measure[i].Name = _StdVertItems[i];
- measure[i].Source = measure.SnapshotSource;
- measure[i].Source2nd = null;
- measure[i].Active = true;
- measure.ResetStat(i);
- }
- break;
- case "HORI":
- for (Int32 i = 0; i < measure.Length; i++)
- {
- measure[i].Name = _StdHorzItems[i];
- measure[i].Source = measure.SnapshotSource;
- measure[i].Source2nd = null;
- measure[i].Active = true;
- measure.ResetStat(i);
- }
- break;
- default:
- return false;
- }
- return true;
- }
- /// <summary>
- /// 设置所有测量项是否激活
- /// </summary>
- /// <param name="analyResult"></param>
- /// <returns></returns>
- public static bool scpiSet_MeasureAllActive(SCPICommandProcessFuncParam analyResult)
- {
- if (Presenter == null || analyResult.Tag is not ScpiTagObj tagObj
- || !scpiSet_ParamCheck(analyResult, out string paraStr))
- {
- return false;
- }
- paraStr = shortCMD(paraStr);
- var measure = Presenter.Measure;
- switch (paraStr)
- {
- case "ON":
- measure.SetAllActive(true);
- break;
- case "OFF":
- measure.SetAllActive(false);
- break;
- default:
- return false;
- }
- return true;
- }
- /// <summary>
- /// 设置或查询测量项类型。
- /// </summary>
- /// <param name="analyResult"></param>
- /// <returns></returns>
- public static bool scpiSet_MeasureItemType(SCPICommandProcessFuncParam analyResult)
- {
- if (Presenter == null || analyResult.Tag is not ScpiTagObj tagObj
- || !checkMEAItemNO(analyResult, out MeasItemPrsnt itemPrsnt)
- || !scpiSet_ParamCheck(analyResult, out string paraStr)
- )
- {
- return false;
- }
- MeasPrsnt measure = Presenter.Measure;
- if (!measure.ScpiNameTable.TryGetValue(shortCMD(paraStr), out string setValue))
- {
- return false;
- }
- itemPrsnt.Name = setValue;
- measure.ResetStat(analyResult.ChannelIndex - 1);
- return true;
- }
- /// <summary>
- /// 设置或查询测量项类型。
- /// </summary>
- /// <param name="analyResult"></param>
- /// <param name="sendMessage"></param>
- /// <returns></returns>
- public static bool scpiQuy_MeasureItemType(SCPICommandProcessFuncParam analyResult, ref SCPISendMessage sendMessage)
- {
- if (Presenter == null || !checkMEAItemNO(analyResult, out MeasItemPrsnt itemPrsnt)
- || analyResult.Tag is not ScpiTagObj tagObj)
- {
- return false;
- }
- MeasPrsnt measure = Presenter.Measure;
- string itemName = itemPrsnt.Name;
- var keyValue = measure.ScpiNameTable.FirstOrDefault(data => data.Value == itemName);
- if (string.IsNullOrWhiteSpace(keyValue.Key))
- {
- return false;
- }
- sendMessage.SendData = decodeStr(keyValue.Key);
- return true;
- }
-
- }
- }
- //================= 共8个方法 =
|