diff --git a/org.fortiss.af3.platform.raspberry/code-gen-hal/inc/af3pihal/rumblepad.h b/org.fortiss.af3.platform.raspberry/code-gen-hal/inc/af3pihal/rumblepad.h index 225624ff9a7d0528a9dbb1b9c2a7ff180d4f8d98..d48208acaa50433d11babb75267b26833349718a 100644 --- a/org.fortiss.af3.platform.raspberry/code-gen-hal/inc/af3pihal/rumblepad.h +++ b/org.fortiss.af3.platform.raspberry/code-gen-hal/inc/af3pihal/rumblepad.h @@ -59,7 +59,11 @@ int16_t rumblepad_get_axis_position(uint16_t axisID); /** Get the button state for the given button. */ int16_t rumblepad_get_button_state(uint16_t buttonID); +/** Set the rumble state */ +void rumblepad_set_rumble(uint16_t strong_magnitude, uint16_t weak_magnitude, uint16_t length, uint16_t delay); + /** Terminates the rumblepad thread and frees its resources. */ void rumblepad_terminate(); #endif /* INC_RUMBLEPAD_H_ */ + diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/.ratings index 4785829b32c990541b7a4b9e88f99fcaac40a1cf..f8248be7d88cd8cd086663dda67efb561f5391c9 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/.ratings +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/.ratings @@ -5,5 +5,5 @@ ConsoleOutputExecutable.java 5b8c50f2236ad49958a0a0b599a7e60265a6fc06 YELLOW HeaderCopyGenerator.java 18239a3adae35256e32dad19df9d8f38acbf7e66 RED MultiUnitMainGenerator.java 458754b89c2d79db3fee08baa444424772e40fb7 RED PWMActuatorExecutable.java 9068846c7ff04c034da6493067fcebf73051de98 YELLOW -RaspberryPIExecutable.java 2c3ac0beaf690ebdb0a0a60ffcacaaf50a49e242 RED +RaspberryPIExecutable.java f94071537e9596817e7895cf79e4202d24224087 RED SingleUnitMainGenerator.java e1df0d82804fd0622b97ecde827844da30370e14 RED diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java index 2c3ac0beaf690ebdb0a0a60ffcacaaf50a49e242..f94071537e9596817e7895cf79e4202d24224087 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java @@ -108,7 +108,7 @@ public class RaspberryPIExecutable extends ExecutionUnitExecutableBase<Raspberry addPlatformElementsCode(deployedPorts); addDataDictionaryCode(); addLogicalComponentCode(deployedComponents); - // addMainFile(deployedComponents, deployedPorts); + addMainFile(deployedComponents, deployedPorts); } catch(Exception ex) { error(AF3PlatformRaspberryActivator.getDefault(), ex.getMessage(), ex); ex.printStackTrace(); @@ -305,12 +305,14 @@ public class RaspberryPIExecutable extends ExecutionUnitExecutableBase<Raspberry /** {@inheritDoc} */ @Override public IExpressionTerm getInitialization() { + // not used return null; } /** {@inheritDoc} */ @Override public IExpressionTerm getTermination() { + // not used return null; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/.ratings index 91bca0504cf99af93cc8f3ba9fe5d3b6c184bd0e..a6a6e091e3505a4c48d03e7895a5d823d10f17a8 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/.ratings +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/.ratings @@ -2,7 +2,7 @@ Button1Executable.java 4419314d71af50239cf6933a83a0f652614cf368 YELLOW Button2Executable.java 3af03ceea3aa09178fe88fe630c94282de0b72f2 YELLOW Button3Executable.java 964fbe4e0b5282ab617c4be2bed31afa8b4f394f YELLOW Button4Executable.java 53db1cce9e3dfface4027f883586bf90638cd4ff YELLOW -ButtonExecutableBase.java 0b7b23652e94f2bf2544b1cba79a298e53d458e7 YELLOW +ButtonExecutableBase.java 02e5bb6aa21183fc9444ec1874c67660908a55d2 YELLOW ButtonL1Executable.java ab68cddae1d323ff0ecd7956133c44d1ef0f9168 YELLOW ButtonL2Executable.java 336b9d8d26a682b701f7a2ca078369c9cc621fbb YELLOW ButtonR1Executable.java 700ef701ed77a0d3f8141166fe647ac5cd4ad570 YELLOW @@ -12,4 +12,4 @@ Left_StickXExecutable.java c3e7f28f44fa27bd79e14ed7e60f44be2dc5a9ab YELLOW Left_StickYExecutable.java f81cc1e3124eb712507825bc54e7d0f633fde640 YELLOW Right_StickXExecutable.java ade165c88d0c6758efa167e5ba445eff87a0fd79 YELLOW Right_StickYExecutable.java 891ea877d8c3f4bab6072a02b17bb92a6caa055d YELLOW -StickExecutableBase.java 01fc6a6617fb6631c105933127de59be59f7915f YELLOW +StickExecutableBase.java 970b8645af2ab59b9a4f8286f59e27fa38f6c1c0 YELLOW diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonExecutableBase.java index 0b7b23652e94f2bf2544b1cba79a298e53d458e7..02e5bb6aa21183fc9444ec1874c67660908a55d2 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonExecutableBase.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/ButtonExecutableBase.java @@ -28,8 +28,8 @@ import org.fortiss.af3.platform.language.executable.IReadableExecutable; * * @author hoelzl */ -public abstract class ButtonExecutableBase<T extends EObject> extends GamepadExecutableBase<T> - implements IReadableExecutable { +abstract class ButtonExecutableBase<T extends EObject> extends GamepadExecutableBase<T> implements + IReadableExecutable { /** Constructor. */ public ButtonExecutableBase(T modelElement) { super(modelElement); diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/StickExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/StickExecutableBase.java index 01fc6a6617fb6631c105933127de59be59f7915f..970b8645af2ab59b9a4f8286f59e27fa38f6c1c0 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/StickExecutableBase.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/gamepad/StickExecutableBase.java @@ -28,8 +28,8 @@ import org.fortiss.af3.platform.language.executable.IReadableExecutable; * * @author hoelzl */ -public abstract class StickExecutableBase<T extends EObject> extends GamepadExecutableBase<T> - implements IReadableExecutable { +abstract class StickExecutableBase<T extends EObject> extends GamepadExecutableBase<T> implements + IReadableExecutable { /** Constructor. */ public StickExecutableBase(T modelElement) { super(modelElement); diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/.ratings index 18a95742a3a8068dc15880f9d69e03bfd9677d87..90b84b781a62c3cd61265f893cfdddc490b01d77 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/.ratings +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/.ratings @@ -1,22 +1,25 @@ -ButtonAExecutable.java 0661a0f5c1fbe12fbed00896365a381f1fbc8650 RED -ButtonBExecutable.java 63073452a6f445ce3ccf59dbdbb8b7a9d8ea5584 RED -ButtonHomeExecutable.java a04d161d5ea0b70dae3db7494adc082207978d56 RED -ButtonL1Executable.java e8523f64013920c0a29e1626217ff92ccd73cff0 RED -ButtonL3Executable.java 6b4d7f9e85bfd55699754e4703aa08f9a00f32b7 RED -ButtonR1Executable.java bfbf0248c4ab7ac171d1e26b83bb5e24af13cab0 RED -ButtonR3Executable.java e70cec4e4779ec85b5185699bb7d7442e842549d RED -ButtonSelectExecutable.java ecc252e9892fbaf57ce838a45760ba14bbdb4bd7 RED -ButtonStartExecutable.java d13a109bc2c7064dc28aa8b100a660d6be9ee45c RED -ButtonXExecutable.java 99b1faf901604ccad9cd25f8b14837e5244ab7af RED -ButtonYExecutable.java c4813f82130418137d62c9994be37133950877d7 RED -DPadDownExecutable.java 7aa0aaab994e22fd446b0ef8770441e09bc2bf29 RED -DPadLeftExecutable.java 0cee35a8f6b874ebee76b7165f09198bdde163cb RED -DPadRightExecutable.java 52e2e59c1669700f0127fb0b0c70a2d558487944 RED -DPadUpExecutable.java f7568fb11774be0caa9b72cbde666651a412012f RED -L2PositionExecutable.java b944b26d961dd24e2cce3b9f47a2f3631b580f35 RED -Left_StickXExecutable.java 6347ebc9366b3d835eeb967fdd27d187b812006f RED -Left_StickYExecutable.java 33894565b5482f28ec7b5eb9d182da67fbd0d0e0 RED -R2PositionExecutable.java eaafe55ee446e2b5d88aed210102b9a6e8cb9bd2 RED -Right_StickXExecutable.java fc1ab5ea6c40323e2b9ed5d63025112cd53bc52d RED -Right_StickYExecutable.java b7826a54892d3ed9a18fb1a0ba6c2ac93cd2ae45 RED -SimpleRumbleFeatureExecutable.java 42520aedc5cf9e249e6df0be6bb2421f3d6f3b14 RED +ButtonAExecutable.java bbcb151d851b1b3d3e97b7e11b790fa13559fd96 YELLOW +ButtonBExecutable.java d659e04dc60cba0808bd2fceae22fcbc1bd203a9 YELLOW +ButtonExecutableBase.java fd0f182816404870725255efeebfbc07c22a8295 YELLOW +ButtonHomeExecutable.java e3a19a82d2cafd3bc75b6a7fc1a75df5656df48c YELLOW +ButtonL1Executable.java 68fac6c2abc7ea40eb7cc16839677a4cdc24111a YELLOW +ButtonL3Executable.java 2d04b51ee7ab822419140cf69821bbcbcfded359 YELLOW +ButtonR1Executable.java cc9b1332e442f3875191fdc2d4fa26bcc94f1b13 YELLOW +ButtonR3Executable.java 4eb79b5e65829beeb0c65686c2ee1b97af02c60b YELLOW +ButtonSelectExecutable.java a141f9ea800c48c10f9a1695fe7c730873a3b021 YELLOW +ButtonStartExecutable.java d5dae399a944aafdccb80fea4273686afeaf65a8 YELLOW +ButtonXExecutable.java 1bd0abb2cd33731bc1a501c5b523074a37847512 YELLOW +ButtonYExecutable.java 703c9497600ca405b7dc2adb143179cf12aa5806 YELLOW +DPadDownExecutable.java f19d39030b1370ea0d0f00727dd7e75635442760 YELLOW +DPadLeftExecutable.java 1026fae470429fb99427adfccf494832f504a378 YELLOW +DPadRightExecutable.java f354bdd8767b4c28e419dcb514f47521a526a01b YELLOW +DPadUpExecutable.java e7a11870695ede63519696b071d30a4c93d6f9d3 YELLOW +L2PositionExecutable.java 6d75fd0b020819a38b1c3ddda9aa9ed536832108 YELLOW +Left_StickXExecutable.java 41667a015567298cfceee981d8c1f309e6cd97b5 YELLOW +Left_StickYExecutable.java cc2b36f9bca913dc1956f34495cf9c77acb13c88 YELLOW +R2PositionExecutable.java 19f778392841d02d281fd856564b75e1333dffaa YELLOW +Right_StickXExecutable.java 97656a2ae56a70eac88153b123f2cd9c584af967 YELLOW +Right_StickYExecutable.java f3d942123ca47d0ddbf32f4f46bfaf2b21732653 YELLOW +RumblepadExecutableBase.java 35438b51af2212c2e169fb7008e9fe45c9b1aef6 YELLOW +SimpleRumbleFeatureExecutable.java 413b6fb3f5847f0d09f52341c98b95f74c352016 YELLOW +StickExecutableBase.java 372150ca78a1ee736bbb2910b266ca05d52aa04f YELLOW diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonAExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonAExecutable.java index 0661a0f5c1fbe12fbed00896365a381f1fbc8650..bbcb151d851b1b3d3e97b7e11b790fa13559fd96 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonAExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonAExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonA; /** Executable for {@link ButtonA}. */ -public class ButtonAExecutable extends ReceiverExecutableBase<ButtonA> { - +public class ButtonAExecutable extends ButtonExecutableBase<ButtonA> { /** Constructor. */ public ButtonAExecutable(ButtonA modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnA_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnA_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_A"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonBExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonBExecutable.java index 63073452a6f445ce3ccf59dbdbb8b7a9d8ea5584..d659e04dc60cba0808bd2fceae22fcbc1bd203a9 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonBExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonBExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonB; /** Executable for {@link ButtonB}. */ -public class ButtonBExecutable extends ReceiverExecutableBase<ButtonB> { - +public class ButtonBExecutable extends ButtonExecutableBase<ButtonB> { /** Constructor. */ public ButtonBExecutable(ButtonB modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnB_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnB_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_B"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonExecutableBase.java new file mode 100644 index 0000000000000000000000000000000000000000..fd0f182816404870725255efeebfbc07c22a8295 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonExecutableBase.java @@ -0,0 +1,46 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2018 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.rumblepad; + +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.rawString; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.language.executable.IReadableExecutable; + +/** + * Base class for executables reading rumblepad buttons. + * + * @author hoelzl + */ +abstract class ButtonExecutableBase<T extends EObject> extends RumblepadExecutableBase<T> implements + IReadableExecutable { + /** Constructor. */ + public ButtonExecutableBase(T modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public final IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return funcCall("rumblepad_get_button_state", rawString(getButtonIdentifier())); + } + + /** Returns the button identifier as defined in {@code rumblepad.h}. */ + protected abstract String getButtonIdentifier(); +} diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonHomeExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonHomeExecutable.java index a04d161d5ea0b70dae3db7494adc082207978d56..e3a19a82d2cafd3bc75b6a7fc1a75df5656df48c 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonHomeExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonHomeExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonHome; /** Executable for {@link ButtonHome}. */ -public class ButtonHomeExecutable extends ReceiverExecutableBase<ButtonHome> { - +public class ButtonHomeExecutable extends ButtonExecutableBase<ButtonHome> { /** Constructor. */ public ButtonHomeExecutable(ButtonHome modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnHome_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnHome_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_MODE"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL1Executable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL1Executable.java index e8523f64013920c0a29e1626217ff92ccd73cff0..68fac6c2abc7ea40eb7cc16839677a4cdc24111a 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL1Executable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL1Executable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonL1; /** Executable for {@link ButtonL1}. */ -public class ButtonL1Executable extends ReceiverExecutableBase<ButtonL1> { - +public class ButtonL1Executable extends ButtonExecutableBase<ButtonL1> { /** Constructor. */ public ButtonL1Executable(ButtonL1 modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL1_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL1_read"); + /** {@inheritDoc} */ + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_L1"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL3Executable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL3Executable.java index 6b4d7f9e85bfd55699754e4703aa08f9a00f32b7..2d04b51ee7ab822419140cf69821bbcbcfded359 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL3Executable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonL3Executable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonL3; /** Executable for {@link ButtonL3}. */ -public class ButtonL3Executable extends ReceiverExecutableBase<ButtonL3> { - +public class ButtonL3Executable extends ButtonExecutableBase<ButtonL3> { /** Constructor. */ public ButtonL3Executable(ButtonL3 modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL3_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL3_read"); + /** {@inheritDoc} */ + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_L3"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR1Executable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR1Executable.java index bfbf0248c4ab7ac171d1e26b83bb5e24af13cab0..cc9b1332e442f3875191fdc2d4fa26bcc94f1b13 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR1Executable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR1Executable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonR1; /** Executable for {@link ButtonR1}. */ -public class ButtonR1Executable extends ReceiverExecutableBase<ButtonR1> { - +public class ButtonR1Executable extends ButtonExecutableBase<ButtonR1> { /** Constructor. */ public ButtonR1Executable(ButtonR1 modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR1_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR1_read"); + /** {@inheritDoc} */ + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_R1"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR3Executable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR3Executable.java index e70cec4e4779ec85b5185699bb7d7442e842549d..4eb79b5e65829beeb0c65686c2ee1b97af02c60b 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR3Executable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonR3Executable.java @@ -15,33 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonR3; /** Executable for {@link ButtonR3}. */ -public class ButtonR3Executable extends ReceiverExecutableBase<ButtonR3> { +public class ButtonR3Executable extends ButtonExecutableBase<ButtonR3> { /** Constructor. */ public ButtonR3Executable(ButtonR3 modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR3_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR3_read"); + /** {@inheritDoc} */ + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_R3"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonSelectExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonSelectExecutable.java index ecc252e9892fbaf57ce838a45760ba14bbdb4bd7..a141f9ea800c48c10f9a1695fe7c730873a3b021 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonSelectExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonSelectExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonSelect; /** Executable for {@link ButtonSelect}. */ -public class ButtonSelectExecutable extends ReceiverExecutableBase<ButtonSelect> { - +public class ButtonSelectExecutable extends ButtonExecutableBase<ButtonSelect> { /** Constructor. */ public ButtonSelectExecutable(ButtonSelect modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnSelect_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnSelect_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_SELECT"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonStartExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonStartExecutable.java index d13a109bc2c7064dc28aa8b100a660d6be9ee45c..d5dae399a944aafdccb80fea4273686afeaf65a8 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonStartExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonStartExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonStart; /** Executable for {@link ButtonStart}. */ -public class ButtonStartExecutable extends ReceiverExecutableBase<ButtonStart> { - +public class ButtonStartExecutable extends ButtonExecutableBase<ButtonStart> { /** Constructor. */ public ButtonStartExecutable(ButtonStart modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnStart_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnStart_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_START"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonXExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonXExecutable.java index 99b1faf901604ccad9cd25f8b14837e5244ab7af..1bd0abb2cd33731bc1a501c5b523074a37847512 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonXExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonXExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonX; /** Executable for {@link ButtonX}. */ -public class ButtonXExecutable extends ReceiverExecutableBase<ButtonX> { - +public class ButtonXExecutable extends ButtonExecutableBase<ButtonX> { /** Constructor. */ public ButtonXExecutable(ButtonX modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnX_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnX_read"); + /** {@inheritDoc} */ + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_X"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonYExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonYExecutable.java index c4813f82130418137d62c9994be37133950877d7..703c9497600ca405b7dc2adb143179cf12aa5806 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonYExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/ButtonYExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonY; /** Executable for {@link ButtonY}. */ -public class ButtonYExecutable extends ReceiverExecutableBase<ButtonY> { - +public class ButtonYExecutable extends ButtonExecutableBase<ButtonY> { /** Constructor. */ public ButtonYExecutable(ButtonY modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnY_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnY_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_Y"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadDownExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadDownExecutable.java index 7aa0aaab994e22fd446b0ef8770441e09bc2bf29..f19d39030b1370ea0d0f00727dd7e75635442760 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadDownExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadDownExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadDown; /** Executable for {@link DPadDown}. */ -public class DPadDownExecutable extends ReceiverExecutableBase<DPadDown> { - +public class DPadDownExecutable extends ButtonExecutableBase<DPadDown> { /** Constructor. */ public DPadDownExecutable(DPadDown modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadDown_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadDown_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_DPAD_DOWN"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadLeftExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadLeftExecutable.java index 0cee35a8f6b874ebee76b7165f09198bdde163cb..1026fae470429fb99427adfccf494832f504a378 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadLeftExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadLeftExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadLeft; /** Executable for {@link DPadLeft}. */ -public class DPadLeftExecutable extends ReceiverExecutableBase<DPadLeft> { - +public class DPadLeftExecutable extends ButtonExecutableBase<DPadLeft> { /** Constructor. */ public DPadLeftExecutable(DPadLeft modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadLeft_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadLeft_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_DPAD_LEFT"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadRightExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadRightExecutable.java index 52e2e59c1669700f0127fb0b0c70a2d558487944..f354bdd8767b4c28e419dcb514f47521a526a01b 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadRightExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadRightExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadRight; /** Executable for {@link DPadRight}. */ -public class DPadRightExecutable extends ReceiverExecutableBase<DPadRight> { - +public class DPadRightExecutable extends ButtonExecutableBase<DPadRight> { /** Constructor. */ public DPadRightExecutable(DPadRight modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadRight_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadRight_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_DPAD_RIGHT"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadUpExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadUpExecutable.java index f7568fb11774be0caa9b72cbde666651a412012f..e7a11870695ede63519696b071d30a4c93d6f9d3 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadUpExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/DPadUpExecutable.java @@ -15,38 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.DPadUp; /** Executable for {@link DPadUp}. */ -public class DPadUpExecutable extends ReceiverExecutableBase<DPadUp> { - +public class DPadUpExecutable extends ButtonExecutableBase<DPadUp> { /** Constructor. */ public DPadUpExecutable(DPadUp modelElement) { super(modelElement); } /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadUp_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnDPadUp_read"); + @Override + protected String getButtonIdentifier() { + return "RUMBLEPAD_BUTTON_DPAD_UP"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/L2PositionExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/L2PositionExecutable.java index b944b26d961dd24e2cce3b9f47a2f3631b580f35..6d75fd0b020819a38b1c3ddda9aa9ed536832108 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/L2PositionExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/L2PositionExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.L2_Position; /** Executable for {@link L2_Position}. */ -public class L2PositionExecutable extends ReceiverExecutableBase<L2_Position> { - +public class L2PositionExecutable extends StickExecutableBase<L2_Position> { /** Constructor. */ public L2PositionExecutable(L2_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL2_Position_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnL2_Position_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_L2"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickXExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickXExecutable.java index 6347ebc9366b3d835eeb967fdd27d187b812006f..41667a015567298cfceee981d8c1f309e6cd97b5 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickXExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickXExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.Left_StickX_Position; /** Executable for {@link Left_StickX_Position}. */ -public class Left_StickXExecutable extends ReceiverExecutableBase<Left_StickX_Position> { - +public class Left_StickXExecutable extends StickExecutableBase<Left_StickX_Position> { /** Constructor. */ public Left_StickXExecutable(Left_StickX_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnLX_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnLX_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_LEFT_STICK_HORIZONTAL"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickYExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickYExecutable.java index 33894565b5482f28ec7b5eb9d182da67fbd0d0e0..cc2b36f9bca913dc1956f34495cf9c77acb13c88 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickYExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Left_StickYExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.Left_StickY_Position; /** Executable for {@link Left_StickY_Position}. */ -public class Left_StickYExecutable extends ReceiverExecutableBase<Left_StickY_Position> { - +public class Left_StickYExecutable extends StickExecutableBase<Left_StickY_Position> { /** Constructor. */ public Left_StickYExecutable(Left_StickY_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnLY_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnLY_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_LEFT_STICK_VERTICAL"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/R2PositionExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/R2PositionExecutable.java index eaafe55ee446e2b5d88aed210102b9a6e8cb9bd2..19f778392841d02d281fd856564b75e1333dffaa 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/R2PositionExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/R2PositionExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.R2_Position; /** Executable for {@link R2_Position}. */ -public class R2PositionExecutable extends ReceiverExecutableBase<R2_Position> { - +public class R2PositionExecutable extends StickExecutableBase<R2_Position> { /** Constructor. */ public R2PositionExecutable(R2_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR2_Position_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnR2_Position_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_R2"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickXExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickXExecutable.java index fc1ab5ea6c40323e2b9ed5d63025112cd53bc52d..97656a2ae56a70eac88153b123f2cd9c584af967 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickXExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickXExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.Right_StickX_Position; /** Executable for {@link Right_StickX_Position}. */ -public class Right_StickXExecutable extends ReceiverExecutableBase<Right_StickX_Position> { - +public class Right_StickXExecutable extends StickExecutableBase<Right_StickX_Position> { /** Constructor. */ public Right_StickXExecutable(Right_StickX_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnRX_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnRX_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_RIGHT_STICK_HORIZONTAL"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickYExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickYExecutable.java index b7826a54892d3ed9a18fb1a0ba6c2ac93cd2ae45..f3d942123ca47d0ddbf32f4f46bfaf2b21732653 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickYExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/Right_StickYExecutable.java @@ -15,34 +15,18 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; -import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; - -import org.fortiss.af3.component.model.InputPort; -import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.ReceiverExecutableBase; import org.fortiss.af3.platform.raspberry.model.rumblepad.Right_StickY_Position; /** Executable for {@link Right_StickY_Position}. */ -public class Right_StickYExecutable extends ReceiverExecutableBase<Right_StickY_Position> { - +public class Right_StickYExecutable extends StickExecutableBase<Right_StickY_Position> { /** Constructor. */ public Right_StickYExecutable(Right_StickY_Position modelElement) { super(modelElement); } - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_btnRY_is_noval"); - } - - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - - public IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { - return funcCall("rp_btnRY_read"); + /** {@inheritDoc} */ + @Override + protected String getAxisIdentifier() { + return "RUMBLEPAD_AXIS_RIGHT_STICK_VERTICAL"; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/RumblepadExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/RumblepadExecutableBase.java new file mode 100644 index 0000000000000000000000000000000000000000..35438b51af2212c2e169fb7008e9fe45c9b1aef6 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/RumblepadExecutableBase.java @@ -0,0 +1,61 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2018 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.rumblepad; + +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.rawString; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.raspberry.generator.executable.framework.ISingletonInitializableExecutable; +import org.fortiss.af3.platform.raspberry.generator.executable.library.PiHALLibraryExecutableBase; +import org.fortiss.af3.platform.raspberry.model.rumblepad.RumblepadPackage; + +/** + * Base class for all executables of the rumblepad. + * + * @author hoelzl + */ +abstract class RumblepadExecutableBase<T extends EObject> extends PiHALLibraryExecutableBase<T> + implements ISingletonInitializableExecutable { + /** Constructor. */ + public RumblepadExecutableBase(T modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public final IExpressionTerm getInitialization() { + return rawString("rumblepad_configuration_t* rumblepad_config = malloc(sizeof(rumblepad_configuration_t));\n" + + "rumblepad_config->device_id = \"/dev/input/js0\";\n" + + "rumblepad_config->waiting_sleep_in_micros = 50;\n" + + "rumblepad_config->axis_callback = NULL;\n" + + "rumblepad_config->button_callback = NULL;" + + "rumblepad_initialize(rumblepad_config);\n\n"); + } + + /** {@inheritDoc} */ + @Override + public final String getSingletonInitializationIdentifier() { + // use EMF package as singleton identifier + return RumblepadPackage.eNS_URI; + } + + /** {@inheritDoc} */ + @Override + public final String getHeaderFileName() { + return "rumblepad.h"; + } +} diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/SimpleRumbleFeatureExecutable.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/SimpleRumbleFeatureExecutable.java index 42520aedc5cf9e249e6df0be6bb2421f3d6f3b14..413b6fb3f5847f0d09f52341c98b95f74c352016 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/SimpleRumbleFeatureExecutable.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/SimpleRumbleFeatureExecutable.java @@ -16,38 +16,28 @@ package org.fortiss.af3.platform.raspberry.generator.executable.rumblepad; import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.intConst; -import org.fortiss.af3.component.model.InputPort; import org.fortiss.af3.component.model.OutputPort; +import org.fortiss.af3.expression.model.terms.FunctionCall; import org.fortiss.af3.expression.model.terms.IExpressionTerm; -import org.fortiss.af3.platform.language.executable.TransmitterExecutableBase; +import org.fortiss.af3.platform.language.executable.IWritableExecutable; import org.fortiss.af3.platform.raspberry.model.rumblepad.SimpleRumbleFeature; /** Executable for {@link SimpleRumbleFeature}. */ -public class SimpleRumbleFeatureExecutable extends TransmitterExecutableBase<SimpleRumbleFeature> { +public class SimpleRumbleFeatureExecutable extends RumblepadExecutableBase<SimpleRumbleFeature> + implements IWritableExecutable { /** Constructor. */ public SimpleRumbleFeatureExecutable(SimpleRumbleFeature modelElement) { super(modelElement); } - /** {@inheritDoc} */ - public IExpressionTerm getInitialization() { - return funcCall("rp_init"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getNoValGuardAccessor(InputPort logicalSignal) { - return funcCall("rp_simpleRumble_is_noval"); - } - - /** {@inheritDoc} */ - public IExpressionTerm getTermination() { - return funcCall("rp_term"); - } - /** {@inheritDoc} */ @Override public IExpressionTerm getValueWriteAccessor(OutputPort logicalSignal, IExpressionTerm value) { - return funcCall("rp_simpleRumble_write"); + FunctionCall fc = funcCall("rumblepad_set_rumble", value, value); + fc.getArguments().add(intConst(500)); + fc.getArguments().add(intConst(0)); + return fc; } } diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/StickExecutableBase.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/StickExecutableBase.java new file mode 100644 index 0000000000000000000000000000000000000000..372150ca78a1ee736bbb2910b266ca05d52aa04f --- /dev/null +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/generator/executable/rumblepad/StickExecutableBase.java @@ -0,0 +1,46 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2018 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.rumblepad; + +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.funcCall; +import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.rawString; + +import org.eclipse.emf.ecore.EObject; +import org.fortiss.af3.component.model.InputPort; +import org.fortiss.af3.expression.model.terms.IExpressionTerm; +import org.fortiss.af3.platform.language.executable.IReadableExecutable; + +/** + * Base class for executables reading rumblepad sticks and axis inputs. + * + * @author hoelzl + */ +abstract class StickExecutableBase<T extends EObject> extends RumblepadExecutableBase<T> implements + IReadableExecutable { + /** Constructor. */ + public StickExecutableBase(T modelElement) { + super(modelElement); + } + + /** {@inheritDoc} */ + @Override + public final IExpressionTerm getValueReadAccessor(InputPort logicalSignal) { + return funcCall("rumblepad_get_axis_position", rawString(getAxisIdentifier())); + } + + /** Returns the axis identifier as defined in {@code rumblepad.h}. */ + protected abstract String getAxisIdentifier(); +}