必须最少引用头文件

This commit is contained in:
Stone 2016-10-09 17:09:27 +00:00
parent 8f0f21b30f
commit f11a652f3f
4 changed files with 17 additions and 12 deletions

View File

@ -11,6 +11,8 @@
#include "TokenNet\TokenController.h"
#include "Device\RTC.h"
AP0801* AP0801::Current = nullptr;
AP0801::AP0801()

View File

@ -7,7 +7,6 @@
#include "TokenNet\TokenClient.h"
#include "Message\ProxyFactory.h"
#include "App\Alarm.h"
#include "Device\RTC.h"
// 阿波罗0801/0802
class AP0801

View File

@ -14,7 +14,7 @@ error code
ProxyFactory::ProxyFactory():Proxys(String::Compare)
{
debug_printf("创建 ProxyFac\r\n");
Client = nullptr;
Client = nullptr;
}
bool ProxyFactory::Open(TokenClient* client)
@ -32,6 +32,7 @@ bool ProxyFactory::Open(TokenClient* client)
Client->Register("Proxy/Read", &ProxyFactory::Read, this);
Client->Register("Proxy/QueryPorts",&ProxyFactory::QueryPorts, this);
debug_printf("\r\n");
return true;
}
@ -244,23 +245,27 @@ bool ProxyFactory::QueryPorts(const Pair& args, Stream& result)
bool ProxyFactory::Upload(Proxy& port, Buffer& data)
{
if (!Client)return false;
MemoryStream ms;
BinaryPair bp(ms);
bp.Set("Port", port.Name);
bp.Set("Data", data);
Client->Invoke("Proxy/Upload", Buffer(ms.GetBuffer(),ms.Position()));
return true;
}
bool ProxyFactory::UpOpen(Proxy& port)
{
if (!Client)return false;
MemoryStream ms;
BinaryPair bp(ms);
bp.Set("Port", port.Name);
bp.Set("Open", (byte)0x01);
Client->Invoke("Proxy/Open", Buffer(ms.GetBuffer(), ms.Position()));
return true;
}

View File

@ -2,7 +2,6 @@
#define __ProxyFactory_H__
#include "Sys.h"
#include "TokenNet\TokenMessage.h"
#include "Message\Pair.h"
#include "TokenNet\TokenClient.h"
#include "Device\Proxy.h"
@ -15,8 +14,8 @@ public:
Dictionary<cstring, Proxy*> Proxys;
TokenClient* Client;
ProxyFactory();
// 工程打开
bool Open(TokenClient* client);
// 端口注册