Package com.serotonin.m2m2.rt.dataImage

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


        Matcher m = p.matcher(msg);
        if(m.find()) { //Could use length consumed to allow many points to receive values from the same strings
          SerialPointLocatorRT pl = rt.getPointLocator();
            SerialPointLocatorVO plVo = pl.getVo();
          String value = m.group(plVo.getValueIndex());                 
              PointValueTime newValue = new PointValueTime(DataValue.stringToValue(value, plVo.getDataTypeId()),
                  Common.timer.currentTimeMillis());
            rt.updatePointValue(newValue);
          buffer.pop(m.group(0).length());
          index -= m.group(0).length();
          searchRegex(new String(buffer.peekAll()), depth+1);
View Full Code Here


    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

    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

        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

  /* (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

            // 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

            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

            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

           
           
            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

    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

TOP

Related Classes of com.serotonin.m2m2.rt.dataImage.PointValueTime

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.