TCPIP SERVER

This commit is contained in:
TAO Cheng
2014-11-12 08:58:34 +08:00
parent b94f3d2cf3
commit cba2694c0c
7 changed files with 123 additions and 31 deletions
@@ -16,7 +16,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// 中文(简体,中国) resources
// Chinese (Simplified, PRC) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
@@ -1072,8 +1072,8 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Exit",IDCANCEL,512,305,39,14
GROUPBOX "TCP/IP Server Control",IDC_STATIC,17,12,87,81
PUSHBUTTON "Start",IDC_BUTTON_PLC_TCPIP_SERVER_START,28,32,63,18
PUSHBUTTON "Stop",IDC_BUTTON_PLC_TCPIP_SERVER_STOP,28,65,63,18
PUSHBUTTON "Start",IDC_BUTTON_PLC_TCPIP_SERVER_START,29,49,63,18
PUSHBUTTON "Stop",IDC_BUTTON_PLC_TCPIP_SERVER_STOP,29,73,63,18
EDITTEXT IDC_EDIT_MSG,342,14,201,273,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL
PUSHBUTTON "Update",IDC_BUTTON_PLC_TCPIP_SERVER_UPDATESTATE,277,70,40,14
GROUPBOX "DM DATA",IDC_STATIC,110,12,214,81
@@ -1091,6 +1091,8 @@ BEGIN
CONTROL "",IDC_LIST_PLC_TCPIP_SERVER_CCDDATA,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,24,110,294,166
GROUPBOX "Static",IDC_STATIC,17,97,307,214
PUSHBUTTON "Update",IDC_BUTTON_PLC_TCPIP_SERVER_UPDATEDATA,277,291,40,14
EDITTEXT IDC_EDIT_PLC_TCPIP_SERVER_PORTNUMBER,51,30,40,14,ES_AUTOHSCROLL
LTEXT "Port",IDC_STATIC,29,33,14,8
END
@@ -1728,12 +1730,12 @@ BEGIN
IDS_SO7_ABOUTBOX "&About Utility for SO7..."
END
#endif // 中文(简体,中国) resources
#endif // Chinese (Simplified, PRC) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 英语(美国) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -2692,7 +2694,7 @@ BEGIN
END
END
#endif // 英语(美国) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
@@ -464,6 +464,7 @@ void CSo7_Option::OnBnClickedOk()
CSo7_Util_PLC_TCPIP_SERVER* pSo7_Util_PLC_TCPIP_SERVER=new CSo7_Util_PLC_TCPIP_SERVER();
pSo7_Util_PLC_TCPIP_SERVER->DoModal();
delete pSo7_Util_PLC_TCPIP_SERVER;
pSo7_Util_PLC_TCPIP_SERVER=NULL;
if (g_pSo7_TCPIP_Server)
{
delete g_pSo7_TCPIP_Server;
@@ -89,6 +89,9 @@ BOOL CSo7_Util_PLC_TCPIP_SERVER::OnInitDialog()
GetDlgItem(IDC_EDIT_PLC_TCPIP_SERVER_STATE_LASER2)->SetWindowTextW(str);
str.Format(_T("%d"),g_pSo7_TCPIP_Server->m_TCPIPServerState._PLCRunningState);
GetDlgItem(IDC_EDIT_PLC_TCPIP_SERVER_PLC_STATE)->SetWindowTextW(str);
GetDlgItem(IDC_EDIT_PLC_TCPIP_SERVER_PORTNUMBER)->SetWindowTextW(_T("9600"));
m_UpdateListControl(E_LISTCTRL_TITLE);
UpdateData(FALSE);
@@ -99,9 +102,15 @@ BOOL CSo7_Util_PLC_TCPIP_SERVER::OnInitDialog()
void CSo7_Util_PLC_TCPIP_SERVER::OnBnClickedButtonPlcTcpipServerStart()
{
CString str;
UpdateData(TRUE);
USES_CONVERSION;
GetDlgItem(IDC_EDIT_PLC_TCPIP_SERVER_PORTNUMBER)->GetWindowText(str);
const char* cTempValue=T2A(str);
short sPortNumber=static_cast<short>(atoi(cTempValue));
if (g_pSo7_TCPIP_Server)
{
g_pSo7_TCPIP_Server->StartServer(m_hWnd,9600);
g_pSo7_TCPIP_Server->StartServer(m_hWnd,sPortNumber);
m_csMSG=_T("<StartServer> ok.");
OutputWithScroll(m_csMSG,m_edMSG);
}
@@ -194,7 +203,7 @@ void CSo7_Util_PLC_TCPIP_SERVER::m_UpdateListControl(int _type)
cTmp=T2A(csTmp);
if (g_pSo7_TCPIP_Server)
{
g_pSo7_TCPIP_Server->m_CCDData[iRow]=atoi(cTmp);
g_pSo7_TCPIP_Server->m_CCDData_D10000[iRow]=atoi(cTmp);
}
}
break;
@@ -1073,6 +1073,8 @@
#define IDC_EDIT_PLC_TCPIP_SERVER_PLC_STATE 1899
#define IDC_BUTTON_PLC_TCPIP_SERVER_UPDATESTATE2 1900
#define IDC_BUTTON_PLC_TCPIP_SERVER_UPDATEDATA 1900
#define IDC_EDIT__PLC_TCPIP_PORTNUMBER2 1901
#define IDC_EDIT_PLC_TCPIP_SERVER_PORTNUMBER 1901
#define IDC_LIST_PLC_TCPIP_SERVER_CCDDATA 1902
#define IDC_IPADDRESS_PLC_TCPIP 1903
#define IDC_BUTTON_DIY_EXIT_BUTTON 32740