必须最少引用头文件
This commit is contained in:
parent
8f0f21b30f
commit
f11a652f3f
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "TokenNet\TokenController.h"
|
||||
|
||||
#include "Device\RTC.h"
|
||||
|
||||
AP0801* AP0801::Current = nullptr;
|
||||
|
||||
AP0801::AP0801()
|
||||
|
@ -168,7 +170,7 @@ void AP0801::InitClient()
|
|||
// 创建客户端
|
||||
auto client = new TokenClient();
|
||||
client->Cfg = tk;
|
||||
|
||||
|
||||
// 需要使用本地连接
|
||||
//client->UseLocal();
|
||||
|
||||
|
@ -286,13 +288,13 @@ void AP0801::OpenClient(ISocketHost& host)
|
|||
// {
|
||||
// debug_printf("4");
|
||||
// auto ctrl = AddControl(*HostAP, uri, tk->Port);
|
||||
//
|
||||
//
|
||||
// // 如果没有主机,这里打开令牌客户端,为组网做准备
|
||||
// if(!Host)
|
||||
// if(!Host)
|
||||
// Client->Open();
|
||||
// else
|
||||
// else
|
||||
// Client->AttachControls();
|
||||
//
|
||||
//
|
||||
// // 假如来迟了,客户端已经打开,那么自己挂载事件
|
||||
// if(Client->Opened && Client->Master)
|
||||
// {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "TokenNet\TokenClient.h"
|
||||
#include "Message\ProxyFactory.h"
|
||||
#include "App\Alarm.h"
|
||||
#include "Device\RTC.h"
|
||||
|
||||
// 阿波罗0801/0802
|
||||
class AP0801
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
@ -11,12 +10,12 @@
|
|||
class ProxyFactory
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
Dictionary<cstring, Proxy*> Proxys;
|
||||
TokenClient* Client;
|
||||
|
||||
|
||||
|
||||
ProxyFactory();
|
||||
|
||||
// 工程打开
|
||||
bool Open(TokenClient* client);
|
||||
// 端口注册
|
||||
|
@ -32,7 +31,7 @@ public:
|
|||
bool SetConfig(const Pair& args, Stream& result);
|
||||
// 获取设备列表
|
||||
bool QueryPorts(const Pair& args, Stream& result);
|
||||
|
||||
|
||||
// XXX7,自动bool Proxy/SetAuto(bool auto, Byte[] boot)。 // 设备上电后自动发送,可能需要引导数据 => 合并到2
|
||||
// 8,查询状态Byte[] Proxy/Query(String port, String key)。 // 支持查询是否已打开、已缓存数据量等。
|
||||
|
||||
|
|
Loading…
Reference in New Issue