use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithConditionFunction method createModel.
@Override
protected void createModel() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
buttonModel.setTargetPlatformKey("iotbutton");
buttonModel.addStereotype(Stereotype.createCondition("not empty(array[0])"));
ModelProperty digitalInputStateProperty = new ModelProperty();
digitalInputStateProperty.setMandatory(true);
digitalInputStateProperty.setName("sensor_value");
digitalInputStateProperty.setType(PrimitiveType.FLOAT);
digitalInputStateProperty.setTargetPlatformKey("iotbutton");
digitalInputStateProperty.addStereotype(Stereotype.createWithXpath("array[1]"));
buttonModel.setStatusProperties(Arrays.asList(new ModelProperty[] { digitalInputStateProperty }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("button", buttonModel).build());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithConditionalProperties method createModel.
@Override
protected void createModel() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
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 }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("button", buttonModel).build());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithConfiguration2 method createModel.
@Override
protected void createModel() {
FunctionblockModel buttonModel = new FunctionblockModel(ModelId.fromPrettyFormat("demo.fb:PushButton:1.0.0"));
ModelProperty buttonEnableProperty = new ModelProperty();
buttonEnableProperty.setMandatory(true);
buttonEnableProperty.setName("enable");
buttonEnableProperty.setType(PrimitiveType.BOOLEAN);
buttonEnableProperty.setTargetPlatformKey("iotbutton");
buttonEnableProperty.addStereotype(Stereotype.createWithXpath("/e"));
buttonModel.setConfigurationProperties(Arrays.asList(new ModelProperty[] { buttonEnableProperty }));
infomodel.getFunctionblocks().add(ModelProperty.Builder("button", buttonModel).build());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithNestedEnum method createModel.
@Override
protected void createModel() {
EnumModel unitEnum = EnumModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Enum:1.0.0")).literal("Celcius", null).literal("Fahrenheit", null).build();
FunctionblockModel temperatureModel = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Temperature:1.0.0")).statusProperty(ModelProperty.Builder("value", PrimitiveType.FLOAT).withXPathStereotype("/temperature", "iotbutton").build()).statusProperty(ModelProperty.Builder("unit", unitEnum.getId()).withXPathStereotype("'Celcius'", "iotbutton").build()).build();
infomodel.getFunctionblocks().add(ModelProperty.Builder("outdoorTemperature", temperatureModel).build());
}
use of org.eclipse.vorto.model.FunctionblockModel in project vorto by eclipse.
the class SpecWithTwoFunctionblocksWithNestedEntity method createModel.
@Override
protected void createModel() {
EntityModel sensorValueEntity = EntityModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:SensorValue:1.0.0")).property(ModelProperty.Builder("value", PrimitiveType.FLOAT).withXPathStereotype("/temperature", "iotbutton").build()).build();
FunctionblockModel temperatureModel = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Temperature:1.0.0")).statusProperty(ModelProperty.Builder("value", sensorValueEntity).build()).build();
infomodel.getFunctionblocks().add(ModelProperty.Builder("outdoorTemperature", temperatureModel).build());
EntityModel sensorValueEntity2 = EntityModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:SensorValue:1.0.0")).property(ModelProperty.Builder("value", PrimitiveType.FLOAT).withXPathStereotype("/humidity", "iotbutton").build()).build();
FunctionblockModel humidityModel = FunctionblockModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Humidity:1.0.0")).statusProperty(ModelProperty.Builder("value", sensorValueEntity2).build()).build();
infomodel.getFunctionblocks().add(ModelProperty.Builder("humidity", humidityModel).build());
}
Aggregations