Search in sources :

Example 1 with VirtualPointLocatorRT

use of com.serotonin.m2m2.virtual.rt.VirtualPointLocatorRT in project ma-modules-public by infiniteautomation.

the class VirtualDataSourceRT method doPoll.

@Override
public void doPoll(long time) {
    if (delay > 0) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
    }
    for (DataPointRT dataPoint : dataPoints) {
        VirtualPointLocatorRT locator = dataPoint.getPointLocator();
        // Change the point values according to their definitions.
        locator.change();
        dataPoint.updatePointValue(new PointValueTime(locator.getCurrentValue(), time));
    }
}
Also used : DataPointRT(com.serotonin.m2m2.rt.dataImage.DataPointRT) PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime)

Example 2 with VirtualPointLocatorRT

use of com.serotonin.m2m2.virtual.rt.VirtualPointLocatorRT in project ma-modules-public by infiniteautomation.

the class VirtualDataSourceRT method forcePointRead.

@Override
public void forcePointRead(DataPointRT dataPoint) {
    VirtualPointLocatorRT locator = dataPoint.getPointLocator();
    locator.change();
    dataPoint.updatePointValue(new PointValueTime(locator.getCurrentValue(), System.currentTimeMillis()));
}
Also used : PointValueTime(com.serotonin.m2m2.rt.dataImage.PointValueTime)

Example 3 with VirtualPointLocatorRT

use of com.serotonin.m2m2.virtual.rt.VirtualPointLocatorRT in project ma-modules-public by infiniteautomation.

the class VirtualPointLocatorVO method createRuntime.

@Override
public PointLocatorRT<VirtualPointLocatorVO> createRuntime() {
    ChangeTypeRT changeType = getChangeType().createRuntime();
    String startValue = getChangeType().getStartValue();
    DataValue startObject;
    if (dataTypeId == DataTypes.BINARY)
        startObject = BinaryValue.parseBinary(startValue);
    else if (dataTypeId == DataTypes.MULTISTATE) {
        try {
            startObject = MultistateValue.parseMultistate(startValue);
        } catch (NumberFormatException e) {
            startObject = new MultistateValue(0);
        }
    } else if (dataTypeId == DataTypes.NUMERIC) {
        try {
            startObject = NumericValue.parseNumeric(startValue);
        } catch (NumberFormatException e) {
            startObject = new NumericValue(0);
        }
    } else {
        if (startValue == null)
            startObject = new AlphanumericValue("");
        else
            startObject = new AlphanumericValue(startValue);
    }
    return new VirtualPointLocatorRT(this, changeType, startObject, isSettable());
}
Also used : AlphanumericValue(com.serotonin.m2m2.rt.dataImage.types.AlphanumericValue) DataValue(com.serotonin.m2m2.rt.dataImage.types.DataValue) VirtualPointLocatorRT(com.serotonin.m2m2.virtual.rt.VirtualPointLocatorRT) ChangeTypeRT(com.serotonin.m2m2.virtual.rt.ChangeTypeRT) NumericValue(com.serotonin.m2m2.rt.dataImage.types.NumericValue) MultistateValue(com.serotonin.m2m2.rt.dataImage.types.MultistateValue)

Aggregations

PointValueTime (com.serotonin.m2m2.rt.dataImage.PointValueTime)2 DataPointRT (com.serotonin.m2m2.rt.dataImage.DataPointRT)1 AlphanumericValue (com.serotonin.m2m2.rt.dataImage.types.AlphanumericValue)1 DataValue (com.serotonin.m2m2.rt.dataImage.types.DataValue)1 MultistateValue (com.serotonin.m2m2.rt.dataImage.types.MultistateValue)1 NumericValue (com.serotonin.m2m2.rt.dataImage.types.NumericValue)1 ChangeTypeRT (com.serotonin.m2m2.virtual.rt.ChangeTypeRT)1 VirtualPointLocatorRT (com.serotonin.m2m2.virtual.rt.VirtualPointLocatorRT)1