外部设置令牌控制器显示消息日志时是否显示远程地址
This commit is contained in:
parent
32a8c2c263
commit
e3dd1bc5d9
|
@ -196,6 +196,7 @@ TokenClient* AP0801::CreateClient()
|
||||||
// 建立内网控制器
|
// 建立内网控制器
|
||||||
auto token2 = new TokenController();
|
auto token2 = new TokenController();
|
||||||
token2->Port = dynamic_cast<ITransport*>(socket);
|
token2->Port = dynamic_cast<ITransport*>(socket);
|
||||||
|
token2->ShowRemote = true;
|
||||||
client->Local = token2;
|
client->Local = token2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ void TokenClient::SayHello(bool broadcast)
|
||||||
{
|
{
|
||||||
TS("TokenClient::SayHello");
|
TS("TokenClient::SayHello");
|
||||||
|
|
||||||
auto ctrl = broadcast ? Control : Local;
|
auto ctrl = !broadcast ? Control : Local;
|
||||||
if(!ctrl) return;
|
if(!ctrl) return;
|
||||||
|
|
||||||
TokenMessage msg(0x01);
|
TokenMessage msg(0x01);
|
||||||
|
|
|
@ -63,6 +63,8 @@ TokenController::TokenController() : Controller(), Key(0)
|
||||||
|
|
||||||
Server = nullptr;
|
Server = nullptr;
|
||||||
|
|
||||||
|
ShowRemote = false;
|
||||||
|
|
||||||
// 默认屏蔽心跳日志和确认日志
|
// 默认屏蔽心跳日志和确认日志
|
||||||
Buffer(NoLogCodes, sizeof(NoLogCodes)).Clear();
|
Buffer(NoLogCodes, sizeof(NoLogCodes)).Clear();
|
||||||
NoLogCodes[0] = 0x03;
|
NoLogCodes[0] = 0x03;
|
||||||
|
@ -318,13 +320,15 @@ void TokenController::ShowMessage(cstring action, const Message& msg)
|
||||||
|
|
||||||
debug_printf("Token::%s ", action);
|
debug_printf("Token::%s ", action);
|
||||||
|
|
||||||
if (msg.State)
|
if (ShowRemote || msg.State)
|
||||||
{
|
{
|
||||||
auto svr = (IPEndPoint*)Server;
|
//auto svr = (IPEndPoint*)Server;
|
||||||
auto rmt = (IPEndPoint*)msg.State;
|
auto svr = (IPEndPoint*)msg.State;
|
||||||
if (!svr || svr->Address == IPAddress::Broadcast())
|
if(!svr) svr = (IPEndPoint*)Server;
|
||||||
|
//if (!svr || svr->Address == IPAddress::Broadcast())
|
||||||
|
if(svr)
|
||||||
{
|
{
|
||||||
rmt->Show();
|
svr->Show();
|
||||||
debug_printf(" ");
|
debug_printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,11 @@ protected:
|
||||||
//virtual bool SendInternal(const Buffer& bs, const void* state);
|
//virtual bool SendInternal(const Buffer& bs, const void* state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint Token; // 令牌
|
uint Token; // 令牌
|
||||||
ByteArray Key; // 通信密码
|
ByteArray Key; // 通信密码
|
||||||
|
|
||||||
byte NoLogCodes[8]; // 没有日志的指令
|
byte NoLogCodes[8]; // 没有日志的指令
|
||||||
|
bool ShowRemote; // 消息日志中是否显示远程地址
|
||||||
|
|
||||||
TokenController();
|
TokenController();
|
||||||
virtual ~TokenController();
|
virtual ~TokenController();
|
||||||
|
|
Loading…
Reference in New Issue