123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- using CliWrap;
- using Ips.Library.Basic;
- using Ips.Library.Entity;
- namespace Ips.Library.LocLib
- {
- public static class XdcUtil
- {
- static readonly string CliFile = Path.Combine(IpsPath.CliRootDir, "xdc", "xdc.exe");
- public static async Task<CommandResult> ExecuteAsync(string fileIn, string fileOut, double fs, XdcItem[] items, int th = 6, CancellationToken token = default)
- {
- var len = items.Length;
- var ffcs = new double[len];
- var bws = new double[len];
- var mods = new ModuType[len];
- for (int i = 0; i < len; i++)
- {
- var item = items[i];
- ffcs[i] = item.Ffc;
- bws[i] = item.BandWidth;
- mods[i] = item.ModuType;
- }
- var cli = Cli.Wrap(CliFile)
- .WithArguments(args =>
- {
- args.Add(fileIn, true);
- args.Add(fileOut, true);
- args.Add(fs);
- args.Add("--ffcs").Add(ffcs.JoinAsString(" "), false);
- args.Add("--bws").Add(bws.JoinAsString(" "), false);
- args.Add("--mods").Add(mods.Select(m => m.ToString("d")).JoinAsString(" "), false);
- args.Add("--th").Add(th);
- });
- var resCmd = await cli.ExecuteAsync(token);
- return resCmd;
- }
- }
- public class XdcItem
- {
- public XdcItem()
- {
- }
- /// <summary>
- /// 同频对消参数
- /// </summary>
- /// <param name="ffc">频偏(MHz)</param>
- /// <param name="bandWidth">信号带宽(MHz)</param>
- /// <param name="moduType">调制方式</param>
- public XdcItem(double ffc, double bandWidth, ModuType moduType)
- {
- Ffc = ffc;
- BandWidth = bandWidth;
- ModuType = moduType;
- }
- /// <summary>
- /// 频偏(MHz)
- /// </summary>
- public double Ffc { get; set; }
- /// <summary>
- /// 信号带宽(MHz)
- /// </summary>
- public double BandWidth { get; set; }
- /// <summary>
- /// 调制方式
- /// </summary>
- public ModuType ModuType { get; set; }
- }
- }
|