use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecWithCondition 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.FLOAT);
ModelProperty digitalInputStateProperty2 = new ModelProperty();
digitalInputStateProperty2.setMandatory(true);
digitalInputStateProperty2.setName("sensor_value2");
digitalInputStateProperty2.setType(PrimitiveType.FLOAT);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithConditionalXpath("count == 0", "/count"));
digitalInputStateProperty2.setTargetPlatformKey("iotbutton");
digitalInputStateProperty2.addStereotype(Stereotype.createWithConditionalXpath("count > 1", "/count"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty, digitalInputStateProperty2 }));
addFunctionblockProperty("button", buttonModel);
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecWithConditionedRules method createFBSpec.
@Override
protected void createFBSpec() {
FunctionblockModel doorState = 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("homeconnect");
digitalInputStateProperty.addStereotype(Stereotype.createWithConditionalXpath("data.key == 'DoorState'", "data/value"));
doorState.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
FunctionblockModel operationState = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
ModelProperty digitalInputStateProperty1 = new ModelProperty();
digitalInputStateProperty1.setMandatory(true);
digitalInputStateProperty1.setName("sensor_value");
digitalInputStateProperty1.setType(PrimitiveType.STRING);
digitalInputStateProperty1.setTargetPlatformKey("homeconnect");
digitalInputStateProperty1.addStereotype(Stereotype.createWithConditionalXpath("data.key == 'OperationState'", "data/value"));
operationState.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty1 }));
addFunctionblockProperty("doorState", doorState);
addFunctionblockProperty("operationState", operationState);
}
use of org.eclipse.vorto.repository.api.content.ModelProperty in project vorto by eclipse.
the class SpecWithCustomFunction method createButtonFb.
private FunctionblockModel createButtonFb() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb.PushButton:1.0.0"), ModelType.Functionblock);
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("digital_input_state");
digitalInputStateProperty.setType(PrimitiveType.BOOLEAN);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("boolean:toBoolean(\"true\")"));
ModelProperty digitalInputCount = new ModelProperty();
digitalInputCount.setMandatory(true);
digitalInputCount.setName("digital_input_count");
digitalInputCount.setType(PrimitiveType.INT);
digitalInputCount.setTargetPlatformKey("iotbutton");
digitalInputCount.addStereotype(Stereotype.createWithXpath("button:convertClickType(clickType)"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty, digitalInputCount }));
return buttonModel;
}
Aggregations