package com.donghuan.c_interface;
|
|
import java.util.ArrayList;
|
|
import com.battdata_rt.BattData_RT_Array;
|
|
public class CInterfaceState {
|
|
public ArrayList<CIntefaceStateData> m_al_stat = new ArrayList<CIntefaceStateData>();
|
|
public int alm_com_err_count = 0;
|
public long alm_rec_id = 0;
|
|
public CInterfaceState(BattData_RT_Array al_Data) {
|
m_al_stat.add(new CIntefaceStateData(0));
|
for(int n=0; n<al_Data.getItemCount(); n++) {
|
m_al_stat.add(new CIntefaceStateData(al_Data.getItem(n).BattGroupId));
|
}
|
}
|
|
public void setTxCountInc(int bg_id) {
|
for(int n=0; n<m_al_stat.size(); n++) {
|
if(bg_id == m_al_stat.get(n).bg_id) {
|
m_al_stat.get(n).tx_count += 1;
|
if(m_al_stat.get(n).tx_count > 100000) {
|
m_al_stat.get(n).tx_count = 10;
|
}
|
break;
|
}
|
}
|
}
|
|
public void setAlmErrCountInc() {
|
if(alm_com_err_count < 10000) {
|
if(alm_com_err_count < 0) {
|
alm_com_err_count = 0;
|
}
|
alm_com_err_count++;
|
}
|
}
|
|
public void setErrCountInc(int bg_id) {
|
|
setAlmErrCountInc();
|
|
for(int n=0; n<m_al_stat.size(); n++) {
|
if(bg_id == m_al_stat.get(n).bg_id) {
|
if(m_al_stat.get(n).com_err_count < 1000000) {
|
m_al_stat.get(n).com_err_count += 1;
|
} else {
|
m_al_stat.get(n).com_err_type = 1;
|
}
|
break;
|
}
|
}
|
}
|
|
public void clearErrCount(int bg_id) {
|
boolean no_err = true;
|
for(int n=0; n<m_al_stat.size(); n++) {
|
CIntefaceStateData csd = m_al_stat.get(n);
|
if(bg_id == csd.bg_id) {
|
csd.com_err_count = 0;
|
csd.com_err_type = 0;
|
}
|
if(csd.com_err_count > 0) {
|
no_err = false;
|
}
|
|
if(true == no_err) {
|
alm_com_err_count = 0;
|
}
|
}
|
}
|
|
public void setBaseProcessValue(int val, int sum) {
|
for(int n=0; n<m_al_stat.size(); n++) {
|
if(0 == m_al_stat.get(n).bg_id) {
|
m_al_stat.get(n).tx_count = val;
|
m_al_stat.get(n).rx_count = sum;
|
break;
|
}
|
}
|
}
|
}
|