Skip to content
Snippets Groups Projects
Commit fc43fddd authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Completed brick model elements for RasPi platform.

refs 3079
parent d6cc99f7
No related branches found
No related tags found
No related merge requests found
......@@ -165,6 +165,9 @@
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor">
</modelElementClass>
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits">
</modelElementClass>
</modelElementHandler>
</extension>
<extension
......@@ -191,6 +194,26 @@
type="org.fortiss.af3.platform.raspberry.model.ActuatorPWM">
</input>
</propertySection>
<propertySection
afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class="org.fortiss.af3.platform.raspberry.ui.properties.UIDUnitPropertySection"
enablesFor="1"
id="org.fortiss.af3.platform.raspberry.ui.properties.UIDUnitPropertySection"
tab="org.fortiss.tooling.kernel.ui.property.tab.general">
<input
type="org.fortiss.af3.platform.raspberry.model.brick.UIDUnit">
</input>
</propertySection>
<propertySection
afterSection="org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class="org.fortiss.af3.platform.raspberry.ui.properties.ActuatorDigitsPropertySection"
enablesFor="1"
id="org.fortiss.af3.platform.raspberry.ui.properties.ActuatorDigitsPropertySection"
tab="org.fortiss.tooling.kernel.ui.property.tab.general">
<input
type="org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits">
</input>
</propertySection>
</propertySections>
</extension>
</plugin>
/*--------------------------------------------------------------------------+
$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.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
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.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits;
import org.fortiss.af3.platform.raspberry.model.brick.BrickPackage;
import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
/**
* Property section for {@link ActuatorDigits}s.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 9E768B733BD37201F97399293FA0DFA7
*/
public class ActuatorDigitsPropertySection extends PropertySectionBase {
/** The actuator model element. */
private ActuatorDigits actuator;
/** The hex output button. */
private Button hexOutputFlagButton;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
hexOutputFlagButton = getWidgetFactory().createButton(composite, "", SWT.CHECK);
createFormEntry(hexOutputFlagButton, "Coordinator Unit");
hexOutputFlagButton.setSelection(false);
}
/** {@inheritDoc} */
@Override
protected void setSectionInput(Object input) {
actuator = (ActuatorDigits)input;
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
IObservableValue modelObservable =
observeValue(actuator, BrickPackage.Literals.ACTUATOR_DIGITS__SHOW_HEX_VALUE);
dbc.bindValue(observeSelection(hexOutputFlagButton), modelObservable);
}
}
/*--------------------------------------------------------------------------+
$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.observeText;
import static org.fortiss.tooling.kernel.ui.util.ObservableUtils.observeValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.swt.SWT;
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.brick.BrickPackage;
import org.fortiss.af3.platform.raspberry.model.brick.UIDUnit;
import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
/**
* Property section for {@link UIDUnit}s.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 9E768B733BD37201F97399293FA0DFA7
*/
public class UIDUnitPropertySection extends PropertySectionBase {
/** The unit. */
private UIDUnit unit;
/** The unique ID widget. */
private Text uidText;
/** {@inheritDoc} */
@Override
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
super.createControls(parent, tabbedPropertySheetPage);
uidText = createDecoratedText("UID");
}
/** {@inheritDoc} */
@Override
protected void setSectionInput(Object input) {
unit = (UIDUnit)input;
}
/** {@inheritDoc} */
@Override
public void refresh() {
super.refresh();
IObservableValue modelObservable =
observeValue(unit, BrickPackage.Literals.UID_UNIT__UNIQUE_BRICKLET_ID);
dbc.bindValue(observeText(uidText, SWT.Modify), modelObservable);
}
}
......@@ -31,6 +31,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor;
import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor;
......@@ -92,6 +93,11 @@ public class ProtoypeProvider extends PrototypeProviderBase {
setConnectorPosition(pwm, 0, 0);
registerPrototype("PWM_Actuator", pwm, CATEGORY_NAME);
ActuatorDigits digits = RaspberryModelElementFactory.createActuatorDigits();
setNodePosition(digits, 0, 0);
setConnectorPosition(digits, 0, 0);
registerPrototype("Segment_Digits", digits, BRICK);
Button1 button1 = RaspberryModelElementFactory.createButton1();
setNodePosition(button1, 0, 0);
setConnectorPosition(button1, 0, 0);
......
......@@ -2,25 +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="../../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="../../org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="CanConnector" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transceiver"/>
<eClassifiers xsi:type="ecore:EClass" name="ActuatorPWM" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Transmitter">
<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">
<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="../../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"
eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver"/>
eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver"/>
<eClassifiers xsi:type="ecore:EClass" name="Button1" eSuperTypes="#//gamepad/GamepadReceiverBase"/>
<eClassifiers xsi:type="ecore:EClass" name="Button2" eSuperTypes="#//gamepad/GamepadReceiverBase"/>
<eClassifiers xsi:type="ecore:EClass" name="Button3" eSuperTypes="#//gamepad/GamepadReceiverBase"/>
......@@ -36,16 +32,19 @@
</eSubpackages>
<eSubpackages name="brick" nsURI="http://www.fortiss.org/af3/platform/raspberry/brick"
nsPrefix="org-fortiss-af3-platform-raspberry">
<eClassifiers xsi:type="ecore:EClass" name="UIDUnit" abstract="true" eSuperTypes="../../org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement">
<eClassifiers xsi:type="ecore:EClass" name="UIDUnit" abstract="true" eSuperTypes="platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedCommentedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueBrickletID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="UltraSonicSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="LaserRangeSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationXSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationYSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationZSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityXSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityYSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityZSensor" eSuperTypes="../../org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="UltraSonicSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="LaserRangeSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationXSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationYSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AccelerationZSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityXSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityYSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="AngularVelocityZSensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver #//brick/UIDUnit"/>
<eClassifiers xsi:type="ecore:EClass" name="ActuatorDigits" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter #//brick/UIDUnit">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="showHexValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
......@@ -28,6 +28,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPi;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor;
import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor;
......@@ -84,7 +85,7 @@ public class RaspberryPiCompositor extends
LaserRangeSensor.class, AccelerationXSensor.class,
AccelerationYSensor.class, AccelerationZSensor.class,
AngularVelocityXSensor.class, AngularVelocityYSensor.class,
AngularVelocityZSensor.class);
AngularVelocityZSensor.class, ActuatorDigits.class);
if(container != null) {
final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class);
return instanceOfAny && instanceOfAny2;
......
......@@ -27,6 +27,7 @@ import org.fortiss.af3.platform.raspberry.model.RaspberryPiModelFactory;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AccelerationZSensor;
import org.fortiss.af3.platform.raspberry.model.brick.ActuatorDigits;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityXSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityYSensor;
import org.fortiss.af3.platform.raspberry.model.brick.AngularVelocityZSensor;
......@@ -253,4 +254,14 @@ public class RaspberryModelElementFactory {
createConnectorLayout(sensor);
return sensor;
}
/** Creates an {@link ActuatorDigits}. */
public static ActuatorDigits createActuatorDigits() {
ActuatorDigits ad = BrickFactory.eINSTANCE.createActuatorDigits();
ad.setName("SegmentDigits");
ad.setUniqueBrickletID("");
ad.setShowHexValue(false);
createConnectorLayout(ad);
return ad;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment