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 2bb00181005efca9622dda461d9d505258d91dec..e3e9fe54b8fc41b28614da4b424c0d2f1281e80c 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 @@ -28,6 +28,7 @@ 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.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; @@ -82,6 +83,11 @@ public class ProtoypeProvider extends PrototypeProviderBase { setConnectorPosition(sls, 0, 0); registerPrototype("LaserScanner_Sensor", sls, CATEGORY_NAME); + SensorGamepad pad = RaspberryModelElementFactory.createGamepadSensor(); + setNodePosition(pad, 0, 0); + setConnectorPosition(pad, 0, 0); + registerPrototype("Gamepad_Sensor", pad, CATEGORY_NAME); + // ActuatorConnector actuator = RaspberryModelElementFactory.createActuatorConnector(); // setNodePosition(actuator, 0, 0); // setConnectorPosition(actuator, 0, 0); diff --git a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml index fff2d6b3ec1492065af27024a10f2bbcce030fa8..57788801e0757ccee9821a19a4f8597ecd114bd8 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/plugin.xml +++ b/org.fortiss.af3.platform.raspberry/trunk/plugin.xml @@ -154,6 +154,45 @@ </objectClass> </target> </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.GamepadSensorTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.SensorGamepad"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.GamepadSensorExecutable"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanBusTransmissionCatalogTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.CanBus"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CanTransmissionCatalog"> + </objectClass> + </target> + </transformationProvider> + <transformationProvider + transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CanConnectorTransmissionCatalogTransformation"> + <source> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.model.CanConnector"> + </objectClass> + </source> + <target> + <objectClass + objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CanTransmissionCatalog"> + </objectClass> + </target> + </transformationProvider> </extension> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanTransmissionCatalog.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanTransmissionCatalog.java new file mode 100644 index 0000000000000000000000000000000000000000..8f3a64fdda743adce6e38b9d815a55fd91ab7ed6 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CanTransmissionCatalog.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.ArrayList; +import java.util.List; + +import org.fortiss.af3.deployment.generator.DeploymentExecutableTransformationContext; +import org.fortiss.af3.deployment.generator.Transmission; +import org.fortiss.af3.deployment.generator.TransmissionCatalog; +import org.fortiss.af3.generator.common.model.c.CSourcePackage; + +/** + * Can Transmission Catalog + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class CanTransmissionCatalog extends TransmissionCatalog { + + /** Stores the transmissions contained in this catalog. */ + private final List<Transmission> transmissions = new ArrayList<Transmission>(); + + /** Adds the given transmission to the catalog. */ + @Override + public void addTransmission(Transmission transmission) { + transmissions.add(transmission); + } + + /** + * Here the one can create additional SourcePackages which are common for all ECUs. + * It won't be used in the current release. + */ + @Override + public CSourcePackage getSourcePackage(DeploymentExecutableTransformationContext ctx) { + return null; + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.java new file mode 100644 index 0000000000000000000000000000000000000000..f335e8ecb040d58a9ad647e719272a5b1ddf233c --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/GamepadSensorExecutable.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 GamepadSensorExecutable extends GenericReceiverExecutable { + + /** Constructor. */ + public GamepadSensorExecutable(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/transform/CanBusTransmissionCatalogTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransmissionCatalogTransformation.java new file mode 100644 index 0000000000000000000000000000000000000000..7609aa34553960be92c85eb7103a3ddeab120aeb --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanBusTransmissionCatalogTransformation.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$Id: GenericTransmisstionUnitTransmissionCatalogTransformation.java 5274 2012-08-02 07:54:11Z mou $ +| | +| Copyright 2011 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.deployment.generator.TransmissionCatalog; +import org.fortiss.af3.platform.model.generic.GenericTransmissionUnit; +import org.fortiss.af3.platform.raspberry.generator.executable.CanTransmissionCatalog; +import org.fortiss.af3.platform.raspberry.model.CanBus; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * {@link TransmissionCatalog} generator for {@link GenericTransmissionUnit}. + * + * @author hoelzl + * @author $Author: mou $ + * @version $Rev: 5274 $ + * @ConQAT.Rating GREEN Hash: C4318B1D240DC4CACC2BB0311CB2B23A + */ +public class CanBusTransmissionCatalogTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return CanTransmissionCatalog.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 CanTransmissionCatalog(); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransmissionCatalogTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransmissionCatalogTransformation.java new file mode 100644 index 0000000000000000000000000000000000000000..d60a8b87a4df5b2d4227c8e2add1ee1f909eab68 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/CanConnectorTransmissionCatalogTransformation.java @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------+ +$Id: GenericTransceiverTransmissionCatalogTransformation.java 5274 2012-08-02 07:54:11Z mou $ +| | +| Copyright 2011 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.deployment.generator.TransmissionCatalog; +import org.fortiss.af3.platform.model.generic.GenericTransceiver; +import org.fortiss.af3.platform.raspberry.generator.executable.CanTransmissionCatalog; +import org.fortiss.af3.platform.raspberry.model.CanConnector; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * {@link TransmissionCatalog} generator for {@link GenericTransceiver}. + * + * @author hoelzl + * @author $Author: mou $ + * @version $Rev: 5274 $ + * @ConQAT.Rating GREEN Hash: 99AE1800CB3BA900FDB2FD75FC254AD4 + */ +public class CanConnectorTransmissionCatalogTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return CanTransmissionCatalog.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 CanTransmissionCatalog(); + } +} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java new file mode 100644 index 0000000000000000000000000000000000000000..3e81e0263d2432fe872f1de4374c2b365ccc5d79 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/transform/GamepadSensorTransformation.java @@ -0,0 +1,59 @@ +/*--------------------------------------------------------------------------+ +$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.GamepadSensorExecutable; +import org.fortiss.af3.platform.raspberry.model.SensorGamepad; +import org.fortiss.tooling.kernel.extension.ITransformationProvider; +import org.fortiss.tooling.kernel.extension.data.ITransformationContext; + +/** + * + * @author eder + * @author $Author: hoelzl $ + * @version $Rev: 18709 $ + * @ConQAT.Rating RED Hash: + */ +public class GamepadSensorTransformation implements ITransformationProvider { + + /** {@inheritDoc} */ + @Override + public Class<?> getTargetClass() { + return GamepadSensorExecutable.class; + } + + /** {@inheritDoc} */ + @Override + public boolean + canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) { + return SensorGamepad.class.isAssignableFrom(sourceClass); + } + + /** {@inheritDoc} */ + @Override + public boolean canTransform(Object source, ITransformationContext context) { + return source instanceof SensorGamepad; + } + + /** {@inheritDoc} */ + @Override + public Object transform(Object source, ITransformationContext context) { + return new GamepadSensorExecutable((SensorGamepad)source); + } + +} 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 12c3f96e3411cad9aadf60ee3edc80fc1b30af76..d2ad802842f014828a9ed6828d969e1236561238 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 @@ -26,6 +26,7 @@ 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.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; @@ -73,6 +74,14 @@ public class RaspberryModelElementFactory { return connector; } + /** Creates a {@link SensorGamepad} */ + public static SensorGamepad createGamepadSensor() { + SensorGamepad connector = ModelFactory.eINSTANCE.createSensorGamepad(); + connector.setName("Gamepad_In"); + createConnectorLayout(connector); + return connector; + } + /** Creates a {@link SensorIMU}. */ public static SensorIMU createSensorIMU() { SensorIMU connector = ModelFactory.eINSTANCE.createSensorIMU();