透传,配置
This commit is contained in:
parent
10c5b9bf00
commit
967d605084
|
@ -128,7 +128,7 @@ ISocketHost* AP0801::Create8266(bool apOnly)
|
|||
|
||||
//Sys.AddTask(SetWiFiTask, this, 0, -1, "SetWiFi");
|
||||
Client->Register("SetWiFi", &Esp8266::SetWiFi, host);
|
||||
Client->Register("SetWiFi", &Esp8266::GetWiFi, host);
|
||||
Client->Register("GetWiFi", &Esp8266::GetWiFi, host);
|
||||
|
||||
host->OpenAsync();
|
||||
|
||||
|
|
|
@ -40,9 +40,16 @@ TokenClient::TokenClient()
|
|||
NextReport = 0;
|
||||
ReportLength = 0;
|
||||
|
||||
|
||||
// 重启
|
||||
this->Register("Gateway/Restart", InvokeRestStart, this);
|
||||
// 重置
|
||||
this->Register("Gateway/Reset", InvokeRestBoot, this);
|
||||
// 透传
|
||||
this->Register("Message/Transparent", InvokeMessage, this);
|
||||
// 设置配置
|
||||
this->Register("Config/Set", InvokeConfigSet, this);
|
||||
// 获取配置
|
||||
this->Register("Config/Get", InvokeConfigGet, this);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1007,3 +1014,31 @@ bool TokenClient::InvokeRestBoot(void * param, const BinaryPair& args, Stream& r
|
|||
|
||||
return true;
|
||||
}
|
||||
bool TokenClient::InvokeMessage(void * param, const BinaryPair& args, Stream& result)
|
||||
{
|
||||
byte id;
|
||||
ByteArray data;
|
||||
|
||||
if (!args.Get("id", id)) return false;
|
||||
if (!args.Get("data", data)) return false;
|
||||
|
||||
// 拿到数据,根据ID分发给各个串口
|
||||
|
||||
|
||||
//测试,原样返回结果
|
||||
//result.Write("id");
|
||||
result.Write(id);
|
||||
//result.Write("data")
|
||||
result.Write(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool TokenClient::InvokeConfigGet(void * param, const BinaryPair& args, Stream& result)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool TokenClient::InvokeConfigSet(void * param, const BinaryPair& args, Stream& result)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -104,9 +104,17 @@ private:
|
|||
|
||||
void OnInvoke(const TokenMessage& msg, TokenController* ctrl);
|
||||
bool OnInvoke(const String& action, const BinaryPair& args, Stream& result);
|
||||
// 重启,重置
|
||||
static bool InvokeRestStart(void * param, const BinaryPair& args, Stream& result);
|
||||
static bool InvokeRestBoot(void * param, const BinaryPair& args, Stream& result);
|
||||
|
||||
//配置
|
||||
static bool InvokeConfigSet(void * param, const BinaryPair& args, Stream& result);
|
||||
static bool InvokeConfigGet(void * param, const BinaryPair& args, Stream& result);
|
||||
|
||||
//透传消息
|
||||
static bool InvokeMessage(void * param, const BinaryPair& args, Stream& result);
|
||||
|
||||
private:
|
||||
uint _task;
|
||||
uint _taskBroadcast; // 广播任务
|
||||
|
|
Loading…
Reference in New Issue