CUGWatch.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #define MAX_COM_BUFFER_LEN 256
  15. // 端口配置参数,//TODO:目前只有一个,多个的话在封装,目前先实现功能
  16. struct ComParameter
  17. {
  18. int nSerialPortNumber; // 串口号
  19. int nBaudRate; // 波特率 0~ 65535
  20. int nDataBits; //数据位为8位
  21. int nFlowControl; //无流控制
  22. int nParity; //无校验位
  23. int nStopBits; //一位停止位
  24. };
  25. // 串口数量
  26. enum EN_COM_NUMBER
  27. {
  28. ONE,
  29. TWO
  30. };
  31. class CUGWatch
  32. {
  33. public:
  34. CUGWatch();
  35. ~CUGWatch();
  36. void ReadConfig();
  37. //void aaa();
  38. bool GetUserParaUT100(int& iMode, int& iVolFullScale, int& iCurFullScale, int& iPowFullScale, int& iSignSns, int& iTestLev, int iOverTime = 2000);
  39. bool SetUserParaUT100(int iMode, int iVolFullScale, int iCurFullScale, int iPowFullScale, int iSignSns, int iTestLev, int iOverTime = 2000);
  40. //设置标定中心频率
  41. bool SetCaliCenterFrqUT100(int iCenterFrq, int iOverTime = 2000);
  42. /**校准数据
  43. */
  44. bool CalibrationUG_UT100();
  45. /**检查完成
  46. */
  47. bool CheckCaliFinish();
  48. /**打开端口
  49. */
  50. int JOpenPort();
  51. void JClosePort();
  52. private:
  53. std::unique_ptr<CRS232> m_cUGSerial;
  54. /**自定义可以多个
  55. */
  56. std::vector<ComParameter> m_comPar;
  57. int iUGUserPara[6] = { 0 };
  58. };
  59. #endif //__CUGWATCH_H__