This commit is contained in:
zhangsheng 2025-05-29 21:34:17 +08:00
parent 54985fd568
commit f406bd903a
2 changed files with 31 additions and 5 deletions

View File

@ -403,7 +403,32 @@ 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;
} }
@ -613,9 +638,9 @@ void Uart::DealRecvData(const char *pData) {
case DEVICE_INF2: case DEVICE_INF2:
DealDataNodeName(pData); DealDataNodeName(pData);
break; break;
// case ASK_TASK: case ASK_TASK:
// DealAskTask(ushortAdd); DealAskTaskOld(ushortAdd);
// break; break;
case DEVICE_EXCEPTION: case DEVICE_EXCEPTION:
DealException(pData); DealException(pData);
break; break;
@ -1280,9 +1305,9 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
memcpy(RecvBuf, (char *)&UartRecvBuf[i], 100); memcpy(RecvBuf, (char *)&UartRecvBuf[i], 100);
DealDataNodeWave(RecvBuf, command); DealDataNodeWave(RecvBuf, command);
mPackgeIndex = (unsigned int)UartRecvBuf[i + 6]; mPackgeIndex = (unsigned int)UartRecvBuf[i + 6];
} else if (now_task != WAVE_CMD && ( command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION || command == UPGRADE_ASK)) { } else if (now_task != WAVE_CMD && (command == ASK_TASK || command == DEVICE_INF || command == MEAS_EVAL || command == CONFIG || command == UPGRADE || command == DEVICE_INF2 || command == SIGNAL_STRENGTH || command == DEVICE_EXCEPTION || command == UPGRADE_ASK)) {
char RecvBuf[100] = {0x00}; char RecvBuf[100] = {0x00};
if (command == UPGRADE_ASK) if (command == UPGRADE_ASK || command == ASK_TASK)
{ {
memcpy(RecvBuf, &UartRecvBuf[i], 8); memcpy(RecvBuf, &UartRecvBuf[i], 8);
if (!CheckCrc(RecvBuf, 7)) { if (!CheckCrc(RecvBuf, 7)) {

View File

@ -175,6 +175,7 @@ public:
int FindRecvPackage(int bytesRead, char* mUartRecvBuf, char* head); int FindRecvPackage(int bytesRead, char* mUartRecvBuf, char* head);
int DealAskTask(uint16_t ushortAdd); int DealAskTask(uint16_t ushortAdd);
int DealAskTaskOld(uint16_t ushortAdd);
int DealFeatureValue(const char* pData, uint16_t ushortAdd); int DealFeatureValue(const char* pData, uint16_t ushortAdd);
int DealException(const char* pData); int DealException(const char* pData);
int DealReviveDuration(uint16_t ushortAdd); int DealReviveDuration(uint16_t ushortAdd);