1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace CheckServer
- {
- public static class SignalProcHelper
- {
- private const string dll = @"AddIns\信号测量\SignalProc.dll";
- #region cpp dll Interop
- [DllImport(dll, EntryPoint = "SigalEst", CallingConvention = CallingConvention.Cdecl)]
- private extern static void SigalEst(string file, long fsHz, int[] smpStart, int[] smpCount, int[] modes, double[] rates, double[] ffcs, int len);
- #endregion
- public static List<SignalProcRes> SigalEst(string file, long fsHz, int[] smpStart, int[] smpCount)
- {
- int sigCount = smpStart.Length;
- int[] modes = new int[sigCount];//信号模式
- double[] rates = new double[sigCount];//调制速率
- double[] ffcs = new double[sigCount];//信号频偏Hz
- SigalEst(file, fsHz, smpStart, smpCount, modes, rates, ffcs, sigCount);
- List<SignalProcRes> list = new List<SignalProcRes>();
- for (int i = 0; i < modes.Length; i++)
- {
- SignalProcRes item = new SignalProcRes()
- {
- SignalType = (EnumSignalType)modes[i],
- Ffc = Math.Round(ffcs[i], 2),
- Rate = Math.Round(rates[i], 2),
- };
- list.Add(item);
- }
- return list;
- }
- }
- public class SignalProcRes
- {
- /// <summary>
- /// 信号类型
- /// </summary>
- public EnumSignalType SignalType { get; set; }
- /// <summary>
- /// 调制速率(bps)
- /// </summary>
- public double Rate { get; set; }
- /// <summary>
- /// 频偏
- /// </summary>
- public double Ffc { get; set; }
- }
- public enum EnumSignalType
- {
- SUNKNOW = -1, //UNKNOW
- BPSK = 1, //BPSK 备注为界面显示字母
- OQPSK = 2, //OQPSK
- QPSK = 3, //QPSK
- P4QPSK = 4, //Pi/4QPSK
- _8PSK = 5, //8PSK
- _16APSK = 6, //16APSK
- _32APSK = 7 //32APSK
- }
- }
|