This commit is contained in:
cdyong 2015-12-30 00:51:00 +00:00
parent fb89810e4c
commit ffeedf6826
2 changed files with 21 additions and 0 deletions

View File

@ -376,6 +376,26 @@ bool TinyServer::Disjoin(TinyMessage& msg, ushort crc) const
return true;
}
bool TinyServer::Disjoin(byte id)
{
TS("TinyServer::Disjoin");
auto dv = FindDevice(id);
auto crc = Crc::Hash16(dv->GetHardID());
TinyMessage msg;
msg.Code = 0x02;
auto ms = msg.ToStream();
ms.Write(crc);
msg.Length = ms.Position();
Send(msg);
DeleteDevice(id);
return true;
}
// 心跳保持与对方的活动状态
bool TinyServer::OnPing(const TinyMessage& msg)
{

View File

@ -61,6 +61,7 @@ public:
bool OnJoin(const TinyMessage& msg);
bool Disjoin(TinyMessage& msg, ushort crc) const;
bool Disjoin(byte id);
bool OnDisjoin(const TinyMessage& msg);
// 心跳