Merge branch 'dg101' of http://192.168.0.10:3000/pandx/WLG into dg101
This commit is contained in:
commit
d83488a4d0
@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1102353172776392420" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-469859550318386951" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@ -16,7 +16,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1102353172776392420" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-469859550318386951" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
||||
@ -810,7 +810,8 @@ int SqliteDB::CalculateBattery() {
|
||||
memset(selectSql, 0x00, sizeof(selectSql));
|
||||
char updateSql[1024] = {0};
|
||||
int res = 0;
|
||||
sprintf(selectSql, " dataNodeNo,StaticTime,WaveTime,featureInterVal,waveInterVal,samplingRate,batteryPower ");
|
||||
//数据关联使用MeasurementID字段
|
||||
sprintf(selectSql, " dataNodeNo,StaticTime,WaveTime,featureInterVal,waveInterVal,samplingRate,batteryPower,MeasurementID ");
|
||||
array_t vecRes = GetDataMultiLine(T_SENSOR_INFO(TNAME), selectSql, NULL);
|
||||
zlog_info(zct, "Size = %d", vecRes.size());
|
||||
if (vecRes.size() > 0) {
|
||||
@ -818,13 +819,13 @@ int SqliteDB::CalculateBattery() {
|
||||
float capacity = 0.0, startCapacity = 0.0;
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
memset(selectSql, 0x00, sizeof(selectSql));
|
||||
sprintf(whereCon, " dataNodeNo = '%s' and batteryRemain <> '' order by timeStamp desc limit 0,1 ", vecRes[i][0].c_str());
|
||||
sprintf(whereCon, " dataNodeNo = '%s' and batteryRemain <> '' order by timeStamp desc limit 0,1 ", vecRes[i][7].c_str());
|
||||
vec_t vecResSig = sqlite_db_ctrl::instance().GetDataSingleLine(T_BATTERY_INFO(TNAME), " * ", whereCon);
|
||||
std::vector<std::string> vParam;
|
||||
boost::split(vParam, vecRes[i][6], boost::is_any_of(","), boost::token_compress_on);
|
||||
if (vParam.size() <= 0 || vecResSig.size() <= 0) { //第一次计算
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "dataNodeNo = '%s' ", vecRes[i][0].c_str());
|
||||
sprintf(whereCon, "dataNodeNo = '%s' ", vecRes[i][7].c_str());
|
||||
std::string Dip = sqlite_db_ctrl::instance().GetData(T_DATASTATIC_INFO(TNAME), " dip ", whereCon);
|
||||
if (Dip == "") {
|
||||
continue;
|
||||
@ -840,7 +841,7 @@ int SqliteDB::CalculateBattery() {
|
||||
break;
|
||||
}
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp asc limit 0,1 ", vecRes[i][0].c_str());
|
||||
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp asc limit 0,1 ", vecRes[i][7].c_str());
|
||||
vecResSig = sqlite_db_ctrl::instance().GetDataSingleLine(T_BATTERY_INFO(TNAME), " * ", whereCon);
|
||||
if (vecResSig.size() <= 0) { //一条数据都没有
|
||||
continue;
|
||||
@ -852,7 +853,7 @@ int SqliteDB::CalculateBattery() {
|
||||
zlog_info(zct, "dip = %d", atoi(vecResSig[1].c_str()));
|
||||
|
||||
zlog_info(zct, "capacity = %f", capacity);
|
||||
sprintf(whereCon, " dataNodeNo = '%s' and timeStamp > '%s'", vecRes[i][0].c_str(), vecResSig[8].c_str());
|
||||
sprintf(whereCon, " dataNodeNo = '%s' and timeStamp > '%s'", vecRes[i][7].c_str(), vecResSig[8].c_str());
|
||||
array_t vecResbattery = GetDataMultiLine(T_BATTERY_INFO(TNAME), " * ", whereCon);
|
||||
zlog_info(zct, "vecResbattery size = %d", vecResbattery.size());
|
||||
if (vecResbattery.size() <= 0) {
|
||||
@ -904,14 +905,14 @@ int SqliteDB::CalculateBattery() {
|
||||
remainBattery = 10;
|
||||
}
|
||||
|
||||
zlog_info(zct, "dataNodeNo = %s,batteryUsage = %f,batteryRemain = %f", vecRes[i][0].c_str(), atof(vecResSig[6].c_str()), remainBattery);
|
||||
zlog_info(zct, "dataNodeNo = %s,batteryUsage = %f,batteryRemain = %f", vecRes[i][7].c_str(), atof(vecResSig[6].c_str()), remainBattery);
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp desc limit 0,1 ", vecRes[i][0].c_str());
|
||||
sprintf(whereCon, " dataNodeNo = '%s' order by timeStamp desc limit 0,1 ", vecRes[i][7].c_str());
|
||||
std::string strtimeStamp = GetData(T_BATTERY_INFO(TNAME), " timeStamp ", whereCon);
|
||||
|
||||
sprintf(updateSql, "batteryUsage='%f',batteryRemain='%f'", usageBattery, remainBattery);
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon, "dataNodeNo ='%s' and timeStamp = '%s'", vecRes[i][0].c_str(), strtimeStamp.c_str());
|
||||
sprintf(whereCon, "dataNodeNo ='%s' and timeStamp = '%s'", vecRes[i][7].c_str(), strtimeStamp.c_str());
|
||||
res = UpdateTableData(T_BATTERY_INFO(TNAME), updateSql, whereCon);
|
||||
if(res !=0 ){
|
||||
zlog_error(zct, "res = %d", res);
|
||||
@ -921,19 +922,19 @@ int SqliteDB::CalculateBattery() {
|
||||
memset(updateSql, 0x00, sizeof(updateSql));
|
||||
|
||||
char insertSql[1024] = {0x00}, deleteSql[1024] = {0x00};
|
||||
sprintf(insertSql, "insert into t_battery_history select * from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][0].c_str());
|
||||
sprintf(insertSql, "insert into t_battery_history select * from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][7].c_str());
|
||||
res = ExeSql(insertSql);
|
||||
if(res !=0 ){
|
||||
zlog_error(zct, "res = %d", res);
|
||||
break;
|
||||
}
|
||||
sprintf(deleteSql, "delete from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][0].c_str());
|
||||
sprintf(deleteSql, "delete from t_battery_info where timeStamp < '%s' and dataNodeNo = '%s'", strtimeStamp.c_str(), vecRes[i][7].c_str());
|
||||
res = ExeSql(deleteSql);
|
||||
if(res !=0 ){
|
||||
zlog_error(zct, "res = %d", res);
|
||||
break;
|
||||
}
|
||||
sprintf(whereCon, "dataNodeNo = '%s' ", vecRes[i][0].c_str());
|
||||
sprintf(whereCon, "dataNodeNo = '%s' ", vecRes[i][7].c_str());
|
||||
if (startCapacity > 0) {
|
||||
sprintf(updateSql, "batteryPower = '%f,%f' ", startCapacity, remainBattery);
|
||||
} else {
|
||||
|
||||
@ -622,7 +622,8 @@ void Uart::DealDataNodeName(const char *pData) {
|
||||
sprintf(whereCon, "zigbeeShortAddr='%s'", szShortAdd);
|
||||
std::string strNodeName(NodeName);
|
||||
zlog_info(zct, "strNodeName = %s", strNodeName.c_str());
|
||||
solve(gbkNodeName, NodeName);
|
||||
//solve(gbkNodeName, NodeName);
|
||||
hexToAscii(strNodeName.c_str(), gbkNodeName);
|
||||
zlog_info(zct, "gbkNodeName = %s", gbkNodeName);
|
||||
zlog_info(zct, "NodeName = %s", NodeName);
|
||||
zlog_info(zct, "whereCon = %s", whereCon);
|
||||
|
||||
@ -228,7 +228,7 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
|
||||
if (0 == sqlite_db_ctrl::instance().GetTableRows(T_DATASTATIC_INFO(TNAME), whereCon)) { // First Connect
|
||||
char insertSql[1024] = {0};
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%d','%d','',%ld,'%s','1',%d", strLongAddr.c_str(), (strMeasurementID + "-S").c_str(), dataStatic.TemTop, dataStatic.TemBot, dataStatic.Dip, dataStatic.Voltage, staticIndex, nowTimetamp.c_str(), nodeResend);
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%d','%d','',%ld,'%s','1',%d", strMeasurementID.c_str(), (strMeasurementID + "-S").c_str(), dataStatic.TemTop, dataStatic.TemBot, dataStatic.Dip, dataStatic.Voltage, staticIndex, nowTimetamp.c_str(), nodeResend);
|
||||
sqlite_db_ctrl::instance().InsertData(T_DATASTATIC_INFO(TNAME), insertSql);
|
||||
sqlite_db_ctrl::instance().CalculateBattery();
|
||||
} else {
|
||||
@ -303,7 +303,7 @@ void Uart::DealDataNodeFeature(const char *pData, int flag) {
|
||||
if ((Count * 3 < SAVE_COUNT && lTime < OneWeek) || strTime.size() == 0) { // 1 week
|
||||
char insertSql[1024] = {0};
|
||||
memset(insertSql, 0x00, sizeof(insertSql));
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f',%ld,'%s','1',%d", strLongAddr.c_str(), (strMeasurementID + "-X").c_str(), dataDymX.DiagnosisPk, dataDymX.IntegratPk, dataDymX.IntegratRMS, dataDymX.RmsValues,
|
||||
sprintf(insertSql, "'%s','%s','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f','%f',%ld,'%s','1',%d", strMeasurementID.c_str(), (strMeasurementID + "-X").c_str(), dataDymX.DiagnosisPk, dataDymX.IntegratPk, dataDymX.IntegratRMS, dataDymX.RmsValues,
|
||||
dataDymX.EnvelopEnergy, dataDymX.Amp1, dataDymX.Amp2, dataDymX.Amp3, dataDymX.Amp4, dataDymX.Amp5, dataDymX.Phase1, dataDymX.Phase2, dataDymX.Phase3, dataDymX.Phase4, staticIndex, nowTimetamp.c_str(), nodeResend);
|
||||
sqlite_db_ctrl::instance().InsertData(szTableName, insertSql);
|
||||
|
||||
|
||||
@ -248,10 +248,11 @@ void Uart::UpdateWirelessNode(uint16_t shortAdd) {
|
||||
if(value == 49){
|
||||
gpio_set(GlobalConfig::GPIO_G.zigAckreset,0);
|
||||
mssleep(10000);
|
||||
if(gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48)
|
||||
if(gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48){
|
||||
gpio_set(GlobalConfig::GPIO_G.zigAckreset,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mssleep(10000);
|
||||
time += 1;
|
||||
}while(time < 150);
|
||||
@ -474,7 +475,6 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
|
||||
UpdateData[4] = UINT16_LOW(ushortAdd);
|
||||
UpdateData[5] = 0x0A;
|
||||
UpdateData[6] = 0x01;
|
||||
UpdateData[7] = 0x02;
|
||||
char hex[200] = {0x00};
|
||||
stringToHex(strName.c_str(), hex);
|
||||
bytesSize = strlen(hex) / 2;
|
||||
@ -484,7 +484,7 @@ int Uart::UpdateConfig(uint16_t ushortAdd) {
|
||||
free(bytes);
|
||||
} else {
|
||||
for (size_t i = 0; i < bytesSize; i++) {
|
||||
UpdateData[8 + i] = bytes[i];
|
||||
UpdateData[7 + i] = bytes[i];
|
||||
}
|
||||
free(bytes);
|
||||
unsigned char tmp1 = 0x00;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user