add codes
This commit is contained in:
parent
2de3d1688b
commit
666d2d4b77
@ -672,30 +672,6 @@ std::string LocalServer::HandleCgi_cmd(std::string &pData) {
|
|||||||
std::string data = jd.JsonCmd_Cgi_71(param);
|
std::string data = jd.JsonCmd_Cgi_71(param);
|
||||||
return data;
|
return data;
|
||||||
}break;
|
}break;
|
||||||
case kGetFeatureSensorInfo:{
|
|
||||||
JsonData jd;
|
|
||||||
Param_101 param;
|
|
||||||
param.mac = recvBody["mac"].asString();
|
|
||||||
param.timeStart = recvBody["timeStart"].asString();
|
|
||||||
param.timeEnd = recvBody["timeEnd"].asString();
|
|
||||||
param.mPackageFlag = recvBody["package"].asInt();
|
|
||||||
std::string data = jd.JsonCmd_Cgi_101(param);
|
|
||||||
return data;
|
|
||||||
}break;
|
|
||||||
case kScanSenorInfo:{
|
|
||||||
JsonData jd;
|
|
||||||
std::string data = jd.JsonCmd_Cgi_102();
|
|
||||||
return data;
|
|
||||||
}break;
|
|
||||||
case kOperateSensor:{
|
|
||||||
JsonData jd;
|
|
||||||
Param_103 param;
|
|
||||||
param.mac = recvBody["mac"].asString();
|
|
||||||
param.name = recvBody["name"].asString();
|
|
||||||
param.operate = recvBody["operate"].asString();
|
|
||||||
std::string data = jd.JsonCmd_Cgi_103(param);
|
|
||||||
return data;
|
|
||||||
}break;
|
|
||||||
default:
|
default:
|
||||||
JsonData jd;
|
JsonData jd;
|
||||||
std::string data = jd.JsonCmd_Cgi_default();
|
std::string data = jd.JsonCmd_Cgi_default();
|
||||||
|
|||||||
@ -416,32 +416,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
|||||||
zlog_info(zct, " DealAskTask end" );
|
zlog_info(zct, " DealAskTask end" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int Uart::DealAskTaskOld(uint16_t ushortAdd){
|
|
||||||
char wherecon[50]={0};
|
|
||||||
sprintf(wherecon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
|
||||||
int sensor_count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), wherecon);
|
|
||||||
|
|
||||||
if (sensor_count < 1) {
|
|
||||||
zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
int next_duration = 0,next_task_id = 0;
|
|
||||||
int taskID;
|
|
||||||
ScheduleTask scheduleTask;
|
|
||||||
taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration, next_task_id);
|
|
||||||
zlog_info(zct, "DealAskTaskOld taskID = %d next_duration = %d next_task_id = %d", taskID, next_duration, next_task_id);
|
|
||||||
if(next_task_id == kScheduleUpgrade){
|
|
||||||
scheduleTask.cmd = REVIVE_DURATION;
|
|
||||||
scheduleTask.shortAddr = ushortAdd;
|
|
||||||
scheduleTask.duration = next_duration;
|
|
||||||
scheduleTask.next_taskID = UPGRADE;
|
|
||||||
TaskResp(scheduleTask);
|
|
||||||
}
|
|
||||||
if (taskID == kScheduleUpgrade){
|
|
||||||
UpdateWirelessNode(ushortAdd);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int Uart::DealException(const char* pData){
|
int Uart::DealException(const char* pData){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -686,7 +661,35 @@ int Uart::DealFeatureValue(const char *pData,uint16_t ushortAdd){
|
|||||||
last_time = atol(nowTimetamp.c_str());
|
last_time = atol(nowTimetamp.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int Uart::DealAskTaskOld(uint16_t ushortAdd){
|
||||||
|
char wherecon[50]={0};
|
||||||
|
sprintf(wherecon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||||
|
int sensor_count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), wherecon);
|
||||||
|
|
||||||
|
if (sensor_count < 1) {
|
||||||
|
zlog_warn(zct, "device info not found %02x%02x ", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int next_duration = 0,next_task_id = 0;
|
||||||
|
int taskID;
|
||||||
|
ScheduleTask scheduleTask;
|
||||||
|
bool z = false;
|
||||||
|
taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration,z, next_task_id);
|
||||||
|
zlog_warn(zct, "DealAskTaskOld taskID = %d next_duration = %d next_task_id = %d", taskID, next_duration, next_task_id);
|
||||||
|
//if(next_task_id == kScheduleUpgrade)
|
||||||
|
{
|
||||||
|
// scheduleTask.cmd = REVIVE_DURATION;
|
||||||
|
// scheduleTask.shortAddr = ushortAdd;
|
||||||
|
// scheduleTask.duration = next_duration;
|
||||||
|
// scheduleTask.next_taskID = UPGRADE;
|
||||||
|
// TaskResp(scheduleTask);
|
||||||
|
UpdateWirelessNode(ushortAdd);
|
||||||
|
}
|
||||||
|
if (taskID == kScheduleUpgrade){
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
void Uart::DealRecvData(const char *pData) {
|
void Uart::DealRecvData(const char *pData) {
|
||||||
|
|
||||||
uint16_t ushortAdd = BUILD_UINT16(pData[3] & 0xFF, pData[4] & 0xFF);
|
uint16_t ushortAdd = BUILD_UINT16(pData[3] & 0xFF, pData[4] & 0xFF);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user