Skip to content
Snippets Groups Projects
Commit 7cd44214 authored by Johannes Eder's avatar Johannes Eder
Browse files

raspberry code generation fix

parent 2b90054b
No related branches found
No related tags found
No related merge requests found
Showing
with 354 additions and 0 deletions
......@@ -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);
......
......@@ -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>
......
/*--------------------------------------------------------------------------+
$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;
}
}
/*--------------------------------------------------------------------------+
$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);
}
}
/*--------------------------------------------------------------------------+
$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();
}
}
/*--------------------------------------------------------------------------+
$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();
}
}
/*--------------------------------------------------------------------------+
$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);
}
}
......@@ -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();
......
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