add code
This commit is contained in:
parent
06b9fe215e
commit
bcb9ff0409
@ -390,6 +390,7 @@ int Uart::DealReviveDuration(uint16_t ushortAdd){
|
|||||||
ScheduleTask scheduleTask;
|
ScheduleTask scheduleTask;
|
||||||
int next_taskID = 0;
|
int next_taskID = 0;
|
||||||
uint16_t next_duration = scheduler::instance().GetNextDuration(ushortAdd,next_taskID);
|
uint16_t next_duration = scheduler::instance().GetNextDuration(ushortAdd,next_taskID);
|
||||||
|
next_taskID = MEAS_EVAL;
|
||||||
zlog_info(zct, "next_duration = %d ", next_duration);
|
zlog_info(zct, "next_duration = %d ", next_duration);
|
||||||
scheduleTask.cmd = REVIVE_DURATION;
|
scheduleTask.cmd = REVIVE_DURATION;
|
||||||
scheduleTask.shortAddr = ushortAdd;
|
scheduleTask.shortAddr = ushortAdd;
|
||||||
@ -556,8 +557,8 @@ void Uart::DealRecvData(const char *pData) {
|
|||||||
DealException(pData);
|
DealException(pData);
|
||||||
break;
|
break;
|
||||||
case MEAS_EVAL:
|
case MEAS_EVAL:
|
||||||
DealDataNodeFeature(pData, 0);
|
|
||||||
DealReviveDuration(ushortAdd);
|
DealReviveDuration(ushortAdd);
|
||||||
|
DealDataNodeFeature(pData, 0);
|
||||||
break;
|
break;
|
||||||
case UPGRADE:
|
case UPGRADE:
|
||||||
if (recvcode == 0){
|
if (recvcode == 0){
|
||||||
@ -611,13 +612,7 @@ void Uart::DealDataNodeName(const char *pData) {
|
|||||||
}
|
}
|
||||||
char MeasurementID[100] = {0x00};
|
char MeasurementID[100] = {0x00};
|
||||||
sprintf(MeasurementID, "%02x%02x%02x%02x%02x%02x%02x%02x", pData[71], pData[72], pData[73], pData[74], pData[75], pData[76], pData[77], pData[78]);
|
sprintf(MeasurementID, "%02x%02x%02x%02x%02x%02x%02x%02x", pData[71], pData[72], pData[73], pData[74], pData[75], pData[76], pData[77], pData[78]);
|
||||||
uint8_t upgrade = pData[79] & 0xFF;
|
|
||||||
if (upgrade == 1)
|
|
||||||
{
|
|
||||||
uint16_t ushortAdd = BUILD_UINT16(pData[3] & 0xFF, pData[4] & 0xFF);
|
|
||||||
DealUpgrade(ushortAdd,2);
|
|
||||||
scheduler::instance().UpgradeResult(ushortAdd,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
char gbkNodeName[128] = {0x00};
|
char gbkNodeName[128] = {0x00};
|
||||||
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
||||||
@ -700,6 +695,7 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
|||||||
RecvData *pRecvData = (RecvData *)pData;
|
RecvData *pRecvData = (RecvData *)pData;
|
||||||
zlog_warn(zct, "recv remote zigbee module info shortAddr %02x%02x", pRecvData->Data[46], pRecvData->Data[47]);
|
zlog_warn(zct, "recv remote zigbee module info shortAddr %02x%02x", pRecvData->Data[46], pRecvData->Data[47]);
|
||||||
char buf[32] = {0};
|
char buf[32] = {0};
|
||||||
|
char whereCon[64] = {0};
|
||||||
char chTemp = pRecvData->Data[0]; //设备状态标志 1 byte
|
char chTemp = pRecvData->Data[0]; //设备状态标志 1 byte
|
||||||
DataNodeInfo dataNodeInfo;
|
DataNodeInfo dataNodeInfo;
|
||||||
dataNodeInfo.EquipSta = GET_BIT(chTemp, 2);
|
dataNodeInfo.EquipSta = GET_BIT(chTemp, 2);
|
||||||
@ -842,6 +838,22 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
|||||||
dataNodeInfo.SamplingRate = 192000;
|
dataNodeInfo.SamplingRate = 192000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int upgrade = GET_BIT(chTemp, 7);
|
||||||
|
zlog_info(zct, "upgrade = %d", upgrade);
|
||||||
|
if (upgrade == 1)
|
||||||
|
{
|
||||||
|
uint16_t ushortAdd = BUILD_UINT16(pData[3] & 0xFF, pData[4] & 0xFF);
|
||||||
|
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||||
|
std::string soft_version = sqlite_db_ctrl::instance().GetData(T_SENSOR_INFO(TNAME), " softVersion ", whereCon);
|
||||||
|
if (dataNodeInfo.SoftVersion != soft_version) {
|
||||||
|
DealUpgrade(ushortAdd,0);
|
||||||
|
scheduler::instance().UpgradeResult(ushortAdd,0);
|
||||||
|
}else{
|
||||||
|
DealUpgrade(ushortAdd,3);
|
||||||
|
scheduler::instance().UpgradeResult(ushortAdd,3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 54=》序号25 ACC采样时间
|
// 54=》序号25 ACC采样时间
|
||||||
memset(buf, 0, 32);
|
memset(buf, 0, 32);
|
||||||
sprintf(buf, "%u", pRecvData->Data[54]); // ACC 采样时间 1 byte
|
sprintf(buf, "%u", pRecvData->Data[54]); // ACC 采样时间 1 byte
|
||||||
@ -903,7 +915,7 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
|||||||
sprintf(buf, "%d", chTemp);
|
sprintf(buf, "%d", chTemp);
|
||||||
dataNodeInfo.VIntegralFilterFrequency = atoi(buf);
|
dataNodeInfo.VIntegralFilterFrequency = atoi(buf);
|
||||||
|
|
||||||
char whereCon[64] = {0};
|
|
||||||
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
sprintf(whereCon, "dataNodeNo='%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||||
if (sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), whereCon) > 0) {
|
if (sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), whereCon) > 0) {
|
||||||
char updateSql[1024] = {0};
|
char updateSql[1024] = {0};
|
||||||
|
|||||||
@ -558,7 +558,7 @@ int Uart::TaskResp(ScheduleTask scheduleTask){
|
|||||||
UpdateData[4] = scheduleTask.shortAddr & 0xFF;
|
UpdateData[4] = scheduleTask.shortAddr & 0xFF;
|
||||||
UpdateData[5] = scheduleTask.cmd & 0xFF;
|
UpdateData[5] = scheduleTask.cmd & 0xFF;
|
||||||
UpdateData[6] = 0x00;
|
UpdateData[6] = 0x00;
|
||||||
if (scheduleTask.cmd == REVIVE_DURATION)
|
if (scheduleTask.cmd == MEAS_EVAL)
|
||||||
{
|
{
|
||||||
UpdateData[7] = UINT16_LOW(scheduleTask.duration);
|
UpdateData[7] = UINT16_LOW(scheduleTask.duration);
|
||||||
UpdateData[8] = UINT16_HIGH(scheduleTask.duration);
|
UpdateData[8] = UINT16_HIGH(scheduleTask.duration);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user