use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecWithTypeConversion method createFBSpec.
@Override
protected void createFBSpec() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.STRING);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("type:convertDouble(/@lng[1])"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
addFunctionblockProperty("button", buttonModel);
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class BleGattDeviceBuilder method build.
public BleGattDevice build() {
this.device = new BleGattDevice();
for (ModelProperty fbprop : infomodel.getFunctionblocks()) {
FunctionblockModel fb = mappingSpec.getFunctionBlock(fbprop.getName());
if ("blegatt".equals(fb.getTargetPlatformKey())) {
BleGattService service = new BleGattService();
Optional<Stereotype> stereotype = fb.getStereotype("source");
if (stereotype.isPresent()) {
String uuid = stereotype.get().getAttributes().get("uuid");
if (uuid != null) {
service.setUuid(UUID.fromString(uuid));
}
}
for (ModelProperty prop : fb.getConfigurationProperties()) {
BleGattCharacteristic ch = buildCharacteristic(prop);
if (ch.getUuid() != null) {
service.addCharacteristics(ch);
}
}
for (ModelProperty prop : fb.getStatusProperties()) {
BleGattCharacteristic ch = buildCharacteristic(prop);
if (ch.getUuid() != null) {
service.addCharacteristics(ch);
}
}
device.addService(service);
}
}
return device;
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class MappingSpecificationSerializer method iterator.
public Iterator<IMappingSerializer> iterator() {
List<IMappingSerializer> serializers = new ArrayList<IMappingSerializer>();
for (ModelProperty fbProperty : specification.getInfoModel().getFunctionblocks()) {
serializers.add(new FunctionblockMappingSerializer(specification, fbProperty.getName()));
}
serializers.add(new InformationModelMappingSerializer(specification));
return serializers.iterator();
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecGattConverter method createFBSpec.
@Override
protected void createFBSpec() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.STRING);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("button:convertSensorValue(conversion:byteArrayToInt(characteristics[@uuid='23-D1-13-EF-5F-78-23-15-DE-EF-12-12-0D-F0-00-00']/data, 3, 0, 0, 3))"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
addFunctionblockProperty("button", buttonModel);
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecWithByteArrayConverter method createFBSpec.
@Override
protected void createFBSpec() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.STRING);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("button:convertSensorValue(conversion:byteArrayToInt(/data, 3, 0, 0, 3))"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
addFunctionblockProperty("button", buttonModel);
}
Aggregations