60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
#pragma once
|
|
|
|
// base header
|
|
#include "base/base.h"
|
|
#include "serial_port.h"
|
|
// duilib
|
|
#include "duilib/UIlib.h"
|
|
#include "tcp_server_libevent.h"
|
|
#include <map>
|
|
#include "lua_wraper.h"
|
|
#include "global.h"
|
|
#include <fstream>
|
|
|
|
class TcpServerFrom :
|
|
public ui::ChildBox,
|
|
LuaBindInterface
|
|
{
|
|
public:
|
|
TcpServerFrom(ui::Window* hwnd, string url, uint32_t port, TcpServerLibevent* p);
|
|
~TcpServerFrom();
|
|
TcpServerLibevent* ServerP();
|
|
virtual void Init() override;
|
|
void OnNewConnAccept(ConnectionLibevent*);
|
|
void OnDisConnected(ConnectionLibevent*);
|
|
LuaDelegate* LuaVM();
|
|
std::map<uint32_t, ConnectionLibevent*> mClients;
|
|
|
|
protected:
|
|
void ShowDataInEdit(const char*) override;
|
|
|
|
private:
|
|
void updateStatus();
|
|
TcpServerLibevent* m_server;
|
|
std::string m_url;
|
|
uint32_t m_port;
|
|
ui::Label* m_label_1;
|
|
ui::RichEdit* m_rich_edit_1;
|
|
ui::RichEdit* mEditLua;
|
|
ui::RichEdit* m_rich_edit_3;
|
|
ui::Button* m_button_1;
|
|
ui::CheckBox* m_check_box_1;
|
|
ui::CheckBox* m_check_box_2;
|
|
ui::RichEdit* m_rich_edit_4;
|
|
ui::CheckBox* m_check_box_3;
|
|
ui::CheckBox* m_check_box_4;
|
|
ui::Button* m_button_2;
|
|
ui::Button* m_btn_save_lua;
|
|
ui::Label* m_label_2;
|
|
ui::Combo* m_combo_1;
|
|
ui::Button* m_button_3;
|
|
std::ifstream mLuaFileRead;
|
|
std::ofstream mLuaFileEdit;
|
|
bool mFlagSelectClient;
|
|
LuaDelegate *mLua;
|
|
std::string mLuaScript;
|
|
};
|
|
|
|
|
|
|