CapCore.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace NNCapTest.API
  8. {
  9. //采集配置参数
  10. public struct st_ad_para_c
  11. {
  12. /// <summary>
  13. /// dds频率 -无需配置
  14. /// </summary>
  15. ulong udds;
  16. /// <summary>
  17. /// 采样率
  18. /// </summary>
  19. ulong uSampleFreq;
  20. /// <summary>
  21. /// /窄带中心频率 DDC有效-偏移频率
  22. /// </summary>
  23. ulong uDDCFreq;
  24. /// <summary>
  25. /// 采样类型 0-ADC 1-DDC
  26. /// </summary>
  27. byte uSampleMode;
  28. /// <summary>
  29. /// 触发模式 0-内触发 1-外触发
  30. /// </summary>
  31. byte uTrigMode;
  32. /// <summary>
  33. /// 时钟源 0-内时钟 1-外时钟 2-外参考
  34. /// </summary>
  35. byte uClockSrc;
  36. /// <summary>
  37. /// 保留
  38. /// </summary>
  39. byte ures;
  40. /// <summary>
  41. /// 抽取倍数
  42. /// </summary>
  43. uint uExtTimes;
  44. }
  45. static class CapCore
  46. {
  47. private const string dllName = @"Api\CPC2007_ADCardx64.dll";
  48. [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
  49. public static extern IntPtr c_createdevice();
  50. [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
  51. public static extern int openDev_c(IntPtr ptr);
  52. [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
  53. public static extern int initDev_c(IntPtr ptr);
  54. [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
  55. public static extern int control_ad_para_c(IntPtr ptr, st_ad_para_c para, bool blSend = true);
  56. [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)]
  57. public static extern int closeDev_c(IntPtr ptr);
  58. }
  59. }