add code
This commit is contained in:
parent
54985fd568
commit
f406bd903a
@ -403,7 +403,32 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
zlog_info(zct, " DealAskTask end" );
|
||||
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){
|
||||
return 0;
|
||||
}
|
||||
@ -613,9 +638,9 @@ void Uart::DealRecvData(const char *pData) {
|
||||
case DEVICE_INF2:
|
||||
DealDataNodeName(pData);
|
||||
break;
|
||||
// case ASK_TASK:
|
||||
// DealAskTask(ushortAdd);
|
||||
// break;
|
||||
case ASK_TASK:
|
||||
DealAskTaskOld(ushortAdd);
|
||||
break;
|
||||
case DEVICE_EXCEPTION:
|
||||
DealException(pData);
|
||||
break;
|
||||
@ -1280,9 +1305,9 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
|
||||
memcpy(RecvBuf, (char *)&UartRecvBuf[i], 100);
|
||||
DealDataNodeWave(RecvBuf, command);
|
||||
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};
|
||||
if (command == UPGRADE_ASK)
|
||||
if (command == UPGRADE_ASK || command == ASK_TASK)
|
||||
{
|
||||
memcpy(RecvBuf, &UartRecvBuf[i], 8);
|
||||
if (!CheckCrc(RecvBuf, 7)) {
|
||||
|
||||
@ -175,6 +175,7 @@ public:
|
||||
int FindRecvPackage(int bytesRead, char* mUartRecvBuf, char* head);
|
||||
|
||||
int DealAskTask(uint16_t ushortAdd);
|
||||
int DealAskTaskOld(uint16_t ushortAdd);
|
||||
int DealFeatureValue(const char* pData, uint16_t ushortAdd);
|
||||
int DealException(const char* pData);
|
||||
int DealReviveDuration(uint16_t ushortAdd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user