map/das-dn/hostadsbf/hostadsbf.h

85 lines
2.5 KiB
C
Raw Normal View History

2024-12-03 10:36:06 +08:00
#ifndef _ISS_ADSBF_PROCESS_H_
#define _ISS_ADSBF_PROCESS_H_
#include "ryFileDef.h"
#include "process.h"
#include "Log.h"
#include "AdsLib.h"
#include "AdsVariable.h"
#include "RouterAccess.h"
2024-12-09 09:41:04 +08:00
using namespace Beckhoff::Ads;
//using namespace bhf::ads;
2024-12-03 10:36:06 +08:00
typedef std::unordered_map<short, short> register2typemap;
2024-12-04 08:48:18 +08:00
typedef struct
{
BOOLEAN inuse;
WORD adsDataMemAddr;
WORD adsDataMaxAddr;
register2typemap adsDataBlocks;
} struADSData;
typedef std::vector<struADSData> adsReadDataVector;
2024-12-03 10:36:06 +08:00
class CHostADSBFProcess : public CProcess
{
public:
CHostADSBFProcess();
virtual ~CHostADSBFProcess();
virtual BOOLEAN OnPreCreate(int id);
virtual BOOLEAN Run(void);
virtual BOOLEAN OnTimer(void);
private:
struRYADSOption m_nOptions;
//增加websocket连接
pthread_t m_pid;
std::string m_localIp; //本机IP地址
std::string m_localNetId; //本机IP地址
std::string m_remoteIp; //PLC设备ip地址
std::string m_remoteNetId;
AdsDevice *m_turbine;
int m_total_length;
DWORD last_sec;
2024-12-04 08:48:18 +08:00
struADSData m_adsDatas[4];
2024-12-03 10:36:06 +08:00
public:
BOOLEAN m_bHaveFTP; //存在FTP协议
//ftp参数信息
char m_user[64];
char m_password[64];
char m_remotePath[128];
char m_localPath[128];
2024-12-04 16:02:58 +08:00
WORD m_remotePort;
2024-12-03 10:36:06 +08:00
//文件信息
int m_iv;
LONG m_currentDirNo; //当前目录编号
LONG m_currentFileNo; //当前文件编号
LONG m_lastDirNo; //上一目录编号
LONG m_lastFileNo; //上一文件编号
LONG m_currentDirStartFileNo; //当前目录文件开始编号
LONG m_lastReadDirNo; //最后获取的目录编号
LONG m_lastReadFileNo; //最后获取的文件编号
LONG m_lastReadDirStartFileNo; //最后获取的目录文件开始编号
LONG m_curStartDirNo; //当前获取的目录编号
LONG m_curStartFileNo; //当前获取的文件编号
BOOLEAN m_bHaveUnReadFile; //存在未读的文件
BOOLEAN m_bFtpRun;
const char* getRemoteIp(void) {return m_remoteIp.c_str(); }
private:
BOOLEAN calc(void);
2024-12-04 16:02:58 +08:00
BOOLEAN readDeviceState(const AdsDevice& route);
2024-12-03 10:36:06 +08:00
BOOLEAN readRealData(void);
BOOLEAN readFileID(void);
};
#endif //_ISS_ADSBF_PROCESS_H_