本文整理汇总了Java中org.edgexfoundry.domain.meta.OperatingState类的典型用法代码示例。如果您正苦于以下问题:Java OperatingState类的具体用法?Java OperatingState怎么用?Java OperatingState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperatingState类属于org.edgexfoundry.domain.meta包,在下文中一共展示了OperatingState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: provision
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public void provision(ScanList availableList) {
if(availableList != null && availableList.getScan().size() > 0){
for (Map<String,String> device : availableList.getScan()) {
Device matchingDevice = deviceExists(device);
if (matchingDevice != null) {
if (matchingDevice.getOperatingState().equals(OperatingState.DISABLED) || devices.getDevice(matchingDevice.getName()) == null) {
matchingDevice.setOperatingState(OperatingState.ENABLED);
devices.add(matchingDevice);
}
continue;
}
ProvisionWatcher watcher = deviceMatches(device);
if (watcher != null) {
//Provision the device
Device newDevice = createDevice(device, watcher);
devices.add(newDevice);
}
}
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:23,代码来源:DeviceDiscovery.java
示例2: provision
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public void provision(ScanList availableList) {
if (availableList != null && availableList.getScan().size() > 0) {
for (Map<String, String> device : availableList.getScan()) {
Device matchingDevice = deviceExists(device);
if (matchingDevice != null) {
if (matchingDevice.getOperatingState().equals(OperatingState.disabled)
|| devices.getDevice(matchingDevice.getName()) == null) {
matchingDevice.setOperatingState(OperatingState.enabled);
devices.add(matchingDevice);
}
continue;
}
ProvisionWatcher watcher = deviceMatches(device);
if (watcher != null) {
// Provision the device
Device newDevice = createDevice(device, watcher);
devices.add(newDevice);
}
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:25,代码来源:DeviceDiscovery.java
示例3: add
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean add(Device device) {
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
profiles.removeDevice(device);
}
logger.info("Adding managed device: " + device.getName());
Device metaDevice = addDeviceToMetaData(device);
if (metaDevice == null) {
remove(device);
return false;
}
if (metaDevice.getOperatingState().equals(OperatingState.enabled)) {
OPCUA.initializeDevice(metaDevice);
}
return true;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:21,代码来源:DeviceStore.java
示例4: add
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean add(Device device) {
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
profiles.removeDevice(device);
}
logger.info("Adding managed device: " + device.getName());
Device metaDevice = addDeviceToMetaData(device);
if (metaDevice == null) {
remove(device);
return false;
}
if (metaDevice.getOperatingState().equals(OperatingState.ENABLED)) {
mqtt.initializeDevice(metaDevice);
}
return true;
}
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:21,代码来源:DeviceStore.java
示例5: provision
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public void provision(ScanList availableList) {
if (availableList != null && availableList.getScan().size() > 0) {
for (Map<String, String> device : availableList.getScan()) {
Device matchingDevice = deviceExists(device);
if (matchingDevice != null) {
if (matchingDevice.getOperatingState().equals(OperatingState.DISABLED)
|| devices.getDevice(matchingDevice.getName()) == null) {
matchingDevice.setOperatingState(OperatingState.ENABLED);
devices.add(matchingDevice);
}
continue;
}
ProvisionWatcher watcher = deviceMatches(device);
if (watcher != null) {
// Provision the device
Device newDevice = createDevice(device, watcher);
devices.add(newDevice);
}
}
}
}
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:25,代码来源:DeviceDiscovery.java
示例6: add
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean add(Device device) {
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
profiles.removeDevice(device);
}
logger.info("Adding managed device: " + device.getName());
Device metaDevice = addDeviceToMetaData(device);
if (metaDevice == null) {
remove(device);
return false;
}
if (metaDevice.getOperatingState().equals(OperatingState.ENABLED)) {
Ble.initializeDevice(metaDevice);
}
return true;
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:21,代码来源:DeviceStore.java
示例7: provision
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public void provision(ScanList availableList) {
if (availableList != null && availableList.getScan().size() > 0) {
for (Map<String,String> device : availableList.getScan()) {
Device matchingDevice = deviceExists(device);
if (matchingDevice != null) {
if (matchingDevice.getOperatingState().equals(OperatingState.DISABLED)
|| devices.getDevice(matchingDevice.getName()) == null) {
matchingDevice.setOperatingState(OperatingState.ENABLED);
devices.add(matchingDevice);
}
continue;
}
ProvisionWatcher watcher = deviceMatches(device);
if (watcher != null) {
// Provision the device
Device newDevice = createDevice(device, watcher);
devices.add(newDevice);
}
}
}
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:25,代码来源:DeviceDiscovery.java
示例8: remove
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean remove(Device device) {
logger.debug("Removing managed device: " + device.getName());
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
Modbus.disconnectDevice(device);
deviceClient.updateOpState(device.getId(), OperatingState.DISABLED.name());
profiles.removeDevice(device);
}
return true;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:11,代码来源:DeviceStore.java
示例9: add
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean add(Device device) {
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
profiles.removeDevice(device);
}
logger.info("Adding managed device: " + device.getName());
Device metaDevice = addDeviceToMetaData(device);
if (metaDevice == null) {
remove(device);
return false;
}
if (metaDevice.getOperatingState().equals(OperatingState.ENABLED))
Modbus.initializeDevice(metaDevice);
return true;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:16,代码来源:DeviceStore.java
示例10: initialize
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public Map<String, Device> initialize(String id) {
List<Device> metaDevices = deviceClient.devicesForService(id);
devices = new HashMap<>();
watchers.initialize(id);
Modbus.initialize();
for (Device device : metaDevices) {
deviceClient.updateOpState(device.getId(),OperatingState.DISABLED.name());
add(device);
}
logger.info("Device service has " + devices.size() + " devices.");
return getDevices();
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:13,代码来源:DeviceStore.java
示例11: isDeviceLocked
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean isDeviceLocked(String deviceId){
Device device = getDeviceById(deviceId);
if (device == null) {
device = getMetaDeviceById(deviceId);
if (device == null) {
logger.error("Device not present with id " + deviceId);
throw new NotFoundException("device", deviceId);
}
}
return device.getAdminState().equals(AdminState.LOCKED) || device.getOperatingState().equals(OperatingState.DISABLED);
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:12,代码来源:DeviceStore.java
示例12: updateLastConnected
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
private void updateLastConnected(String deviceName) {
Device device = devices.getDevice(deviceName);
if (device != null) {
deviceClient.updateLastConnected(device.getId(), Calendar.getInstance().getTimeInMillis());
if (device.getOperatingState().equals(OperatingState.DISABLED))
devices.setDeviceByIdOpState(device.getId(), OperatingState.ENABLED);
} else {
logger.debug("No device found for device name: " + deviceName + ". Could not update last connected time");
}
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:11,代码来源:CoreDataMessageHandler.java
示例13: sendCoreData
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的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
示例14: createDevice
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
private Device createDevice(Map<String, String> device, ProvisionWatcher watcher) {
Device newDevice = new Device();
newDevice.setProfile(watcher.getProfile());
newDevice.setService(watcher.getService());
String name = device.get("name") + " " + device.get("address");
newDevice.setName(name);
Addressable addressable = createAddressable(device, name, watcher.getService().getAddressable());
newDevice.setAddressable(addressable);
newDevice.setLabels(watcher.getService().getLabels());
newDevice.setAdminState(AdminState.UNLOCKED);
newDevice.setOperatingState(OperatingState.ENABLED);
return newDevice;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:14,代码来源:DeviceDiscovery.java
示例15: createDevice
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
private Device createDevice(Map<String, String> device, ProvisionWatcher watcher) {
Device newDevice = new Device();
newDevice.setProfile(watcher.getProfile());
newDevice.setService(watcher.getService());
String name = device.get("name") + " " + device.get("address");
newDevice.setName(name);
Addressable addressable =
createAddressable(device, name, watcher.getService().getAddressable());
newDevice.setAddressable(addressable);
newDevice.setLabels(watcher.getService().getLabels());
newDevice.setAdminState(AdminState.unlocked);
newDevice.setOperatingState(OperatingState.enabled);
return newDevice;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:15,代码来源:DeviceDiscovery.java
示例16: remove
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean remove(Device device) {
logger.debug("Removing managed device: " + device.getName());
if (devices.containsKey(device.getName())) {
devices.remove(device.getName());
OPCUA.disconnectDevice(device);
deviceClient.updateOpState(device.getId(), OperatingState.disabled.name());
profiles.removeDevice(device);
}
return true;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:11,代码来源:DeviceStore.java
示例17: initialize
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public Map<String, Device> initialize(String id) {
List<Device> metaDevices = deviceClient.devicesForService(id);
devices = new HashMap<>();
watchers.initialize(id);
OPCUA.initialize();
for (Device device : metaDevices) {
deviceClient.updateOpState(device.getId(), OperatingState.disabled.name());
add(device);
}
logger.info("Device service has " + devices.size() + " devices.");
return getDevices();
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:14,代码来源:DeviceStore.java
示例18: isDeviceLocked
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public boolean isDeviceLocked(String deviceId) {
Device device = getDeviceById(deviceId);
if (device == null) {
device = getMetaDeviceById(deviceId);
if (device == null) {
logger.error("Device not present with id " + deviceId);
throw new NotFoundException("device", deviceId);
}
}
return device.getAdminState().equals(AdminState.locked)
|| device.getOperatingState().equals(OperatingState.disabled);
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:14,代码来源:DeviceStore.java
示例19: updateLastConnected
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
private void updateLastConnected(String deviceName) {
Device device = devices.getDevice(deviceName);
if (device != null) {
deviceClient.updateLastConnected(device.getId(), Calendar.getInstance().getTimeInMillis());
if (device.getOperatingState().equals(OperatingState.disabled))
devices.setDeviceByIdOpState(device.getId(), OperatingState.enabled);
} else {
logger.debug("No device found for device name: " + deviceName
+ ". Could not update last connected time");
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:12,代码来源:CoreDataMessageHandler.java
示例20: sendCoreData
import org.edgexfoundry.domain.meta.OperatingState; //导入依赖的package包/类
public List<EdgeElement> sendCoreData(String deviceName, List<Reading> readings,
Map<String, OPCUAObject> objects) {
try {
if (objects != null) {
List<EdgeElement> elementList = new ArrayList<EdgeElement>();
logger.debug("readings: " + readings);
for (Reading reading : readings) {
elementList.add(EdgeJsonFormatter.decodeJsonStringToEdgeElement(reading.getValue()));
}
boolean success = sendEvent(buildEvent(deviceName, readings), 0);
if (success) {
updateLastConnected(deviceName);
logger.debug("elementList: " + elementList);
return elementList;
} 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<EdgeElement>();
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:30,代码来源:CoreDataMessageHandler.java
注:本文中的org.edgexfoundry.domain.meta.OperatingState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论