| /** |
| * ******************************************************************************* |
| * Copyright (c) 2019 Robert Bosch GmbH and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package templates.m2m.os |
| |
| import com.inchron.realtime.root.model.Model |
| import org.eclipse.app4mc.amalthea.model.OSModel |
| import templates.AbstractAmaltheaInchronTransformer |
| import org.eclipse.app4mc.amalthea.model.OperatingSystem |
| import com.google.inject.Singleton |
| |
| @Singleton |
| class OSTransformer extends AbstractAmaltheaInchronTransformer { |
| |
| |
| def transfromOSModel(OSModel amltHWModel, Model inchronModel) { |
| |
| amltHWModel.operatingSystems.forEach [ amltOS | |
| var inchronSystem = createGenericSystem(amltOS) |
| |
| // Adding Inchron System object to Model |
| inchronModel.systems.add(inchronSystem) |
| ] |
| } |
| |
| def create inchronModelFactory.createGenericSystem createGenericSystem(OperatingSystem amltOS){ |
| |
| it.name = amltOS.name + "_SYSTEM" |
| |
| it.components.add(createComponent(amltOS)) |
| |
| it.rtosConfig = createRtosConfig(amltOS) |
| |
| // RtosModel with default attributes |
| it.rtosModel = createRtosModel(amltOS) |
| } |
| |
| def create inchronModelFactory.createComponent createComponent(OperatingSystem amltOS){ |
| it.name = amltOS.name + "_SWC" |
| } |
| |
| def create inchronModelFactory.createRtosConfig createRtosConfig(OperatingSystem amltOS){ |
| it.name = amltOS.name |
| } |
| |
| def create inchronModelFactory.createRtosModel createRtosModel(OperatingSystem amltOS){ |
| it.name = "generic" |
| it.returnType = "void" |
| } |
| |
| } |