当前位置: 首页>>代码示例>>Java>>正文


Java Reading.getValue方法代码示例

本文整理汇总了Java中org.edgexfoundry.domain.core.Reading.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Reading.getValue方法的具体用法?Java Reading.getValue怎么用?Java Reading.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.edgexfoundry.domain.core.Reading的用法示例。


在下文中一共展示了Reading.getValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendCoreData

import org.edgexfoundry.domain.core.Reading; //导入方法依赖的package包/类
public List<ResponseObject> sendCoreData(String deviceName, List<Reading> readings, Map<String, ModbusObject> objects) {
	try{
	
		if (objects != null) {

			List<ResponseObject> resps = new ArrayList<>();
			logger.debug("readings: " + readings);
			for (Reading reading: readings) {										
				ResponseObject resp = new ResponseObject(reading.getName(), reading.getValue());						
				resps.add(resp);
			}
			boolean success = sendEvent(buildEvent(deviceName, readings), 0);
			if (success) {
				updateLastConnected(deviceName);
				return resps;
			}
			else {
				if (devices.getDevice(deviceName).getOperatingState().equals(OperatingState.ENABLED))
					devices.setDeviceOpState(deviceName, OperatingState.DISABLED);
				logger.error("Could not send event to core data for " + deviceName + ".  Check core data service");
			}
		} else
			logger.debug("No profile object found for the device " + deviceName + ".  MQTT message ignored.");
	}catch(Exception e){
		logger.error("Cannot push the readings to Coredata " + e.getMessage());
		e.printStackTrace();
	}
	return new ArrayList<ResponseObject>();
}
 
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:30,代码来源:CoreDataMessageHandler.java

示例2: update

import org.edgexfoundry.domain.core.Reading; //导入方法依赖的package包/类
/**
 * Update the reading. NotFoundException (HTTP 404) if the reading cannot be found by id.
 * ServiceException (HTTP 503) for unknown or unanticipated issues. DataValidationException if the
 * associated value descriptor is non-existent.
 * 
 * @param reading2 - Reading object containing update data and the id of the reading to be updated
 * @return boolean indicating success of the update operation
 * @throws ServiceException (HTTP 503) for unknown or unanticipated issues
 * @throws DataValidationException (HTTP 409) if one of the readings associated to the new event
 *         contains a non-existent value descriptor.
 * @throws NotFoundException (HTTP 404) if the reading cannot be located by the provided id in the
 *         reading.
 */
@RequestMapping(method = RequestMethod.PUT)
@Override
public boolean update(@RequestBody Reading reading2) {
  try {
    Reading reading = readingRepos.findOne(reading2.getId());
    if (reading != null) {
      if (reading2.getValue() != null) {
        reading.setValue(reading2.getValue());
      }
      if (reading2.getName() != null) {
        if (valDescRepos.findByName(reading2.getName()) == null)
          throw new DataValidationException("Non-existent value descriptor specified in reading");
        reading.setName(reading2.getName());
      }
      if (reading2.getOrigin() != 0) {
        reading.setOrigin(reading2.getOrigin());
      }
      readingRepos.save(reading);
      return true;
    } else {
      logger.error("Request to update with non-existent reading:  " + reading2.getId());
      throw new NotFoundException(Reading.class.toString(), reading2.getId());
    }
  } catch (DataValidationException dE) {
    throw dE;
  } catch (NotFoundException nE) {
    throw nE;
  } catch (Exception e) {
    logger.error("Error updating reading:  " + e.getMessage());
    throw new ServiceException(e);
  }
}
 
开发者ID:edgexfoundry,项目名称:core-data,代码行数:46,代码来源:ReadingControllerImpl.java

示例3: sendCoreData

import org.edgexfoundry.domain.core.Reading; //导入方法依赖的package包/类
public List<ResponseObject> sendCoreData(String deviceName, List<Reading> readings, Map<String, BACNetObject> objects) {
	try{
	
		if (objects != null) {

			List<ResponseObject> resps = new ArrayList<>();
			logger.debug("readings: " + readings);
			for (Reading reading: readings) {										
				ResponseObject resp = new ResponseObject(reading.getName(), reading.getValue());						
				resps.add(resp);
			}
			boolean success = sendEvent(buildEvent(deviceName, readings), 0);
			if (success) {
				updateLastConnected(deviceName);
				return resps;
			}
			else {
				if (devices.getDevice(deviceName).getOperatingState().equals(OperatingState.ENABLED))
					devices.setDeviceOpState(deviceName, OperatingState.DISABLED);
				logger.error("Could not send event to core data for " + deviceName + ".  Check core data service");
			}
		} else
			logger.debug("No profile object found for the device " + deviceName + ".  MQTT message ignored.");
	}catch(Exception e){
		logger.error("Cannot push the readings to Coredata " + e.getMessage());
		e.printStackTrace();
	}
	return new ArrayList<ResponseObject>();
}
 
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:30,代码来源:CoreDataMessageHandler.java

示例4: sendCoreData

import org.edgexfoundry.domain.core.Reading; //导入方法依赖的package包/类
public List<ResponseObject> sendCoreData(String deviceName, List<Reading> readings,
    Map<String, MqttObject> objects) {

  try {

    if (objects != null) {
      List<ResponseObject> resps = new ArrayList<>();
      logger.debug("readings: " + readings);
      for (Reading reading : readings) {
        ResponseObject resp = new ResponseObject(reading.getName(), reading.getValue());
        resps.add(resp);
      }

      boolean success = sendEvent(buildEvent(deviceName, readings), 0);
      if (success) {
        updateLastConnected(deviceName);
        return resps;
      } else {
        if (devices.getDevice(deviceName).getOperatingState().equals(OperatingState.ENABLED)) {
          devices.setDeviceOpState(deviceName, OperatingState.DISABLED);
        }

        logger.error(
            "Could not send event to core data for " + deviceName + ".  Check core data service");
      }
    } else {
      logger.debug(
          "No profile object found for the device " + deviceName + ".  MQTT message ignored.");
    }
  } catch (Exception e) {
    logger.error("Cannot push the readings to Coredata " + e.getMessage());
    e.printStackTrace();
  }

  return new ArrayList<>();
}
 
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:37,代码来源:CoreDataMessageHandler.java

示例5: sendCoreData

import org.edgexfoundry.domain.core.Reading; //导入方法依赖的package包/类
public List<ResponseObject> sendCoreData(String deviceName, List<Reading> readings,
    Map<String, BleObject> objects) {

  try {

    if (objects != null) {
      List<ResponseObject> resps = new ArrayList<>();
      logger.debug("readings: " + readings);
      for (Reading reading: readings) {
        ResponseObject resp = new ResponseObject(reading.getName(), reading.getValue());
        resps.add(resp);
      }

      boolean success = sendEvent(buildEvent(deviceName, readings), 0);
      if (success) {
        updateLastConnected(deviceName);
        return resps;
      } else {
        if (devices.getDevice(deviceName).getOperatingState().equals(OperatingState.ENABLED)) {
          devices.setDeviceOpState(deviceName, OperatingState.DISABLED);
        }

        logger.error("Could not send event to core data for "
            + deviceName + ".  Check core data service");
      }
    } else {
      logger.debug("No profile object found for the device "
          + deviceName + ".  BLE message ignored.");
    }
  } catch (Exception e) {
    logger.error("Cannot push the readings to Coredata " + e.getMessage());
    e.printStackTrace();
  }

  return new ArrayList<ResponseObject>();
}
 
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:37,代码来源:CoreDataMessageHandler.java


注:本文中的org.edgexfoundry.domain.core.Reading.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。