You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.2 KiB
C++
93 lines
3.2 KiB
C++
// RunComm.h: interface for the CRunComm class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include "run.h"
|
|
|
|
#include "structure.h"
|
|
|
|
#include "DllDefines.h"
|
|
|
|
//
|
|
class MCCTRDLLCLASS CRunComm : public CRun
|
|
{
|
|
public:
|
|
CRunComm(int nID, const std::string& strName, const std::vector<stModule>& modules, const std::vector<int>& iSequenceModuleNo);
|
|
virtual ~CRunComm();
|
|
|
|
enum
|
|
{
|
|
MAINT_OPEN_COM = 0x1,
|
|
MAINT_CLOSE_COM = 0x2,
|
|
MAINT_SEND_COM = 0x4,
|
|
MAINT_CONNECT_PORT = 0x8,
|
|
MAINT_DISCONNECT_PORT = 0x10,
|
|
MAINT_SEND_PACKET = 0x20,
|
|
};
|
|
|
|
protected:
|
|
bool IsMaintenaceCloseCommPort() const;
|
|
bool IsMaintenanceSendComm() const;
|
|
bool IsMaintenaceOpenCommPort() const;
|
|
std::string GetMaintMsg() const;
|
|
bool IsMaintenanceDisconnectPort() const;
|
|
bool IsMaintenanceConnectPort() const;
|
|
bool IsMaintenanceSendPacket() const;
|
|
|
|
bool SetCommPortSetting(unsigned int nWhichOne, const stComSetting& _comSetting);
|
|
stComSetting GetCommPortSetting(unsigned int nWhichOne, bool bMaint = false);
|
|
|
|
bool SetNetworkPortSetting(unsigned int nWhichOne, const stNetAddress& _netAddress);
|
|
stNetAddress GetNetworkPortSetting(unsigned int nWhichOne, bool bMaint = false);
|
|
|
|
// send com data to modules in maintenance mode
|
|
void OnMaintenanceSendCom(const stComSetting& _comSetting, const std::string& strSendMsg) override;
|
|
|
|
// send open com to modules in maintenance mode
|
|
void OnMaintenanceOpenCom(const stComSetting& _comSetting) override;
|
|
|
|
// send close com to modules in maintenance mode
|
|
void OnMaintenanceCloseCom(const stComSetting& _comSetting) override;
|
|
|
|
// send packet to modules in maintenance mode
|
|
void OnMaintenanceSendPacket(const stNetAddress& _netAddress, const std::string& strSendMsg) override;
|
|
|
|
// send connect port to modules in maintenance mode
|
|
void OnMaintenanceConnectPort(const stNetAddress& _netAddress) override;
|
|
|
|
// send connect port to modules in maintenance mode
|
|
void OnMaintenanceDisconnectPort(const stNetAddress& _netAddress) override;
|
|
|
|
// write acknowledge message to text file
|
|
void WriteAckToTextFile(const std::string& strAckMsg);
|
|
|
|
virtual void SendPacket(const std::string& strAckMsg = "");
|
|
virtual void DisconnectPort(const std::string& strAckMsg = "");
|
|
virtual void ConnectPort(const std::string& strAckMsg = "");
|
|
virtual void SendComm(const std::string& strAckMsg = "");
|
|
virtual void CloseCommPort(const std::string& strAckMsg = "");
|
|
virtual void OpenCommPort(const std::string& strAckMsg = "");
|
|
|
|
void SetMaintCommSettings(const stComSetting& _comSetting);
|
|
|
|
private:
|
|
// Maintenance use
|
|
char m_cComCommand{ 0 };
|
|
std::string m_strMaintSendMsg;
|
|
|
|
// TCP/IP Maintenance variables
|
|
stNetAddress m_maintNetAddress;
|
|
// Serial Comm Settings for maintenance use
|
|
|
|
stComSetting m_maintComSetting;
|
|
|
|
// TCP/IP variables for auto run
|
|
std::vector<stNetAddress> m_vecNetAddress;
|
|
// Serial Comm Settings for auto run use
|
|
std::vector<stComSetting> m_vecComSetting;
|
|
};
|