From 2b90054b84fd8de53c037817ca82bb364021f007 Mon Sep 17 00:00:00 2001 From: Johannes Eder <eder@fortiss.org> Date: Mon, 22 May 2017 16:03:46 +0000 Subject: [PATCH] Raspberry code generation stubs --- .../ui/prototype/ProtoypeProvider.java | 18 ++--- .../trunk/plugin.xml | 78 +++++++++++++++++++ .../compose/RaspberryPiCompositor.java | 3 +- .../executable/CanBusExecutable.java | 55 +++++++++++++ .../executable/CanConnectorExecutable.java | 77 ++++++++++++++++++ .../executable/IMUSensorExecutable.java | 64 +++++++++++++++ .../LaserRangeFinderSensorExecutable.java | 64 +++++++++++++++ .../LaserScannerSensorExecutable.java | 64 +++++++++++++++ .../executable/PWMActuatorExecutable.java | 64 +++++++++++++++ .../executable/RaspberryPIExecutable.java | 7 +- .../transform/CanBusTransformation.java | 60 ++++++++++++++ .../transform/CanConnectorTransformation.java | 60 ++++++++++++++ .../transform/IMUSensorTransformation.java | 60 ++++++++++++++ .../LaserRangeFinderSensorTransformation.java | 60 ++++++++++++++ .../LaserScannerSensorTransformation.java | 60 ++++++++++++++ .../transform/PWMActuatorTransformation.java | 60 ++++++++++++++ .../transform/RaspberryPITransformation.java | 3 +- 17 files changed, 844 insertions(+), 13 deletions(-) create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanBusExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransformation.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransformation.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java create mode 100644 org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/PWMActuatorTransformation.java diff --git a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java index e5c96200..2bb00181 100644 --- a/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java +++ b/org.fortiss.af3.platform.raspberry.ui/trunk/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java @@ -24,12 +24,10 @@ import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodeBounds; import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodePosition; import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createRectangle; -import org.fortiss.af3.platform.raspberry.model.ActuatorConnector; 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.RaspberryPi; -import org.fortiss.af3.platform.raspberry.model.SensorConnector; import org.fortiss.af3.platform.raspberry.model.SensorIMU; import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; @@ -64,10 +62,10 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(con, 0, 0); registerPrototype("CanConnector", con, CATEGORY_NAME); - SensorConnector sensor = RaspberryModelElementFactory.createSensorConnector(); - setNodePosition(sensor, 0, 0); - setConnectorPosition(sensor, 0, 0); - registerPrototype("GenericPI_Sensor", sensor, CATEGORY_NAME); + // SensorConnector sensor = RaspberryModelElementFactory.createSensorConnector(); + // setNodePosition(sensor, 0, 0); + // setConnectorPosition(sensor, 0, 0); + // registerPrototype("GenericPI_Sensor", sensor, CATEGORY_NAME); SensorIMU imu = RaspberryModelElementFactory.createSensorIMU(); setNodePosition(imu, 0, 0); @@ -84,10 +82,10 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(sls, 0, 0); registerPrototype("LaserScanner_Sensor", sls, CATEGORY_NAME); - ActuatorConnector actuator = RaspberryModelElementFactory.createActuatorConnector(); - setNodePosition(actuator, 0, 0); - setConnectorPosition(actuator, 0, 0); - registerPrototype("GenericPI_Actuator", actuator, CATEGORY_NAME); + // ActuatorConnector actuator = RaspberryModelElementFactory.createActuatorConnector(); + // setNodePosition(actuator, 0, 0); + // setConnectorPosition(actuator, 0, 0); + // registerPrototype("GenericPI_Actuator", actuator, CATEGORY_NAME); ActuatorPWM pwm = RaspberryModelElementFactory.createActuatorPWM(); setNodePosition(pwm, 0, 0); diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index a40d19b0..fff2d6b3 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -76,6 +76,84 @@ </objectClass> </target> </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanConnectorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.CanConnector"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CanConnectorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.IMUSensorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.SensorIMU"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.IMUSensorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.LaserRangeFinderSensorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.LaserRangeFinderSensorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.LaserScannerSensorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.SensorLaserScanner"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.LaserScannerSensorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.PWMActuatorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.ActuatorPWM"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.PWMActuatorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanBusTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.CanBus"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CanBusExecutable"> + </objectClass> + </target> + </transformationProvider> </extension> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java index fd5561a6..a2e54f45 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java @@ -28,6 +28,7 @@ import org.fortiss.af3.platform.raspberry.model.CanConnector; import org.fortiss.af3.platform.raspberry.model.RaspberryPi; import org.fortiss.af3.platform.raspberry.model.SensorConnector; import org.fortiss.af3.platform.raspberry.model.SensorGamepad; +import org.fortiss.af3.platform.raspberry.model.SensorIMU; import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; @@ -48,7 +49,7 @@ public class RaspberryPiCompositor extends final boolean instanceOfAny2 = isInstanceOfAny(contained, CanConnector.class, SensorConnector.class, ActuatorConnector.class, ActuatorPWM.class, SensorLaserRangeFinder.class, - SensorGamepad.class, SensorLaserScanner.class); + SensorGamepad.class, SensorLaserScanner.class, SensorIMU.class); if(container != null) { final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class); return instanceOfAny && instanceOfAny2; diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanBusExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanBusExecutable.java new file mode 100644 index 00000000..d8f0d797 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanBusExecutable.java @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import java.util.List; +import java.util.Map; + +import org.fortiss.af3.component.model.Component; +import org.fortiss.af3.component.model.Port; +import org.fortiss.af3.generator.common.model.source.SourcePackage; +import org.fortiss.af3.platform.language.executable.TransmissionUnitExecutableBase; +import org.fortiss.af3.platform.model.ExecutionUnit; +import org.fortiss.af3.platform.model.TransmissionUnit; +import org.fortiss.af3.platform.raspberry.model.CanBus; + +/** + * Executable for {@link CanBus}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class CanBusExecutable extends TransmissionUnitExecutableBase<TransmissionUnit> { + + /** Constructor. */ + public CanBusExecutable(TransmissionUnit modelElement) { + super(modelElement); + // no functionality as of now + } + + /** {@inheritDoc} */ + @Override + public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair, + Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent, + int deploymentID) { + // no functionality as of now + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java new file mode 100644 index 00000000..d6fcdcf6 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanConnectorExecutable.java @@ -0,0 +1,77 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.component.model.OutputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.generic.generator.executable.GenericTransceiverExecutable; +import org.fortiss.af3.platform.model.generic.GenericTransceiver; +import org.fortiss.af3.platform.raspberry.model.CanConnector; + +/** + * Executable for {@link CanConnector}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class CanConnectorExecutable extends GenericTransceiverExecutable { + + /** Constructor. */ + public CanConnectorExecutable(GenericTransceiver modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getInitialization() { + return super.getInitialization(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { + return super.getNoValGuardAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValWriteAccessor(OutputPort logicalSignal) { + return super.getNoValWriteAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getTermination() { + return super.getTermination(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return super.getValueReadAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { + return super.getValueWriteAccessor(logicalSignal, value); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java new file mode 100644 index 00000000..bec3e38f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/IMUSensorExecutable.java @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; +import org.fortiss.af3.platform.model.generic.GenericReceiver; +import org.fortiss.af3.platform.raspberry.model.SensorIMU; + +/** + * Executable for {@link SensorIMU}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class IMUSensorExecutable extends GenericReceiverExecutable { + + /** Constructor. */ + public IMUSensorExecutable(GenericReceiver modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getInitialization() { + return super.getInitialization(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { + return super.getNoValGuardAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getTermination() { + return super.getTermination(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return super.getValueReadAccessor(logicalSignal); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java new file mode 100644 index 00000000..5e71557e --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserRangeFinderSensorExecutable.java @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; +import org.fortiss.af3.platform.model.generic.GenericReceiver; +import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; + +/** + * Executable for {@link SensorLaserRangeFinder}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class LaserRangeFinderSensorExecutable extends GenericReceiverExecutable { + + /** Constructor. */ + public LaserRangeFinderSensorExecutable(GenericReceiver modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getInitialization() { + return super.getInitialization(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { + return super.getNoValGuardAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getTermination() { + return super.getTermination(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return super.getValueReadAccessor(logicalSignal); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java new file mode 100644 index 00000000..5c64931b --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/LaserScannerSensorExecutable.java @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.generic.generator.executable.GenericReceiverExecutable; +import org.fortiss.af3.platform.model.generic.GenericReceiver; +import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; + +/** + * Executable for {@link SensorLaserScanner}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class LaserScannerSensorExecutable extends GenericReceiverExecutable { + + /** Constructor. */ + public LaserScannerSensorExecutable(GenericReceiver modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getInitialization() { + return super.getInitialization(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { + return super.getNoValGuardAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getTermination() { + return super.getTermination(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return super.getValueReadAccessor(logicalSignal); + } +} 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 new file mode 100644 index 00000000..c442eb2e --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/PWMActuatorExecutable.java @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.executable; + +import org.fortiss.af3.component.model.OutputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.generic.generator.executable.GenericTransmitterExecutable; +import org.fortiss.af3.platform.model.generic.GenericTransmitter; +import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; + +/** + * Executable for {@link ActuatorPWM}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class PWMActuatorExecutable extends GenericTransmitterExecutable { + + /** Constructor. */ + public PWMActuatorExecutable(GenericTransmitter modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getInitialization() { + return super.getInitialization(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getNoValWriteAccessor(OutputPort logicalSignal) { + return super.getNoValWriteAccessor(logicalSignal); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getTermination() { + return super.getTermination(); + } + + /** {@inheritDoc} */ + @Override + public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { + return super.getValueWriteAccessor(logicalSignal, value); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java index b653f55f..7bcf55ce 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java @@ -33,17 +33,22 @@ import org.fortiss.af3.expression.model.terms.IExpressionTerm; import org.fortiss.af3.expression.model.terms.imperative.IStatementTerm; import org.fortiss.af3.generator.common.model.c.CSourcePackage; import org.fortiss.af3.platform.generic.generator.executable.GenericExecutionUnitExecutable; +import org.fortiss.af3.platform.language.executable.IInitializableExecutable; import org.fortiss.af3.platform.language.executable.IReadableExecutable; +import org.fortiss.af3.platform.language.executable.ITerminatableExecutable; import org.fortiss.af3.platform.language.executable.IWritableExecutable; import org.fortiss.af3.platform.model.ExecutionUnit; import org.fortiss.af3.platform.model.PlatformConnectorUnit; import org.fortiss.af3.platform.model.generic.GenericTransceiver; +import org.fortiss.af3.platform.raspberry.model.RaspberryPi; import org.fortiss.tooling.kernel.extension.data.ITransformationContext; /** + * {@link IInitializableExecutable} and {@link ITerminatableExecutable} for the {@link RaspberryPi} + * platform. * * @author eder - * @author $Author: hoelzl $ + * @author $Author: eder $ * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransformation.java new file mode 100644 index 00000000..e486ff8a --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.CanBusExecutable; +import org.fortiss.af3.platform.raspberry.model.CanBus; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link CanBus}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class CanBusTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return CanBusExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return CanBus.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof CanBus; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new CanBusExecutable((CanBus)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransformation.java new file mode 100644 index 00000000..c1384349 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.CanConnectorExecutable; +import org.fortiss.af3.platform.raspberry.model.CanConnector; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link CanConnector}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class CanConnectorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return CanConnectorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return CanConnector.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof CanConnector; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new CanConnectorExecutable((CanConnector)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java new file mode 100644 index 00000000..6648dc62 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/IMUSensorTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.IMUSensorExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorIMU; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link SensorIMU}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class IMUSensorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return IMUSensorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return SensorIMU.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof SensorIMU; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new IMUSensorExecutable((SensorIMU)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java new file mode 100644 index 00000000..68e2a364 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserRangeFinderSensorTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.LaserRangeFinderSensorExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorLaserRangeFinder; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link SensorLaserRangeFinder}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class LaserRangeFinderSensorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return LaserRangeFinderSensorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return SensorLaserRangeFinder.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof SensorLaserRangeFinder; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new LaserRangeFinderSensorExecutable((SensorLaserRangeFinder)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java new file mode 100644 index 00000000..e5c80421 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/LaserScannerSensorTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.LaserScannerSensorExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorLaserScanner; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link SensorLaserScanner}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class LaserScannerSensorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return LaserScannerSensorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return SensorLaserScanner.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof SensorLaserScanner; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new LaserScannerSensorExecutable((SensorLaserScanner)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/PWMActuatorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/PWMActuatorTransformation.java new file mode 100644 index 00000000..3edc3262 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/PWMActuatorTransformation.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------+ +$Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $ +| | +| Copyright 2017 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.generator.transform; + +import org.fortiss.af3.platform.raspberry.generator.executable.PWMActuatorExecutable; +import org.fortiss.af3.platform.raspberry.model.ActuatorPWM; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * Transformation for {@link ActuatorPWM}. + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class PWMActuatorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return PWMActuatorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return ActuatorPWM.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof ActuatorPWM; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new PWMActuatorExecutable((ActuatorPWM)source); + } + +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/RaspberryPITransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/RaspberryPITransformation.java index eb320f64..dabce839 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/RaspberryPITransformation.java +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/RaspberryPITransformation.java @@ -23,9 +23,10 @@ import org.fortiss.tooling.kernel.extension.ITransformationProvider; import org.fortiss.tooling.kernel.extension.data.ITransformationContext; /** + * Transformation from {@link RaspberryPi} to {@link RaspberryPIExecutable}. * * @author eder - * @author $Author: hoelzl $ + * @author $Author: eder $ * @version $Rev: 18709 $ * @ConQAT.Rating RED Hash: */ -- GitLab