|
|
|
@ -219,6 +219,8 @@ bool LoadIecPoints()
|
|
|
|
|
|
|
|
|
|
g_iec_points.push_back(pt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("IEC Points: %lld\n", (long long)g_iec_points.size());
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -249,10 +251,9 @@ int GetAIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCur
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char buf[16] = { 0 };
|
|
|
|
|
sprintf(buf, "%u", pt.sadr);
|
|
|
|
|
std::string sql = "SELECT sadr,state,stype,ival,fval,d_time FROM niec_origin_data WHERE sadr=";
|
|
|
|
|
snprintf(buf, sizeof(buf), "%u", pt.sadr);
|
|
|
|
|
std::string sql = "SELECT sadr,state,stype,ival,fval,d_time FROM niec_latest_org_data WHERE sadr=";
|
|
|
|
|
sql += buf;
|
|
|
|
|
sql += " ORDER BY `id` DESC LIMIT 1";
|
|
|
|
|
|
|
|
|
|
if (mysql_query(mysql, sql.c_str()))
|
|
|
|
|
{
|
|
|
|
@ -273,7 +274,17 @@ int GetAIPntMsg(int j, unsigned int *igno, unsigned int* iItemNo, DAY_TIME* sCur
|
|
|
|
|
if (igno != NULL) *igno = pt.sensorGroupNo;
|
|
|
|
|
if (iItemNo != NULL) *iItemNo = pt.itemNo;
|
|
|
|
|
if (iaddr != NULL) *iaddr = pt.sensorId;
|
|
|
|
|
if (pfValue != NULL) *pfValue = atof(row[4]);
|
|
|
|
|
if (pfValue != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (row[4] != NULL && strlen(row[4]) > 0)
|
|
|
|
|
{
|
|
|
|
|
*pfValue = atof(row[4]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*pfValue = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sCurTime != NULL && row[5] != NULL)
|
|
|
|
|
{
|
|
|
|
|
sscanf(row[5], "%04d-%02d-%2d %02d:%02d:%02d", &year, &mon, &day, &hour, &min, &sec);
|
|
|
|
|