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));
}
}
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()));
}
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());
}
Aggregations