use of com.fr3ts0n.pvs.IndexedProcessVar in project AndrOBD by fr3ts0n.
the class ObdItemAdapter method addAllDataSeries.
/**
* Add data series to all process variables
*/
protected synchronized void addAllDataSeries() {
String pluginStr = "";
for (IndexedProcessVar pv : (Iterable<IndexedProcessVar>) pvs.values()) {
XYSeries series = (XYSeries) pv.get(FID_DATA_SERIES);
if (series == null) {
series = new XYSeries(String.valueOf(pv.get(EcuDataPv.FID_DESCRIPT)));
pv.put(FID_DATA_SERIES, series);
pv.addPvChangeListener(this, PvChangeEvent.PV_MODIFIED);
}
// assemble data items for plugin notification
pluginStr += String.format("%s;%s;%s;%s\n", pv.get(EcuDataPv.FID_MNEMONIC), pv.get(EcuDataPv.FID_DESCRIPT), String.valueOf(pv.get(EcuDataPv.FID_VALUE)), pv.get(EcuDataPv.FID_UNITS));
}
// notify plugins
if (PluginManager.pluginHandler != null) {
PluginManager.pluginHandler.sendDataList(pluginStr);
}
}
use of com.fr3ts0n.pvs.IndexedProcessVar in project AndrOBD by fr3ts0n.
the class DfcItemAdapter method getView.
/* (non-Javadoc)
* @see com.fr3ts0n.ecu.gui.androbd.ObdItemAdapter#getView(int, android.view.View, android.view.ViewGroup)
*/
@Override
public View getView(int position, View v, ViewGroup parent) {
// get data PV
IndexedProcessVar currPv = (IndexedProcessVar) getItem(position);
if (v == null) {
v = mInflater.inflate(R.layout.obd_item, parent, false);
}
TextView tvDescr = (TextView) v.findViewById(R.id.obd_label);
TextView tvValue = (TextView) v.findViewById(R.id.obd_units);
tvValue.setText(String.valueOf(currPv.get(EcuCodeItem.FID_CODE)));
tvDescr.setText(String.valueOf(currPv.get(EcuCodeItem.FID_DESCRIPT)));
return v;
}
use of com.fr3ts0n.pvs.IndexedProcessVar in project AndrOBD by fr3ts0n.
the class ObdItemAdapter method pvChanged.
@Override
public void pvChanged(PvChangeEvent event) {
if (allowDataUpdates) {
IndexedProcessVar pv = (IndexedProcessVar) event.getSource();
XYSeries series = (XYSeries) pv.get(FID_DATA_SERIES);
if (series != null) {
if (event.getValue() instanceof Number) {
series.add(event.getTime(), ((Number) event.getValue()).doubleValue());
}
}
// send update to plugin handler
if (PluginManager.pluginHandler != null) {
PluginManager.pluginHandler.sendDataUpdate(pv.get(EcuDataPv.FID_MNEMONIC).toString(), event.getValue().toString());
}
}
}
Aggregations