Package org.ugate.service.entity.jpa

Examples of org.ugate.service.entity.jpa.RemoteNodeReading


    for (int i=0; i<numberOfRecords; i++) {
      Calendar cal = Calendar.getInstance();
      cal.set(Calendar.HOUR_OF_DAY, Double.valueOf(Math.random() * (24 - 1)).intValue());
      cal.set(Calendar.MINUTE, Double.valueOf(Math.random() * (59 - 0)).intValue());

      RemoteNodeReading sr = new RemoteNodeReading();
      sr.setSignalStrength(Double.valueOf(Math.random() * (60 - 1)).intValue());
      sr.setRemoteNode(getRemoteNode());
      sr.setFromMultiState(Double.valueOf(Math.random() * (15 - 1)).intValue());
      sr.setLaserFeet(Double.valueOf(Math.random() * (30 - 0)).intValue());
      sr.setLaserInches(Double.valueOf(Math.random() * (11 - 0)).intValue());
      sr.setSonarFeet(Double.valueOf(Math.random() * (10 - 0)).intValue());
      sr.setSonarInches(Double.valueOf(Math.random() * (11 - 0)).intValue());
      sr.setMicrowaveCycleCount(Double.valueOf(Math.random() * (50 - 0)).intValue());
      sr.setPirIntensity(Double.valueOf(Math.random() * (25 - 0)).intValue());
      sr.setReadDate(cal.getTime());
     
      final RxTxRemoteNodeReadingDTO srdto = new RxTxRemoteNodeReadingDTO(sr, RxData.Status.NORMAL);
      UGateKeeper.DEFAULT.notifyListeners(new UGateEvent<RemoteNode, RxTxRemoteNodeReadingDTO>(
          srdto.getRemoteNode(), UGateEvent.Type.WIRELESS_DATA_RX_SUCCESS, true, null,
           Command.SENSOR_GET_READINGS, null, srdto));
View Full Code Here


      processData(rn, UGateEvent.Type.WIRELESS_DATA_RX_SUCCESS, command, 
          new RxRawData<Void>(rn, status, rxResponse.getRssi(), null),
          failures > 0 ? RS.rbLabel(KEY.LASER_CALIBRATION_FAILED) : RS.rbLabel(KEY.LASER_CALIBRATION_SUCCESS));
    } else if (command == Command.SENSOR_GET_READINGS || command == Command.GATE_TOGGLE_OPEN_CLOSE) {
      int i = 1;
      final RemoteNodeReading rnr = new RemoteNodeReading();
      rnr.setRemoteNode(rn);
      rnr.setReadDate(new Date());
      rnr.setSignalStrength(rxResponse.getRssi());
      rnr.setSonarFeet(rxResponse.getData()[++i]);
      rnr.setSonarInches(rxResponse.getData()[++i]);
      rnr.setMicrowaveCycleCount(rxResponse.getData()[++i]);
      rnr.setPirIntensity(rxResponse.getData()[++i]);
      rnr.setLaserFeet(rxResponse.getData()[++i]);
      rnr.setLaserInches(rxResponse.getData()[++i]);
      rnr.setGateState(rxResponse.getData()[++i]);
      final RxTxRemoteNodeReadingDTO sr = new RxTxRemoteNodeReadingDTO(rnr, status);
      processData(rn, UGateEvent.Type.WIRELESS_DATA_RX_SUCCESS, command, sr,
          RS.rbLabel(KEY.SERVICE_RX_READINGS, sr));
    } else if (command == Command.SENSOR_GET_SETTINGS) {
      // the number of response data and their order is important!!!
View Full Code Here

          notifyMembers(jsonData);
        } else if (event.getType() == UGateEvent.Type.WIRELESS_DATA_RX_SUCCESS
            && event.getNewValue() instanceof RxTxRemoteNodeReadingDTO) {
          final RxTxRemoteNodeReadingDTO sr = (RxTxRemoteNodeReadingDTO) event
              .getNewValue();
          final RemoteNodeReading rnr = sr.getRemoteNodeReading();
          String jsonData = jsonRemoteNode
              .toJSON(rnr.getRemoteNode());
          final String rnrJsonData = jsonRemoteNodeReading
              .toJSON(rnr);
          final String rnrsKey = '"'
              + RemoteNodeType.REMOTE_NODE_READINGS.getKey()
              + "\":";
          jsonData = jsonData.replaceAll(rnrsKey
              + rnr.getRemoteNode().getRemoteNodeReadings(),
              rnrsKey + rnrJsonData);
          if (log.isInfoEnabled()) {
            log.info(String
                .format("Sending %1$s (address: %2$s) notification to %3$s web member(s): %4$s",
                    RemoteNodeReading.class.getSimpleName(),
                    rnr.getRemoteNode().getAddress(),
                    members.size(), jsonData));
          }
          notifyMembers(jsonData);
        }
      }
View Full Code Here

   * @param isReset
   *            true when the readings should be reset when no readings exist
   */
  public void remoteNodeReadingShow(final boolean isReset) {
    try {
      final RemoteNodeReading rnr = ServiceProvider.IMPL
          .getRemoteNodeService().findReadingLatest(cb.getRemoteNode());
      if (rnr != null) {
        remoteNodeReadingShow(rnr);
      } else if (isReset) {
        remoteNodeReadingShow(null);
View Full Code Here

   * @param ctx
   *            the {@link WebContext} to add values to
   */
  protected void addRemoteNodeReadingVars(final RemoteNode rn,
      final WebContext ctx) {
    RemoteNodeReading rnr = ServiceProvider.IMPL
        .getRemoteNodeService().findReadingLatest(rn);
    if (rnr == null) {
      rnr = new RemoteNodeReading();
    }
    final List<ValueType<RemoteNodeReading, Object>> cmds = new ArrayList<>();
    for (final RemoteNodeReadingType rnrt : RemoteNodeReadingType.values()) {
      try {
        cmds.add(rnrt.newValueType(rnr));
View Full Code Here

TOP

Related Classes of org.ugate.service.entity.jpa.RemoteNodeReading

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.