This commit is contained in:
zhangsheng 2024-11-21 15:05:46 +08:00
parent c680978701
commit 8b4e208e4a
4 changed files with 27 additions and 11 deletions

BIN
Cidn-SH

Binary file not shown.

View File

@ -444,7 +444,6 @@ std::string SqliteDB::GetData(const char *tablename, const char *column, const c
} }
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
mtx_.unlock(); mtx_.unlock();
zlog_info(zct, "[GetData] sql123:%s", strSql.c_str());
return strRes; return strRes;
} }
array_t SqliteDB::GetDataMultiLine(const char *sql){ array_t SqliteDB::GetDataMultiLine(const char *sql){

View File

@ -349,6 +349,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
int taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration); int taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration);
ScheduleTask scheduleTask; ScheduleTask scheduleTask;
zlog_info(zct, "taskID = %d ", taskID); zlog_info(zct, "taskID = %d ", taskID);
taskID = 5;
if (taskID == kScheduleEigenValue) //1.特征值 if (taskID == kScheduleEigenValue) //1.特征值
{ {
char localtimestamp[32] = {0x00}; char localtimestamp[32] = {0x00};
@ -638,6 +639,28 @@ void Uart::DealDataNodeName(const char *pData) {
sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), uplCon, whereCon); sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), uplCon, whereCon);
std::string strData = sqlite_db_ctrl::instance().GetNodeConfigureInfor(whereCon); std::string strData = sqlite_db_ctrl::instance().GetNodeConfigureInfor(whereCon);
data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str()); data_publish(strData.c_str(), GlobalConfig::Topic_G.mPubConfig.c_str());
char szTableName[50] = {0x00};
char sql_table_exist[50] = {0};
sprintf(szTableName, "t_data_%s", MeasurementID);
memset(whereCon,0,sizeof(whereCon));
sprintf(whereCon,"type='table' and name = '%s'",szTableName);
int ret = sqlite_db_ctrl::instance().GetTableRows("sqlite_master",whereCon);
zlog_info(zct, "ret = %d", ret);
if (ret == 0){
sqlite_db_ctrl::instance().Createtable(szTableName);
}
memset(sql_table_exist, 0x00, sizeof(sql_table_exist));
memset(szTableName, 0x00, sizeof(szTableName));
sprintf(szTableName, "t_dataStatic_%s", MeasurementID);
memset(whereCon,0,sizeof(whereCon));
sprintf(whereCon,"type='table' and name = '%s'",szTableName);
ret = sqlite_db_ctrl::instance().GetTableRows("sqlite_master",whereCon);
zlog_info(zct, "ret = %d", ret);
if (ret == 0){
sqlite_db_ctrl::instance().CreatedataStatictable(szTableName);
}
} }
void Uart::DealDataNodeInfo(const char *pData) { void Uart::DealDataNodeInfo(const char *pData) {
@ -887,12 +910,7 @@ void Uart::DealDataNodeInfo(const char *pData) {
zlog_error(zct, "res = %d", res); zlog_error(zct, "res = %d", res);
} }
} }
char szTableName[50] = {0x00};
sprintf(szTableName, "t_data_%s", dataNodeInfo.ZigbeeLongAddr.c_str());
sqlite_db_ctrl::instance().Createtable(szTableName);
memset(szTableName, 0x00, sizeof(szTableName));
sprintf(szTableName, "t_dataStatic_%s", dataNodeInfo.ZigbeeLongAddr.c_str());
sqlite_db_ctrl::instance().CreatedataStatictable(szTableName);
Json::Value jsonVal; Json::Value jsonVal;
jsonVal.clear(); jsonVal.clear();
jsonVal["cmd"] = "26"; jsonVal["cmd"] = "26";

View File

@ -14,8 +14,8 @@ extern zlog_category_t* zct;
extern zlog_category_t* zbt; extern zlog_category_t* zbt;
#define IN_LEN (128*1024ul) #define IN_LEN (128*1024ul)
#define OUT_LEN (IN_LEN + IN_LEN / 16 + 64 + 3) #define OUT_LEN (IN_LEN + IN_LEN / 16 + 64 + 3)
unsigned char fw_outdata[50000]={0}; unsigned char fw_outdata[70000]={0};
unsigned char fw_senddata[50000]={0}; unsigned char fw_senddata[70000]={0};
/* Work-memory needed for compression. Allocate memory in units /* Work-memory needed for compression. Allocate memory in units
* of 'lzo_align_t' (instead of 'char') to make sure it is properly aligned. * of 'lzo_align_t' (instead of 'char') to make sure it is properly aligned.
@ -474,7 +474,6 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
UpdateData[4] = UINT16_LOW(ushortAdd); UpdateData[4] = UINT16_LOW(ushortAdd);
UpdateData[5] = 0x0A; UpdateData[5] = 0x0A;
UpdateData[6] = 0x01; UpdateData[6] = 0x01;
UpdateData[7] = 0x02;
char hex[200] = {0x00}; char hex[200] = {0x00};
stringToHex(strName.c_str(), hex); stringToHex(strName.c_str(), hex);
bytesSize = strlen(hex) / 2; bytesSize = strlen(hex) / 2;
@ -484,7 +483,7 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
free(bytes); free(bytes);
} else { } else {
for (size_t i = 0; i < bytesSize; i++) { for (size_t i = 0; i < bytesSize; i++) {
UpdateData[8 + i] = bytes[i]; UpdateData[7 + i] = bytes[i];
} }
free(bytes); free(bytes);
unsigned char tmp1 = 0x00; unsigned char tmp1 = 0x00;