Package com.serotonin.m2m2.rt.dataImage.types

Examples of com.serotonin.m2m2.rt.dataImage.types.DataValue


        String value;
        DataPointRT dataPointRT = rtm.getDataPoint(dataPointVO.getId());
        if (dataPointRT == null)
            value = disabledValue;
        else {
            PointValueTime pvt = dataPointRT.getPointValue();

            if (pvt != null && pvt.getValue() instanceof ImageValue) {
                // Text renderers don't help here. Create a thumbnail.
                Map<String, Object> model = new HashMap<String, Object>();
                model.put("point", dataPointVO);
                model.put("pointValue", pvt);
                value = BaseDwr.generateContent(request, "imageValueThumbnail.jsp", model);
            }
            else {
                int hint = raw ? TextRenderer.HINT_RAW : TextRenderer.HINT_FULL;
                value = dataPointVO.getTextRenderer().getText(pvt, hint);
                if (pvt != null && time)
                    state.setTime(pvt.getTime());
            }
        }
        state.setValue(value);
    }
View Full Code Here


        private boolean send(List<PublishQueueEntry<SquwkPointVO>> entries) {
            List<SampleAppendRequest> reqs = new ArrayList<SampleAppendRequest>();

            for (PublishQueueEntry<SquwkPointVO> entry : entries) {
                SquwkPointVO vo = entry.getVo();
                PointValueTime pvt = entry.getPvt();
                SampleAppendRequest req = new SampleAppendRequest(vo.getGuid(), pvt.getTime(), coerceDataValue(
                        pvt.getValue(), vo.getDataType()));
                reqs.add(req);
            }

            // Send the request. Set message non-null if there is a failure.
            ResultHandler resultHandler = new ResultHandler();
View Full Code Here

            long time = dtf.parseDateTime(nextLine[0]).getMillis();

            // The rest of the values are point samples.
            for (int i = 1; i < nextLine.length; i++) {
                DataValue value = DataValue.stringToValue(nextLine[i], vos[i - 1].getPointLocator().getDataTypeId());
                PointValueTime pvt = new PointValueTime(value, time);

                if (rts[i - 1] != null)
                    rts[i - 1].savePointValueDirectToCache(pvt, null, true, true);
                else
                    // Save directly to the database
View Full Code Here

      } catch (NumberFormatException e) {
        startObject = new NumericValue(0);
      }
    } else {
      if (startValue == null)
        startObject = new AlphanumericValue("");
      else
        startObject = new AlphanumericValue(startValue);
    }
    return new VirtualPointLocatorRT(changeType, startObject, isSettable());
  }
View Full Code Here

import com.serotonin.m2m2.rt.dataImage.types.DataValue;

public class AlternateBooleanChangeRT extends ChangeTypeRT {
    @Override
    public DataValue change(DataValue currentValue) {
        return new BinaryValue(!currentValue.getBooleanValue());
    }
View Full Code Here

  @Override
  public PointLocatorRT 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);
View Full Code Here

            // The first value is always a date.
            long time = dtf.parseDateTime(nextLine[0]).getMillis();

            // The rest of the values are point samples.
            for (int i = 1; i < nextLine.length; i++) {
                DataValue value = DataValue.stringToValue(nextLine[i], vos[i - 1].getPointLocator().getDataTypeId());
                PointValueTime pvt = new PointValueTime(value, time);

                if (rts[i - 1] != null)
                    rts[i - 1].savePointValueDirectToCache(pvt, null, true, true);
                else
View Full Code Here

                log.debug("Attraction point is not enabled");
            // Point is not currently active.
            return new NumericValue(current);
        }

        DataValue attractorValue = PointValueTime.getValue(point.getPointValue());
        if (attractorValue == null) {
            if (log.isDebugEnabled())
                log.debug("Attraction point has not vaue");
            return new NumericValue(current);
        }

        double attraction = attractorValue.getDoubleValue();

        // Move half the distance toward the attractor...
        double change = (attraction - current) / 2;

        // ... subject to the maximum change allowed...
View Full Code Here

    //Get the data type
    ByteArrayBuilder b = new ByteArrayBuilder(bytes, readOffset, bytes.length);

    //Get the data type
    int dataType = b.getShort();
    DataValue dataValue = null;
   
    //Second put in the data value
    switch(dataType){
      case DataTypes.ALPHANUMERIC:
        String s = b.getString();
View Full Code Here

    @Override
    public void doPoll(long time) {
        for (DataPointRT dataPoint : dataPoints) {
            VirtualPointLocatorRT locator = dataPoint.getPointLocator();

            DataValue oldValue = locator.getCurrentValue();

            // Change the point values according to their definitions.
            locator.change();

            DataValue newValue = locator.getCurrentValue();

            // Update the data image with the new value if necessary.
            //TP EDIT, let the data point settings in the core choose this for us
            //TP TODO: this actually causes issues in high polling data sources.  When setting the value from the UI
            // it will set the value once from there and another time from here.
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.rt.dataImage.types.DataValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.