12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef __DEVICE_HEADER__
- #define __DEVICE_HEADER__
- #include "SynSerial.h"
- #pragma once
- class CDevice
- {
- CSynSerial m_obj;
- public:
- CDevice();
- ~CDevice();
- bool Open();
- void Close();
- std::string SendCommond(std::string cmd);
- public:
- int m_iID; // -- 设备的ID
- int m_iPort; // -- 设备串口号
- std::string m_strDeviceName; // -- 设备名称
- int m_iDeviceType; // -- 设备类型
- int m_iBaudrate; // -- 波特率
- int m_iDatabit; // -- 数据位
- int m_iStopbit; // -- 停止位
- int m_iParitybit; // -- 奇偶校验位
- int m_iRsmode; // -- 串口通信方式,0 - RS232;1 - RS422; 2 - RS485
- //////////////////////////////////////////////////////////////////////////
- std::string m_strIp; // -- ip地址号
- int m_iIpport; // -- ip端口号
- int m_iCommmode; // -- 通信的方式,有 0 - 串口方式;1 - tcp/ip...
- int m_iDevideaddr; // -- 设备地址
- int m_iTimeout; // -- 通讯超时
- int m_iIsuse; // -- 是否启用设备1:启用,0:禁用
- std::string m_strProtocoldllname; // -- 协议DLL名称
- int m_bySpecialdevice; // -- Modbus Rtu;Modbus Ascii;Modbus Tcp;Snmp;RS232;
- };
- extern std::map<int, CDevice*> g_dmap;
- #endif
|