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

removed all unnecessary models

refs 7681
parent 395315b0
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1205 deletions
org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg

14 KiB | W: | H:

org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg

1.78 KiB | W: | H:

org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg
org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg
org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg
org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logo.jpeg
  • 2-up
  • Swipe
  • Onion skin
org.fortiss.af3.platform.raspberry.ui/trunk/icons/can-logoBIG.jpeg

14 KiB

org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png

41.6 KiB | W: | H:

org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png

1.46 KiB | W: | H:

org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png
org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png
org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png
org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logo.png
  • 2-up
  • Swipe
  • Onion skin
org.fortiss.af3.platform.raspberry.ui/trunk/icons/raspberry-pi-logoBIG.png

41.6 KiB

......@@ -22,18 +22,6 @@
modelElementClass="org.fortiss.af3.platform.raspberry.model.RaspberryPi3">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.platform.raspberry.ui.compose.elements.BusCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.Bus">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.platform.raspberry.ui.compose.elements.CoreCompositor">
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.Core">
</modelElementClass>
</modelElementCompositor>
<modelElementCompositor
compositor="org.fortiss.af3.platform.raspberry.ui.compose.elements.CANBusCompositor">
<modelElementClass
......@@ -49,19 +37,6 @@
</extension>
<extension
point="org.fortiss.tooling.kernel.modelConnectionCompositor">
<modelConnectionCompositor
modelConnectionCompositor="org.fortiss.af3.platform.raspberry.ui.compose.connections.CoreToBusConnectionCompositor">
<source>
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.Core">
</modelElementClass>
</source>
<target>
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.Bus">
</modelElementClass>
</target>
</modelConnectionCompositor>
<modelConnectionCompositor
modelConnectionCompositor="org.fortiss.af3.platform.raspberry.ui.compose.connections.RaspberryPi3ToCANBusConnectionCompositor">
<source>
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.compose.elements;
import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.compose.base.hierarchical.elements.TransmissionUnitComponentCompositorBase;
import org.fortiss.af3.platform.model.IArchitectureDomain;
import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.raspberry.model.Bus;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class BusCompositor extends TransmissionUnitComponentCompositorBase<Bus> {
/** {@inheritDoc} */
@Override
public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() {
return RaspberryPlatformHierarchicalCompositionRules.INSTANCE;
}
/** {@inheritDoc} */
@Override
protected Class<? extends IArchitectureDomain> getEditedObjectClass() {
return Bus.class;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.compose.elements;
import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.compose.base.hierarchical.elements.ExecutionUnitComponentCompositorBase;
import org.fortiss.af3.platform.model.IArchitectureDomain;
import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.raspberry.model.Core;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class CoreCompositor extends ExecutionUnitComponentCompositorBase<Core> {
/** {@inheritDoc} */
@Override
public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() {
return RaspberryPlatformHierarchicalCompositionRules.INSTANCE;
}
/** {@inheritDoc} */
@Override
protected Class<? extends IArchitectureDomain> getEditedObjectClass() {
return Core.class;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor;
import org.fortiss.af3.platform.compose.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.model.IArchitectureDomain;
import org.fortiss.af3.platform.raspberry.compositor.RaspberryPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class CoreStructureEditor extends PlatformComponentStructureEditorBase<Core> {
/** {@inheritDoc} */
@Override
public IPlatformHierarchicalCompositionRules getPlatformCompositionRules() {
return RaspberryPlatformHierarchicalCompositionRules.INSTANCE;
}
/** {@inheritDoc} */
@Override
protected Class<? extends IArchitectureDomain> getEditedObjectClass() {
return Core.class;
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.editor.binding;
import org.eclipse.ui.IEditorPart;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.ui.editor.CoreStructureEditor;
import org.fortiss.af3.platform.ui.editor.PlatformComponentStructureEditorBindingBase;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class CoreStructureEditorBinding extends PlatformComponentStructureEditorBindingBase<Core> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Core core) {
return CoreStructureEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel(Core core) {
return "Core Structure";
}
}
......@@ -19,13 +19,11 @@ package org.fortiss.af3.platform.raspberry.ui.prototypes;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createActuator;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createActuatorOut;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBus;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBusMasterInterface;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createBusMasterPort;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBus;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBusMasterInterface;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCANBusMasterPort;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createCore;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createRaspberryPi3;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createSensor;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryModelElementFactory.createSensorIn;
......@@ -34,13 +32,11 @@ import static org.fortiss.tooling.base.utils.LayoutDataUtils.setNodePosition;
import org.fortiss.af3.platform.raspberry.model.Actuator;
import org.fortiss.af3.platform.raspberry.model.ActuatorOut;
import org.fortiss.af3.platform.raspberry.model.Bus;
import org.fortiss.af3.platform.raspberry.model.BusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.BusMasterPort;
import org.fortiss.af3.platform.raspberry.model.CANBus;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterPort;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi3;
import org.fortiss.af3.platform.raspberry.model.Sensor;
import org.fortiss.af3.platform.raspberry.model.SensorIn;
......@@ -78,11 +74,6 @@ public class PrototypeProvider extends PrototypeProviderBase {
setConnectorPosition(actuator, 0, 0);
registerPrototype("ActuatorOut", actuatorOut, CATEGORY_NAME);
Bus bus = createBus("Bus");
setNodePosition(bus, 0, 0);
setConnectorPosition(bus, 0, 0);
registerPrototype("Bus", bus, CATEGORY_NAME);
BusMasterInterface busMasterInterface = createBusMasterInterface("BusMasterInterface");
setNodePosition(busMasterInterface, 0, 0);
setConnectorPosition(busMasterInterface, 0, 0);
......@@ -109,11 +100,6 @@ public class PrototypeProvider extends PrototypeProviderBase {
setConnectorPosition(canBusMasterPort, 0, 0);
registerPrototype("CANBusMasterPort", canBusMasterPort, CATEGORY_NAME);
Core core = createCore("Core");
setNodePosition(core, 0, 0);
setConnectorPosition(core, 0, 0);
registerPrototype("Core", core, CATEGORY_NAME);
RaspberryPi3 raspberryPi3 = createRaspberryPi3("RaspberryPi3");
setNodePosition(raspberryPi3, 0, 0);
setConnectorPosition(raspberryPi3, 0, 0);
......
......@@ -20,8 +20,6 @@
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RaspberryPi3" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//GenericPlatformUnit platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement #//IBoardDomain"/>
<eClassifiers xsi:type="ecore:EClass" name="Core" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IIpCorePlatformArchitectureElement #//IProcessorDomain"/>
<eClassifiers xsi:type="ecore:EClass" name="Bus" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//TransmissionUnit platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IIpCorePlatformArchitectureElement #//IProcessorDomain"/>
<eClassifiers xsi:type="ecore:EClass" name="Sensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/>
<eClassifiers xsi:type="ecore:EClass" name="Actuator" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/>
<eClassifiers xsi:type="ecore:EClass" name="SensorIn" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IIpCorePlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IProcessorDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/>
......
......@@ -15,8 +15,6 @@
<genOperations ecoreOperation="raspberry.ecore#//IBoardDomain/getArchitectureDomainName"/>
</genClasses>
<genClasses ecoreClass="raspberry.ecore#//RaspberryPi3"/>
<genClasses ecoreClass="raspberry.ecore#//Core"/>
<genClasses ecoreClass="raspberry.ecore#//Bus"/>
<genClasses ecoreClass="raspberry.ecore#//Sensor"/>
<genClasses ecoreClass="raspberry.ecore#//Actuator"/>
<genClasses ecoreClass="raspberry.ecore#//SensorIn"/>
......
......@@ -28,32 +28,6 @@
<extension
point="org.fortiss.tooling.kernel.transformationProvider">
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.RaspberryPi1ExecutableTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.RaspberryPi1">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.executable.RaspberryPi1Executable">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.RaspberryPi2ExecutableTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.RaspberryPi2">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.executable.RaspberryPi2Executable">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.RaspberryPi3ExecutableTransformation">
<source>
......@@ -67,19 +41,6 @@
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.CoreExecutableTransformation">
<source>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.model.Core">
</objectClass>
</source>
<target>
<objectClass
objectClass="org.fortiss.af3.platform.raspberry.generator.executable.CoreExecutable">
</objectClass>
</target>
</transformationProvider>
<transformationProvider
transformationProvider="org.fortiss.af3.platform.raspberry.generator.transform.BusExecutableTransformation">
<source>
......@@ -342,12 +303,6 @@
</extension>
<extension
point="org.fortiss.tooling.base.annotation">
<annotation
binding="org.fortiss.af3.platform.raspberry.annotation.valueprovider.CoreAddressValueProvider">
<modelElementClass
modelElementClass="org.fortiss.af3.platform.raspberry.model.Core">
</modelElementClass>
</annotation>
<annotation
binding="org.fortiss.af3.platform.raspberry.annotation.valueprovider.PinNumberValueProvider">
<modelElementClass
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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 static org.fortiss.af3.generator.common.utils.SourceModelElementFactory.createStaticContentSourceUnit;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryUtils.getEcuForComponent;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryUtils.getTargetComponent;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findElementById;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.component.model.PortSpecification;
import org.fortiss.af3.deployment.model.ComponentAllocation;
import org.fortiss.af3.deployment.model.Deployment;
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.model.impl.PlatformConnectorUnitImpl;
import org.fortiss.af3.platform.raspberry.generated.files.RaspberryFileGeneration;
import org.fortiss.af3.platform.raspberry.model.annotation.PeripheralAddress;
import org.fortiss.af3.platform.raspberry.model.annotation.PinNumber;
import org.fortiss.af3.platform.raspberry.model.impl.ActuatorOutImpl;
import org.fortiss.af3.platform.raspberry.model.impl.SensorInImpl;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class BusExecutable extends TransmissionUnitExecutableBase<TransmissionUnit> {
/**
* @param modelElement
*/
public BusExecutable(TransmissionUnit modelElement) {
super(modelElement);
// TODO Auto-generated constructor stub
}
/** {@inheritDoc} */
@Override
public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair,
Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
int deploymentID) {
findBusSignals(deploymentID, topComponent, pack);
}
/**
* Finds Information about Signals that are transmitted over the Bus and form fields of the
* message.
*/
public void findBusSignals(int deploymentID, Component topComponent, SourcePackage pack) {
createProtoFile(deploymentID, topComponent, pack);
createHeaderFile(pack, "sensors");
createHeaderFile(pack, "actuators");
createFilesPeripheralDetails(pack);
}
/**
* Finds Information about Signals that are transmitted over the Bus and form fields of the
* message.
*/
private void createProtoFile(int deploymentID, Component topComponent, SourcePackage pack) {
String messageString = "message msg { \n";
int counter = 0;
Deployment currentDeployment =
(Deployment)findElementById(deploymentID, topComponent.eContainer().eContainer());
for(ComponentAllocation allocation : currentDeployment.getComponentAllocations()) {
Component c1 = allocation.getComponent();
Object lastPort = null;
for(Object port : c1.getConnectors()) {
if(port instanceof OutputPort) {
for(Component c2 : getTargetComponent((OutputPort)port)) {
if(getEcuForComponent(c1, currentDeployment) != getEcuForComponent(c2,
currentDeployment) &&
getEcuForComponent(c2, currentDeployment) != null) {
for(Object specs : ((OutputPort)port).getSpecifications()) {
if(specs instanceof PortSpecification && port != lastPort) {
lastPort = port;
counter = counter + 1;
PortSpecification portSpec = (PortSpecification)specs;
String prtType;
switch(portSpec.getType().toString()) {
case "int":
prtType = "int32";
break;
case "boolean":
prtType = "bool";
break;
default:
prtType = portSpec.getType().toString();
break;
}
messageString +=
"\t optional " + prtType + " " +
((OutputPort)port).getName().toLowerCase() +
"= " + counter + ";\n";
}
}
}
}
}
}
}
messageString += "}";
createFile(pack, messageString, "message.proto");
}
/** Determine Sensors, Actuators their IDs and PinNumbers. */
private void createFilesPeripheralDetails(SourcePackage pack) {
String sensorList = "#include \"sensors.h\" \n\n";
sensorList += "sensors sen[] = \n{ \n";
String actuatorList = "#include \"actuators.h\" \n\n";
actuatorList += "actuators act[] = \n{\n";
String componentsList = "#ifndef __COMPONENTS_H\n";
componentsList += "#define __COMPONENTS_H\n\n";
EList<IHierarchicElement> el = modelElement.getContainer().getContainedElements();
for(IHierarchicElement ce : el) {
EList<IConnector> conList = ce.getConnectors();
for(IConnector conn : conList) {
if(conn instanceof SensorInImpl) {
sensorList += addSensorSpecsToList((SensorInImpl)conn);
componentsList +=
componentDefine("SensorIn", ((PlatformConnectorUnitImpl)conn).getId());
}
if(conn instanceof ActuatorOutImpl) {
actuatorList += addSensorSpecsToList((ActuatorOutImpl)conn);
componentsList +=
componentDefine("ActuatorOut",
((PlatformConnectorUnitImpl)conn).getId());
}
}
}
sensorList = fixEnding(sensorList);
actuatorList = fixEnding(actuatorList);
componentsList += "\n#endif";
createFile(pack, sensorList, "sensors.c");
createFile(pack, actuatorList, "actuators.c");
createFile(pack, componentsList, "components.h");
}
private String fixEnding(String s) {
return s.substring(0, s.length() - ",\n".length()) + "\n};";
}
private String componentDefine(String s, int value) {
return "#define " + s + "_ID_" + value + " " + value + "\n";
}
/** Add specification of peripheral to the respective list of Sensors. */
private String addSensorSpecsToList(PlatformConnectorUnitImpl conn) {
int id = conn.getId();
int pinNr = 0;
int address = 0;
EList<IModelElementSpecification> specs = conn.getSpecifications();
for(IModelElementSpecification spec : specs) {
if(spec instanceof PinNumber) {
pinNr = ((PinNumber)spec).getPinNumber();
}
if(spec instanceof PeripheralAddress) {
address = ((PeripheralAddress)spec).getPeripheralAddress();
}
}
return "\t{" + id + ", " + pinNr + ", " + address + "},\n";
}
/** Create Header Files defining structure for actuator. */
private void createHeaderFile(SourcePackage pack, String type) {
String content = "#ifndef __" + type.toUpperCase() + "_H \n";
content += "#define __" + type.toUpperCase() + "_H \n\n";
content += "struct " + type + "\n{ \n";
content += "\tint Id;\n\tint pinNr;\n\tint address; \n};\n\n";
content += "typedef struct " + type + " " + type + ";\n\n";
content += "extern " + type + " " + type.substring(0, 3) + "[];\n\n";
content += "#endif \n \n";
createFile(pack, content, type + ".h");
}
/** Create file with a given Name and given text. */
private void createFile(SourcePackage pack, String text, String name) {
RaspberryFileGeneration file = new RaspberryFileGeneration(text);
file.createInfofile();
pack.addUnit(createStaticContentSourceUnit(name, file.getContent(), false));
}
}
......@@ -50,5 +50,4 @@ public class CANBusExecutable extends TransmissionUnitExecutableBase<Transmissio
Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
int deploymentID) {
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.BusExecutable;
import org.fortiss.af3.platform.raspberry.model.Bus;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class BusExecutableTransformation implements ITransformationProvider {
/** {@inheritDoc} */
@Override
public Class<?> getTargetClass() {
return BusExecutable.class;
}
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
return Bus.class.isAssignableFrom(sourceClass);
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
return source instanceof Bus;
}
/** {@inheritDoc} */
@Override
public Object transform(Object source, ITransformationContext context) {
return new BusExecutable((Bus)source);
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.raspberry.model.Bus;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class BusTransmissionCatalogTransformation implements ITransformationProvider {
/** {@inheritDoc} */
@Override
public Class<?> getTargetClass() {
return TransmissionCatalog.class;
}
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
return Bus.class.isAssignableFrom(sourceClass);
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
return source instanceof Bus;
}
/** {@inheritDoc} */
@Override
public Object transform(Object source, ITransformationContext context) {
return new TransmissionCatalog();
}
}
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 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.CoreExecutable;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.tooling.kernel.extension.ITransformationProvider;
import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
/**
*
* @author chaudhary
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class CoreExecutableTransformation implements ITransformationProvider {
/** {@inheritDoc} */
@Override
public Class<?> getTargetClass() {
return CoreExecutable.class;
}
/** {@inheritDoc} */
@Override
public boolean
canHandleChainTransformation(Class<?> sourceClass, ITransformationContext context) {
return Core.class.isAssignableFrom(sourceClass);
}
/** {@inheritDoc} */
@Override
public boolean canTransform(Object source, ITransformationContext context) {
return source instanceof Core;
}
/** {@inheritDoc} */
@Override
public Object transform(Object source, ITransformationContext context) {
return new CoreExecutable((Core)source);
}
}
......@@ -19,13 +19,11 @@ package org.fortiss.af3.platform.raspberry.utils;
import org.fortiss.af3.platform.raspberry.model.Actuator;
import org.fortiss.af3.platform.raspberry.model.ActuatorOut;
import org.fortiss.af3.platform.raspberry.model.Bus;
import org.fortiss.af3.platform.raspberry.model.BusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.BusMasterPort;
import org.fortiss.af3.platform.raspberry.model.CANBus;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterInterface;
import org.fortiss.af3.platform.raspberry.model.CANBusMasterPort;
import org.fortiss.af3.platform.raspberry.model.Core;
import org.fortiss.af3.platform.raspberry.model.ModelFactory;
import org.fortiss.af3.platform.raspberry.model.RaspberryPi3;
import org.fortiss.af3.platform.raspberry.model.Sensor;
......@@ -78,22 +76,6 @@ public class RaspberryModelElementFactory {
return raspberryPi3;
}
/** Creates a Core with a given name. */
public static Core createCore(String name) {
Core core = ModelFactory.eINSTANCE.createCore();
core.setName(name);
LayoutModelElementFactory.createNodeElementLayout(core);
return core;
}
/** Creates a Bus with a given name. */
public static Bus createBus(String name) {
Bus bus = ModelFactory.eINSTANCE.createBus();
bus.setName(name);
LayoutModelElementFactory.createConnectionLayout(bus);
return bus;
}
/** Creates a Bus with a given name. */
public static CANBus createCANBus(String name) {
CANBus canBus = ModelFactory.eINSTANCE.createCANBus();
......
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