CUGWatch.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // *****************************************************************************
  2. // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
  3. // 保留所有权利
  4. // *****************************************************************************
  5. // 作者 : 杨坚
  6. // 版本 : 1.0
  7. // 功能说明:
  8. // 发生器,协议
  9. // *****************************************************************************
  10. #ifndef __CUGWATCH_H__
  11. #define __CUGWATCH_H__ 1
  12. #include <CRS232.h>
  13. #include <vector>
  14. //#include "CUltraHeadDiagnosis.h"
  15. #define MAX_COM_BUFFER_LEN 256
  16. // 端口配置参数,//TODO:目前只有一个,多个的话在封装,目前先实现功能
  17. struct ComParameter
  18. {
  19. int nSerialPortNumber; // 串口号
  20. int nBaudRate; // 波特率 0~ 65535
  21. int nDataBits; //数据位为8位
  22. int nFlowControl; //无流控制
  23. int nParity; //无校验位
  24. int nStopBits; //一位停止位
  25. };
  26. // 发声器默认值
  27. struct ST_CUGWATCH_DEF
  28. {
  29. int nUGModelType; //超声类型
  30. int nVoltageVal; //电压
  31. int nCurrentVal; //电流
  32. int nPowerVal; //功率
  33. };
  34. //协议写入参数
  35. struct ST_PROTOCOL_WRITE_PARA
  36. {
  37. int iMode = 0; //3
  38. // 5,2,6,3,4
  39. int iVolFullScale; //电压
  40. int iCurFullScale; // 电流
  41. int iPowFullScale; //功率
  42. int iSignSns; //2信号极性
  43. int iTestLev; //8测试输出等级
  44. };
  45. // 串口数量,可能有多个
  46. enum EN_COM_NUMBER
  47. {
  48. ONE,
  49. TWO
  50. };
  51. class __declspec(dllexport) CUGWatch
  52. {
  53. public:
  54. //CUGWatch(CUltraHead* pUltraHeade);
  55. CUGWatch(const ComParameter com);
  56. ~CUGWatch();
  57. /* LONG SetParam();
  58. LONG GetParam();*/
  59. /**设置值
  60. */
  61. void SetCUGWatchDef(const ST_CUGWATCH_DEF& sCUGWatchDef);
  62. /**修改当前参数
  63. */
  64. bool ReviseUserParaUT100();
  65. /**获取用户设置的参数
  66. */
  67. bool GetUserParaUT100();
  68. /**设置用户参数
  69. */
  70. bool SetUserParaUT100();
  71. bool SetUserParaUT100(ST_PROTOCOL_WRITE_PARA sProtocolWritePara);
  72. /**设置标定中心频率
  73. */
  74. bool SetCaliCenterFrqUT100(int iCenterFrq, int iOverTime = 2000);
  75. /**校准数据
  76. */
  77. bool CalibrationUG_UT100();
  78. /**获取校准参数 频率 阻抗
  79. */
  80. bool GetCaliPara(float& ResImp, float& ResFre);
  81. /**检查完成
  82. */
  83. bool CheckCaliFinish();
  84. private:
  85. /**打开端口
  86. */
  87. int JOpenPort();
  88. void JClosePort();
  89. private:
  90. // CUltraHead* m_pCUltraHead = nullptr;
  91. /**当前配置,获取数据库
  92. */
  93. //std::vector<MODULE_CONFIG_STRUCT> m_vecConfig;
  94. /**串口指针
  95. */
  96. std::unique_ptr<CRS232> m_cUGSerial;
  97. /**自定义可以多个
  98. */
  99. std::vector<ComParameter> m_comPar;
  100. /**发生器默认值
  101. */
  102. ST_CUGWATCH_DEF m_sCUGWatchDef;
  103. /**1.读取
  104. * 2.比对参数
  105. */
  106. ST_PROTOCOL_WRITE_PARA m_sProtocolWritePara;
  107. };
  108. #endif //__CUGWATCH_H__