no message
This commit is contained in:
parent
021f1653b7
commit
7065ee909e
@ -172,9 +172,7 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
//delete mRightShow;
|
//delete mRightShow;
|
||||||
mRightShow = nullptr;
|
mRightShow = nullptr;
|
||||||
}
|
}
|
||||||
if (uMsg == WM_USER_POS_CHANGED) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (uMsg == WM_ADD_TCPCLIENT_MONITOR) {
|
if (uMsg == WM_ADD_TCPCLIENT_MONITOR) {
|
||||||
TcpClientInfo* info = (TcpClientInfo*)wParam;
|
TcpClientInfo* info = (TcpClientInfo*)wParam;
|
||||||
TcpClientLibevent* cli = (TcpClientLibevent*)lParam;
|
TcpClientLibevent* cli = (TcpClientLibevent*)lParam;
|
||||||
@ -383,6 +381,26 @@ LRESULT BasicForm::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
);
|
);
|
||||||
mMonitorNewSelect->Close();
|
mMonitorNewSelect->Close();
|
||||||
}
|
}
|
||||||
|
if (uMsg == WM_ADD_WEBSOCKET_SERVER_CLOSE) {
|
||||||
|
wprintf(L"close %s\r\n", ((wstring*)wParam)->c_str());
|
||||||
|
mRightShow->SetVisible(false);
|
||||||
|
mRightSide->RemoveAll();
|
||||||
|
|
||||||
|
mWebsocketServerForm.erase(*(wstring*)(wParam));
|
||||||
|
int cnt = mMonitor->GetRootNode()->GetChildNode(6)->GetChildNodeCount();
|
||||||
|
ui::TreeNode* p = nullptr;
|
||||||
|
for (int i = 0; i < cnt; i++) {
|
||||||
|
if (mMonitor->GetRootNode()->GetChildNode(6)->GetChildNode(i)->GetText()
|
||||||
|
== *(wstring*)(wParam)) {
|
||||||
|
p = mMonitor->GetRootNode()->GetChildNode(6)->GetChildNode(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nullptr != p)
|
||||||
|
mMonitor->GetRootNode()->GetChildNode(6)->RemoveChildNode(p);
|
||||||
|
//delete mRightShow;
|
||||||
|
mRightShow = nullptr;
|
||||||
|
}
|
||||||
if (uMsg == WM_ADD_UDP_MONITOR) {
|
if (uMsg == WM_ADD_UDP_MONITOR) {
|
||||||
printf("add udp monitor");
|
printf("add udp monitor");
|
||||||
wchar_t pdata[100] = L"\0";
|
wchar_t pdata[100] = L"\0";
|
||||||
|
@ -98,6 +98,18 @@ WebsocketServer::WebsocketServer(std::string server,uint32_t port){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebsocketServer::~WebsocketServer()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
this->m_status = WebsocketClient::STOP;
|
||||||
|
if (m_tls)
|
||||||
|
m_client_tls.stop();
|
||||||
|
else
|
||||||
|
m_client.stop();
|
||||||
|
m_thread->join();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
int WebsocketServer::SendData(uint32_t fd,const char* dat,int len,
|
int WebsocketServer::SendData(uint32_t fd,const char* dat,int len,
|
||||||
websocketpp::frame::opcode::value op){
|
websocketpp::frame::opcode::value op){
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ typedef WsServer::message_ptr message_ptr;
|
|||||||
|
|
||||||
class WebsocketServer {
|
class WebsocketServer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::function<void(std::string addr, uint32_t port)> OnNewConnectionHanlder;
|
typedef std::function<void(std::string addr, uint32_t port)> OnNewConnectionHanlder;
|
||||||
typedef std::function<void(std::string addr, uint32_t port)> OnConnectionCloseHanlder;
|
typedef std::function<void(std::string addr, uint32_t port)> OnConnectionCloseHanlder;
|
||||||
typedef std::function<void(std::string addr, uint32_t port,std::string message)> OnMessageHanlder;
|
typedef std::function<void(std::string addr, uint32_t port,std::string message)> OnMessageHanlder;
|
||||||
@ -25,6 +26,7 @@ public:
|
|||||||
std::string Url();
|
std::string Url();
|
||||||
uint32_t Port();
|
uint32_t Port();
|
||||||
WebsocketServer(std::string server,uint32_t port);
|
WebsocketServer(std::string server,uint32_t port);
|
||||||
|
~WebsocketServer();
|
||||||
friend void on_new_connection(WebsocketServer* s, websocketpp::connection_hdl hdl);
|
friend void on_new_connection(WebsocketServer* s, websocketpp::connection_hdl hdl);
|
||||||
friend void on_message(WebsocketServer* s, websocketpp::connection_hdl hdl, message_ptr msg);
|
friend void on_message(WebsocketServer* s, websocketpp::connection_hdl hdl, message_ptr msg);
|
||||||
friend void on_connection_close(WebsocketServer* s, websocketpp::connection_hdl hdl);
|
friend void on_connection_close(WebsocketServer* s, websocketpp::connection_hdl hdl);
|
||||||
|
@ -26,6 +26,13 @@ WebsocketServerForm::WebsocketServerForm(ui::Window* hwnd, string url,
|
|||||||
this->mLua->BindFunction("showdata", LuaShowData);
|
this->mLua->BindFunction("showdata", LuaShowData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebsocketServerForm::~WebsocketServerForm()
|
||||||
|
{
|
||||||
|
std::cout << "~WebsocketServerForm\r\n";
|
||||||
|
std::cout << "~WebsocketServerForm\r\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void WebsocketServerForm::Init()
|
void WebsocketServerForm::Init()
|
||||||
{
|
{
|
||||||
ui::ChildBox::Init();
|
ui::ChildBox::Init();
|
||||||
@ -68,10 +75,13 @@ void WebsocketServerForm::Init()
|
|||||||
m_btn_close_form = dynamic_cast<ui::Button*>(FindSubControl(L"btn_close_uart"));
|
m_btn_close_form = dynamic_cast<ui::Button*>(FindSubControl(L"btn_close_uart"));
|
||||||
|
|
||||||
if (nullptr != m_btn_close_form) {
|
if (nullptr != m_btn_close_form) {
|
||||||
m_btn_close_form->AttachClick([this](ui::EventArgs *ev) {
|
m_btn_close_form->AttachClick([this](ui::EventArgs* ev) {
|
||||||
|
wstring* name = new wstring(this->GetName());
|
||||||
|
::PostMessage(this->GetWindow()->GetHWND(),
|
||||||
|
WM_ADD_WEBSOCKET_SERVER_CLOSE, (WPARAM)name, 0);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (nullptr != m_btn_save_lua)
|
if (nullptr != m_btn_save_lua)
|
||||||
m_btn_save_lua->AttachClick(
|
m_btn_save_lua->AttachClick(
|
||||||
[this](ui::EventArgs* ev) {
|
[this](ui::EventArgs* ev) {
|
||||||
|
@ -26,6 +26,7 @@ class WebsocketServerForm :
|
|||||||
public:
|
public:
|
||||||
WebsocketServerForm(ui::Window* hwnd,
|
WebsocketServerForm(ui::Window* hwnd,
|
||||||
string url, WebsocketServer* server);
|
string url, WebsocketServer* server);
|
||||||
|
~WebsocketServerForm();
|
||||||
virtual void Init() override;
|
virtual void Init() override;
|
||||||
LuaDelegate* LuaVM();
|
LuaDelegate* LuaVM();
|
||||||
void ShowDataInEdit(const char*) ;
|
void ShowDataInEdit(const char*) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user