no message
This commit is contained in:
parent
905410fde2
commit
7417a488ed
@ -127,13 +127,13 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mMonitor->GetRootNode()->GetChildNode(1)->RemoveChildNode(p);
|
mMonitor->GetRootNode()->GetChildNode(1)->RemoveChildNode(p);
|
||||||
delete mRightShow;
|
// delete mRightShow;
|
||||||
mRightShow = nullptr;
|
mRightShow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uMsg == WM_USER_TCP_SERVER_CLOSE) {
|
if (uMsg == WM_USER_TCP_SERVER_CLOSE) {
|
||||||
wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str());
|
wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str());
|
||||||
mRightShow->SetVisible(false);
|
mRightShow->SetVisible(false);
|
||||||
mRightSide->SetAutoDestroy(true);
|
|
||||||
mRightSide->RemoveAll();
|
mRightSide->RemoveAll();
|
||||||
|
|
||||||
mTcpServerForm.erase(*(wstring*)(wParam));
|
mTcpServerForm.erase(*(wstring*)(wParam));
|
||||||
@ -146,8 +146,9 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mMonitor->GetRootNode()->GetChildNode(2)->RemoveChildNode(p);
|
if(nullptr != p)
|
||||||
delete mRightShow;
|
mMonitor->GetRootNode()->GetChildNode(2)->RemoveChildNode(p);
|
||||||
|
//delete mRightShow;
|
||||||
mRightShow = nullptr;
|
mRightShow = nullptr;
|
||||||
}
|
}
|
||||||
if (uMsg == WM_USER_POS_CHANGED) {
|
if (uMsg == WM_USER_POS_CHANGED) {
|
||||||
@ -393,7 +394,6 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
p->SetVisible(true);
|
p->SetVisible(true);
|
||||||
mRightShow = p;
|
mRightShow = p;
|
||||||
mRightSide->SelectItem(p->GetName());
|
mRightSide->SelectItem(p->GetName());
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p->SetVisible(true);
|
p->SetVisible(true);
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
wstring name;
|
wstring name;
|
||||||
UINT port_num;
|
UINT port_num;
|
||||||
@ -31,8 +30,6 @@ typedef struct {
|
|||||||
|
|
||||||
class SerialPort
|
class SerialPort
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerialPort();
|
SerialPort();
|
||||||
~SerialPort();
|
~SerialPort();
|
||||||
@ -65,16 +62,12 @@ public:
|
|||||||
|
|
||||||
//检查指定串口状态
|
//检查指定串口状态
|
||||||
static int PortState(UINT PortNo);
|
static int PortState(UINT PortNo);
|
||||||
|
|
||||||
//清空指定串口缓冲区
|
//清空指定串口缓冲区
|
||||||
static void ClearCom(UINT PortNo);
|
static void ClearCom(UINT PortNo);
|
||||||
|
|
||||||
//指定端口RTS信号检测,用于脚踏开关信号触发,
|
//指定端口RTS信号检测,用于脚踏开关信号触发,
|
||||||
static int CheckRTS(UINT PortNo);
|
static int CheckRTS(UINT PortNo);
|
||||||
public:
|
public:
|
||||||
//static UINT PortNum; //串口端口号
|
//static UINT PortNum; //串口端口号
|
||||||
static map<int, HANDLE> ComMap;
|
static map<int, HANDLE> ComMap;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,10 +40,13 @@ int ThreadRun(TcpClientLibevent *p) {
|
|||||||
//todo linux版本sleep
|
//todo linux版本sleep
|
||||||
#endif
|
#endif
|
||||||
}else {
|
}else {
|
||||||
|
std::cout << "p->Dispatch()";
|
||||||
ret = p->Dispatch();
|
ret = p->Dispatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "p->Dispatch() finished";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +167,8 @@ int TcpClientLibevent::ConnectServer() {
|
|||||||
bufferevent_free(mBev);
|
bufferevent_free(mBev);
|
||||||
mBev = nullptr;
|
mBev = nullptr;
|
||||||
printf("Connect failed\n");
|
printf("Connect failed\n");
|
||||||
|
mMux.unlock();
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
this->mStatus = TcpClientLibevent::CONNECTING;
|
this->mStatus = TcpClientLibevent::CONNECTING;
|
||||||
@ -223,6 +228,7 @@ int TcpClientLibevent::SetObserver(TcpClientLibevent::TcpClientObserver *ob) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int TcpClientLibevent::Dispatch() {
|
int TcpClientLibevent::Dispatch() {
|
||||||
|
std::cout << "Dispatch\r\n";
|
||||||
return event_base_dispatch(mBase);;
|
return event_base_dispatch(mBase);;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,15 @@ public:
|
|||||||
TcpClientLibevent(std::string addrinfo, int port, TcpClientObserver* p);
|
TcpClientLibevent(std::string addrinfo, int port, TcpClientObserver* p);
|
||||||
~TcpClientLibevent() {
|
~TcpClientLibevent() {
|
||||||
mMux.lock();
|
mMux.lock();
|
||||||
mStatus = STOP;
|
mStatus = TcpClientLibevent::STOP;
|
||||||
mMux.unlock();
|
mMux.unlock();
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
tv.tv_sec = 0;
|
||||||
|
tv.tv_usec = 10000;
|
||||||
|
event_base_loopexit(mBase,&tv);
|
||||||
mThread->join();
|
mThread->join();
|
||||||
event_base_free(mBase);
|
std::cout << "12345\r\n";
|
||||||
|
|
||||||
};
|
};
|
||||||
friend void conn_eventcb(struct bufferevent*, short, void*);
|
friend void conn_eventcb(struct bufferevent*, short, void*);
|
||||||
int ConnectServer();
|
int ConnectServer();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define TCP_CLIENT_SCRIPT "tcp_client.lua"
|
#define TCP_CLIENT_SCRIPT "tcp_client.lua"
|
||||||
TcpClientForm::~TcpClientForm() {
|
TcpClientForm::~TcpClientForm() {
|
||||||
delete mClient;
|
delete mClient;
|
||||||
|
std::cout << "45678\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpClientForm::TcpClientForm(ui::Window* hwnd,std::string url, uint32_t port, TcpClientLibevent* p):
|
TcpClientForm::TcpClientForm(ui::Window* hwnd,std::string url, uint32_t port, TcpClientLibevent* p):
|
||||||
|
Loading…
Reference in New Issue
Block a user