把一些函数常量化,避免错误使用

This commit is contained in:
nnhy 2015-12-09 11:16:39 +00:00
parent 150b1b52c5
commit 176d1b392a
2 changed files with 16 additions and 16 deletions

View File

@ -40,12 +40,12 @@ TinyServer::TinyServer(TinyController* control)
Devices.SetLength(0);
}
bool TinyServer::Send(Message& msg)
bool TinyServer::Send(Message& msg) const
{
return Control->Send(msg);
}
bool TinyServer::Reply(Message& msg)
bool TinyServer::Reply(Message& msg) const
{
return Control->Reply(msg);
}
@ -268,7 +268,7 @@ bool TinyServer::OnJoin(const TinyMessage& msg)
}
// 网关重置节点通信密码
bool TinyServer::ResetPassword(byte id)
bool TinyServer::ResetPassword(byte id) const
{
TS("TinyServer::ResetPassword");
@ -320,7 +320,7 @@ bool TinyServer::OnDisjoin(const TinyMessage& msg)
return true;
}
bool TinyServer::Disjoin(TinyMessage& msg, uint crc)
bool TinyServer::Disjoin(TinyMessage& msg, uint crc) const
{
TS("TinyServer::Disjoin");
@ -541,7 +541,7 @@ bool TinyServer::OnWrite(TinyMessage& msg, Device& dv)
return true;
}
Device* TinyServer::FindDevice(byte id)
Device* TinyServer::FindDevice(byte id) const
{
if(id == 0) return NULL;
@ -569,7 +569,7 @@ void GetDeviceKey(byte scr,Array& key,void* param)
key.Set(dv->Pass, 8);
}
Device* TinyServer::FindDevice(const Array& hardid)
Device* TinyServer::FindDevice(const Array& hardid) const
{
if(hardid.Length() == 0) return NULL;
@ -659,7 +659,7 @@ int TinyServer::LoadDevices()
return i;
}
void TinyServer::SaveDevices()
void TinyServer::SaveDevices() const
{
TS("TinyServer::SaveDevices");
@ -743,7 +743,7 @@ bool TinyServer::LoadConfig()
return true;
}
void TinyServer::SaveConfig()
void TinyServer::SaveConfig() const
{
TS("TinyServer::SaveConfig");

View File

@ -22,8 +22,8 @@ public:
TinyServer(TinyController* control);
// 发送消息
bool Send(Message& msg);
bool Reply(Message& msg);
bool Send(Message& msg) const;
bool Reply(Message& msg) const;
// 收到本地无线网消息
bool OnReceive(TinyMessage& msg);
// 分发外网过来的消息。返回值表示是否有响应
@ -34,16 +34,16 @@ public:
void* Param;
TArray<Device*> Devices;
Device* FindDevice(byte id);
Device* FindDevice(const Array& hardid);
Device* FindDevice(byte id) const;
Device* FindDevice(const Array& hardid) const;
bool DeleteDevice(byte id);
int LoadDevices();
void SaveDevices();
void SaveDevices() const;
void ClearDevices();
bool LoadConfig();
void SaveConfig();
void SaveConfig() const;
void ClearConfig();
// 当前设备
@ -58,9 +58,9 @@ public:
// 组网
bool OnJoin(const TinyMessage& msg);
bool ResetPassword(byte id);
bool ResetPassword(byte id) const;
bool Disjoin(TinyMessage& msg,uint crc);
bool Disjoin(TinyMessage& msg,uint crc) const;
bool OnDisjoin(const TinyMessage& msg);
// 心跳