• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DeviceObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.edgexfoundry.domain.meta.DeviceObject的典型用法代码示例。如果您正苦于以下问题:Java DeviceObject类的具体用法?Java DeviceObject怎么用?Java DeviceObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DeviceObject类属于org.edgexfoundry.domain.meta包,在下文中一共展示了DeviceObject类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDescriptor

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
private ValueDescriptor createDescriptor(String name, DeviceObject object, Device device) {
  PropertyValue value = object.getProperties().getValue();
  Units units = object.getProperties().getUnits();
  ValueDescriptor descriptor = new ValueDescriptor(name, value.getMinimum(), value.getMaximum(),
      IoTType.valueOf(value.getType().substring(0, 1)), units.getDefaultValue(),
      value.getDefaultValue(), "%s", null, object.getDescription());

  try {
    descriptor.setId(valueDescriptorClient.add(descriptor));
  } catch (Exception e) {
    logger.error("Adding Value descriptor: " + descriptor.getName() + " failed with error "
        + e.getMessage());
  }

  return descriptor;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:17,代码来源:ProfileStore.java


示例2: generate

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * generate DeviceProfile<br>
 * Use {@link org.edgexfoundry.domain.meta.DeviceProfile#DeviceProfile()} to generate DeviceProfile
 * 
 * @param name name which matched with Device and addressable
 * @param deviceObjectList list of DeviceObject
 * @param profileResourceList list of ProfileResource
 * @param commandList list of Command
 * 
 * @return generated DeviceProfile
 */
public DeviceProfile generate(String name, List<DeviceObject> deviceObjectList,
    List<ProfileResource> profileResourceList, List<Command> commandList) {
  if (name == null || name.isEmpty()) {
    return null;
  }

  DeviceProfile deviceProfile = new DeviceProfile();
  deviceProfile.setOrigin(new Timestamp(System.currentTimeMillis()).getTime());
  deviceProfile.setCreated(new Timestamp(System.currentTimeMillis()).getTime());
  deviceProfile.setName(name);
  deviceProfile.setManufacturer(OPCUADefaultMetaData.MANUFACTURER.getValue());
  deviceProfile.setModel(OPCUADefaultMetaData.MODEL.getValue());
  deviceProfile.setDescription(OPCUADefaultMetaData.DESCRIPTION_DEVICEPROFILE.getValue());
  deviceProfile.setObjects(OPCUADefaultMetaData.OBJ.getValue());
  String[] labels =
      {OPCUADefaultMetaData.LABEL1.getValue(), OPCUADefaultMetaData.LABEL2.getValue()};
  deviceProfile.setLabels(labels);

  deviceProfile.setDeviceResources(deviceObjectList);
  deviceProfile.setResources(profileResourceList);
  deviceProfile.setCommands(commandList);

  return deviceProfile;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:36,代码来源:DeviceProfileGenerator.java


示例3: initMetaData

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * Initialize MetaData<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link #createWellKnownSetList(String)} to create list of wellknown command<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#generate(String, List, List, List)} to generate
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#addDeviceProfileToMetaData(DeviceProfile)} to add DeviceProfile to
 * MetaData<br>
 * Use {@link DeviceGenerator#generate(String)} to generate Device<br>
 * Use {@link DeviceEnroller#addDeviceToMetaData(Device)} to add Device to MetaData
 * 
 * @param name name of Device
 */
public void initMetaData(String name) {
  List<DeviceObject> deviceObjectList = new ArrayList<DeviceObject>();
  List<ProfileResource> profileResourceList = new ArrayList<ProfileResource>();
  List<Command> commandList = new ArrayList<Command>();

  String command_type = OPCUACommandIdentifier.WELLKNOWN_COMMAND.getValue();
  for (OPCUACommandIdentifier wellknownCommand : OPCUACommandIdentifier.WELLKNOWN_COMMAND_LIST) {
    String commandName = wellknownCommand.getValue();
    deviceObjectList.add(DeviceObjectGenerator.generate(commandName, command_type));
    List<ResourceOperation> setList = createWellKnownSetList(commandName);
    List<ResourceOperation> getList = null;
    profileResourceList.add(ProfileResourceGenerator.generate(commandName, getList, setList));
    commandList.add(CommandGenerator.generate(commandName, null));
  }

  if (null != deviceProfileGenerator && null != deviceEnroller && null != deviceGenerator) {
    DeviceProfile deviceProfile =
        deviceProfileGenerator.generate(name, deviceObjectList, profileResourceList, commandList);
    deviceEnroller.addDeviceProfileToMetaData(deviceProfile);
    Device device = deviceGenerator.generate(name);
    deviceEnroller.addDeviceToMetaData(device);
  } else {
    logger.error("metadata instacne is invalid");
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:42,代码来源:OPCUAMetadataGenerateManager.java


示例4: generate

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * Generate DeviceObject<br>
 * Use {@link #createProfileProperty(String, String)} to create ProfileProperty
 * 
 * @param name name which matched with Command and ProfileResource
 * @param deviceType type of command (wellknown/method/attribute)
 * 
 * @return generated DeviceObject
 */
public static DeviceObject generate(String name, String deviceType) {
  if (name == null || name.isEmpty()) {
    return null;
  }

  DeviceObject deviceObj = new DeviceObject();
  deviceObj.setName(name);
  deviceObj.setTag(getAttributeInfo(name, EdgeMapperCommon.DEVICEOBJECT_TAG.name(), deviceType));
  deviceObj.setDescription(
      getAttributeInfo(name, EdgeMapperCommon.DEVICEOBJECT_DESCRIPTION.name(), deviceType));
  ProfileProperty property = createProfileProperty(name, deviceType);
  deviceObj.setProperties(property);
  deviceObj.setAttributes(new DeviceObjectAttributeInfo.Builder(name).setDataType(
      getAttributeInfo(name, EdgeMapperCommon.DEVICEOBJECT_ATTRIBUTE_DATATYPE.name(), deviceType))
      .build());
  return deviceObj;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:27,代码来源:DeviceObjectGenerator.java


示例5: createDescriptor

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
private ValueDescriptor createDescriptor(String name, DeviceObject object, Device device) {
  PropertyValue value = object.getProperties().getValue();
  Units units = object.getProperties().getUnits();
  ValueDescriptor descriptor = new ValueDescriptor(name,value.getMinimum(),
      value.getMaximum(),IoTType.valueOf(value.getType().substring(0,1)),units.getDefaultValue(),
      value.getDefaultValue(), "%s", null, object.getDescription());

  try {
    descriptor.setId(valueDescriptorClient.add(descriptor));
  } catch (Exception e) {
    logger.error("Adding Value descriptor: " + descriptor.getName()
        + " failed with error " + e.getMessage());
  }

  return descriptor;
}
 
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:17,代码来源:ProfileStore.java


示例6: createDescriptor

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
private ValueDescriptor createDescriptor(String name, DeviceObject object, Device device) {
	PropertyValue value = object.getProperties().getValue();
	Units units = object.getProperties().getUnits();
	ValueDescriptor descriptor = new ValueDescriptor(name,value.getMinimum(),
			value.getMaximum(),IoTType.valueOf(value.getType().substring(0,1)),units.getDefaultValue(),
			value.getDefaultValue(), "%s", null, object.getDescription());
	try {
		descriptor.setId(valueDescriptorClient.add(descriptor));
	} catch (Exception e) {
		logger.error("Adding Value descriptor: " + descriptor.getName() + " failed with error " + e.getMessage());
	}
	return descriptor;
}
 
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:14,代码来源:ProfileStore.java


示例7: ModbusObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
public ModbusObject(DeviceObject object) {
	this.setName(object.getName());
	this.setTag(object.getTag());
	this.setDescription(object.getDescription());
	this.setProperties(object.getProperties());
	this.setAttributes(new ModbusAttribute(object.getAttributes()));
}
 
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:8,代码来源:ModbusObject.java


示例8: update

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * update DeviceObject in DeviceProfile
 * 
 * @param name name which matched with Device and addressable
 * @param deviceObject updated DeviceObject
 * 
 * @return updated DeviceProfile
 */
public DeviceProfile update(String name, DeviceObject deviceObject) {
  if (deviceProfileClient == null || deviceObject == null) {
    return null;
  }

  DeviceProfile deviceProfile = deviceProfileClient.deviceProfileForName(name);
  List<DeviceObject> deviceObjectList = deviceProfile.getDeviceResources();
  deviceObjectList.add(deviceObject);
  deviceProfile.setDeviceResources(deviceObjectList);
  return deviceProfile;
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:20,代码来源:DeviceProfileGenerator.java


示例9: updateMethodService

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * Add method Service to DeviecProfile<br>
 * Use {@link #createAttributeGetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link #createAttributeSetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link DeviceProfileGenerator#update(String, ProfileResource)} to update ProfileResource to
 * DeviceProfile<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#update(String, Command)} to update Comand to
 * DeviceProfile<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link DeviceProfileGenerator#update(String, DeviceObject)} to update DeviceObject to
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#updateDeviceProfileToMetaData(DeviceProfile)} to update DeviceProfile
 * to MetaData
 * 
 * @param deviceProfileName name of DeviceProfile
 * @param commandType Type of Command ( attribute or method or wellknown )
 * @param keyList list of provider key
 */
public void updateMethodService(String deviceProfileName, String commandType,
    ArrayList<String> keyList) {
  if (keyList == null) {
    return;
  }

  for (String providerKey : keyList) {
    String deviceInfoName = providerKey.replaceAll(OPCUADefaultMetaData.BEFORE_REPLACE_WORD,
        OPCUADefaultMetaData.AFTER_REPLACE_WORD);

    List<ResourceOperation> getList = createMethodGetResourceOperation(deviceInfoName);
    List<ResourceOperation> setList = createMethodSetResourceOperation(deviceInfoName);
    ProfileResource profileResource =
        ProfileResourceGenerator.generate(deviceInfoName, getList, setList);

    if (deviceProfileGenerator == null || deviceEnroller == null) {
      return;
    }
    DeviceProfile deviceProfile =
        deviceProfileGenerator.update(deviceProfileName, profileResource);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    Command command = CommandGenerator.generate(deviceInfoName, null);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, command);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    DeviceObject deviceObject = DeviceObjectGenerator.generate(deviceInfoName, commandType);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, deviceObject);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:55,代码来源:OPCUAMetadataGenerateManager.java


示例10: OPCUAObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
public OPCUAObject(DeviceObject object) {
  this.setName(object.getName());
  this.setTag(object.getTag());
  this.setDescription(object.getDescription());
  this.setProperties(object.getProperties());
  this.setAttributes(new OPCUAAttribute(object.getAttributes()));
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:8,代码来源:OPCUAObject.java


示例11: test_deviceobject_generate

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
@Test
public void test_deviceobject_generate() throws Exception {
  logger.info("[TEST] test_deviceobject_generate");
  String name = "name";
  String value = "value";
  DeviceObject deviceobject = DeviceObjectGenerator.generate(name, value);
  assertNotNull(deviceobject);
  logger.info("[PASS] test_deviceobject_generate");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:10,代码来源:OPCUAMetaDataGeneratorTest.java


示例12: test_deviceobject_generate_without_name

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
@Test
public void test_deviceobject_generate_without_name() throws Exception {
  logger.info("[TEST] test_deviceobject_generate_without_name");
  String value = "value";
  DeviceObject deviceobject = DeviceObjectGenerator.generate(null, value);
  assertNull(deviceobject);
  logger.info("[PASS] test_deviceobject_generate_without_name");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:9,代码来源:OPCUAMetaDataGeneratorTest.java


示例13: test_deviceobject_generate_empty_name

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
@Test
public void test_deviceobject_generate_empty_name() throws Exception {
  logger.info("[TEST] test_deviceobject_generate_empty_name");
  String value = "value";
  DeviceObject deviceobject = DeviceObjectGenerator.generate("", value);
  assertNull(deviceobject);
  logger.info("[PASS] test_deviceobject_generate_empty_name");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:9,代码来源:OPCUAMetaDataGeneratorTest.java


示例14: test_deviceProfile_update_with_deviceObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
@Test
public void test_deviceProfile_update_with_deviceObject() throws Exception {
  logger.info("[TEST] test_deviceProfile_update_with_deviceObject");
  DeviceProfileGenerator generator = new DeviceProfileGenerator();
  String name = "name";
  String value = "value";
  DeviceObject deviceobject = DeviceObjectGenerator.generate(name, value);
  DeviceProfile profile = generator.update(name, deviceobject);
  assertNull(profile);
  logger.info("[PASS] test_deviceProfile_update_with_deviceObject");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:12,代码来源:OPCUAMetaDataGeneratorTest.java


示例15: test_deviceProfile_update_without_deviceObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
@Test
public void test_deviceProfile_update_without_deviceObject() throws Exception {
  logger.info("[TEST] test_deviceProfile_update_without_deviceObject");
  DeviceProfileGenerator generator = new DeviceProfileGenerator();
  String name = "name";
  DeviceObject deviceobject = null;
  DeviceProfile profile = generator.update(name, deviceobject);
  assertNull(profile);
  logger.info("[PASS] test_deviceProfile_update_without_deviceObject");
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:11,代码来源:OPCUAMetaDataGeneratorTest.java


示例16: BACNetObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
public BACNetObject(DeviceObject object) {
	this.setName(object.getName());
	this.setTag(object.getTag());
	this.setDescription(object.getDescription());
	this.setProperties(object.getProperties());
	this.setAttributes(new BACNetAttribute(object.getAttributes()));
}
 
开发者ID:edgexfoundry,项目名称:device-bacnet,代码行数:8,代码来源:BACNetObject.java


示例17: MqttObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
public MqttObject(DeviceObject object) {
  this.setName(object.getName());
  this.setTag(object.getTag());
  this.setDescription(object.getDescription());
  this.setProperties(object.getProperties());
  this.setAttributes(new MqttAttribute(object.getAttributes()));
}
 
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:8,代码来源:MqttObject.java


示例18: BleObject

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
public BleObject(DeviceObject object) {
  this.setName(object.getName());
  this.setTag(object.getTag());
  this.setDescription(object.getDescription());
  this.setProperties(object.getProperties());
  this.setAttributes(new BleAttribute(object.getAttributes()));
}
 
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:8,代码来源:BleObject.java


示例19: updateAttributeService

import org.edgexfoundry.domain.meta.DeviceObject; //导入依赖的package包/类
/**
 * Add Attribute Service to DeviecProfile<br>
 * Use {@link org.edge.protocol.opcua.providers.EdgeServices#getAttributeProvider(String)} to get
 * EdgeAttribute Provider<br>
 * Use {@link #createAttributeGetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link #createAttributeSetResourceOperation(String)} to EdgeAttribute
 * GetResourceOperation<br>
 * Use {@link ProfileResourceGenerator#generate(String, List, List)} to generate
 * ProfileResource<br>
 * Use {@link DeviceProfileGenerator#update(String, ProfileResource)} to update ProfileResource to
 * DeviceProfile<br>
 * Use {@link CommandGenerator#generate(String, String)} to generate Command<br>
 * Use {@link DeviceProfileGenerator#update(String, Command)} to update Comand to
 * DeviceProfile<br>
 * Use {@link DeviceObjectGenerator#generate(String, String)} to generate DeviceObject<br>
 * Use {@link DeviceProfileGenerator#update(String, DeviceObject)} to update DeviceObject to
 * DeviceProfile<br>
 * Use {@link DeviceEnroller#updateDeviceProfileToMetaData(DeviceProfile)} to update DeviceProfile
 * to MetaData
 * 
 * @param deviceProfileName name of DeviceProfile
 * @param commandType Type of Command ( attribute or method or wellknown )
 * @param keyList list of provider key
 */
public void updateAttributeService(String deviceProfileName, String commandType,
    ArrayList<String> keyList) {
  if (keyList == null) {
    return;
  }
  for (String providerKey : keyList) {
    EdgeAttributeProvider provider = EdgeServices.getAttributeProvider(providerKey);
    EdgeMapper mapper = null;
    if (provider != null) {
      mapper = provider.getAttributeService(providerKey).getMapper();
    }
    if (mapper == null) {
      mapper = new EdgeMapper();
    }

    String deviceInfoName = providerKey.replaceAll(OPCUADefaultMetaData.BEFORE_REPLACE_WORD,
        OPCUADefaultMetaData.AFTER_REPLACE_WORD);

    List<ResourceOperation> getList = createAttributeGetResourceOperation(deviceInfoName);
    List<ResourceOperation> setList = createAttributeSetResourceOperation(deviceInfoName);
    ProfileResource profileResource =
        ProfileResourceGenerator.generate(deviceInfoName, getList, setList);

    if (deviceProfileGenerator == null || deviceEnroller == null) {
      return;
    }
    DeviceProfile deviceProfile =
        deviceProfileGenerator.update(deviceProfileName, profileResource);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    Command command = CommandGenerator.generate(deviceInfoName,
        mapper.getMappingData(EdgeMapperCommon.PROPERTYVALUE_READWRITE.name()));
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, command);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);

    DeviceObject deviceObject = DeviceObjectGenerator.generate(deviceInfoName, commandType);
    deviceProfile = deviceProfileGenerator.update(deviceProfileName, deviceObject);
    deviceEnroller.updateDeviceProfileToMetaData(deviceProfile);
  }
}
 
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:66,代码来源:OPCUAMetadataGenerateManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ForwardingServerCall类代码示例发布时间:2022-05-22
下一篇:
Java DnFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap