123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- // *****************************************************************************
- // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
- // 保留所有权利
- // *****************************************************************************
- // 作者 : 杨坚
- // 版本 : 1.0
- // 功能说明:
- // 发生器,协议
- // *****************************************************************************
- #ifndef __CUGWATCH_H__
- #define __CUGWATCH_H__ 1
- #include <CRS232.h>
- #include <vector>
- //#include "CUltraHeadDiagnosis.h"
- #define MAX_COM_BUFFER_LEN 256
- // 端口配置参数,//TODO:目前只有一个,多个的话在封装,目前先实现功能
- struct ComParameter
- {
- int nSerialPortNumber; // 串口号
- int nBaudRate; // 波特率 0~ 65535
- int nDataBits; //数据位为8位
- int nFlowControl; //无流控制
- int nParity; //无校验位
- int nStopBits; //一位停止位
- };
- // 发声器默认值
- struct ST_CUGWATCH_DEF
- {
- int nUGModelType; //超声类型
- int nVoltageVal; //电压
- int nCurrentVal; //电流
- int nPowerVal; //功率
- };
- //协议写入参数
- struct ST_PROTOCOL_WRITE_PARA
- {
- int iMode = 0; //3
- // 5,2,6,3,4
- int iVolFullScale; //电压
- int iCurFullScale; // 电流
- int iPowFullScale; //功率
- int iSignSns; //2信号极性
- int iTestLev; //8测试输出等级
- };
- // 串口数量,可能有多个
- enum EN_COM_NUMBER
- {
- ONE,
- TWO
- };
- class __declspec(dllexport) CUGWatch
- {
- public:
- //CUGWatch(CUltraHead* pUltraHeade);
- CUGWatch(const ComParameter com);
- ~CUGWatch();
- /* LONG SetParam();
- LONG GetParam();*/
- /**设置值
- */
- void SetCUGWatchDef(const ST_CUGWATCH_DEF& sCUGWatchDef);
- /**修改当前参数
- */
- bool ReviseUserParaUT100();
- /**获取用户设置的参数
- */
- bool GetUserParaUT100();
- /**设置用户参数
- */
- bool SetUserParaUT100();
- bool SetUserParaUT100(ST_PROTOCOL_WRITE_PARA sProtocolWritePara);
- /**设置标定中心频率
- */
- bool SetCaliCenterFrqUT100(int iCenterFrq, int iOverTime = 2000);
- /**校准数据
- */
- bool CalibrationUG_UT100();
- /**获取校准参数 频率 阻抗
- */
- bool GetCaliPara(float& ResImp, float& ResFre);
- /**检查完成
- */
- bool CheckCaliFinish();
- private:
- /**打开端口
- */
- int JOpenPort();
- void JClosePort();
- private:
- // CUltraHead* m_pCUltraHead = nullptr;
- /**当前配置,获取数据库
- */
- //std::vector<MODULE_CONFIG_STRUCT> m_vecConfig;
- /**串口指针
- */
- std::unique_ptr<CRS232> m_cUGSerial;
- /**自定义可以多个
- */
- std::vector<ComParameter> m_comPar;
- /**发生器默认值
- */
- ST_CUGWATCH_DEF m_sCUGWatchDef;
- /**1.读取
- * 2.比对参数
- */
- ST_PROTOCOL_WRITE_PARA m_sProtocolWritePara;
- };
- #endif //__CUGWATCH_H__
|