From 2e619cb19c0a2194b11446d3cda49e0205d2ce05 Mon Sep 17 00:00:00 2001 From: Florian Hoelzl <hoelzl@fortiss.org> Date: Tue, 29 May 2018 11:51:00 +0200 Subject: [PATCH] Added UI for control center elements. Signed-off-by: Florian Hoelzl <hoelzl@fortiss.org> --- .../plugin.xml | 18 ++ .../platform/raspberry/ui/editpart/.ratings | 2 +- .../editpart/RaspberryPiEditPartFactory.java | 6 +- .../platform/raspberry/ui/handler/.ratings | 2 + .../ControlCenterDownstreamInputHandler.java | 27 +++ .../ControlCenterUpstreamOutputHandler.java | 27 +++ .../platform/raspberry/ui/properties/.ratings | 2 +- ...spberryPiExecutionUnitPropertySection.java | 16 ++ .../platform/raspberry/ui/prototype/.ratings | 2 +- .../ui/prototype/ProtoypeProvider.java | 191 ++++++++++++------ .../META-INF/MANIFEST.MF | 3 + .../af3/platform/raspberry/compose/.ratings | 2 +- .../compose/RaspberryPiCompositor.java | 5 +- 13 files changed, 237 insertions(+), 66 deletions(-) create mode 100644 org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterDownstreamInputHandler.java create mode 100644 org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterUpstreamOutputHandler.java diff --git a/org.fortiss.af3.platform.raspberry.ui/plugin.xml b/org.fortiss.af3.platform.raspberry.ui/plugin.xml index 12a1e64d..63087657 100644 --- a/org.fortiss.af3.platform.raspberry.ui/plugin.xml +++ b/org.fortiss.af3.platform.raspberry.ui/plugin.xml @@ -72,10 +72,28 @@ <modelElementClass modelElementClass="org.fortiss.af3.platform.raspberry.model.brick.UIDUnit"> </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput"> + </modelElementClass> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput"> + </modelElementClass> </editPartFactory> </extension> <extension point="org.fortiss.tooling.kernel.ui.modelElementHandler"> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.ControlCenterDownstreamInputHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput"> + </modelElementClass> + </modelElementHandler> + <modelElementHandler + handler="org.fortiss.af3.platform.raspberry.ui.handler.ControlCenterUpstreamOutputHandler"> + <modelElementClass + modelElementClass="org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput"> + </modelElementClass> + </modelElementHandler> <modelElementHandler handler="org.fortiss.af3.platform.raspberry.ui.handler.PWMActuatorHandler"> <modelElementClass diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/.ratings b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/.ratings index ee85a7a3..e50fb3a4 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/.ratings +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/.ratings @@ -1 +1 @@ -RaspberryPiEditPartFactory.java f0997ba41908982c13eaeddf10d83a74d52dc570 YELLOW +RaspberryPiEditPartFactory.java d0429302194e3669d3dfa0ac62847618b0d28436 YELLOW diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/RaspberryPiEditPartFactory.java b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/RaspberryPiEditPartFactory.java index f0997ba4..d0429302 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/RaspberryPiEditPartFactory.java +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/editpart/RaspberryPiEditPartFactory.java @@ -29,6 +29,8 @@ import org.fortiss.af3.platform.raspberry.model.camera.CameraDetectionStateRight import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceLeft; import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceRight; import org.fortiss.af3.platform.raspberry.model.camera.CameraYawAngle; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput; import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase; import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput; import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput; @@ -71,7 +73,9 @@ public class RaspberryPiEditPartFactory implements IEditPartFactory { model instanceof MotorControlOutput || model instanceof CameraDistanceLeft || model instanceof CameraDistanceRight || model instanceof CameraYawAngle || model instanceof CameraDetectionStateLeft || - model instanceof CameraDetectionStateRight) { + model instanceof CameraDetectionStateRight || + model instanceof ControlCenterUpstreamOutput || + model instanceof ControlCenterDownstreamInput) { return new StickyPlatformConnectorUnitEditPart((PlatformConnectorUnit)model); } return null; diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/.ratings b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/.ratings index e6f1269f..fb77effe 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/.ratings +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/.ratings @@ -3,6 +3,8 @@ CameraInputHandler.java fd5eb60cc1b56cb8f3662c2207dc0ba37e20cb5f YELLOW CanBusHandler.java 5d4dbf229daec81e5eecc4ebfb8f8bc2680f2992 YELLOW CanConnectorHandler.java 3eb2adf8ec6336269d66395025b7ac2050876a79 YELLOW ConsoleOutputHandler.java 364124b954ab0429425e9de71dbe0f7a99e499f9 YELLOW +ControlCenterDownstreamInputHandler.java 5bea85b5228110c87728c0503348bc1e2d3ed370 YELLOW +ControlCenterUpstreamOutputHandler.java 27e8ecb75d11c1dd128572a6bae05ab811a5f67d YELLOW GamepadReceiverHandler.java ff81c9f3e941ba8a2b880b3982f63f71f698569b YELLOW IconModelElementHandlerBase.java 1ebc38a537ec2c87fb7b031df5ddd53f10072af2 YELLOW MotorControlInputHandler.java b5d0f0627c7c14c1ed4cc1e36a761e938a5a4c9e YELLOW diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterDownstreamInputHandler.java b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterDownstreamInputHandler.java new file mode 100644 index 00000000..5bea85b5 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterDownstreamInputHandler.java @@ -0,0 +1,27 @@ +/*-------------------------------------------------------------------------+ +| 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.ui.handler; + +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput; + +/** {@link IconModelElementHandlerBase} for {@link ControlCenterDownstreamInput}s. */ +public class ControlCenterDownstreamInputHandler extends + IconModelElementHandlerBase<ControlCenterDownstreamInput> { + /** Constructor. */ + public ControlCenterDownstreamInputHandler() { + super("icons/unknown.png"); + } +} diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterUpstreamOutputHandler.java b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterUpstreamOutputHandler.java new file mode 100644 index 00000000..27e8ecb7 --- /dev/null +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/handler/ControlCenterUpstreamOutputHandler.java @@ -0,0 +1,27 @@ +/*-------------------------------------------------------------------------+ +| 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.ui.handler; + +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput; + +/** {@link IconModelElementHandlerBase} for {@link ControlCenterUpstreamOutput}s. */ +public class ControlCenterUpstreamOutputHandler extends + IconModelElementHandlerBase<ControlCenterUpstreamOutput> { + /** Constructor. */ + public ControlCenterUpstreamOutputHandler() { + super("icons/unknown.png"); + } +} diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/.ratings b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/.ratings index c3f728b5..cc91abda 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/.ratings +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/.ratings @@ -1,5 +1,5 @@ ActuatorDigitsPropertySection.java c7cc5c1c4a9ef4077b2f4e3cdbae4928596df1ae YELLOW ActuatorPWMPropertySection.java 8a299c2096332c452dab56b703fb773c4b686667 YELLOW BoundedIntPositiveZeroValidator.java b788927873db6f8f17f1affe45dc9877b8ec40aa YELLOW -RaspberryPiExecutionUnitPropertySection.java b045a64d71975fe006699fd28833aa6a08fed1ec YELLOW +RaspberryPiExecutionUnitPropertySection.java c296a2ba6edfaf361f3062897df3656aac2bcde2 YELLOW UIDUnitPropertySection.java 93f1dfea011f61f42e284593169905b9c60abb22 YELLOW diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java index b045a64d..c296a2ba 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/properties/RaspberryPiExecutionUnitPropertySection.java @@ -49,6 +49,10 @@ public class RaspberryPiExecutionUnitPropertySection extends PropertySectionBase private Text cameraServerAddressText; /** The camera server IP port widget. */ private Text cameraServerPortText; + /** The control center server IP address widget. */ + private Text ccAddressText; + /** The control center server IP port widget. */ + private Text ccPortText; /** {@inheritDoc} */ @Override @@ -62,6 +66,8 @@ public class RaspberryPiExecutionUnitPropertySection extends PropertySectionBase ipAddressText = createDecoratedText("Unit IP Address"); cameraServerAddressText = createDecoratedText("Camera Server IP Address"); cameraServerPortText = createDecoratedText("Camera Server IP Port"); + ccAddressText = createDecoratedText("Control Center IP Address"); + ccPortText = createDecoratedText("Control Center IP Port"); } /** {@inheritDoc} */ @@ -105,5 +111,15 @@ public class RaspberryPiExecutionUnitPropertySection extends PropertySectionBase observeValue(unit, RaspberryPiModelPackage.Literals.RASPBERRY_PI__CAMERA_SERVER_PORT); dbc.bindValue(observeText(cameraServerPortText, SWT.Modify), modelObservable); + + modelObservable = + observeValue(unit, + RaspberryPiModelPackage.Literals.RASPBERRY_PI__CONTROLCENTER_SERVER_ADDRESS); + dbc.bindValue(observeText(ccAddressText, SWT.Modify), modelObservable); + + modelObservable = + observeValue(unit, + RaspberryPiModelPackage.Literals.RASPBERRY_PI__CONTROLCENTER_SERVER_PORT); + dbc.bindValue(observeText(ccPortText, SWT.Modify), modelObservable); } } diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/.ratings b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/.ratings index 28e5cabb..70dc4d7d 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/.ratings +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/.ratings @@ -1 +1 @@ -ProtoypeProvider.java e718d04dddfc52ce41ea66ff98696e2aa1b5ea3f YELLOW +ProtoypeProvider.java 914f35ea0411791ea345f5e274038d28e2a2ee62 YELLOW diff --git a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java index e718d04d..914f35ea 100644 --- a/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java +++ b/org.fortiss.af3.platform.raspberry.ui/src/org/fortiss/af3/platform/raspberry/ui/prototype/ProtoypeProvider.java @@ -15,6 +15,63 @@ +--------------------------------------------------------------------------*/ package org.fortiss.af3.platform.raspberry.ui.prototype; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAccelerationXSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAccelerationYSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAccelerationZSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createActuatorDigits; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAngularVelocityXSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAngularVelocityYSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createAngularVelocityZSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButton1; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButton2; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButton3; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButton4; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButtonL1; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButtonL2; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButtonR1; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createButtonR2; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createCameraDetectionStateLeft; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createCameraDetectionStateRight; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createCameraDistanceLeft; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createCameraDistanceRight; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createCameraYawAngle; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createControlCenterDownstreamInput; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createControlCenterUpstreamOutput; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLEDButtonBActuator; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLEDButtonGActuator; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLEDButtonRActuator; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLaserRangeSensor; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLeftStickX; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createLeftStickY; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createMotorControlInput; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createMotorControlOutput; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRightStickX; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRightStickY; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonA; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonB; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonHome; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonL1; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonL3; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonR1; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonR3; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonSelect; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonStart; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonX; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleButtonY; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleDPadDown; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleDPadLeft; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleDPadRight; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleDPadUp; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleL2Position; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleLeftStickX; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleLeftStickY; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleMagnitudeStrong; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleMagnitudeWeak; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleR2Position; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleRightStickX; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleRightStickY; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createRumbleSimpleRumbleFeaturePosition; +import static org.fortiss.af3.platform.raspberry.util.RaspberryModelElementFactory.createUltraSonicSensor; import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_MINIMUM_HEIGHT; import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_MINIMUM_WIDTH; import static org.fortiss.tooling.base.ui.utils.LayoutDataUIUtils.setConnectorPosition; @@ -44,6 +101,8 @@ import org.fortiss.af3.platform.raspberry.model.camera.CameraDetectionStateRight import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceLeft; import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceRight; import org.fortiss.af3.platform.raspberry.model.camera.CameraYawAngle; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput; import org.fortiss.af3.platform.raspberry.model.gamepad.Button1; import org.fortiss.af3.platform.raspberry.model.gamepad.Button2; import org.fortiss.af3.platform.raspberry.model.gamepad.Button3; @@ -94,6 +153,8 @@ public class ProtoypeProvider extends PrototypeProviderBase { protected final static String MOTOR_CONTROL = "Motor Control"; /** Category for camera server elements. */ protected final static String CAMERA_SERVER = "Camera Server"; + /** Category for control center elements. */ + protected final static String CONTROL_CENTER = "Control Center"; /** {@inheritDoc} */ @Override @@ -106,6 +167,7 @@ public class ProtoypeProvider extends PrototypeProviderBase { registerPrototypeCategory(prototypeCategory, BRICK); registerPrototypeCategory(prototypeCategory, MOTOR_CONTROL); registerPrototypeCategory(prototypeCategory, CAMERA_SERVER); + registerPrototypeCategory(prototypeCategory, CONTROL_CENTER); CanBus bus = RaspberryModelElementFactory.createCanBus(); setNodeBounds(bus, @@ -132,64 +194,78 @@ public class ProtoypeProvider extends PrototypeProviderBase { registerMotorControlElements(); registerCameraElements(); registerGamepadElements(); + registerControlCenterElements(); + } + + /** Register elements for control center. */ + private void registerControlCenterElements() { + ControlCenterDownstreamInput input = createControlCenterDownstreamInput(); + setNodePosition(input, 0, 0); + setConnectorPosition(input, 0, 0); + registerPrototype("CC Input", input, CONTROL_CENTER); + + ControlCenterUpstreamOutput output = createControlCenterUpstreamOutput(); + setNodePosition(output, 0, 0); + setConnectorPosition(output, 0, 0); + registerPrototype("CC Output", output, CONTROL_CENTER); } /** Register brick actuators and sensors. */ private void registerBrickElements() { - ActuatorDigits digits = RaspberryModelElementFactory.createActuatorDigits(); + ActuatorDigits digits = createActuatorDigits(); setNodePosition(digits, 0, 0); setConnectorPosition(digits, 0, 0); registerPrototype("Segment_Digits", digits, BRICK); - LEDButtonRActuator ledRButton = RaspberryModelElementFactory.createLEDButtonRActuator(); + LEDButtonRActuator ledRButton = createLEDButtonRActuator(); setNodePosition(ledRButton, 0, 0); setConnectorPosition(ledRButton, 0, 0); registerPrototype("LED_Button_red", ledRButton, BRICK); - LEDButtonGActuator ledGButton = RaspberryModelElementFactory.createLEDButtonGActuator(); + LEDButtonGActuator ledGButton = createLEDButtonGActuator(); setNodePosition(ledGButton, 0, 0); setConnectorPosition(ledGButton, 0, 0); registerPrototype("LED_Button_green", ledGButton, BRICK); - LEDButtonBActuator ledBButton = RaspberryModelElementFactory.createLEDButtonBActuator(); + LEDButtonBActuator ledBButton = createLEDButtonBActuator(); setNodePosition(ledBButton, 0, 0); setConnectorPosition(ledBButton, 0, 0); registerPrototype("LED_Button_blue", ledBButton, BRICK); - UltraSonicSensor uss = RaspberryModelElementFactory.createUltraSonicSensor(); + UltraSonicSensor uss = createUltraSonicSensor(); setNodePosition(uss, 0, 0); setConnectorPosition(uss, 0, 0); registerPrototype(uss.getName(), uss, BRICK); - LaserRangeSensor lsr = RaspberryModelElementFactory.createLaserRangeSensor(); + LaserRangeSensor lsr = createLaserRangeSensor(); setNodePosition(lsr, 0, 0); setConnectorPosition(lsr, 0, 0); registerPrototype(lsr.getName(), lsr, BRICK); - AccelerationXSensor accX = RaspberryModelElementFactory.createAccelerationXSensor(); + AccelerationXSensor accX = createAccelerationXSensor(); setNodePosition(accX, 0, 0); setConnectorPosition(accX, 0, 0); registerPrototype(accX.getName(), accX, BRICK); - AccelerationYSensor accY = RaspberryModelElementFactory.createAccelerationYSensor(); + AccelerationYSensor accY = createAccelerationYSensor(); setNodePosition(accY, 0, 0); setConnectorPosition(accY, 0, 0); registerPrototype(accY.getName(), accY, BRICK); - AccelerationZSensor accZ = RaspberryModelElementFactory.createAccelerationZSensor(); + AccelerationZSensor accZ = createAccelerationZSensor(); setNodePosition(accZ, 0, 0); setConnectorPosition(accZ, 0, 0); registerPrototype(accZ.getName(), accZ, BRICK); - AngularVelocityXSensor avX = RaspberryModelElementFactory.createAngularVelocityXSensor(); + AngularVelocityXSensor avX = createAngularVelocityXSensor(); setNodePosition(avX, 0, 0); setConnectorPosition(avX, 0, 0); registerPrototype(avX.getName(), avX, BRICK); - AngularVelocityYSensor avY = RaspberryModelElementFactory.createAngularVelocityYSensor(); + AngularVelocityYSensor avY = createAngularVelocityYSensor(); setNodePosition(avY, 0, 0); setConnectorPosition(avY, 0, 0); registerPrototype(avY.getName(), avY, BRICK); - AngularVelocityZSensor avZ = RaspberryModelElementFactory.createAngularVelocityZSensor(); + AngularVelocityZSensor avZ = createAngularVelocityZSensor(); setNodePosition(avZ, 0, 0); setConnectorPosition(avZ, 0, 0); registerPrototype(avZ.getName(), avZ, BRICK); @@ -198,7 +274,7 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register rumblepad elements. */ private void registerRumblepadElements() { org.fortiss.af3.platform.raspberry.model.rumblepad.Left_StickX_Position rplsx = - RaspberryModelElementFactory.createRumbleLeftStickX(); + createRumbleLeftStickX(); setNodePosition(rplsx, 0, 0); setConnectorPosition(rplsx, 0, 0); registerPrototype(rplsx.getName(), rplsx, RUMBLEPAD); @@ -209,75 +285,72 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register rumblepad buttons. */ private void registerRumblepadButtons() { - org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonL1 rpl1 = - RaspberryModelElementFactory.createRumbleButtonL1(); + org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonL1 rpl1 = createRumbleButtonL1(); setNodePosition(rpl1, 0, 0); setConnectorPosition(rpl1, 0, 0); registerPrototype(rpl1.getName(), rpl1, RUMBLEPAD); - org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonR1 rpr1 = - RaspberryModelElementFactory.createRumbleButtonR1(); + org.fortiss.af3.platform.raspberry.model.rumblepad.ButtonR1 rpr1 = createRumbleButtonR1(); setNodePosition(rpr1, 0, 0); setConnectorPosition(rpr1, 0, 0); registerPrototype(rpr1.getName(), rpr1, RUMBLEPAD); - L2_Position rpl2 = RaspberryModelElementFactory.createRumbleL2Position(); + L2_Position rpl2 = createRumbleL2Position(); setNodePosition(rpl2, 0, 0); setConnectorPosition(rpl2, 0, 0); registerPrototype(rpl2.getName(), rpl2, RUMBLEPAD); - R2_Position rpr2 = RaspberryModelElementFactory.createRumbleR2Position(); + R2_Position rpr2 = createRumbleR2Position(); setNodePosition(rpr2, 0, 0); setConnectorPosition(rpr2, 0, 0); registerPrototype(rpr2.getName(), rpr2, RUMBLEPAD); - ButtonA rpba = RaspberryModelElementFactory.createRumbleButtonA(); + ButtonA rpba = createRumbleButtonA(); setNodePosition(rpba, 0, 0); setConnectorPosition(rpba, 0, 0); registerPrototype(rpba.getName(), rpba, RUMBLEPAD); - ButtonB rpbb = RaspberryModelElementFactory.createRumbleButtonB(); + ButtonB rpbb = createRumbleButtonB(); setNodePosition(rpbb, 0, 0); setConnectorPosition(rpbb, 0, 0); registerPrototype(rpbb.getName(), rpbb, RUMBLEPAD); - ButtonX rpbx = RaspberryModelElementFactory.createRumbleButtonX(); + ButtonX rpbx = createRumbleButtonX(); setNodePosition(rpbx, 0, 0); setConnectorPosition(rpbx, 0, 0); registerPrototype(rpbx.getName(), rpbx, RUMBLEPAD); - ButtonY rpby = RaspberryModelElementFactory.createRumbleButtonY(); + ButtonY rpby = createRumbleButtonY(); setNodePosition(rpby, 0, 0); setConnectorPosition(rpby, 0, 0); registerPrototype(rpby.getName(), rpby, RUMBLEPAD); - ButtonStart rpbst = RaspberryModelElementFactory.createRumbleButtonStart(); + ButtonStart rpbst = createRumbleButtonStart(); setNodePosition(rpbst, 0, 0); setConnectorPosition(rpbst, 0, 0); registerPrototype(rpbst.getName(), rpbst, RUMBLEPAD); - ButtonSelect rpbse = RaspberryModelElementFactory.createRumbleButtonSelect(); + ButtonSelect rpbse = createRumbleButtonSelect(); setNodePosition(rpbse, 0, 0); setConnectorPosition(rpbse, 0, 0); registerPrototype(rpbse.getName(), rpbse, RUMBLEPAD); - ButtonHome rpbh = RaspberryModelElementFactory.createRumbleButtonHome(); + ButtonHome rpbh = createRumbleButtonHome(); setNodePosition(rpbh, 0, 0); setConnectorPosition(rpbh, 0, 0); registerPrototype(rpbh.getName(), rpbh, RUMBLEPAD); - SimpleRumbleFeature srf = - RaspberryModelElementFactory.createRumbleSimpleRumbleFeaturePosition(); + SimpleRumbleFeature srf = createRumbleSimpleRumbleFeaturePosition(); setNodePosition(srf, 0, 0); setConnectorPosition(srf, 0, 0); registerPrototype(srf.getName(), srf, RUMBLEPAD); - RumbleMagnitudeStrong rms = RaspberryModelElementFactory.createRumbleMagnitudeStrong(); + RumbleMagnitudeStrong rms = createRumbleMagnitudeStrong(); setNodePosition(rms, 0, 0); setConnectorPosition(rms, 0, 0); registerPrototype(rms.getName(), rms, RUMBLEPAD); - RumbleMagnitudeWeak rmw = RaspberryModelElementFactory.createRumbleMagnitudeWeak(); + RumbleMagnitudeWeak rmw = createRumbleMagnitudeWeak(); setNodePosition(rmw, 0, 0); setConnectorPosition(rmw, 0, 0); registerPrototype(rmw.getName(), rmw, RUMBLEPAD); @@ -286,49 +359,49 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register rumblepad sticks and D-pad. */ private void registerRumblepadSticks() { org.fortiss.af3.platform.raspberry.model.rumblepad.Left_StickY_Position rplsy = - RaspberryModelElementFactory.createRumbleLeftStickY(); + createRumbleLeftStickY(); setNodePosition(rplsy, 0, 0); setConnectorPosition(rplsy, 0, 0); registerPrototype(rplsy.getName(), rplsy, RUMBLEPAD); org.fortiss.af3.platform.raspberry.model.rumblepad.Right_StickX_Position rprsx = - RaspberryModelElementFactory.createRumbleRightStickX(); + createRumbleRightStickX(); setNodePosition(rprsx, 0, 0); setConnectorPosition(rprsx, 0, 0); registerPrototype(rprsx.getName(), rprsx, RUMBLEPAD); org.fortiss.af3.platform.raspberry.model.rumblepad.Right_StickY_Position rprsy = - RaspberryModelElementFactory.createRumbleRightStickY(); + createRumbleRightStickY(); setNodePosition(rprsy, 0, 0); setConnectorPosition(rprsy, 0, 0); registerPrototype(rprsy.getName(), rprsy, RUMBLEPAD); - DPadUp rpdpu = RaspberryModelElementFactory.createRumbleDPadUp(); + DPadUp rpdpu = createRumbleDPadUp(); setNodePosition(rpdpu, 0, 0); setConnectorPosition(rpdpu, 0, 0); registerPrototype(rpdpu.getName(), rpdpu, RUMBLEPAD); - DPadDown rpdpd = RaspberryModelElementFactory.createRumbleDPadDown(); + DPadDown rpdpd = createRumbleDPadDown(); setNodePosition(rpdpd, 0, 0); setConnectorPosition(rpdpd, 0, 0); registerPrototype(rpdpd.getName(), rpdpd, RUMBLEPAD); - DPadLeft rpdpl = RaspberryModelElementFactory.createRumbleDPadLeft(); + DPadLeft rpdpl = createRumbleDPadLeft(); setNodePosition(rpdpl, 0, 0); setConnectorPosition(rpdpl, 0, 0); registerPrototype(rpdpl.getName(), rpdpl, RUMBLEPAD); - DPadRight rpdpr = RaspberryModelElementFactory.createRumbleDPadRight(); + DPadRight rpdpr = createRumbleDPadRight(); setNodePosition(rpdpr, 0, 0); setConnectorPosition(rpdpr, 0, 0); registerPrototype(rpdpr.getName(), rpdpr, RUMBLEPAD); - ButtonL3 rpl3 = RaspberryModelElementFactory.createRumbleButtonL3(); + ButtonL3 rpl3 = createRumbleButtonL3(); setNodePosition(rpl3, 0, 0); setConnectorPosition(rpl3, 0, 0); registerPrototype(rpl3.getName(), rpl3, RUMBLEPAD); - ButtonR3 rpr3 = RaspberryModelElementFactory.createRumbleButtonR3(); + ButtonR3 rpr3 = createRumbleButtonR3(); setNodePosition(rpr3, 0, 0); setConnectorPosition(rpr3, 0, 0); registerPrototype(rpr3.getName(), rpr3, RUMBLEPAD); @@ -336,12 +409,12 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register motor controller elements. */ private void registerMotorControlElements() { - MotorControlInput mci = RaspberryModelElementFactory.createMotorControlInput(); + MotorControlInput mci = createMotorControlInput(); setNodePosition(mci, 0, 0); setConnectorPosition(mci, 0, 0); registerPrototype(mci.getName(), mci, MOTOR_CONTROL); - MotorControlOutput mco = RaspberryModelElementFactory.createMotorControlOutput(); + MotorControlOutput mco = createMotorControlOutput(); setNodePosition(mco, 0, 0); setConnectorPosition(mco, 0, 0); registerPrototype(mco.getName(), mco, MOTOR_CONTROL); @@ -349,29 +422,27 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register camera elements. */ private void registerCameraElements() { - CameraDistanceLeft cdl = RaspberryModelElementFactory.createCameraDistanceLeft(); + CameraDistanceLeft cdl = createCameraDistanceLeft(); setNodePosition(cdl, 0, 0); setConnectorPosition(cdl, 0, 0); registerPrototype(cdl.getName(), cdl, CAMERA_SERVER); - CameraDistanceRight cdr = RaspberryModelElementFactory.createCameraDistanceRight(); + CameraDistanceRight cdr = createCameraDistanceRight(); setNodePosition(cdr, 0, 0); setConnectorPosition(cdr, 0, 0); registerPrototype(cdr.getName(), cdr, CAMERA_SERVER); - CameraDetectionStateLeft cdsl = - RaspberryModelElementFactory.createCameraDetectionStateLeft(); + CameraDetectionStateLeft cdsl = createCameraDetectionStateLeft(); setNodePosition(cdsl, 0, 0); setConnectorPosition(cdsl, 0, 0); registerPrototype(cdsl.getName(), cdsl, CAMERA_SERVER); - CameraDetectionStateRight cdsr = - RaspberryModelElementFactory.createCameraDetectionStateRight(); + CameraDetectionStateRight cdsr = createCameraDetectionStateRight(); setNodePosition(cdsr, 0, 0); setConnectorPosition(cdsr, 0, 0); registerPrototype(cdsr.getName(), cdsr, CAMERA_SERVER); - CameraYawAngle cya = RaspberryModelElementFactory.createCameraYawAngle(); + CameraYawAngle cya = createCameraYawAngle(); setNodePosition(cya, 0, 0); setConnectorPosition(cya, 0, 0); registerPrototype(cya.getName(), cya, CAMERA_SERVER); @@ -379,62 +450,62 @@ public class ProtoypeProvider extends PrototypeProviderBase { /** Register gamepad elements. */ private void registerGamepadElements() { - Button1 button1 = RaspberryModelElementFactory.createButton1(); + Button1 button1 = createButton1(); setNodePosition(button1, 0, 0); setConnectorPosition(button1, 0, 0); registerPrototype(button1.getName(), button1, GAMEPAD); - Button2 button2 = RaspberryModelElementFactory.createButton2(); + Button2 button2 = createButton2(); setNodePosition(button2, 0, 0); setConnectorPosition(button2, 0, 0); registerPrototype(button2.getName(), button2, GAMEPAD); - Button3 button3 = RaspberryModelElementFactory.createButton3(); + Button3 button3 = createButton3(); setNodePosition(button3, 0, 0); setConnectorPosition(button3, 0, 0); registerPrototype(button3.getName(), button3, GAMEPAD); - Button4 button4 = RaspberryModelElementFactory.createButton4(); + Button4 button4 = createButton4(); setNodePosition(button4, 0, 0); setConnectorPosition(button4, 0, 0); registerPrototype(button4.getName(), button4, GAMEPAD); - ButtonL1 buttonL1 = RaspberryModelElementFactory.createButtonL1(); + ButtonL1 buttonL1 = createButtonL1(); setNodePosition(buttonL1, 0, 0); setConnectorPosition(buttonL1, 0, 0); registerPrototype(buttonL1.getName(), buttonL1, GAMEPAD); - ButtonL2 buttonL2 = RaspberryModelElementFactory.createButtonL2(); + ButtonL2 buttonL2 = createButtonL2(); setNodePosition(buttonL2, 0, 0); setConnectorPosition(buttonL2, 0, 0); registerPrototype(buttonL2.getName(), buttonL2, GAMEPAD); - ButtonR1 buttonR1 = RaspberryModelElementFactory.createButtonR1(); + ButtonR1 buttonR1 = createButtonR1(); setNodePosition(buttonR1, 0, 0); setConnectorPosition(buttonR1, 0, 0); registerPrototype(buttonR1.getName(), buttonR1, GAMEPAD); - ButtonR2 buttonR2 = RaspberryModelElementFactory.createButtonR2(); + ButtonR2 buttonR2 = createButtonR2(); setNodePosition(buttonR2, 0, 0); setConnectorPosition(buttonR2, 0, 0); registerPrototype(buttonR2.getName(), buttonR2, GAMEPAD); - Left_StickX_Position Left_StickX = RaspberryModelElementFactory.createLeftStickX(); + Left_StickX_Position Left_StickX = createLeftStickX(); setNodePosition(Left_StickX, 0, 0); setConnectorPosition(Left_StickX, 0, 0); registerPrototype(Left_StickX.getName(), Left_StickX, GAMEPAD); - Left_StickY_Position Left_StickY = RaspberryModelElementFactory.createLeftStickY(); + Left_StickY_Position Left_StickY = createLeftStickY(); setNodePosition(Left_StickY, 0, 0); setConnectorPosition(Left_StickY, 0, 0); registerPrototype(Left_StickY.getName(), Left_StickY, GAMEPAD); - Right_StickX_Position Right_StickX = RaspberryModelElementFactory.createRightStickX(); + Right_StickX_Position Right_StickX = createRightStickX(); setNodePosition(Right_StickX, 0, 0); setConnectorPosition(Right_StickX, 0, 0); registerPrototype(Right_StickX.getName(), Right_StickX, GAMEPAD); - Right_StickY_Position Right_StickY = RaspberryModelElementFactory.createRightStickY(); + Right_StickY_Position Right_StickY = createRightStickY(); setNodePosition(Right_StickY, 0, 0); setConnectorPosition(Right_StickY, 0, 0); registerPrototype(Right_StickY.getName(), Right_StickY, GAMEPAD); diff --git a/org.fortiss.af3.platform.raspberry/META-INF/MANIFEST.MF b/org.fortiss.af3.platform.raspberry/META-INF/MANIFEST.MF index e49e122a..cd4b555e 100644 --- a/org.fortiss.af3.platform.raspberry/META-INF/MANIFEST.MF +++ b/org.fortiss.af3.platform.raspberry/META-INF/MANIFEST.MF @@ -14,6 +14,9 @@ Export-Package: org.fortiss.af3.platform.raspberry.model, org.fortiss.af3.platform.raspberry.model.camera, org.fortiss.af3.platform.raspberry.model.camera.impl, org.fortiss.af3.platform.raspberry.model.camera.util, + org.fortiss.af3.platform.raspberry.model.controlcenter, + org.fortiss.af3.platform.raspberry.model.controlcenter.impl, + org.fortiss.af3.platform.raspberry.model.controlcenter.util, org.fortiss.af3.platform.raspberry.model.gamepad, org.fortiss.af3.platform.raspberry.model.gamepad.impl, org.fortiss.af3.platform.raspberry.model.gamepad.util, diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/.ratings b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/.ratings index 6401645b..c81110a3 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/.ratings +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/.ratings @@ -1,4 +1,4 @@ CanBusCompositor.java 04d8d8b5276fe06dfd1222b54de90ead680d4b6c YELLOW CanToRaspberryCompositor.java 269e6b0dcfbbb5d0da72e199704e768f50651073 YELLOW -RaspberryPiCompositor.java 64e7a786367efbec47ee9af65cebaf98fed2db3f YELLOW +RaspberryPiCompositor.java c54e0128e71e3ba9e3f7222bfd8f65c420dfd303 YELLOW RaspberryToCanCompositor.java 2552acc59eb5a7381c60b3c40d32978c96f409b0 YELLOW diff --git a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java index 64e7a786..c54e0128 100644 --- a/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java +++ b/org.fortiss.af3.platform.raspberry/src/org/fortiss/af3/platform/raspberry/compose/RaspberryPiCompositor.java @@ -41,6 +41,8 @@ import org.fortiss.af3.platform.raspberry.model.camera.CameraDetectionStateRight import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceLeft; import org.fortiss.af3.platform.raspberry.model.camera.CameraDistanceRight; import org.fortiss.af3.platform.raspberry.model.camera.CameraYawAngle; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterDownstreamInput; +import org.fortiss.af3.platform.raspberry.model.controlcenter.ControlCenterUpstreamOutput; import org.fortiss.af3.platform.raspberry.model.gamepad.GamepadReceiverBase; import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlInput; import org.fortiss.af3.platform.raspberry.model.motorcontrol.MotorControlOutput; @@ -84,7 +86,8 @@ public class RaspberryPiCompositor extends RumbleMagnitudeWeak.class, MotorControlInput.class, MotorControlOutput.class, CameraDistanceLeft.class, CameraDistanceRight.class, CameraYawAngle.class, - CameraDetectionStateLeft.class, CameraDetectionStateRight.class); + CameraDetectionStateLeft.class, CameraDetectionStateRight.class, + ControlCenterDownstreamInput.class, ControlCenterUpstreamOutput.class); if(container != null) { final boolean instanceOfAny = isInstanceOfAny(container, RaspberryPi.class); return instanceOfAny && instanceOfAny2; -- GitLab