Examples of PointValueTime


Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

    private ViewComponentState preparePointComponentState(PointComponent pointComponent, User user, DataPointRT point,
            Map<String, Object> model, HttpServletRequest request) {
        ViewComponentState state = new ViewComponentState();
        state.setId(pointComponent.getId());

        PointValueTime pointValue = prepareBasePointState(pointComponent.getId(), state,
                pointComponent.tgetDataPoint(), point, model);

        model.put("pointComponent", pointComponent);
        if (pointComponent.isValid())
            setEvents(pointComponent.tgetDataPoint(), user, model);
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

    protected void createStateImpl(RuntimeManager rtm, HttpServletRequest request, JspComponentState state) {
        long maxTs = 0;
        for (JspViewChartPoint point : points) {
            DataPointRT dataPointRT = rtm.getDataPoint(point.getDataPointVO().getId());
            if (dataPointRT != null) {
                PointValueTime pvt = dataPointRT.getPointValue();
                if (pvt != null && maxTs < pvt.getTime())
                    maxTs = pvt.getTime();
            }
        }

        StringBuilder htmlData = new StringBuilder();
        htmlData.append("chart/");
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

        return new AnnotatedPointValueTime(dataValue, ts, TranslatableMessage.deserialize(annotation));
      }catch(Exception e){
        throw new ShouldNeverHappenException(e);
      }
    }else{
      return new PointValueTime(dataValue, ts);
    }
  }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

  /* (non-Javadoc)
   * @see com.serotonin.m2m2.db.dao.nosql.NoSQLDataSerializer#getBytes(com.serotonin.m2m2.db.dao.nosql.NoSQLDataEntry)
   */
  @Override
  public byte[] getBytes(ITime obj) {
    PointValueTime value = (PointValueTime)obj;
    ByteArrayBuilder b = new ByteArrayBuilder();
    //First put in the data type
    b.putShort((short) value.getValue().getDataType());
   
    //Second put in the data value
    switch(value.getValue().getDataType()){
      case DataTypes.ALPHANUMERIC:
        b.putString(value.getStringValue());
        break;
      case DataTypes.BINARY:
        b.putBoolean(value.getBooleanValue());
        break;
      case DataTypes.IMAGE:
        throw new ShouldNeverHappenException("Images are not supported");
      case DataTypes.MULTISTATE:
        b.putInt(value.getIntegerValue());
        break;
      case DataTypes.NUMERIC:
        b.putDouble(value.getDoubleValue());
        break;
      default:
        throw new ShouldNeverHappenException("Data type of " + value.getValue().getDataType() + " is not supported");

    }
   
    //Put in annotation
    if(value.isAnnotated()){
      AnnotatedPointValueTime apv = (AnnotatedPointValueTime)value;
      b.putString(apv.getSourceMessage().serialize());
    }else
      b.putString(null);
   
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

            // 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.
            //if (!DataValue.isEqual(oldValue, newValue))
                dataPoint.updatePointValue(new PointValueTime(locator.getCurrentValue(), time));
        }
    }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

            int dataType = point.getPointLocator().getDataTypeId();

            DataValue startValue = null;
            if (!instance.isFromInception()) {
                // Get the value just before the start of the report
                PointValueTime pvt = pointValueDao.getPointValueBefore(point.getId(), instance.getReportStartTime());
                if (pvt != null)
                    startValue = pvt.getValue();

                // Make sure the data types match
                if (DataTypes.getDataType(startValue) != dataType)
                    startValue = null;
            }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

            final String pointStore = instanceId + "_" + point.getReportPointId();
            dao.getData(pointStore, 0, Long.MAX_VALUE, -1, false, new NoSQLQueryCallback(){

        @Override
        public void entry(String storeName, long timestamp, ITime entry) {
          PointValueTime pvt = (PointValueTime) entry;
          edv.setValue(pvt.getValue());
          edv.setTime(pvt.getTime());
         
          if(pvt instanceof AnnotatedPointValueTime)
            edv.setAnnotation(((AnnotatedPointValueTime)pvt).getSourceMessage());
         
          handler.pointData(edv);
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

           
           
            DataValue startValue = null;
            if (!instance.isFromInception()) {
                // Get the value just before the start of the report
                PointValueTime pvt = pointValueDao.getPointValueBefore(point.getId(), instance.getReportStartTime());
                if (pvt != null)
                    startValue = pvt.getValue();

                // Make sure the data types match
                if (DataTypes.getDataType(startValue) != dataType)
                    startValue = null;
            }
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

    protected void doPoll(long time) {
        if (nextValueTime == -1) {
            // Determine when we should start from
            nextValueTime = System.currentTimeMillis();
            for (DataPointRT dp : dataPoints) {
                PointValueTime pvt = dp.getPointValue();
                if (pvt == null) {
                    nextValueTime = 0;
                    break;
                }
                if (nextValueTime > pvt.getTime())
                    nextValueTime = pvt.getTime();
            }

            if (nextValueTime == 0)
                nextValueTime = new DateTime(2008, 1, 1, 0, 0, 0, 0).getMillis();
            else
View Full Code Here

Examples of com.serotonin.m2m2.rt.dataImage.PointValueTime

                // Update the next value time.
                nextValueTime = time + 1000 * 60 * 60;

                for (DataPointRT dp : dataPoints) {
                    PointValueTime pvt = dp.getPointValue();
                    if (pvt != null && pvt.getTime() >= time)
                        // This value is in the past. Ignore it.
                        continue;

                    EnvCanPointLocatorVO plvo = dp.getVO().getPointLocator();
                    if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.TEMP && !Double.isNaN(temp))
                        pvt = new PointValueTime(temp, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.DEW_POINT_TEMP
                            && !Double.isNaN(dptemp))
                        pvt = new PointValueTime(dptemp, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.REL_HUM && !Double.isNaN(relhum))
                        pvt = new PointValueTime(relhum, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.WIND_DIR
                            && !Double.isNaN(winddir))
                        pvt = new PointValueTime(winddir, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.WIND_SPEED
                            && !Double.isNaN(windspd))
                        pvt = new PointValueTime(windspd, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.VISIBILITY
                            && !Double.isNaN(visibility))
                        pvt = new PointValueTime(visibility, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.STN_PRESS
                            && !Double.isNaN(stnpress))
                        pvt = new PointValueTime(stnpress, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.HUMIDEX && !Double.isNaN(humidex))
                        pvt = new PointValueTime(humidex, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.WIND_CHILL
                            && !Double.isNaN(windchill))
                        pvt = new PointValueTime(windchill, time);
                    else if (plvo.getAttributeId() == EnvCanPointLocatorVO.Attributes.WEATHER && weather != null)
                        pvt = new PointValueTime(weather, time);
                    else
                        continue;

                    dp.updatePointValue(pvt);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.