Search in sources :

Example 1 with DoubleMonitor

use of com.infiniteautomation.mango.monitor.DoubleMonitor in project ma-modules-public by infiniteautomation.

the class InternalDataSourceRT method forcePointRead.

@Override
public void forcePointRead(DataPointRT dataPoint) {
    InternalPointLocatorRT locator = dataPoint.getPointLocator();
    ValueMonitor<?> m = Common.MONITORED_VALUES.getValueMonitor(locator.getPointLocatorVO().getMonitorId());
    if (m != null) {
        if (m instanceof IntegerMonitor)
            dataPoint.updatePointValue(new PointValueTime((double) ((IntegerMonitor) m).getValue(), Common.timer.currentTimeMillis()));
        else if (m instanceof LongMonitor)
            dataPoint.updatePointValue(new PointValueTime((double) ((LongMonitor) m).getValue(), Common.timer.currentTimeMillis()));
        else if (m instanceof DoubleMonitor)
            dataPoint.updatePointValue(new PointValueTime((double) ((DoubleMonitor) m).getValue(), Common.timer.currentTimeMillis()));
        else if (m instanceof AtomicIntegerMonitor)
            dataPoint.updatePointValue(new PointValueTime((double) ((AtomicIntegerMonitor) m).getValue(), Common.timer.currentTimeMillis()));
    }
}
Also used : PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime) LongMonitor(com.infiniteautomation.mango.monitor.LongMonitor) AtomicIntegerMonitor(com.infiniteautomation.mango.monitor.AtomicIntegerMonitor) AtomicIntegerMonitor(com.infiniteautomation.mango.monitor.AtomicIntegerMonitor) IntegerMonitor(com.infiniteautomation.mango.monitor.IntegerMonitor) DoubleMonitor(com.infiniteautomation.mango.monitor.DoubleMonitor)

Example 2 with DoubleMonitor

use of com.infiniteautomation.mango.monitor.DoubleMonitor in project ma-modules-public by infiniteautomation.

the class InternalDataSourceRT method doPoll.

@Override
public void doPoll(long time) {
    if (createsPoints) {
        for (ValueMonitor<?> m : Common.MONITORED_VALUES.getMonitors()) {
            if (createPointsPattern.matcher(m.getId()).matches() && !monitorMap.containsKey(m.getId()))
                createMonitorPoint(m);
        }
    }
    for (DataPointRT dataPoint : dataPoints) {
        InternalPointLocatorRT locator = dataPoint.getPointLocator();
        ValueMonitor<?> m = Common.MONITORED_VALUES.getValueMonitor(locator.getPointLocatorVO().getMonitorId());
        if (m != null) {
            if (m instanceof IntegerMonitor)
                dataPoint.updatePointValue(new PointValueTime((double) ((IntegerMonitor) m).getValue(), time));
            else if (m instanceof LongMonitor)
                dataPoint.updatePointValue(new PointValueTime((double) ((LongMonitor) m).getValue(), time));
            else if (m instanceof DoubleMonitor)
                dataPoint.updatePointValue(new PointValueTime((double) ((DoubleMonitor) m).getValue(), time));
            else if (m instanceof AtomicIntegerMonitor)
                dataPoint.updatePointValue(new PointValueTime((double) ((AtomicIntegerMonitor) m).getValue(), time));
        }
    }
}
Also used : DataPointRT(com.serotonin.m2m2.rt.dataImage.DataPointRT) PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime) LongMonitor(com.infiniteautomation.mango.monitor.LongMonitor) AtomicIntegerMonitor(com.infiniteautomation.mango.monitor.AtomicIntegerMonitor) AtomicIntegerMonitor(com.infiniteautomation.mango.monitor.AtomicIntegerMonitor) IntegerMonitor(com.infiniteautomation.mango.monitor.IntegerMonitor) DoubleMonitor(com.infiniteautomation.mango.monitor.DoubleMonitor)

Aggregations

AtomicIntegerMonitor (com.infiniteautomation.mango.monitor.AtomicIntegerMonitor)2 DoubleMonitor (com.infiniteautomation.mango.monitor.DoubleMonitor)2 IntegerMonitor (com.infiniteautomation.mango.monitor.IntegerMonitor)2 LongMonitor (com.infiniteautomation.mango.monitor.LongMonitor)2 PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)2 DataPointRT (com.serotonin.m2m2.rt.dataImage.DataPointRT)1