Device.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __DEVICE_HEADER__
  2. #define __DEVICE_HEADER__
  3. #include "SynSerial.h"
  4. #pragma once
  5. class CDevice
  6. {
  7. CSynSerial m_obj;
  8. public:
  9. CDevice();
  10. ~CDevice();
  11. bool Open();
  12. void Close();
  13. std::string SendCommond(std::string cmd);
  14. public:
  15. int m_iID; // -- 设备的ID
  16. int m_iPort; // -- 设备串口号
  17. std::string m_strDeviceName; // -- 设备名称
  18. int m_iDeviceType; // -- 设备类型
  19. int m_iBaudrate; // -- 波特率
  20. int m_iDatabit; // -- 数据位
  21. int m_iStopbit; // -- 停止位
  22. int m_iParitybit; // -- 奇偶校验位
  23. int m_iRsmode; // -- 串口通信方式,0 - RS232;1 - RS422; 2 - RS485
  24. //////////////////////////////////////////////////////////////////////////
  25. std::string m_strIp; // -- ip地址号
  26. int m_iIpport; // -- ip端口号
  27. int m_iCommmode; // -- 通信的方式,有 0 - 串口方式;1 - tcp/ip...
  28. int m_iDevideaddr; // -- 设备地址
  29. int m_iTimeout; // -- 通讯超时
  30. int m_iIsuse; // -- 是否启用设备1:启用,0:禁用
  31. std::string m_strProtocoldllname; // -- 协议DLL名称
  32. int m_bySpecialdevice; // -- Modbus Rtu;Modbus Ascii;Modbus Tcp;Snmp;RS232;
  33. };
  34. extern std::map<int, CDevice*> g_dmap;
  35. #endif