本文整理汇总了Java中org.edgexfoundry.domain.meta.DeviceProfile类的典型用法代码示例。如果您正苦于以下问题:Java DeviceProfile类的具体用法?Java DeviceProfile怎么用?Java DeviceProfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceProfile类属于org.edgexfoundry.domain.meta包,在下文中一共展示了DeviceProfile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (ProvisionWatcher watcher: watchers.stream().filter(w -> profile.getName().equals(w.getProfile().getName())).collect(Collectors.toList())) {
//update all devices that use the profile
watcher.setProfile(profile);
success &= update(watcher);
}
return success;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:17,代码来源:WatcherStore.java
示例2: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (Device device: devices.entrySet().stream().map(d -> d.getValue()).filter(d -> profile.getName().equals(d.getProfile().getName())).collect(Collectors.toList())) {
//update all devices that use the profile
device.setProfile(profile);
success &= update(device.getId());
}
return success;
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:17,代码来源:DeviceStore.java
示例3: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (ProvisionWatcher watcher : watchers.stream()
.filter(w -> profile.getName().equals(w.getProfile().getName()))
.collect(Collectors.toList())) {
// update all devices that use the profile
watcher.setProfile(profile);
success &= update(watcher);
}
return success;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:21,代码来源:WatcherStore.java
示例4: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (Device device : devices.entrySet().stream().map(d -> d.getValue())
.filter(d -> profile.getName().equals(d.getProfile().getName()))
.collect(Collectors.toList())) {
// update all devices that use the profile
device.setProfile(profile);
success &= update(device.getId());
}
return success;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:20,代码来源:DeviceStore.java
示例5: generate
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的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
示例6: addDeviceProfileToMetaData
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
/**
* Add DeviceProfile to metadata <br>
* Use {@link org.edgexfoundry.controller.DeviceProfileClient#add(DeviceProfile)} to add DeviceProfile
*
* @param deviceProfile added DeviceProfile
* @return added deviceProfile if success, otherwise null
*/
public DeviceProfile addDeviceProfileToMetaData(DeviceProfile deviceProfile) {
if (null == deviceProfile || deviceProfileClient == null) {
logger.debug("addDeviceProfileToMetaData has failed");
return null;
}
DeviceProfile retDeviceProfile = null;
try {
String deviceProfileId = deviceProfileClient.add(deviceProfile);
logger.debug("Add deviceProfile successfully msg: " + deviceProfileId);
retDeviceProfile = deviceProfileClient.deviceProfile(deviceProfileId);
} catch (Exception e) {
logger.error("Could not add deviceProfile to metadata msg: " + e.getMessage());
}
return retDeviceProfile;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:24,代码来源:DeviceEnroller.java
示例7: initMetaData
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的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
示例8: getNewDevice
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
private Device getNewDevice() {
DeviceProfile profile = getDeviceProfile();
if (profile != null) {
DeviceService service = getDeviceService();
if (service != null) {
Addressable addressable = getAddressable();
if (addressable != null) {
return getDevice(profile, service, addressable);
} else {
logger.error("Cannot create default Mqtt device without an addressable");
}
} else {
logger.error("Cannot create default Mqtt device without the device service");
}
} else {
logger.error("Cannot create default Mqtt device without a profile");
}
return null;
}
开发者ID:edgexfoundry,项目名称:device-mqtt,代码行数:20,代码来源:MqttDriver.java
示例9: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (ProvisionWatcher watcher: watchers.stream()
.filter(w -> profile.getName().equals(w.getProfile().getName()))
.collect(Collectors.toList())) {
// update all devices that use the profile
watcher.setProfile(profile);
success &= update(watcher);
}
return success;
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:21,代码来源:WatcherStore.java
示例10: updateProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public boolean updateProfile(String profileId) {
DeviceProfile profile;
try {
profile = profileClient.deviceProfile(profileId);
} catch (Exception e) {
// No such profile exists to update
return true;
}
boolean success = true;
for (Device device: devices.entrySet().stream().map(d -> d.getValue())
.filter(d -> profile.getName().equals(d.getProfile().getName()))
.collect(Collectors.toList())) {
// update all devices that use the profile
device.setProfile(profile);
success &= update(device.getId());
}
return success;
}
开发者ID:edgexfoundry,项目名称:device-bluetooth,代码行数:20,代码来源:DeviceStore.java
示例11: ModbusDeviceProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
public ModbusDeviceProfile(DeviceProfile profile) {
this.setCommands(profile.getCommands());
this.setCreated(profile.getCreated());
this.setDescription(profile.getDescription());
this.setId(profile.getId());
this.setLabels(profile.getLabels());
this.setManufacturer(profile.getManufacturer());
this.setModel(profile.getModel());
this.setModified(profile.getModified());
this.setName(profile.getName());
this.setResources(profile.getResources());
this.setObjects(profile.getObjects());
this.setDeviceResources(profile.getDeviceResources());
}
开发者ID:edgexfoundry,项目名称:device-modbus,代码行数:15,代码来源:ModbusDeviceProfile.java
示例12: testValueDescriptorsForDeviceByName
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
@Test
public void testValueDescriptorsForDeviceByName() {
Device device = DeviceData.newTestInstance();
DeviceProfile profile = ProfileData.newTestInstance();
Command command = CommandData.newTestInstance();
profile.addCommand(command);
device.setProfile(profile);
List<ValueDescriptor> valDes = new ArrayList<>();
valDes.add(valueDescriptor);
when(deviceClient.deviceForName(DeviceData.TEST_NAME)).thenReturn(device);
when(valDescRepos.findByName(TEST_NAME)).thenReturn(valueDescriptor);
List<ValueDescriptor> valueDescriptors =
controller.valueDescriptorsForDeviceByName(DeviceData.TEST_NAME);
checkTestData(valueDescriptors.get(0), TEST_ID);
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:16,代码来源:ValueDescriptorTest.java
示例13: testValueDescriptorsForDeviceById
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
@Test
public void testValueDescriptorsForDeviceById() {
Device device = DeviceData.newTestInstance();
DeviceProfile profile = ProfileData.newTestInstance();
Command command = CommandData.newTestInstance();
profile.addCommand(command);
device.setProfile(profile);
List<ValueDescriptor> valDes = new ArrayList<>();
valDes.add(valueDescriptor);
when(deviceClient.device(TEST_ID)).thenReturn(device);
when(valDescRepos.findByName(TEST_NAME)).thenReturn(valueDescriptor);
List<ValueDescriptor> valueDescriptors = controller.valueDescriptorsForDeviceById(TEST_ID);
checkTestData(valueDescriptors.get(0), TEST_ID);
}
开发者ID:edgexfoundry,项目名称:core-data,代码行数:15,代码来源:ValueDescriptorTest.java
示例14: update
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
/**
* update Command in DeviceProfile
*
* @param name name which matched with Device and addressable
* @param command updated Command
*
* @return updated DeviceProfile
*/
public DeviceProfile update(String name, Command command) {
if (deviceProfileClient == null || command == null) {
return null;
}
DeviceProfile deviceProfile = deviceProfileClient.deviceProfileForName(name);
deviceProfile.addCommand(command);
return deviceProfile;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:18,代码来源:DeviceProfileGenerator.java
示例15: updateDeviceProfileToMetaData
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
/**
* Update DeviceProfile to metadata <br>
* Use {@link org.edgexfoundry.controller.DeviceProfileClient#update(DeviceProfile)} to add DeviceProfile
*
* @param deviceProfile updated DeviceProfile
* @return true if success, otherwise null
*/
public boolean updateDeviceProfileToMetaData(DeviceProfile deviceProfile) {
if (null == deviceProfile || deviceProfileClient == null) {
logger.debug("updateDeviceProfileToMetaData has failed");
return false;
}
if (true == deviceProfileClient.update(deviceProfile)) {
deviceStore.updateProfile(deviceProfile.getId());
}
return true;
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:19,代码来源:DeviceEnroller.java
示例16: deleteDeviceProfile
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
/**
* Delete DeviceProfile in metadata <br>
* Use {@link org.edgexfoundry.controller.DeviceProfileClient#delete(String)} to delete DeviceProfile
*/
private void deleteDeviceProfile() {
for (DeviceProfile deviceProfile : deviceProfileClient.deviceProfiles()) {
try {
logger.debug("remove profile from metadata ret: "
+ deviceProfileClient.delete(deviceProfile.getId()));
} catch (Exception e) {
logger.debug("Could not remove profile from metadata msg: " + e.getMessage());
}
}
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:15,代码来源:DeviceEnroller.java
示例17: updateMethodService
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的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
示例18: test_deviceProfile_generate
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
@Test
public void test_deviceProfile_generate() throws Exception {
logger.info("[TEST] test_deviceProfile_generate");
DeviceProfileGenerator generator = new DeviceProfileGenerator();
String name = "name";
DeviceProfile profile = generator.generate(name, null, null, null);
assertNotNull(profile);
logger.info("[PASS] test_deviceProfile_generate");
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:10,代码来源:OPCUAMetaDataGeneratorTest.java
示例19: test_deviceProfile_generate_with_name
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
@Test
public void test_deviceProfile_generate_with_name() throws Exception {
logger.info("[TEST] test_deviceProfile_generate");
DeviceProfileGenerator generator = new DeviceProfileGenerator();
DeviceProfile profile = generator.generate(null, null, null, null);
assertNull(profile);
logger.info("[PASS] test_deviceProfile_generate");
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:9,代码来源:OPCUAMetaDataGeneratorTest.java
示例20: test_deviceProfile_generate_without_name
import org.edgexfoundry.domain.meta.DeviceProfile; //导入依赖的package包/类
@Test
public void test_deviceProfile_generate_without_name() throws Exception {
logger.info("[TEST] test_deviceProfile_generate");
DeviceProfileGenerator generator = new DeviceProfileGenerator();
DeviceProfile profile = generator.generate(null, null, null, null);
assertNull(profile);
logger.info("[PASS] test_deviceProfile_generate");
}
开发者ID:mgjeong,项目名称:device-opcua-java,代码行数:9,代码来源:OPCUAMetaDataGeneratorTest.java
注:本文中的org.edgexfoundry.domain.meta.DeviceProfile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论