From 32e8e1602d0e71a3de37058be93579bc16ab125e Mon Sep 17 00:00:00 2001 From: Florian Hoelzl <hoelzl@fortiss.org> Date: Mon, 9 Oct 2017 10:19:02 +0000 Subject: [PATCH] Added property sections for Raspberry Pi units. refs 3079 --- .../trunk/plugin.xml | 16 +++ ...spberryPiExecutionUnitPropertySection.java | 104 ++++++++++++++++++ .../trunk/META-INF/MANIFEST.MF | 7 +- .../trunk/model/raspberry.ecore | 21 ++-- .../trunk/model/raspberry.genmodel | 25 +++-- .../trunk/plugin.xml | 18 +-- .../PWMChannelNumberValueProvider.java | 48 -------- .../executable/PWMActuatorExecutable.java | 4 +- .../util/RaspberryModelElementFactory.java | 14 ++- 9 files changed, 161 insertions(+), 96 deletions(-) create mode 100644 org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java delete mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml index 01827e80..ac775ed5 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/plugin.xml @@ -137,4 +137,20 @@ </modelElementClass> </modelElementHandler> </extension> + <extension + point="org.eclipse.ui.views.properties.tabbed.propertySections"> + <propertySections + contributorId="org.fortiss.tooling.kernel.ui.properties.Contributor"> + <propertySection + afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection" + class="org.fortiss.af3.platform.raspberry.ui.properties.RaspberryPiExecutionUnitPropertySection" + enablesFor="1" + id="org.fortiss.af3.platform.raspberry.ui.properties.RaspberryPiExecutionUnitPropertySection" + tab="org.fortiss.tooling.kernel.ui.property.tab.general"> + <input + type="org.fortiss.af3.platform.raspberry.model.RaspberryPi"> + </input> + </propertySection> + </propertySections> + </extension> </plugin> diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java new file mode 100644 index 00000000..548aada7 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------+ +$Id$ +| | +| Copyright 2013 ForTISS GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.af3.platform.raspberry.ui.properties; + +import static org.eclipse.jface.databinding.swt.SWTObservables.observeSelection; +import static org.eclipse.jface.databinding.swt.SWTObservables.observeText; +import static org.fortiss.af3.expression.ui.databinding.validate.IntToStringConverter.INT_STRING_CONVERTER; +import static org.fortiss.af3.expression.ui.databinding.validate.StringToIntConverter.STRING_INT_CONVERTER; +import static org.fortiss.tooling.kernel.ui.util.DataBindingUtils.performComplexTextBinding; +import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue; + +import org.conqat.ide.commons.ui.databinding.validate.NumberPositiveValidator; +import org.conqat.ide.commons.ui.databinding.validate.TextToIntegerValidator; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi; +import org.fortiss.af3.platform.raspberry.model.RaspberryPiModelPackage; +import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase; + +/** + * Property section for {@link RaspberryPi}s. + * + * @author hoelzl + * @author $Author$ + * @version $Rev$ + * @ConQAT.Rating GREEN Hash: 9E768B733BD37201F97399293FA0DFA7 + */ +public class RaspberryPiExecutionUnitPropertySection extends PropertySectionBase { + + /** The execution unit. */ + private RaspberryPi unit; + /** The virtual keyboard port number widget. */ + private Text canCoordinationIDText; + /** The cycle time widget. */ + private Text cycleTimeText; + /** The IP address widget. */ + private Text ipAddressText; + /** The coordinator flag button. */ + private Button coordinatorFlagButton; + + /** {@inheritDoc} */ + @Override + public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { + super.createControls(parent, tabbedPropertySheetPage); + canCoordinationIDText = createDecoratedText("CAN Unit ID"); + cycleTimeText = createDecoratedText("Cycle Time (ms)"); + coordinatorFlagButton = getWidgetFactory().createButton(composite, "", SWT.CHECK); + createFormEntry(coordinatorFlagButton, "Coordinator Unit"); + coordinatorFlagButton.setSelection(false); + ipAddressText = createDecoratedText("IP Address"); + } + + /** {@inheritDoc} */ + @Override + protected void setSectionInput(Object input) { + unit = (RaspberryPi)input; + } + + /** {@inheritDoc} */ + @Override + public void refresh() { + super.refresh(); + + IObservableValue modelObservable = + observeValue(unit, + RaspberryPiModelPackage.Literals.RASPBERRY_PI__CAN_COORDINATION_ID); + performComplexTextBinding(dbc, canCoordinationIDText, modelObservable, + INT_STRING_CONVERTER, STRING_INT_CONVERTER, TextToIntegerValidator.INSTANCE, + new NumberPositiveValidator()); + + modelObservable = + observeValue(unit, RaspberryPiModelPackage.Literals.RASPBERRY_PI__CYCLE_TIME); + performComplexTextBinding(dbc, cycleTimeText, modelObservable, INT_STRING_CONVERTER, + STRING_INT_CONVERTER, TextToIntegerValidator.INSTANCE, + new NumberPositiveValidator()); + + modelObservable = + observeValue(unit, RaspberryPiModelPackage.Literals.RASPBERRY_PI__IP_ADDRESS); + dbc.bindValue(observeText(ipAddressText, SWT.Modify), modelObservable); + + modelObservable = + observeValue(unit, RaspberryPiModelPackage.Literals.RASPBERRY_PI__COORDINATOR_UNIT); + dbc.bindValue(observeSelection(coordinatorFlagButton), modelObservable); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF b/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF index 0b3651d7..9f97ce07 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF +++ b/org.fortiss.af3.platform.raspberry/trunk/META-INF/MANIFEST.MF @@ -7,12 +7,9 @@ Bundle-ClassPath: . Bundle-Vendor: fortiss GmbH Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.fortiss.af3.platform.raspberry.model, +Export-Package: + org.fortiss.af3.platform.raspberry.model, org.fortiss.af3.platform.raspberry.model.gamepad, - org.fortiss.af3.platform.raspberry.model.gamepad.impl, - org.fortiss.af3.platform.raspberry.model.gamepad.util, - org.fortiss.af3.platform.raspberry.model.impl, - org.fortiss.af3.platform.raspberry.model.util, org.fortiss.af3.platform.raspberry.util Bundle-ActivationPolicy: lazy Bundle-Activator: org.fortiss.af3.platform.raspberry.AF3PlatformRaspberryActivator diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 075db297..44a3fbbb 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -2,10 +2,21 @@ <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model" nsURI="http://www.fortiss.org/af3/platform/raspberry" nsPrefix="org-fortiss-af3-platform-raspberry"> - <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"/> + <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="canCoordinationID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="ipAddress" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="coordinatorUnit" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cycleTime" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="CanBus" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit"/> <eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transceiver"/> - <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"/> + <eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="channelID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ActuatorDigits" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="showHexValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueBrickletID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> <eSubpackages name="gamepad" nsURI="http://www.fortiss.org/af3/platform/raspberry/gamepad" nsPrefix="org-fortiss-af3-platform-raspberry-gamepad"> <eClassifiers xsi:type="ecore:EClass" name="GamepadReceiverBase" abstract="true" @@ -23,10 +34,4 @@ <eClassifiers xsi:type="ecore:EClass" name="Right_StickX_Position" eSuperTypes="#//gamepad/GamepadReceiverBase"/> <eClassifiers xsi:type="ecore:EClass" name="Right_StickY_Position" eSuperTypes="#//gamepad/GamepadReceiverBase"/> </eSubpackages> - <eSubpackages name="annotation" nsURI="http://www.fortiss.org/af3/platform/raspberry/annotation" - nsPrefix="org-fortiss-af3-platform-raspberry-annotation"> - <eClassifiers xsi:type="ecore:EClass" name="Channel" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="channel" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> - </eClassifiers> - </eSubpackages> </ecore:EPackage> diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel index 3b6ac1ac..df5f346b 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.genmodel @@ -5,12 +5,23 @@ containmentProxies="true" arrayAccessors="true" complianceLevel="7.0" copyrightFields="false" usedGenPackages="platform:/resource/org.fortiss.tooling.base/model/base.genmodel#//model platform:/resource/org.fortiss.af3.platform/model/platform.genmodel#//model platform:/resource/org.fortiss.tooling.kernel/model/kernel.genmodel#//model"> <foreignModel>raspberry.ecore</foreignModel> - <genPackages prefix="Model" basePackage="org.fortiss.af3.platform.raspberry" disposableProviderFactory="true" - ecorePackage="raspberry.ecore#/"> - <genClasses ecoreClass="raspberry.ecore#//RaspberryPi"/> + <genPackages prefix="RaspberryPiModel" basePackage="org.fortiss.af3.platform.raspberry" + disposableProviderFactory="true" ecorePackage="raspberry.ecore#/"> + <genClasses ecoreClass="raspberry.ecore#//RaspberryPi"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//RaspberryPi/canCoordinationID"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//RaspberryPi/ipAddress"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//RaspberryPi/coordinatorUnit"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//RaspberryPi/cycleTime"/> + </genClasses> <genClasses ecoreClass="raspberry.ecore#//CanBus"/> <genClasses ecoreClass="raspberry.ecore#//CanConnector"/> - <genClasses ecoreClass="raspberry.ecore#//ActuatorPWM"/> + <genClasses ecoreClass="raspberry.ecore#//ActuatorPWM"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//ActuatorPWM/channelID"/> + </genClasses> + <genClasses ecoreClass="raspberry.ecore#//ActuatorDigits"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//ActuatorDigits/showHexValue"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//ActuatorDigits/uniqueBrickletID"/> + </genClasses> <nestedGenPackages prefix="Gamepad" basePackage="org.fortiss.af3.platform.raspberry.model" disposableProviderFactory="true" ecorePackage="raspberry.ecore#//gamepad"> <genClasses image="false" ecoreClass="raspberry.ecore#//gamepad/GamepadReceiverBase"/> @@ -27,11 +38,5 @@ <genClasses ecoreClass="raspberry.ecore#//gamepad/Right_StickX_Position"/> <genClasses ecoreClass="raspberry.ecore#//gamepad/Right_StickY_Position"/> </nestedGenPackages> - <nestedGenPackages prefix="Annotation" basePackage="org.fortiss.af3.platform.raspberry.model" - disposableProviderFactory="true" ecorePackage="raspberry.ecore#//annotation"> - <genClasses ecoreClass="raspberry.ecore#//annotation/Channel"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute raspberry.ecore#//annotation/Channel/channel"/> - </genClasses> - </nestedGenPackages> </genPackages> </genmodel:GenModel> diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index 70b7d7e3..8ac1231b 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -14,7 +14,7 @@ <!-- @generated raspberry --> <package uri="http://www.fortiss.org/af3/platform/raspberry" - class="org.fortiss.af3.platform.raspberry.model.ModelPackage" + class="org.fortiss.af3.platform.raspberry.model.RaspberryPiModelPackage" genModel="model/raspberry.genmodel"/> </extension> @@ -26,13 +26,6 @@ genModel="model/raspberry.genmodel"/> </extension> - <extension point="org.eclipse.emf.ecore.generated_package"> - <!-- @generated raspberry --> - <package - uri="http://www.fortiss.org/af3/platform/raspberry/annotation" - class="org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage" - genModel="model/raspberry.genmodel"/> - </extension> <extension point="org.fortiss.tooling.kernel.modelElementCompositor"> <modelElementCompositor @@ -288,13 +281,4 @@ </target> </transformationProvider> </extension> - <extension - point="org.fortiss.tooling.base.annotation"> - <annotation - binding="org.fortiss.af3.platform.raspberry.annotation.PWMChannelNumberValueProvider"> - <modelElementClass - modelElementClass="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> - </modelElementClass> - </annotation> - </extension> </plugin> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java deleted file mode 100644 index 13abd5eb..00000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/annotation/PWMChannelNumberValueProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: GPIOPinNumberValueProvider.java 15846 2016-02-02 09:14:08Z zverlov $ -| | -| Copyright 2015 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.0 (the "License"); | -| you may not use this file except in compliance with the License. | -| You may obtain a copy of the License at | -| | -| http://www.apache.org/licenses/LICENSE-2.0 | -| | -| Unless required by applicable law or agreed to in writing, software | -| distributed under the License is distributed on an "AS IS" BASIS, | -| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | -| See the License for the specific language governing permissions and | -| limitations under the License. | -+--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.annotation; - -import org.fortiss.af3.platform.model.Transceiver; -import org.fortiss.af3.platform.raspberry.model.annotation.AnnotationPackage; -import org.fortiss.af3.platform.raspberry.model.annotation.Channel; -import org.fortiss.tooling.base.annotation.valueprovider.EStructuralFeatureValueProviderBase; -import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider; - -/** - * {@link IAnnotationValueProvider} that allows to annotate a Pin Number of a GPIO - * {@link Transceiver} used in PikeOS Platform. - * - * @author chaudhary - * @author $Author: zverlov $ - * @version $Rev: 15846 $ - * @ConQAT.Rating GREEN Hash: C69EECC82FF9912335C19FC6A5CD6996 - */ - -public class PWMChannelNumberValueProvider extends EStructuralFeatureValueProviderBase<Channel> { - - /** Constructor. */ - public PWMChannelNumberValueProvider() { - super(AnnotationPackage.Literals.CHANNEL, AnnotationPackage.Literals.CHANNEL__CHANNEL); - } - - /** {@inheritDoc} */ - @Override - public String getAnnotationName(Channel specification) { - return "PWM Channel"; - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java index e3d5da7e..faabcd8e 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java @@ -19,13 +19,11 @@ package org.fortiss.af3.platform.raspberry.generator.executable; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intConst; -import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation; import org.fortiss.af3.component.model.OutputPort; import org.fortiss.af3.expression.model.terms.IExpressionTerm; import org.fortiss.af3.platform.language.executable.TransmitterExecutableBase; import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; -import org.fortiss.af3.platform.raspberry.model.annotation.Channel; /** * Executable for {@link ActuatorPWM}. @@ -64,6 +62,6 @@ public class PWMActuatorExecutable extends TransmitterExecutableBase<ActuatorPWM } private int getPWMChannelFromModelElement(ActuatorPWM modelElement) { - return getAnnotation(modelElement, Channel.class).getChannel(); + return modelElement.getChannelID(); } } diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java index 7af2fc73..f2364e53 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/util/RaspberryModelElementFactory.java @@ -22,8 +22,8 @@ import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createCon import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; import org.fortiss.af3.platform.raspberry.model.CanBus; import org.fortiss.af3.platform.raspberry.model.CanConnector; -import org.fortiss.af3.platform.raspberry.model.ModelFactory; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; +import org.fortiss.af3.platform.raspberry.model.RaspberryPiModelFactory; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -51,15 +51,19 @@ public class RaspberryModelElementFactory { /** Creates a {@link RaspberryPi}. */ public static RaspberryPi createRaspberryPi() { - final RaspberryPi pi = ModelFactory.eINSTANCE.createRaspberryPi(); + final RaspberryPi pi = RaspberryPiModelFactory.eINSTANCE.createRaspberryPi(); LayoutModelElementFactory.createNodeElementLayout(pi); pi.setName("RaspberryPI"); + pi.setCanCoordinationID(255); + pi.setCycleTime(100); + pi.setIpAddress("192.168.21.241"); + pi.setCoordinatorUnit(false); return pi; } /** Creates a {@link CanBus}. */ public static CanBus createCanBus() { - final CanBus bus = ModelFactory.eINSTANCE.createCanBus(); + final CanBus bus = RaspberryPiModelFactory.eINSTANCE.createCanBus(); LayoutModelElementFactory.createNodeElementLayout(bus); bus.setName("CanBus"); return bus; @@ -67,7 +71,7 @@ public class RaspberryModelElementFactory { /** Creates a {@link CanConnector}. */ public static CanConnector createCanConnector() { - CanConnector canConnector = ModelFactory.eINSTANCE.createCanConnector(); + CanConnector canConnector = RaspberryPiModelFactory.eINSTANCE.createCanConnector(); canConnector.setName("CanConnector"); createConnectorLayout(canConnector); return canConnector; @@ -75,7 +79,7 @@ public class RaspberryModelElementFactory { /** Creates a {@link ActuatorPWM}. */ public static ActuatorPWM createActuatorPWM() { - ActuatorPWM connector = ModelFactory.eINSTANCE.createActuatorPWM(); + ActuatorPWM connector = RaspberryPiModelFactory.eINSTANCE.createActuatorPWM(); connector.setName("PWM"); createConnectorLayout(connector); return connector; -- GitLab