|
|
@@ -697,7 +697,8 @@ static int proc_ntp(char *path, int op, NTPManager *ntp)
|
|
|
pntp->product_id = 0;
|
|
|
r = proc_ntp(path, PARAS_CHECK, pntp);
|
|
|
if(r==0) {
|
|
|
- r = dev_update_ntp_info(get_dm()->db, 0, pntp);
|
|
|
+ //r = dev_clear_table(dm->db, TAB_ID_NTP); if(r) goto quit;
|
|
|
+ r = dev_update_ntp_info(dm->db, 0, pntp);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
@@ -876,6 +877,7 @@ static int proc_snmp(char *path, int op, SNMPManager *snmp)
|
|
|
if(op==PARAS_READ) {
|
|
|
r = proc_snmp(path, PARAS_CHECK, psnmp);
|
|
|
if(r==0) {
|
|
|
+ //r = dev_clear_table(dm->db, TAB_ID_SNMP); if(r) goto quit;
|
|
|
r = dev_update_snmp_info(dm->db, 0, psnmp);
|
|
|
}
|
|
|
}
|
|
|
@@ -1042,6 +1044,7 @@ static int proc_mqtt(char *path, int op, mqtt_info_t *mqtt)
|
|
|
if(op==PARAS_READ) {
|
|
|
r = proc_mqtt(path, PARAS_CHECK, pmqtt);
|
|
|
if(r==0) {
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_MQTT); if(r) goto quit;
|
|
|
r = dev_mqtt_update_info(dm->db, pmqtt);
|
|
|
}
|
|
|
}
|
|
|
@@ -1165,19 +1168,12 @@ static int proc_mail(char *path, int op, mail_info_t *mail)
|
|
|
break;
|
|
|
|
|
|
case PARAS_READ:
|
|
|
- case PARAS_WRITE:
|
|
|
{
|
|
|
pmail = &mail2;
|
|
|
send = &pmail->send;
|
|
|
- if(op==PARAS_READ) {
|
|
|
- dic = iniparser_load(path); if(!dic) return -1;
|
|
|
- send->id = 0;
|
|
|
- }
|
|
|
- else {
|
|
|
- r = dev_mail_get(dm->db, pmail); if(r) return -1;
|
|
|
- r = proc_mail(path, PARAS_CHECK, pmail); if(r) return -1;
|
|
|
- dic = dictionary_new(0); if(!dic) return -1;
|
|
|
- }
|
|
|
+ send->id = 0;
|
|
|
+
|
|
|
+ dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
r = ini_rw(dic, "mail:send.mode", &send->mode, sizeof(send->mode), TYPE_INT, op); if(r) goto quit;
|
|
|
r = ini_rw(dic, "mail:send.server", send->server, sizeof(send->server), TYPE_STR, op); if(r) goto quit;
|
|
|
@@ -1199,16 +1195,42 @@ static int proc_mail(char *path, int op, mail_info_t *mail)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(op==PARAS_READ) {
|
|
|
- r = proc_mail(path, PARAS_CHECK, pmail);
|
|
|
- if(r==0) {
|
|
|
- r = dev_mail_update_send(dm->db, &pmail->send);
|
|
|
- r = dev_mail_update_recv(dm->db, pmail->recv);
|
|
|
+ r = proc_mail(path, PARAS_CHECK, pmail); if(r) goto quit;
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_MAIL); if(r) goto quit;
|
|
|
+ r = dev_mail_update_send(dm->db, &pmail->send); if(r) goto quit;
|
|
|
+ r = dev_mail_update_recv(dm->db, pmail->recv); if(r) goto quit;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case PARAS_WRITE:
|
|
|
+ {
|
|
|
+ pmail = &mail2;
|
|
|
+ send = &pmail->send;
|
|
|
+
|
|
|
+ r = dev_mail_get(dm->db, pmail); if(r) return -1;
|
|
|
+ r = proc_mail(path, PARAS_CHECK, pmail); if(r) return -1;
|
|
|
+ dic = dictionary_new(0); if(!dic) return -1;
|
|
|
+
|
|
|
+ r = ini_rw(dic, "mail:send.mode", &send->mode, sizeof(send->mode), TYPE_INT, op); if(r) goto quit;
|
|
|
+ r = ini_rw(dic, "mail:send.server", send->server, sizeof(send->server), TYPE_STR, op); if(r) goto quit;
|
|
|
+ r = ini_rw(dic, "mail:send.port", send->port, sizeof(send->port), TYPE_STR, op); if(r) goto quit;
|
|
|
+ r = ini_rw(dic, "mail:send.auth", send->auth, sizeof(send->auth), TYPE_STR, op); if(r) goto quit;
|
|
|
+ r = ini_rw(dic, "mail:send.ca", send->ca, sizeof(send->ca), TYPE_STR, op); if(r) goto quit;
|
|
|
+ r = ini_rw(dic, "mail:send.account", send->account, sizeof(send->account), TYPE_STR, op); if(r) goto quit;
|
|
|
+
|
|
|
+ for(i=0; i<MAIL_RECV_MAX; i++) {
|
|
|
+ mail_recv_t *recv=&pmail->recv[i];
|
|
|
+
|
|
|
+ recv->idx = i;
|
|
|
+ if(op==PARAS_READ || (op==PARAS_WRITE && recv->use)) {
|
|
|
+ sprintf(token, "mail:recv%d.use", i+1);
|
|
|
+ r = ini_rw(dic, token, &recv->use, sizeof(recv->use), TYPE_INT, op); if(r) goto quit;
|
|
|
+
|
|
|
+ sprintf(token, "mail:recv%d.account", i+1);
|
|
|
+ r = ini_rw(dic, token, recv->account, sizeof(recv->account), TYPE_STR, op); if(r) goto quit;
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- r = ini_dump(path, dic);
|
|
|
- }
|
|
|
+ r = ini_dump(path, dic);
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
@@ -1288,32 +1310,41 @@ static int proc_role(char *path, int op, RoleInfo *role)
|
|
|
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
+ int x,chk_ok=0;
|
|
|
+
|
|
|
prole = &role2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- while(1) {
|
|
|
- sprintf(token, "role:role%d.name", i);
|
|
|
- r = ini_rw(dic, token, prole->roleName, sizeof(prole->roleName), TYPE_STR, op); if(r) break;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ i = 1;
|
|
|
+ while(1) {
|
|
|
+ sprintf(token, "role:role%d.name", i);
|
|
|
+ r = ini_rw(dic, token, prole->roleName, sizeof(prole->roleName), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.level", i);
|
|
|
- r = ini_rw(dic, token, &prole->roleLevel, sizeof(prole->roleLevel), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.level", i);
|
|
|
+ r = ini_rw(dic, token, &prole->roleLevel, sizeof(prole->roleLevel), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.auth", i);
|
|
|
- r = ini_rw(dic, token, prole->roleAuthority, sizeof(prole->roleAuthority), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.auth", i);
|
|
|
+ r = ini_rw(dic, token, prole->roleAuthority, sizeof(prole->roleAuthority), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.sort", i);
|
|
|
- r = ini_rw(dic, token, &prole->roleSort, sizeof(prole->roleAuthority), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.sort", i);
|
|
|
+ r = ini_rw(dic, token, &prole->roleSort, sizeof(prole->roleAuthority), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.time", i);
|
|
|
- r = ini_rw(dic, token, prole->createTime, sizeof(prole->createTime), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.time", i);
|
|
|
+ r = ini_rw(dic, token, prole->createTime, sizeof(prole->createTime), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- r = proc_role(path, PARAS_CHECK, prole);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_role_info(dm->db, prole);
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_role(path, PARAS_CHECK, prole); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_insert_role_info(dm->db, prole); if(r) break;
|
|
|
+ }
|
|
|
+
|
|
|
+ i++;
|
|
|
}
|
|
|
if(r) break;
|
|
|
-
|
|
|
- i++;
|
|
|
+ chk_ok = 1;
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_ROLE); if(r) break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -1439,32 +1470,39 @@ static int proc_user(char *path, int op, UserInfo *user)
|
|
|
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
+ int x,chk_ok=0;
|
|
|
puser = &user2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- while(1) {
|
|
|
- sprintf(token, "role:role%d.name", i);
|
|
|
- r = ini_rw(dic, token, puser->userName, sizeof(puser->userName), TYPE_STR, op); if(r) break;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ i = 1;
|
|
|
+ while(1) {
|
|
|
+ sprintf(token, "role:role%d.name", i);
|
|
|
+ r = ini_rw(dic, token, puser->userName, sizeof(puser->userName), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.password", i);
|
|
|
- r = ini_rw(dic, token, &puser->userPW, sizeof(puser->userPW), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.password", i);
|
|
|
+ r = ini_rw(dic, token, &puser->userPW, sizeof(puser->userPW), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.nick_name", i);
|
|
|
- r = ini_rw(dic, token, puser->nickName, sizeof(puser->nickName), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.nick_name", i);
|
|
|
+ r = ini_rw(dic, token, puser->nickName, sizeof(puser->nickName), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.role_id", i);
|
|
|
- r = ini_rw(dic, token, &puser->roleID, sizeof(puser->roleID), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.role_id", i);
|
|
|
+ r = ini_rw(dic, token, &puser->roleID, sizeof(puser->roleID), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "role:role%d.time", i);
|
|
|
- r = ini_rw(dic, token, puser->createTime, sizeof(puser->createTime), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "role:role%d.time", i);
|
|
|
+ r = ini_rw(dic, token, puser->createTime, sizeof(puser->createTime), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- r = proc_user(path, PARAS_CHECK, puser);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_user_info(dm->db, puser);
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_user(path, PARAS_CHECK, puser); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_insert_user_info(dm->db, puser); if(r) break;
|
|
|
+ }
|
|
|
+ i++;
|
|
|
}
|
|
|
if(r) break;
|
|
|
-
|
|
|
- i++;
|
|
|
+ chk_ok = 1;
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_USER); if(r) break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -1561,27 +1599,33 @@ static int proc_group(char *path, int op, GroupInfo *group)
|
|
|
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
+ int x,chk_ok=0;
|
|
|
pgroup = &group2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- while(1) {
|
|
|
- sprintf(token, "group:group%d.id", i);
|
|
|
- r = ini_rw(dic, token, &pgroup->GroupID, sizeof(pgroup->GroupID), TYPE_STR, op); if(r) break;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ i = 1;
|
|
|
+ while(1) {
|
|
|
+ sprintf(token, "group:group%d.id", i);
|
|
|
+ r = ini_rw(dic, token, &pgroup->GroupID, sizeof(pgroup->GroupID), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "group:group%d.name", i);
|
|
|
- r = ini_rw(dic, token, pgroup->GroupName, sizeof(pgroup->GroupName), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "group:group%d.name", i);
|
|
|
+ r = ini_rw(dic, token, pgroup->GroupName, sizeof(pgroup->GroupName), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "group:group%d.ch_list", i);
|
|
|
- r = ini_rw(dic, token, pgroup->GroupChList, sizeof(pgroup->GroupChList), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "group:group%d.ch_list", i);
|
|
|
+ r = ini_rw(dic, token, pgroup->GroupChList, sizeof(pgroup->GroupChList), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- r = proc_group(path, PARAS_CHECK, pgroup);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_group_info(dm->db, pgroup);
|
|
|
- if(r) {
|
|
|
- break;
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_group(path, PARAS_CHECK, pgroup); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_insert_group_info(dm->db, pgroup); if(r) break;
|
|
|
}
|
|
|
+ i++;
|
|
|
}
|
|
|
- i++;
|
|
|
+ if(r) break;
|
|
|
+ chk_ok = 1;
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_GROUP); if(r) break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -1729,108 +1773,116 @@ static int proc_sensor(char *path, int op, GlobalSensorManger *sensor)
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
float f;
|
|
|
+ int x,chk_ok=0;
|
|
|
|
|
|
psensor = &sensor2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- while(1) {
|
|
|
- sprintf(token, "sensor:sensor%d.id", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_id, sizeof(psensor->sensor_id), TYPE_INT, op); if(r) break;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ i = 1;
|
|
|
+ while(1) {
|
|
|
+ sprintf(token, "sensor:sensor%d.id", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_id, sizeof(psensor->sensor_id), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.type", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_type, sizeof(psensor->sensor_type), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.type", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_type, sizeof(psensor->sensor_type), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.name", i);
|
|
|
- r = ini_rw(dic, token, psensor->sensor_name, sizeof(psensor->sensor_name), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.name", i);
|
|
|
+ r = ini_rw(dic, token, psensor->sensor_name, sizeof(psensor->sensor_name), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.iface", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_interface_type, sizeof(psensor->sensor_interface_type), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.iface", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_interface_type, sizeof(psensor->sensor_interface_type), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.port", i);
|
|
|
- r = ini_rw(dic, token, psensor->sensor_port_name, sizeof(psensor->sensor_port_name), TYPE_STR, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.port", i);
|
|
|
+ r = ini_rw(dic, token, psensor->sensor_port_name, sizeof(psensor->sensor_port_name), TYPE_STR, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.addr", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_addr, sizeof(psensor->sensor_addr), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.addr", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_addr, sizeof(psensor->sensor_addr), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.baudrate", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_baud, sizeof(psensor->sensor_baud), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.baudrate", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_baud, sizeof(psensor->sensor_baud), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.vcnt", i);
|
|
|
- r = ini_rw(dic, token, &psensor->sensor_val_count, sizeof(psensor->sensor_val_count), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.vcnt", i);
|
|
|
+ r = ini_rw(dic, token, &psensor->sensor_val_count, sizeof(psensor->sensor_val_count), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- //////////////////////
|
|
|
- GlobalSensorOverManage *pover=&psensor->over_manager;
|
|
|
- for(j=1; j<=2; j++) {
|
|
|
- for(k=1; k<=2; k++) {
|
|
|
- if(j==1) {
|
|
|
- if(k==1) {
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.en", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_upper_enabled, sizeof(pover->sensor_val1_upper_enabled), TYPE_INT, op); if(r) break;
|
|
|
+ //////////////////////
|
|
|
+ GlobalSensorOverManage *pover=&psensor->over_manager;
|
|
|
+ for(j=1; j<=2; j++) {
|
|
|
+ for(k=1; k<=2; k++) {
|
|
|
+ if(j==1) {
|
|
|
+ if(k==1) {
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.en", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_upper_enabled, sizeof(pover->sensor_val1_upper_enabled), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold, sizeof(pover->sensor_val1_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold, sizeof(pover->sensor_val1_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th_act", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold_ctrl, sizeof(pover->sensor_val1_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th_act", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold_ctrl, sizeof(pover->sensor_val1_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th_para", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold_ctrl_para, sizeof(pover->sensor_val1_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
- }
|
|
|
- else {
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.en", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_lower_enabled, sizeof(pover->sensor_val1_lower_enabled), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th_para", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_upper_threshold_ctrl_para, sizeof(pover->sensor_val1_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.en", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_lower_enabled, sizeof(pover->sensor_val1_lower_enabled), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold, sizeof(pover->sensor_val1_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold, sizeof(pover->sensor_val1_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th_act", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold_ctrl, sizeof(pover->sensor_val1_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th_act", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold_ctrl, sizeof(pover->sensor_val1_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th_para", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold_ctrl_para, sizeof(pover->sensor_val1_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th_para", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val1_lower_threshold_ctrl_para, sizeof(pover->sensor_val1_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- if(k==1) {
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.en", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_upper_enabled, sizeof(pover->sensor_val2_upper_enabled), TYPE_INT, op); if(r) break;
|
|
|
+ else {
|
|
|
+ if(k==1) {
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.en", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_upper_enabled, sizeof(pover->sensor_val2_upper_enabled), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold, sizeof(pover->sensor_val2_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold, sizeof(pover->sensor_val2_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th_act", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold_ctrl, sizeof(pover->sensor_val2_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th_act", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold_ctrl, sizeof(pover->sensor_val2_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.up.th_para", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold_ctrl_para, sizeof(pover->sensor_val2_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
- }
|
|
|
- else {
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.en", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_lower_enabled, sizeof(pover->sensor_val2_lower_enabled), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.up.th_para", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_upper_threshold_ctrl_para, sizeof(pover->sensor_val2_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.en", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_lower_enabled, sizeof(pover->sensor_val2_lower_enabled), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold, sizeof(pover->sensor_val2_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold, sizeof(pover->sensor_val2_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th_act", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold_ctrl, sizeof(pover->sensor_val2_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th_act", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold_ctrl, sizeof(pover->sensor_val2_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "sensor:sensor%d.v%d.lo.th_para", i, j);
|
|
|
- r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold_ctrl_para, sizeof(pover->sensor_val2_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "sensor:sensor%d.v%d.lo.th_para", i, j);
|
|
|
+ r = ini_rw(dic, token, &pover->sensor_val2_lower_threshold_ctrl_para, sizeof(pover->sensor_val2_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(r) break;
|
|
|
}
|
|
|
if(r) break;
|
|
|
}
|
|
|
if(r) break;
|
|
|
- }
|
|
|
- if(r) break;
|
|
|
|
|
|
- r = proc_sensor(path, PARAS_CHECK, psensor);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_sensor_genera_manage(dm->db, 0, psensor->sensor_id, psensor);
|
|
|
- r = dev_update_sensor_over_manage(dm->db, 0, psensor->sensor_id, psensor);
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_sensor(path, PARAS_CHECK, psensor); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_insert_sensor_genera_manage(dm->db, psensor); if(r) break;
|
|
|
+ r = dev_update_sensor_over_manage(dm->db, 0, psensor->sensor_id, psensor); if(r) break;
|
|
|
+ }
|
|
|
+ i++;
|
|
|
}
|
|
|
if(r) break;
|
|
|
- i++;
|
|
|
+ chk_ok = 1;
|
|
|
+ r = dev_clear_table(dm->db, TAB_ID_SENSOR); if(r) break;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -1961,7 +2013,7 @@ static int proc_sensor(char *path, int op, GlobalSensorManger *sensor)
|
|
|
}
|
|
|
static int proc_power(char *path, int op, GlobalPowerManger *power)
|
|
|
{
|
|
|
- int i=1,r=0;
|
|
|
+ int i,j,r=0;
|
|
|
char temp[100];
|
|
|
char *p,token[100];
|
|
|
dictionary *dic=NULL;
|
|
|
@@ -1997,106 +2049,113 @@ static int proc_power(char *path, int op, GlobalPowerManger *power)
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
float f;
|
|
|
+ int x,chk_ok=0;
|
|
|
|
|
|
GlobalPowerManger *tmp=&power2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- for(i=1; i<=dm->brdMax; i++) {
|
|
|
- sprintf(token, "power:channel%d.addr",i);
|
|
|
- r = ini_rw(dic, token, &tmp->product_saddr, sizeof(tmp->product_saddr), TYPE_INT, op); if(r) break;
|
|
|
- tmp->product_ch_id = i;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ for(i=1; i<=dm->brdMax; i++) {
|
|
|
+ sprintf(token, "power:channel%d.addr",i);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_saddr, sizeof(tmp->product_saddr), TYPE_INT, op); if(r) break;
|
|
|
+ tmp->product_ch_id = i;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ch_addr",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_addr, sizeof(tmp->product_ch_addr), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ch_addr",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_addr, sizeof(tmp->product_ch_addr), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.name",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, tmp->product_ch_name, sizeof(tmp->product_ch_name), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.name",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, tmp->product_ch_name, sizeof(tmp->product_ch_name), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.type",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_type, sizeof(tmp->product_ch_type), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.type",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_type, sizeof(tmp->product_ch_type), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.status",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_status, sizeof(tmp->product_ch_status), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.status",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_status, sizeof(tmp->product_ch_status), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.start_delay",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_start_delay, sizeof(tmp->product_ch_start_delay), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.start_delay",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_start_delay, sizeof(tmp->product_ch_start_delay), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.stop_delay",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_stop_delay, sizeof(tmp->product_ch_stop_delay), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.stop_delay",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_stop_delay, sizeof(tmp->product_ch_stop_delay), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////voltage//////////
|
|
|
- GlobalOverManager *pover=&tmp->global_over_manager;
|
|
|
- //upper
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_upper_enable, sizeof(pover->product_vol_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
-
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_upper_threshold, sizeof(pover->product_vol_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ ///////////voltage//////////
|
|
|
+ GlobalOverManager *pover=&tmp->global_over_manager;
|
|
|
+ //upper
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_upper_enable, sizeof(pover->product_vol_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl, sizeof(pover->product_vol_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_upper_threshold, sizeof(pover->product_vol_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl_para, sizeof(pover->product_vol_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl, sizeof(pover->product_vol_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- //lower
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_lower_enable, sizeof(pover->product_vol_lower_enable), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl_para, sizeof(pover->product_vol_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_lower_threshold, sizeof(pover->product_vol_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ //lower
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_lower_enable, sizeof(pover->product_vol_lower_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl, sizeof(pover->product_vol_over_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_lower_threshold, sizeof(pover->product_vol_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl_para, sizeof(pover->product_vol_over_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl, sizeof(pover->product_vol_over_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl_para, sizeof(pover->product_vol_over_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////current//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_upper_enable, sizeof(pover->product_cur_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////current//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_upper_enable, sizeof(pover->product_cur_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_upper_threshold, sizeof(pover->product_cur_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_upper_threshold, sizeof(pover->product_cur_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl, sizeof(pover->product_cur_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl, sizeof(pover->product_cur_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl_para, sizeof(pover->product_cur_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl_para, sizeof(pover->product_cur_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////power//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_upper_enable, sizeof(pover->product_pwr_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////power//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_upper_enable, sizeof(pover->product_pwr_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_upper_threshold, sizeof(pover->product_pwr_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_upper_threshold, sizeof(pover->product_pwr_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl, sizeof(pover->product_pwr_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl, sizeof(pover->product_pwr_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl_para, sizeof(pover->product_pwr_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl_para, sizeof(pover->product_pwr_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////power consumption//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_upper_enable, sizeof(pover->product_pwrcon_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////power consumption//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_upper_enable, sizeof(pover->product_pwrcon_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_upper_threshold, sizeof(pover->product_pwrcon_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_upper_threshold, sizeof(pover->product_pwrcon_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl_para, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
-
|
|
|
- r = proc_power(path, PARAS_CHECK, tmp);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_power_manage_genera_info(dm->db, 0, i, tmp);
|
|
|
- r = dev_update_power_manage_over_info(dm->db, 0, i, tmp);
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl_para, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_power(path, PARAS_CHECK, tmp); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_update_power_manage_genera_info(dm->db, 0, i, tmp); if(r) break;
|
|
|
+ r = dev_update_power_manage_over_info(dm->db, 0, i, tmp); if(r) break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ if(r) break;
|
|
|
+ chk_ok = 1;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -2259,102 +2318,109 @@ static int proc_power3(char *path, int op, GlobalTreeACManager *power)
|
|
|
case PARAS_READ:
|
|
|
{
|
|
|
float f;
|
|
|
+ int x,chk_ok=0;
|
|
|
|
|
|
GlobalTreeACManager *tmp=&power2;
|
|
|
dic = iniparser_load(path); if(!dic) return -1;
|
|
|
|
|
|
- for(i=1; i<=dm->brdMax; i++) {
|
|
|
- sprintf(token, "power:channel%d.addr",i);
|
|
|
- r = ini_rw(dic, token, &tmp->product_saddr, sizeof(tmp->product_saddr), TYPE_INT, op); if(r) break;
|
|
|
- tmp->product_ch_id = i;
|
|
|
+ for(x=0; x<2; x++) {
|
|
|
+ for(i=1; i<=dm->brdMax; i++) {
|
|
|
+ sprintf(token, "power:channel%d.addr",i);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_saddr, sizeof(tmp->product_saddr), TYPE_INT, op); if(r) break;
|
|
|
+ tmp->product_ch_id = i;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ch_addr",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ch_addr, sizeof(tmp->product_ch_addr), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ch_addr",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ch_addr, sizeof(tmp->product_ch_addr), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ph_id",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ph_id, sizeof(tmp->product_ph_id), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ph_id",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ph_id, sizeof(tmp->product_ph_id), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ph_type",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ph_type, sizeof(tmp->product_ph_type), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ph_type",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ph_type, sizeof(tmp->product_ph_type), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ph_otype",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ph_outputType, sizeof(tmp->product_ph_outputType), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ph_otype",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ph_outputType, sizeof(tmp->product_ph_outputType), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.ph_ostat",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &tmp->product_ph_outputStatus, sizeof(tmp->product_ph_outputStatus), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.ph_ostat",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &tmp->product_ph_outputStatus, sizeof(tmp->product_ph_outputStatus), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////voltage//////////
|
|
|
- GlobalOverManager *pover=&tmp->global_over_manager;
|
|
|
- //upper
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_upper_enable, sizeof(pover->product_vol_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////voltage//////////
|
|
|
+ GlobalOverManager *pover=&tmp->global_over_manager;
|
|
|
+ //upper
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_upper_enable, sizeof(pover->product_vol_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_upper_threshold, sizeof(pover->product_vol_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_upper_threshold, sizeof(pover->product_vol_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl, sizeof(pover->product_vol_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl, sizeof(pover->product_vol_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl_para, sizeof(pover->product_vol_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_upper_threshold_ctrl_para, sizeof(pover->product_vol_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- //lower
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_lower_enable, sizeof(pover->product_vol_lower_enable), TYPE_INT, op); if(r) break;
|
|
|
+ //lower
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_lower_enable, sizeof(pover->product_vol_lower_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_lower_threshold, sizeof(pover->product_vol_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_lower_threshold, sizeof(pover->product_vol_lower_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl, sizeof(pover->product_vol_over_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl, sizeof(pover->product_vol_over_lower_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.voltate.lo.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl_para, sizeof(pover->product_vol_over_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.voltate.lo.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_vol_over_lower_threshold_ctrl_para, sizeof(pover->product_vol_over_lower_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////current//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_upper_enable, sizeof(pover->product_cur_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////current//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_upper_enable, sizeof(pover->product_cur_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_upper_threshold, sizeof(pover->product_cur_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_upper_threshold, sizeof(pover->product_cur_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl, sizeof(pover->product_cur_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl, sizeof(pover->product_cur_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.current.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl_para, sizeof(pover->product_cur_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.current.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_cur_over_upper_threshold_ctrl_para, sizeof(pover->product_cur_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////power//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_upper_enable, sizeof(pover->product_pwr_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////power//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_upper_enable, sizeof(pover->product_pwr_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_upper_threshold, sizeof(pover->product_pwr_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_upper_threshold, sizeof(pover->product_pwr_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl, sizeof(pover->product_pwr_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl, sizeof(pover->product_pwr_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.power.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl_para, sizeof(pover->product_pwr_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.power.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwr_over_upper_threshold_ctrl_para, sizeof(pover->product_pwr_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- ///////////power consumption//////////
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.en",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_upper_enable, sizeof(pover->product_pwrcon_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
+ ///////////power consumption//////////
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.en",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_upper_enable, sizeof(pover->product_pwrcon_upper_enable), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.val",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_upper_threshold, sizeof(pover->product_pwrcon_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.val",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_upper_threshold, sizeof(pover->product_pwrcon_upper_threshold), TYPE_FLOAT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.act",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.act",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl), TYPE_INT, op); if(r) break;
|
|
|
|
|
|
- sprintf(token, "power:channel%d.threshold.powerc.up.para",tmp->product_ch_id);
|
|
|
- r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl_para, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
-
|
|
|
- r = proc_power3(path, PARAS_CHECK, tmp);
|
|
|
- if(r==0) {
|
|
|
- r = dev_update_t_ac_power_manage_info(dm->db, tmp);
|
|
|
- r = dev_update_t_ac_power_manage_over_info(dm->db, tmp);
|
|
|
+ sprintf(token, "power:channel%d.threshold.powerc.up.para",tmp->product_ch_id);
|
|
|
+ r = ini_rw(dic, token, &pover->product_pwrcon_over_upper_threshold_ctrl_para, sizeof(pover->product_pwrcon_over_upper_threshold_ctrl_para), TYPE_INT, op); if(r) break;
|
|
|
+
|
|
|
+ if(chk_ok==0) {
|
|
|
+ r = proc_power3(path, PARAS_CHECK, tmp); if(r) break;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ r = dev_update_t_ac_power_manage_info(dm->db, tmp); if(r) break;
|
|
|
+ r = dev_update_t_ac_power_manage_over_info(dm->db, tmp); if(r) break;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(r) break;
|
|
|
+ chk_ok = 1;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
@@ -2776,10 +2842,8 @@ static int ini_save(paras_handle_t *h)
|
|
|
return 0;
|
|
|
}
|
|
|
#endif
|
|
|
-
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
|
-
|
|
|
int paras_init(void)
|
|
|
{
|
|
|
int r=0;
|
|
|
@@ -2883,30 +2947,30 @@ int paras_serv_xport(char *path, int io)
|
|
|
char temp[100];
|
|
|
|
|
|
if(io==PARAS_IMPORT) {
|
|
|
- r = proc_ntp(path, PARAS_READ, NULL);
|
|
|
- r = proc_mqtt(path, PARAS_READ, NULL);
|
|
|
- r = proc_mail(path, PARAS_READ, NULL);
|
|
|
- r = proc_snmp(path, PARAS_READ, NULL);
|
|
|
- r = proc_role(path, PARAS_READ, NULL);
|
|
|
- r = proc_user(path, PARAS_READ, NULL);
|
|
|
- r = proc_group(path, PARAS_READ, NULL);
|
|
|
- //r = proc_timer(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_ntp(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_mqtt(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_mail(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_snmp(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_role(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_user(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_group(path, PARAS_READ, NULL);
|
|
|
+ //r *= proc_timer(path, PARAS_READ, NULL);
|
|
|
}
|
|
|
else if(io==PARAS_EXPORT) {
|
|
|
get_curtime_str(temp,sizeof(temp));
|
|
|
sprintf(path, "/tmp/service_%s.ini", temp);
|
|
|
|
|
|
- r = proc_ntp(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_mqtt(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_mail(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_snmp(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_role(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_user(path, PARAS_WRITE, NULL);
|
|
|
- r = proc_group(path, PARAS_WRITE, NULL);
|
|
|
- //r = proc_timer(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_ntp(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_mqtt(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_mail(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_snmp(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_role(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_user(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_group(path, PARAS_WRITE, NULL);
|
|
|
+ //r *= proc_timer(path, PARAS_WRITE, NULL);
|
|
|
}
|
|
|
|
|
|
- return 0;
|
|
|
+ return r;
|
|
|
}
|
|
|
|
|
|
int paras_alarm_xport(char *path, int io)
|
|
|
@@ -2917,10 +2981,10 @@ int paras_alarm_xport(char *path, int io)
|
|
|
pwr3 = is_power3();
|
|
|
if(io==PARAS_IMPORT) {
|
|
|
if(pwr3) {
|
|
|
- r = proc_power(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_power(path, PARAS_READ, NULL);
|
|
|
}
|
|
|
else {
|
|
|
- r = proc_power3(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_power3(path, PARAS_READ, NULL);
|
|
|
}
|
|
|
}
|
|
|
else if(io==PARAS_EXPORT) {
|
|
|
@@ -2928,10 +2992,10 @@ int paras_alarm_xport(char *path, int io)
|
|
|
sprintf(path, "/tmp/power_%s.ini", temp);
|
|
|
|
|
|
if(pwr3) {
|
|
|
- r = proc_power3(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_power3(path, PARAS_WRITE, NULL);
|
|
|
}
|
|
|
else {
|
|
|
- r = proc_power(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_power(path, PARAS_WRITE, NULL);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2942,16 +3006,15 @@ int paras_sensor_xport(char *path, int io)
|
|
|
{
|
|
|
int r=-1;
|
|
|
char temp[100];
|
|
|
-
|
|
|
|
|
|
if(io==PARAS_IMPORT) {
|
|
|
- r = proc_sensor(path, PARAS_READ, NULL);
|
|
|
+ r *= proc_sensor(path, PARAS_READ, NULL);
|
|
|
}
|
|
|
else if(io==PARAS_EXPORT) {
|
|
|
get_curtime_str(temp,sizeof(temp));
|
|
|
sprintf(path, "/tmp/sensor_%s.ini", temp);
|
|
|
|
|
|
- r = proc_sensor(path, PARAS_WRITE, NULL);
|
|
|
+ r *= proc_sensor(path, PARAS_WRITE, NULL);
|
|
|
}
|
|
|
|
|
|
return r;
|