├── robo4j-hw-lego ├── .gitignore ├── README.md └── src │ └── main │ └── java │ └── com │ └── robo4j │ └── hw │ └── lego │ ├── provider │ └── IProvider.java │ ├── ILegoHardware.java │ ├── IButton.java │ ├── util │ ├── ButtonUtil.java │ ├── EscapeButtonUtil.java │ └── BrickUtils.java │ ├── ILcd.java │ ├── LegoException.java │ ├── ILegoSensor.java │ ├── ILegoMotor.java │ └── enums │ └── LcdFontEnum.java ├── robo4j-hw-rpi ├── .gitignore ├── README.md └── src │ ├── main │ └── java │ │ └── com │ │ └── robo4j │ │ └── hw │ │ └── rpi │ │ ├── gps │ │ ├── GPSEvent.java │ │ ├── VelocityEvent.java │ │ ├── FixQuality.java │ │ └── AbstractGPSEvent.java │ │ ├── pad │ │ ├── LF710Input.java │ │ ├── PadInputResponseListener.java │ │ ├── RoboControlPad.java │ │ ├── LF710PadUtils.java │ │ └── LF710Exception.java │ │ ├── i2c │ │ ├── ReadableDevice.java │ │ ├── adafruitbackpack │ │ │ ├── LedBackpackType.java │ │ │ └── BiColor.java │ │ ├── adafruitlcd │ │ │ └── ButtonListener.java │ │ └── accelerometer │ │ │ └── CalibratedAccelerometer.java │ │ ├── camera │ │ └── CameraClientException.java │ │ ├── imu │ │ └── bno │ │ │ ├── shtp │ │ │ └── ShtpReportIds.java │ │ │ ├── DataListener.java │ │ │ └── DataEventType.java │ │ ├── serial │ │ └── ydlidar │ │ │ └── ScanReceiver.java │ │ └── utils │ │ └── I2cBus.java │ ├── examples │ └── java │ │ └── com │ │ └── robo4j │ │ └── hw │ │ └── rpi │ │ └── i2c │ │ └── adafruitlcd │ │ ├── Util.java │ │ ├── LCDDemo.java │ │ ├── HelloLcd.java │ │ ├── ExitDemo.java │ │ └── HelloWorldDemo.java │ └── test │ └── java │ └── com │ └── robo4j │ └── hw │ └── rpi │ ├── pad │ └── LF710PadUtilsTests.java │ ├── imu │ └── bno │ │ └── impl │ │ └── BnoSerialTests.java │ └── gps │ └── MockGPS.java ├── robo4j-units-rpi-http ├── .gitignore └── src │ ├── test │ └── resources │ │ ├── snapshot.png │ │ ├── robo4jSystemConsumer.xml │ │ └── robo4jSystemProducer.xml │ └── main │ └── java │ └── module-info.java ├── robo4j-core ├── .gitignore └── src │ ├── test │ ├── resources │ │ ├── robo_sample1.jpg │ │ ├── 20161021_NoSignal_240.png │ │ ├── 20161021_NoSignal_640.png │ │ ├── textFileTest.txt │ │ ├── json_1.json │ │ ├── testMessageEmitterSystem_10.xml │ │ ├── testMessageEmitterSystem_22.xml │ │ ├── testMessageEmitterSystem_8.xml │ │ ├── testRoboSystemOnly.xml │ │ ├── double.xml │ │ ├── test.xml │ │ ├── testRoboUnitsOnly.xml │ │ └── testsubconfig.xml │ └── java │ │ └── com │ │ └── robo4j │ │ ├── units │ │ └── CounterCommand.java │ │ ├── TestToolkit.java │ │ └── StringToolkit.java │ └── main │ ├── resources │ └── banner.txt │ └── java │ └── com │ └── robo4j │ ├── util │ ├── StringConstants.java │ ├── StreamException.java │ └── PropertyMapBuilder.java │ ├── net │ ├── RoboContextDescriptorEntry.java │ └── MessageCallback.java │ ├── reflect │ └── ReflectionScanException.java │ ├── configuration │ ├── ConfigurationFactory.java │ └── ConfigurationFactoryException.java │ ├── AttributeDescriptor.java │ ├── Export.java │ ├── CriticalSectionTrait.java │ ├── scheduler │ └── FinalInvocationListener.java │ ├── WorkTrait.java │ └── BlockingTrait.java ├── robo4j-math ├── .gitignore └── src │ ├── test │ └── java │ │ └── com │ │ └── robo4j │ │ └── math │ │ └── features │ │ └── FeatureExtractionTest.java │ └── main │ └── java │ ├── module-info.java │ └── com │ └── robo4j │ └── math │ ├── geometry │ ├── ScanResult2D.java │ └── MatrixEmpty.java │ └── jfr │ └── ScanId.java ├── robo4j-socket-http ├── .gitignore └── src │ ├── test │ ├── resources │ │ ├── snapshot.png │ │ ├── robo_client_context.xml │ │ └── http_get.xml │ └── java │ │ ├── com │ │ └── robo4j │ │ │ └── socket │ │ │ └── http │ │ │ └── test │ │ │ ├── units │ │ │ └── config │ │ │ │ ├── enums │ │ │ │ ├── CommunicationType.java │ │ │ │ └── TestEnum.java │ │ │ │ └── service │ │ │ │ ├── NumberService.java │ │ │ │ └── NumberServiceImpl.java │ │ │ ├── json │ │ │ └── TimeUtils.java │ │ │ └── codec │ │ │ ├── HttpPathDTOCodec.java │ │ │ ├── CameraMessageCodec.java │ │ │ ├── NSBTypesTestMessageCodec.java │ │ │ ├── NSBETypesTestMessageCodec.java │ │ │ └── NSBETypesAndCollectionTestMessageCodec.java │ │ └── module-info.java │ └── main │ ├── java │ ├── module-info.java │ └── com │ │ └── robo4j │ │ └── socket │ │ └── http │ │ ├── channel │ │ ├── DatagramConnectionType.java │ │ ├── ChannelHandler.java │ │ └── SelectionKeyHandler.java │ │ ├── message │ │ ├── MessageDenominator.java │ │ ├── HttpMessage.java │ │ ├── DatagramMessage.java │ │ └── HttpDenominator.java │ │ ├── util │ │ ├── TypeCollection.java │ │ ├── ExceptionMessageUtils.java │ │ ├── HttpConstant.java │ │ ├── RoboReflectException.java │ │ └── DatagramBodyType.java │ │ ├── json │ │ ├── JsonTypeAdapter.java │ │ ├── JsonBooleanAdapter.java │ │ ├── JsonNumberAdapter.java │ │ ├── JsonAdapter.java │ │ ├── JsonStringAdapter.java │ │ ├── JsonException.java │ │ └── JsonEnumAdapter.java │ │ ├── units │ │ ├── CodecRegistryException.java │ │ ├── SocketEncoder.java │ │ ├── SocketDecoder.java │ │ ├── HttpProducer.java │ │ └── SocketContext.java │ │ ├── HttpException.java │ │ ├── HttpHeaderFieldValues.java │ │ ├── request │ │ ├── ChannelResponseProcess.java │ │ └── DefaultRequestFactory.java │ │ ├── codec │ │ ├── CameraMessageCodec.java │ │ ├── StringCodec.java │ │ ├── CameraConfigMessageCodec.java │ │ └── SimpleCommandCodec.java │ │ ├── SocketException.java │ │ ├── MIMEContentTypes.java │ │ └── dto │ │ └── ClientClassPathDTO.java │ └── resources │ ├── welcome.html │ ├── error.html │ ├── exit.html │ ├── status.html │ ├── success.html │ └── setup.html ├── documents ├── graphics │ ├── .gitignore │ ├── scan.png │ ├── robo4j.jpg │ ├── logo_robo4j.png │ ├── logo_robo4j.psd │ ├── icons │ │ ├── robo4j16.png │ │ ├── robo4j32.png │ │ ├── robo4j64.png │ │ ├── scan16.png │ │ ├── robo4j128.png │ │ ├── robo4j256.png │ │ ├── robo4j400.png │ │ ├── robo4j128text.png │ │ ├── robo4j256text.png │ │ ├── robo4j400text.png │ │ └── robo4j64text.png │ ├── logo_robo4j_cogs.png │ ├── logo_robo4j_cogs.psd │ ├── logo_robo4j_black.png │ ├── logo_robo4j_small.png │ ├── logo_robo4j_black_132.png │ ├── logo_robo4j_cogs_square.psd │ └── special │ │ └── robo4j_chart_pin.png └── powerpoint │ └── Robo4JTemplate.potx ├── robo4j-units-rpi ├── .gitignore └── src │ ├── examples │ ├── java │ │ └── com │ │ │ └── robo4j │ │ │ └── units │ │ │ └── rpi │ │ │ ├── led │ │ │ └── AdafruitOledSSD1306Example.java │ │ │ └── lcd │ │ │ ├── LcdDemo.java │ │ │ └── ExitDemo.java │ └── resources │ │ ├── logitechF710.xml │ │ ├── matrix8x8example.xml │ │ ├── bargraph24example.xml │ │ ├── alphanumericexample.xml │ │ ├── roboclawexample.xml │ │ ├── bno080GyroExample.xml │ │ ├── gyroexample.xml │ │ └── bno080VectorExample.xml │ └── main │ ├── java │ ├── module-info.java │ └── com │ │ └── robo4j │ │ └── units │ │ └── rpi │ │ ├── led │ │ └── BackpackMessageCommand.java │ │ ├── lcd │ │ ├── LcdMessageType.java │ │ └── AdafruitException.java │ │ └── camera │ │ └── CameraUtil.java │ └── resources │ └── alphanumericexample.xml ├── robo4j-units-lego ├── .gitignore └── src │ ├── examples │ ├── resources │ │ ├── robo4jSystem.xml │ │ └── robo4jInfraExample.xml │ └── java │ │ └── com │ │ └── robo4j │ │ └── units │ │ └── lego │ │ └── controller │ │ └── ReportController.java │ └── main │ └── java │ └── com │ └── robo4j │ └── units │ └── lego │ ├── enums │ └── LegoEnum.java │ ├── gripper │ └── GripperEnum.java │ ├── LegoUnitException.java │ ├── infra │ ├── InfraSensorEnum.java │ └── InfraSensorMessage.java │ ├── sonic │ └── SonicSensorEnum.java │ └── brick │ └── PlateButtonI.java ├── libs └── ev3classes-9.1.jar ├── docker ├── Dockerfile_openjdk11 └── Dockerfile_oraclejdk8 ├── .gitignore ├── licence_idea.txt ├── ide └── eclipse │ └── checkstyle │ └── checkstyleconfig.properties └── .github └── workflows └── robo4j-verification.yml /robo4j-hw-lego/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | -------------------------------------------------------------------------------- /robo4j-units-rpi-http/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /robo4j-core/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | *.class -------------------------------------------------------------------------------- /robo4j-math/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | *.bak -------------------------------------------------------------------------------- /robo4j-socket-http/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | -------------------------------------------------------------------------------- /documents/graphics/.gitignore: -------------------------------------------------------------------------------- 1 | /Thumbs.db 2 | /.DS_Store 3 | -------------------------------------------------------------------------------- /robo4j-units-rpi/.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | /bin/ 3 | /build/ 4 | -------------------------------------------------------------------------------- /robo4j-units-lego/.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | /bin/ 3 | /build/ 4 | -------------------------------------------------------------------------------- /libs/ev3classes-9.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/libs/ev3classes-9.1.jar -------------------------------------------------------------------------------- /documents/graphics/scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/scan.png -------------------------------------------------------------------------------- /documents/graphics/robo4j.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/robo4j.jpg -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j.psd -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j16.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j32.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j64.png -------------------------------------------------------------------------------- /documents/graphics/icons/scan16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/scan16.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j128.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j256.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j400.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_cogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_cogs.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_cogs.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_cogs.psd -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j128text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j128text.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j256text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j256text.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j400text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j400text.png -------------------------------------------------------------------------------- /documents/graphics/icons/robo4j64text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/icons/robo4j64text.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_black.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_small.png -------------------------------------------------------------------------------- /documents/powerpoint/Robo4JTemplate.potx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/powerpoint/Robo4JTemplate.potx -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_black_132.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_black_132.png -------------------------------------------------------------------------------- /documents/graphics/logo_robo4j_cogs_square.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/logo_robo4j_cogs_square.psd -------------------------------------------------------------------------------- /documents/graphics/special/robo4j_chart_pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/documents/graphics/special/robo4j_chart_pin.png -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/robo_sample1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/robo4j-core/src/test/resources/robo_sample1.jpg -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/resources/snapshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/robo4j-socket-http/src/test/resources/snapshot.png -------------------------------------------------------------------------------- /robo4j-units-rpi-http/src/test/resources/snapshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/robo4j-units-rpi-http/src/test/resources/snapshot.png -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/20161021_NoSignal_240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/robo4j-core/src/test/resources/20161021_NoSignal_240.png -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/20161021_NoSignal_640.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Robo4J/robo4j/HEAD/robo4j-core/src/test/resources/20161021_NoSignal_640.png -------------------------------------------------------------------------------- /robo4j-units-rpi-http/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module robo4j.units.rpi.http { 2 | requires robo4j.http; 3 | requires org.slf4j; 4 | 5 | exports com.robo4j.units.rpi.http.camera to robo4j.core; 6 | } -------------------------------------------------------------------------------- /docker/Dockerfile_openjdk11: -------------------------------------------------------------------------------- 1 | FROM openjdk:11-jdk-slim as builder 2 | ENV APP_HOME=/usr/app/ 3 | WORKDIR $APP_HOME 4 | COPY build.gradle settings.gradle libraries.gradle gradlew $APP_HOME 5 | COPY . . 6 | RUN ./gradlew build -------------------------------------------------------------------------------- /robo4j-core/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | 2 | ______ _____ ______ _____ _____ _____ _____ 3 | |_____/ | | |_____] | | | | | | 4 | | \_ |_____| |_____] |_____| __| . __|__ |_____| 5 | 6 | ::Robo4J.io:: -------------------------------------------------------------------------------- /docker/Dockerfile_oraclejdk8: -------------------------------------------------------------------------------- 1 | FROM anapsix/alpine-java:8_jdk as builder 2 | ENV APP_HOME=/usr/app/ 3 | WORKDIR $APP_HOME 4 | COPY build.gradle settings.gradle libraries.gradle gradlew $APP_HOME 5 | COPY . . 6 | RUN ./gradlew robo4j-core:build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | licence.idea 3 | !/licence.idea 4 | /.gradle/ 5 | /build/ 6 | bin/ 7 | *.bak 8 | *.jfr 9 | .idea 10 | /.DS_Store 11 | robo4j-hw-rpi/out 12 | robo4j-math/out 13 | robo4j-core/out 14 | robo4j-hw-lego/out 15 | robo4j-units-lego/out 16 | robo4j-socket-http/out 17 | robo4j-units-rpi/out 18 | /.nb-gradle/ 19 | .nb-gradle-properties 20 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module robo4j.http { 2 | requires transitive robo4j.core; 3 | requires org.slf4j; 4 | 5 | exports com.robo4j.socket.http; 6 | exports com.robo4j.socket.http.codec; 7 | exports com.robo4j.socket.http.enums; 8 | exports com.robo4j.socket.http.units; 9 | exports com.robo4j.socket.http.util; 10 | exports com.robo4j.socket.http.provider; 11 | exports com.robo4j.socket.http.message; 12 | exports com.robo4j.socket.http.dto; 13 | exports com.robo4j.socket.http.json; 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /licence_idea.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, $today.year, Marcus Hirt, Miroslav Wengner 2 | 3 | Robo4J is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | Robo4J is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with Robo4J. If not, see . -------------------------------------------------------------------------------- /robo4j-hw-rpi/README.md: -------------------------------------------------------------------------------- 1 | # robo4j-hw-rpi 2 | Hardware abstractions for the raspberry pi. 3 | 4 | These hardware abstractions make it easier to develop for the Raspberry Pi. They can be used stand-alone, or together with the Robo4J framework. 5 | 6 | 7 | There are three source folders: 8 | 9 | 1. src - the source code 10 | 2. test - junit tests 11 | 3. examples - examples that demonstrate how the devices can be used 12 | 13 | There is an Eclipse .project file provided. The only thing required for development is to set up a User Library in Eclipse called PI4J, with the PI4J jars. 14 | 15 | 16 | Notes on running the examples: 17 | 18 | 1. Make sure that you have the raspberry jars on your class path 19 | 2. Access to the hardware ports usually requires sudo access -------------------------------------------------------------------------------- /robo4j-hw-lego/README.md: -------------------------------------------------------------------------------- 1 | # robo4j-hw-lego 2 | Hardware abstractions for Lego Mindstorm (LejOs) 3 | 4 | These hardware abstractions make it easier to develop for the LegoMindstorm. They can be used stand-alone, or together with the Robo4J framework. 5 | 6 | 7 | There are three source folders: 8 | 9 | 1. src - the source code 10 | 2. test - junit tests 11 | 3. examples - examples that demonstrate how the devices can be used 12 | 13 | There is an Eclipse .project file provided. The only thing required for development is to set up a User Library in Eclipse called LejOs, with the LejOs jars. 14 | 15 | 16 | Notes on running the examples: 17 | 18 | 1. Make sure that you have the LejOs jars on your class path 19 | 2. Access to the hardware ports doesnt require sudo access -------------------------------------------------------------------------------- /ide/eclipse/checkstyle/checkstyleconfig.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | # 4 | # Robo4J is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Robo4J is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with Robo4J. If not, see . 16 | # 17 | 18 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/textFileTest.txt: -------------------------------------------------------------------------------- 1 | ==== 2 | Copyright (c) 2014, 2019, Marcus Hirt, Miroslav Wengner 3 | 4 | Robo4J is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | Robo4J is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with Robo4J. If not, see . 16 | ==== 17 | 18 | this is text file test 19 | please whole transfer 20 | DONE -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/json_1.json: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014, 2019, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | {"uid":"robo4j","configuration":["httpClient","imageController","scheduleController","httpServer"]} -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/java/com/robo4j/units/rpi/led/AdafruitOledSSD1306Example.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.units.rpi.led; 19 | 20 | public class AdafruitOledSSD1306Example { 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/robo4j-verification.yml: -------------------------------------------------------------------------------- 1 | name: robo4j-verification 2 | run-name: ${{ github.actor }} is robo4j runner 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | - 'feature/**' 8 | jobs: 9 | robo4j-install: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | - name: Setup Java 21 15 | uses: actions/setup-java@v4 16 | with: 17 | distribution: 'zulu' 18 | java-version: '21' 19 | java-package: 'jdk' 20 | mvn-toolchain-id: 'JavaSE-21' 21 | - name: Setup Maven 22 | uses: stCarolas/setup-maven@v4.5 23 | with: 24 | maven-version: '3.9.6' 25 | - name: Cache Maven local 26 | uses: actions/cache@v4 27 | with: 28 | path: ~/.m2/repository 29 | key: ${{ runner.os }}-robo4j-maven 30 | - name: Build and test 31 | run: mvn install -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/resources/robo_client_context.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | com.robo4j.socket.http.test.units.config.StringConsumer 20 | 21 | -------------------------------------------------------------------------------- /robo4j-math/src/test/java/com/robo4j/math/features/FeatureExtractionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.math.features; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | public class FeatureExtractionTest { 24 | } 25 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module robo4j.units.rpi { 2 | requires jdk.jfr; 3 | requires transitive robo4j.core; 4 | requires transitive robo4j.hw.rpi; 5 | requires org.slf4j; 6 | 7 | exports com.robo4j.units.rpi.accelerometer; 8 | exports com.robo4j.units.rpi.camera; 9 | exports com.robo4j.units.rpi.gps; 10 | exports com.robo4j.units.rpi.gyro; 11 | exports com.robo4j.units.rpi.imu; 12 | exports com.robo4j.units.rpi.lcd; 13 | exports com.robo4j.units.rpi.led; 14 | exports com.robo4j.units.rpi.lidarlite; 15 | exports com.robo4j.units.rpi.pad; 16 | exports com.robo4j.units.rpi.pwm; 17 | exports com.robo4j.units.rpi.roboclaw; 18 | 19 | uses com.robo4j.math.jfr.ScanEvent; 20 | uses com.robo4j.math.jfr.JfrUtils; 21 | uses com.robo4j.math.geometry.Tuple3d; 22 | uses com.robo4j.math.geometry.Tuple3f; 23 | uses com.robo4j.math.geometry.ScanResult2D; 24 | uses com.robo4j.math.geometry.Point2f; 25 | uses jdk.jfr.Event; 26 | } -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/channel/DatagramConnectionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.channel; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public enum DatagramConnectionType { 24 | SERVER, CLIENT 25 | } 26 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/message/MessageDenominator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.message; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public interface MessageDenominator { 24 | T generate(); 25 | } 26 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/util/TypeCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.util; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public enum TypeCollection { 24 | ARRAY, 25 | LIST, 26 | MAP 27 | } 28 | -------------------------------------------------------------------------------- /robo4j-core/src/test/java/com/robo4j/units/CounterCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units; 18 | 19 | /** 20 | * Controls the CounterUnit. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public enum CounterCommand { 26 | START, STOP, RESET, COUNTER_INC 27 | } 28 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/channel/ChannelHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.channel; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | public interface ChannelHandler { 24 | void start(); 25 | 26 | void stop(); 27 | } 28 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/message/HttpMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.message; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public interface HttpMessage { 24 | HttpDenominator getDenominator(); 25 | } 26 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonTypeAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public interface JsonTypeAdapter { 24 | 25 | String adapt(Object obj); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/welcome.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client welcome page 21 | 22 | 23 | 24 |

25 | Robo4j Client default welcome page 26 |

27 |

28 | Robo4j Client is alive 29 |

30 | 31 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/util/StringConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.util; 18 | 19 | /** 20 | * Commonly used constants. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public final class StringConstants { 26 | public static final String EMPTY = ""; 27 | } 28 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/units/config/enums/CommunicationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.units.config.enums; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public enum CommunicationType { 24 | HTTP, DATAGRAM 25 | } 26 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/units/config/enums/TestEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.units.config.enums; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | public interface TestEnum { 24 | 25 | int getId(); 26 | 27 | String getName(); 28 | } 29 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/units/config/service/NumberService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.units.config.service; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public interface NumberService { 24 | 25 | Integer getNumber(); 26 | } 27 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/error.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client alive ERROR page 21 | 22 | 23 | 24 |

25 | Robo4j Client default ERROR page 26 |

27 |

28 | Robo4j Client is alive but your request is not supported 29 |

30 | 31 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/module-info.java: -------------------------------------------------------------------------------- 1 | module robo4j.http.test { 2 | requires robo4j.core; 3 | requires robo4j.http; 4 | 5 | requires org.junit.jupiter.api; 6 | requires org.junit.jupiter.engine; 7 | requires org.slf4j; 8 | 9 | 10 | exports com.robo4j.socket.http.test.utils; 11 | exports com.robo4j.socket.http.test.units.config to robo4j.core; 12 | exports com.robo4j.socket.http.test.units.config.codec to robo4j.http; 13 | exports com.robo4j.socket.http.test.codec to robo4j.http; 14 | 15 | opens com.robo4j.socket.http.test to org.junit.platform.commons; 16 | opens com.robo4j.socket.http.test.units.config.codec to org.junit.platform.commons; 17 | opens com.robo4j.socket.http.test.utils to org.junit.platform.commons; 18 | opens com.robo4j.socket.http.test.message to org.junit.platform.commons; 19 | opens com.robo4j.socket.http.test.units to org.junit.platform.commons; 20 | opens com.robo4j.socket.http.test.json to org.junit.platform.commons; 21 | opens com.robo4j.socket.http.test.request to org.junit.platform.commons; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/provider/IProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego.provider; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | public interface IProvider { 24 | 25 | Output create(final DevicePort type, final DeviceType deviceType); 26 | } 27 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/gps/GPSEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.gps; 18 | 19 | /** 20 | * Event emitted from a GPS. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface GPSEvent { 26 | /** 27 | * @return the source of this event. 28 | */ 29 | GPS getSource(); 30 | } 31 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/channel/SelectionKeyHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.channel; 18 | 19 | import java.nio.channels.SelectionKey; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface SelectionKeyHandler { 26 | 27 | SelectionKey handle(); 28 | } 29 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/exit.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client exit page 21 | 22 | 23 | 24 |

25 | Robo4j Client default exit page 26 |

27 |

28 | Thank you for using Robo4j.io!
29 | we love Robotics & Robo4j.io 30 |

31 | 32 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/ILegoHardware.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | /** 20 | * generic interface for LegoMindstorm hardware 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface ILegoHardware { 26 | 27 | Type getType(); 28 | 29 | String getName(); 30 | } 31 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/examples/resources/robo4jSystem.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 6 20 | 5 21 | 5 22 | 23 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/enums/LegoEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.enums; 18 | 19 | /** 20 | * Every Lego related enum should implement this interface 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface LegoEnum { 26 | int getType(); 27 | String getName(); 28 | } 29 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/message/DatagramMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.message; 18 | 19 | /** 20 | * Datagram message 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public interface DatagramMessage { 26 | T toMessage(); 27 | 28 | void addMessage(T message); 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/units/CodecRegistryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.units; 18 | 19 | public class CodecRegistryException extends RuntimeException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public CodecRegistryException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/pad/LF710Input.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | /** 20 | * Interface for Logitech Gamepad inputs 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface LF710Input { 26 | 27 | short getMask(); 28 | 29 | String getDesc(); 30 | 31 | String name(); 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-units-rpi-http/src/test/resources/robo4jSystemConsumer.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 2 20 | 2 21 | 2 22 | 23 | 24 | -------------------------------------------------------------------------------- /robo4j-units-rpi-http/src/test/resources/robo4jSystemProducer.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 2 20 | 2 21 | 2 22 | 23 | 24 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/status.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client status page 21 | 22 | 23 | 24 |

25 | Robo4j Client default status page 26 |

27 |

28 | Robo4j Core agent status successfully generated!
29 | 30 |

31 |

32 | CACHE= ${cache} 33 |

34 | 35 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/units/SocketEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.units; 18 | 19 | /** 20 | * Encoder for encoding a target type to a message String. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public interface SocketEncoder { 26 | R encode(T stuff); 27 | Class getEncodedClass(); 28 | } 29 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/units/config/service/NumberServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.units.config.service; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public class NumberServiceImpl implements NumberService { 24 | 25 | @Override 26 | public Integer getNumber() { 27 | return 22; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/logitechF710.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | com.robo4j.units.rpi.pad.LF710PadUnit 20 | 21 | /dev/input/js0 22 | lcd 23 | 24 | 25 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testMessageEmitterSystem_10.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 2 21 | 2 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testMessageEmitterSystem_22.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 2 21 | 2 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testMessageEmitterSystem_8.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 2 21 | 2 22 | 2 23 | 24 | 25 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testRoboSystemOnly.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 6 21 | 3 22 | 10 23 | 24 | 25 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/examples/java/com/robo4j/hw/rpi/i2c/adafruitlcd/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | /** 20 | * 21 | * @author Marcus Hirt (@hirt) 22 | * @author Miroslav Wengner (@miragemiko) 23 | */ 24 | public class Util { 25 | static void sleep(int sleep) { 26 | try { 27 | Thread.sleep(sleep); 28 | } catch (InterruptedException e) { 29 | // Don't care 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonBooleanAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public class JsonBooleanAdapter extends JsonAdapter { 24 | 25 | @Override 26 | public String internalAdapt(Boolean obj) { 27 | return obj.toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/units/SocketDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.units; 18 | 19 | /** 20 | * Decoder for translating from a message string to a specific target type. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public interface SocketDecoder { 26 | R decode(T json); 27 | Class getDecodedClass(); 28 | } 29 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/success.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client success page 21 | 22 | 23 | 24 |

25 | Robo4j Client default success page 26 |

27 |

28 | Robo4j Command has been successfully processed!
29 | Congratulation 30 |

31 |

32 | command= ${command} 33 |

34 | 35 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/examples/java/com/robo4j/hw/rpi/i2c/adafruitlcd/LCDDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * The interface for the demos. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public interface LCDDemo { 28 | String getName(); 29 | void run(AdafruitLcd lcd) throws IOException; 30 | } 31 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/message/HttpDenominator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.message; 18 | 19 | /** 20 | * 21 | * @see HttpRequestDenominator 22 | * @see HttpResponseDenominator 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public interface HttpDenominator extends MessageDenominator { 28 | String getVersion(); 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/java/com/robo4j/units/rpi/led/BackpackMessageCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.led; 18 | 19 | /** 20 | * Types of messages for the LED backpacks. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public enum BackpackMessageCommand { 26 | 27 | //@formatter:off 28 | CLEAR, 29 | PAINT, 30 | DISPLAY 31 | //@formatter:on 32 | 33 | } -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/gripper/GripperEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.gripper; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public enum GripperEnum { 24 | OPEN_CLOSE (1), 25 | OPEN (2), 26 | CLOSE (3); 27 | 28 | final int id; 29 | 30 | GripperEnum(int id) { 31 | this.id = id; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/HttpException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http; 18 | 19 | public class HttpException extends RuntimeException{ 20 | private static final long serialVersionUID = 1L; 21 | 22 | public HttpException(String message) { 23 | super(message); 24 | } 25 | 26 | public HttpException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/matrix8x8example.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | com.robo4j.units.rpi.led.Adafruit8x8MatrixUnit 20 | 21 | 1 22 | 23 | 0x70 24 | 25 | 26 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/IButton.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | import lejos.hardware.KeyListener; 20 | 21 | /** 22 | * Methods expoced to the outside 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public interface IButton { 28 | void waitForPressAndRelease(); 29 | 30 | void addKeyListener(KeyListener listener); 31 | 32 | String getName(); 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/bargraph24example.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.led.Adafruit24BargraphUnit 21 | 22 | 1 23 | 24 | 0x70 25 | 26 | 27 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/net/RoboContextDescriptorEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.net; 18 | 19 | import java.net.InetAddress; 20 | 21 | /** 22 | * Internal bookkeeping class for discoveries. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | class RoboContextDescriptorEntry { 28 | public RoboContextDescriptor descriptor; 29 | public long lastAccess; 30 | public InetAddress address; 31 | } 32 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/util/ButtonUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego.util; 18 | 19 | import lejos.hardware.Button; 20 | 21 | /** 22 | * ButtonUtil to use lego hw native function 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public final class ButtonUtil { 28 | 29 | public static void setLEDPattern(int color){ 30 | Button.LEDPattern(color); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/pad/PadInputResponseListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | @FunctionalInterface 24 | public interface PadInputResponseListener { 25 | 26 | /** 27 | * 28 | * @param response joystick or button pressed response 29 | */ 30 | void onInputPressed(LF710Message response); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/resources/alphanumericexample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.led.AdafruitAlphanumericUnit 21 | 22 | 1 23 | 24 | 0x70 25 | 26 | 27 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/alphanumericexample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.led.AdafruitAlphanumericUnit 21 | 22 | 1 23 | 24 | 0x70 25 | 26 | 27 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/java/com/robo4j/units/rpi/lcd/LcdMessageType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.lcd; 18 | 19 | /** 20 | * Some types of messages known. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public enum LcdMessageType { 26 | // FIXME(Marcus/Jan 23, 2017): If we go with Object, we can have 27 | // different actual message types instead. 28 | SET_TEXT, CLEAR, DISPLAY_ENABLE, STOP, SCROLL, 29 | } -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/HttpHeaderFieldValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http; 18 | 19 | /** 20 | * Util class for header field values. All names are lower case. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class HttpHeaderFieldValues { 26 | 27 | public static String NO_CACHE = "no-cache"; 28 | public static final String CONNECTION_KEEP_ALIVE = "keep-alive"; 29 | } 30 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/i2c/ReadableDevice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * A device which provides a readable value. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | * 27 | * @param 28 | * the kind of data which can be read from the device. 29 | */ 30 | public interface ReadableDevice { 31 | E read() throws IOException; 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonNumberAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public class JsonNumberAdapter extends JsonAdapter{ 24 | 25 | public JsonNumberAdapter() { 26 | } 27 | 28 | @Override 29 | protected String internalAdapt(Integer obj) { 30 | return String.valueOf(obj); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/pad/RoboControlPad.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | import java.io.InputStream; 20 | 21 | /** 22 | * General pad abstraction 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public interface RoboControlPad { 28 | 29 | // TODO: review the purpose of the return 30 | boolean connect(); 31 | 32 | void disconnect(); 33 | 34 | InputStream source(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/ILcd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | /** 20 | * Generic interface for Lego Mindstorm LCD 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface ILcd { 26 | 27 | void initRobo4j(String title, String robotName); 28 | 29 | void clear(); 30 | 31 | void printText(int line, int increment, String text); 32 | 33 | void printText(String text); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/request/ChannelResponseProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.request; 18 | 19 | /** 20 | * NIO Channel result of request 21 | * 22 | * 23 | * @see HttpResponseProcess 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public interface ChannelResponseProcess { 29 | 30 | String getPath(); 31 | 32 | T getTarget(); 33 | 34 | Object getResult(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/util/ExceptionMessageUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.util; 18 | 19 | /** 20 | * formatting message for exception 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public final class ExceptionMessageUtils { 26 | 27 | public static String mapMessage(Object key, Object val){ 28 | return String.format("invalid key: %s or value %s", key, val); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /robo4j-math/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2023, Marcus Hirt, Miroslav Wengner 3 | * 4 | * ******************************************************************** 5 | * Robo4J: math module 6 | * ******************************************************************** 7 | * 8 | * Robo4J is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * Robo4J is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with Robo4J. If not, see . 20 | */ 21 | module robo4j.math { 22 | requires transitive jdk.jfr; 23 | requires org.slf4j; 24 | 25 | exports com.robo4j.math.features; 26 | exports com.robo4j.math.geometry; 27 | exports com.robo4j.math.geometry.impl; 28 | exports com.robo4j.math.jfr; 29 | } -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/units/HttpProducer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.units; 18 | 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | 22 | /** 23 | * Marker annotation marking the class as of interest for the HttpUnit. 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | @Retention(RetentionPolicy.RUNTIME) 29 | public @interface HttpProducer { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/camera/CameraClientException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.camera; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class CameraClientException extends RuntimeException { 26 | @Serial 27 | private static final long serialVersionUID = 1L; 28 | 29 | public CameraClientException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/java/com/robo4j/units/rpi/lcd/AdafruitException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.lcd; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class AdafruitException extends RuntimeException { 26 | @Serial 27 | private static final long serialVersionUID = 1L; 28 | 29 | public AdafruitException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/imu/bno/shtp/ShtpReportIds.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.imu.bno.shtp; 19 | 20 | /** 21 | * Helper for report types. 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public interface ShtpReportIds { 27 | /** 28 | * @return the id of the report. 29 | */ 30 | int getId(); 31 | 32 | /** 33 | * @return the channel which can report such a report. 34 | */ 35 | ShtpChannel getChannel(); 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/codec/CameraMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.codec; 18 | 19 | import com.robo4j.socket.http.units.HttpProducer; 20 | 21 | /** 22 | * Camera Image codec 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | @HttpProducer 28 | public class CameraMessageCodec extends AbstractHttpMessageCodec { 29 | 30 | public CameraMessageCodec() { 31 | super(CameraMessage.class); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public abstract class JsonAdapter implements JsonTypeAdapter { 24 | 25 | @SuppressWarnings("unchecked") 26 | @Override 27 | public String adapt(Object obj) { 28 | return internalAdapt((T)obj); 29 | } 30 | 31 | protected abstract String internalAdapt(T obj); 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonStringAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | import com.robo4j.socket.http.util.JsonElementStringBuilder; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public class JsonStringAdapter extends JsonAdapter { 26 | 27 | @Override 28 | public String internalAdapt(String obj) { 29 | return JsonElementStringBuilder.Builder().addQuotation(obj).build(); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/imu/bno/DataListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.imu.bno; 19 | 20 | /** 21 | * DeviceListener reacts on produced event 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public interface DataListener { 27 | 28 | /** 29 | * Called when there is a new result available. 30 | * 31 | * @param event 32 | * the event with data from the bno device. 33 | */ 34 | void onResponse(DataEvent3f event); 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/double.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.StringProducer 21 | 22 | 23 | target 24 | consumer 25 | 26 | 27 | 28 | 29 | 30 | com.robo4j.units.StringConsumer 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | class JsonException extends RuntimeException { 24 | private static final long serialVersionUID = 1L; 25 | 26 | JsonException(String message) { 27 | super(message); 28 | } 29 | 30 | JsonException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/resources/setup.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | Robo4j Client setup page 21 | 22 | 23 | 28 | 29 |

30 | Robo4j Client default setup page 31 |

32 |

33 | Robo4j Core agent setup successfully generated!
34 | 35 |

36 |

37 | ACTIVE BRICK SETUP 38 |

39 |

40 | ${setup} 41 |

42 | 43 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/json/JsonEnumAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.json; 18 | 19 | import com.robo4j.socket.http.util.JsonElementStringBuilder; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public class JsonEnumAdapter extends JsonAdapter> { 26 | 27 | @Override 28 | protected String internalAdapt(Enum obj) { 29 | return JsonElementStringBuilder.Builder().addQuotation(obj.name()).build(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/util/HttpConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.util; 18 | 19 | /** 20 | * Commonly used constants 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public final class HttpConstant { 26 | public static final int DEFAULT_VALUE_0 = 0; 27 | public static final String HTTP_QUERY_SEP = "\u0026"; // AMPERSAND & 28 | public static final String HTTP_EMPTY_SEP = "\\s+"; 29 | public static final String HTTP_NEW_LINE = "\r\n"; 30 | } 31 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/i2c/adafruitbackpack/LedBackpackType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.i2c.adafruitbackpack; 19 | 20 | /** 21 | * LEDBackpackType available Adafruit backpack types 22 | * 23 | * https://learn.adafruit.com/adafruit-led-backpack/overview 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public enum LedBackpackType { 29 | //@formatter:off 30 | BI_COLOR_BAR_24, 31 | BI_COLOR_MATRIX_8x8, 32 | ALPHANUMERIC 33 | //@formatter:on 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/reflect/ReflectionScanException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.reflect; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * ReflectionScanException. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public class ReflectionScanException extends RuntimeException { 28 | @Serial 29 | private static final long serialVersionUID = 1L; 30 | 31 | public ReflectionScanException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/configuration/ConfigurationFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.configuration; 18 | 19 | /** 20 | * Factory for creating empty configurations. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public class ConfigurationFactory { 26 | /** 27 | * Creates a new, empty, configuration. 28 | * 29 | * @return an empty {@link Configuration}. 30 | */ 31 | public static Configuration createEmptyConfiguration() { 32 | return new DefaultConfiguration(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/LegoException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | /** 20 | * 21 | * Exception related to the lego package 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miro Wengner (@miragemiko) 25 | */ 26 | public class LegoException extends RuntimeException { 27 | private static final long serialVersionUID = 1L; 28 | 29 | public LegoException(String message) { 30 | super(message); 31 | } 32 | 33 | public LegoException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/serial/ydlidar/ScanReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.serial.ydlidar; 18 | 19 | import com.robo4j.math.geometry.ScanResult2D; 20 | 21 | /** 22 | * Interface for consumers of scan results. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public interface ScanReceiver { 28 | /** 29 | * Called upon new scan data. 30 | * 31 | * @param scanResult 32 | * result from the scanner. 33 | */ 34 | public void onScan(ScanResult2D scanResult); 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/codec/StringCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.codec; 18 | 19 | import com.robo4j.socket.http.units.HttpProducer; 20 | 21 | /** 22 | * Default codec for any unit that takes string messages. 23 | * 24 | * @see SimpleCommand 25 | * 26 | * @author Marcus Hirt (@hirt) 27 | * @author Miro Wengner (@miragemiko) 28 | */ 29 | @HttpProducer 30 | public class StringCodec extends AbstractHttpMessageCodec { 31 | 32 | public StringCodec() { 33 | super(StringMessage.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/util/StreamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.util; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class StreamException extends RuntimeException { 26 | @Serial 27 | private static final long serialVersionUID = 1L; 28 | 29 | public StreamException(String message) { 30 | super(message); 31 | } 32 | 33 | public StreamException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/SocketException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http; 18 | 19 | /** 20 | * 21 | * generic http exception 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miro Wengner (@miragemiko) 25 | */ 26 | public class SocketException extends RuntimeException { 27 | private static final long serialVersionUID = 1L; 28 | 29 | public SocketException(String message) { 30 | super(message); 31 | } 32 | 33 | public SocketException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/codec/CameraConfigMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.codec; 18 | 19 | import com.robo4j.socket.http.units.HttpProducer; 20 | 21 | /** 22 | * 23 | * Camera Image config codec 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | 29 | @HttpProducer 30 | public class CameraConfigMessageCodec extends AbstractHttpMessageCodec { 31 | 32 | public CameraConfigMessageCodec() { 33 | super(CameraConfigMessage.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/AttributeDescriptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | /** 20 | * The descriptor for an attribute. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public interface AttributeDescriptor { 26 | /** 27 | * Returns the type of the attribute. 28 | * 29 | * @return the attribute type. 30 | */ 31 | Class attributeType(); 32 | 33 | /** 34 | * Returns the name of the attribute. 35 | * 36 | * @return the attribute name. 37 | */ 38 | String attributeName(); 39 | } 40 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/examples/java/com/robo4j/hw/rpi/i2c/adafruitlcd/HelloLcd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * Simple hello world-style example. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public class HelloLcd { 28 | 29 | public static void main(String[] args) throws IOException { 30 | AdafruitLcd lcd = LcdFactory.createLCD(); 31 | lcd.setBacklight(Color.TEAL); 32 | lcd.setText("Hello World!\n-----Robo4J-----"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/util/RoboReflectException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.util; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public class RoboReflectException extends RuntimeException { 24 | private static final long serialVersionUID = 1L; 25 | 26 | public RoboReflectException(String message) { 27 | super(message); 28 | } 29 | 30 | public RoboReflectException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/roboclawexample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.roboclaw.RoboClawRCTankUnit 21 | 22 | 1 23 | 24 | 0x40 25 | 6 26 | 7 27 | 28 | 29 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/LegoUnitException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego; 18 | 19 | /** 20 | * Default RoboUnit Exception 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class LegoUnitException extends RuntimeException{ 26 | private static final long serialVersionUID = 1L; 27 | 28 | public LegoUnitException(String message) { 29 | super(message); 30 | } 31 | 32 | public LegoUnitException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/infra/InfraSensorEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.infra; 18 | 19 | import java.util.stream.Stream; 20 | 21 | /** 22 | * InfraSensorEnum {@link com.robo4j.units.lego.InfraSensorUnit} 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public enum InfraSensorEnum { 28 | START, STOP, NONE; 29 | 30 | public static InfraSensorEnum parseValue(String value) { 31 | return Stream.of(values()).filter(v -> v.name().equals(value.toUpperCase())).findFirst().orElse(NONE); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/ILegoSensor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | 20 | import com.robo4j.hw.lego.enums.DigitalPortEnum; 21 | import com.robo4j.hw.lego.enums.SensorTypeEnum; 22 | 23 | /** 24 | * 25 | * Basic functionality of any LegoMindstorm Sensor 26 | * 27 | * @author Marcus Hirt (@hirt) 28 | * @author Miro Wengner (@miragemiko) 29 | */ 30 | public interface ILegoSensor { 31 | 32 | DigitalPortEnum port(); 33 | 34 | SensorTypeEnum type(); 35 | 36 | String getData(); 37 | 38 | void activate(boolean status); 39 | 40 | void close(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/util/EscapeButtonUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego.util; 18 | 19 | import com.robo4j.hw.lego.wrapper.ButtonWrapper; 20 | import lejos.hardware.Button; 21 | import lejos.hardware.Key; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public final class EscapeButtonUtil { 28 | private static final ButtonWrapper escape = new ButtonWrapper(Button.ESCAPE); 29 | 30 | public static void waitForPressAndRelease(){ 31 | escape.waitForPressAndRelease(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/sonic/SonicSensorEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.sonic; 18 | 19 | import java.util.stream.Stream; 20 | 21 | /** 22 | * SonicSensorEnum {@link com.robo4j.units.lego.SonicSensorUnit} 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public enum SonicSensorEnum { 28 | START, STOP, NONE; 29 | 30 | public static SonicSensorEnum parseValue(String value) { 31 | return Stream.of(values()).filter(v -> v.name().equals(value.toUpperCase())).findFirst().orElse(NONE); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/json/TimeUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.json; 18 | 19 | import org.slf4j.Logger; 20 | import org.slf4j.LoggerFactory; 21 | 22 | /** 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public final class TimeUtils { 27 | private static final Logger LOGGER = LoggerFactory.getLogger(TimeUtils.class); 28 | 29 | static void printTimeDiffNano(String message, long start) { 30 | LOGGER.debug("message: {} duration: {}", message, System.nanoTime() - start); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/brick/PlateButtonI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.brick; 18 | 19 | import com.robo4j.hw.lego.enums.ButtonTypeEnum; 20 | import com.robo4j.units.lego.enums.PlateButtonEnum; 21 | 22 | /** 23 | * Plate button works as the interface of binding LegoMindstorm Hardware button with Robo4J abstraction 24 | * to allow dynamic configuration 25 | * 26 | * @author Marcus Hirt (@hirt) 27 | * @author Miro Wengner (@miragemiko) 28 | */ 29 | public interface PlateButtonI { 30 | 31 | PlateButtonEnum getKey(); 32 | ButtonTypeEnum getValue(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/gps/VelocityEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.gps; 18 | 19 | /** 20 | * Event for the velocity. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public interface VelocityEvent extends GPSEvent { 26 | /** 27 | * Returns the measured heading in degrees. 28 | * 29 | * @return the measured heading in degrees. 30 | */ 31 | float getHeading(); 32 | 33 | /** 34 | * Returns the horizontal speed in km/h. 35 | * 36 | * @return the horizontal speed in km/h. 37 | */ 38 | float getGroundSpeed(); 39 | } 40 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/pad/LF710PadUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miro Wengner (@miragemiko) 22 | */ 23 | public class LF710PadUtils { 24 | private static final int MAX_AMOUNT = 32767; 25 | private static final int MAX_PERCENTAGE = 100; 26 | 27 | public static int axesMiniStickToPercentage(int volume) { 28 | return (MAX_PERCENTAGE * volume) / MAX_AMOUNT; 29 | } 30 | 31 | public static int axesMiniStickToValue(int percentage) { 32 | return (MAX_AMOUNT * percentage) / MAX_PERCENTAGE; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/codec/SimpleCommandCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.codec; 18 | 19 | import com.robo4j.socket.http.units.HttpProducer; 20 | 21 | /** 22 | * default simple codec for simple commands Simple codec is currently used for 23 | * Enum 24 | * 25 | * @see SimpleCommand 26 | * 27 | * @author Marcus Hirt (@hirt) 28 | * @author Miro Wengner (@miragemiko) 29 | */ 30 | @HttpProducer 31 | public class SimpleCommandCodec extends AbstractHttpMessageCodec { 32 | public SimpleCommandCodec() { 33 | super(SimpleCommand.class); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/bno080GyroExample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.imu.Bno080Unit 21 | 22 | GYROSCOPE 23 | 60 24 | 25 | 26 | 27 | com.robo4j.units.rpi.imu.DataEventListenerUnit 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/Export.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import static java.lang.annotation.ElementType.TYPE; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Annotation for making a unit available outside of the home context. By 27 | * default units will be hidden from remote contexts. 28 | * 29 | * @author Marcus Hirt (@hirt) 30 | * @author Miroslav Wengner (@miragemiko) 31 | */ 32 | @Retention(RUNTIME) 33 | @Target(TYPE) 34 | public @interface Export { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/codec/HttpPathDTOCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.codec; 18 | 19 | import com.robo4j.socket.http.codec.AbstractHttpMessageCodec; 20 | import com.robo4j.socket.http.dto.HttpPathMethodDTO; 21 | import com.robo4j.socket.http.units.HttpProducer; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | @HttpProducer 28 | public class HttpPathDTOCodec extends AbstractHttpMessageCodec { 29 | public HttpPathDTOCodec() { 30 | super(HttpPathMethodDTO.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/examples/java/com/robo4j/hw/rpi/i2c/adafruitlcd/ExitDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | import java.io.IOException; 20 | /** 21 | * This one really doesn't anything but clean up and exit. 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public class ExitDemo implements LCDDemo { 27 | 28 | @Override 29 | public String getName() { 30 | return ""; 31 | } 32 | 33 | @Override 34 | public void run(AdafruitLcd lcd) throws IOException { 35 | lcd.clear(); 36 | lcd.stop(); 37 | System.exit(0); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/pad/LF710Exception.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * Logitech F710 Gamepad exception 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public class LF710Exception extends RuntimeException { 28 | @Serial 29 | private static final long serialVersionUID = 1L; 30 | 31 | public LF710Exception(String message) { 32 | super(message); 33 | } 34 | 35 | public LF710Exception(String message, Throwable cause) { 36 | super(message, cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/codec/CameraMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.codec; 18 | 19 | import com.robo4j.socket.http.codec.AbstractHttpMessageCodec; 20 | import com.robo4j.socket.http.units.HttpProducer; 21 | 22 | /** 23 | * Camera Image codec 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miro Wengner (@miragemiko) 27 | */ 28 | @HttpProducer 29 | public class CameraMessageCodec extends AbstractHttpMessageCodec { 30 | 31 | public CameraMessageCodec() { 32 | super(CameraMessage.class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/CriticalSectionTrait.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import static java.lang.annotation.ElementType.TYPE; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Annotate the with this annotation to declare that the unit will get messages 27 | * delivered one at a time. 28 | * 29 | * @author Marcus Hirt (@hirt) 30 | * @author Miroslav Wengner (@miragemiko) 31 | */ 32 | @Retention(RUNTIME) 33 | @Target(TYPE) 34 | public @interface CriticalSectionTrait { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/test.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.StringProducer 21 | 22 | consumer 23 | 10 24 | 25 | 26 | 27 | 28 | com.robo4j.units.StringConsumer 29 | 30 | 10 31 | 32 | 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/utils/I2cBus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.utils; 19 | 20 | import java.util.stream.Stream; 21 | 22 | public enum I2cBus { 23 | BUS_UNKNOWN(-1), 24 | BUS_0(0), 25 | BUS_1(1) 26 | ; 27 | 28 | private final int address; 29 | I2cBus(int address) { 30 | this.address = address; 31 | } 32 | 33 | public int address(){ 34 | return address; 35 | } 36 | 37 | public static I2cBus getByAddress(int address) { 38 | return Stream.of(values()).filter(p -> p.address == address).findFirst().orElse(BUS_UNKNOWN); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/scheduler/FinalInvocationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.scheduler; 18 | 19 | import com.robo4j.RoboContext; 20 | 21 | /** 22 | * Optional listener to be executed on the final invocation of series of 23 | * scheduled invocations. 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public interface FinalInvocationListener { 29 | /** 30 | * This method is called when all the scheduled runs are completed. 31 | * 32 | * @param context 33 | * the RoboContext. 34 | */ 35 | void onFinalInvocation(RoboContext context); 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-math/src/main/java/com/robo4j/math/geometry/ScanResult2D.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.math.geometry; 18 | 19 | import java.util.List; 20 | /** 21 | * The results from a 2D scan. 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public interface ScanResult2D { 27 | List getPoints(); 28 | Point2f getNearestPoint(); 29 | Point2f getFarthestPoint(); 30 | Point2f getLeftmostPoint(); 31 | Point2f getRightmostPoint(); 32 | double getMaxX(); 33 | double getMinX(); 34 | double getMaxY(); 35 | double getMinY(); 36 | float getAngularResolution(); 37 | int getScanID(); 38 | } 39 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/i2c/adafruitlcd/ButtonListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | /** 20 | * A button listener interface that can be used to listen for buttons being 21 | * pressed on the LCD shield. 22 | * 23 | * @see ButtonPressedObserver 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miro Wengner (@miragemiko) 27 | */ 28 | @FunctionalInterface 29 | public interface ButtonListener { 30 | /** 31 | * Called when a button is pressed on the LCD shield. 32 | * 33 | * @param button the button that was pressed. 34 | */ 35 | void onButtonPressed(Button button); 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testRoboUnitsOnly.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | com.robo4j.units.StringProducer 20 | 21 | consumer 22 | 10 23 | 24 | 25 | 26 | 27 | com.robo4j.units.StringConsumer 28 | 29 | 10 30 | 31 | 32 | -------------------------------------------------------------------------------- /robo4j-core/src/test/java/com/robo4j/TestToolkit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | import java.util.Random; 22 | 23 | /** 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public class TestToolkit { 29 | private final static Random RND = new Random(); 30 | 31 | public static Map createSingleValueProps(String key, String value) { 32 | Map properties = new HashMap<>(); 33 | properties.put(key, value); 34 | return properties; 35 | } 36 | 37 | public static Random getRND() { 38 | return RND; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/gps/FixQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.gps; 18 | 19 | /** 20 | * Quality of the sat fix. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public final class FixQuality { 26 | private final int qualityCode; 27 | private final String description; 28 | 29 | public FixQuality(int qualityCode, String description) { 30 | this.qualityCode = qualityCode; 31 | this.description = description; 32 | } 33 | 34 | public int getQualityCode() { 35 | return qualityCode; 36 | } 37 | 38 | public String getDescription() { 39 | return description; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/codec/NSBTypesTestMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.codec; 18 | 19 | import com.robo4j.socket.http.codec.AbstractHttpMessageCodec; 20 | import com.robo4j.socket.http.units.HttpProducer; 21 | import com.robo4j.socket.http.test.units.config.codec.NSBTypesTestMessage; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | @HttpProducer 28 | public class NSBTypesTestMessageCodec extends AbstractHttpMessageCodec { 29 | public NSBTypesTestMessageCodec() { 30 | super(NSBTypesTestMessage.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/WorkTrait.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import static java.lang.annotation.ElementType.TYPE; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Annotate units with this annotation to declare that their onMessage methods 27 | * may take some time to finish. The messages will be delivered using a separate 28 | * work pool. 29 | * 30 | * @author Marcus Hirt (@hirt) 31 | * @author Miroslav Wengner (@miragemiko) 32 | */ 33 | @Retention(RUNTIME) 34 | @Target(TYPE) 35 | public @interface WorkTrait { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/codec/NSBETypesTestMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.codec; 18 | 19 | import com.robo4j.socket.http.codec.AbstractHttpMessageCodec; 20 | import com.robo4j.socket.http.units.HttpProducer; 21 | import com.robo4j.socket.http.test.units.config.codec.NSBETypesTestMessage; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | @HttpProducer 28 | public class NSBETypesTestMessageCodec extends AbstractHttpMessageCodec { 29 | public NSBETypesTestMessageCodec() { 30 | super(NSBETypesTestMessage.class); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/examples/java/com/robo4j/hw/rpi/i2c/adafruitlcd/HelloWorldDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.adafruitlcd; 18 | 19 | import java.io.IOException; 20 | 21 | import com.robo4j.hw.rpi.i2c.adafruitlcd.AdafruitLcd; 22 | 23 | /** 24 | * The mandatory Hello World! 25 | * 26 | * @author Marcus Hirt (@hirt) 27 | * @author Miroslav Wengner (@miragemiko) 28 | */ 29 | public class HelloWorldDemo implements LCDDemo { 30 | 31 | @Override 32 | public String getName() { 33 | return "Hello World"; 34 | } 35 | 36 | @Override 37 | public void run(AdafruitLcd lcd) throws IOException { 38 | lcd.clear(); 39 | lcd.setText("Hello World!\nDone!"); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/gyroexample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.gyro.GyroL3GD20Unit 21 | 22 | 1 23 | 0x6b 24 | DPS_245 25 | true 26 | 27 | 10 28 | 29 | 30 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/util/PropertyMapBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.util; 18 | 19 | import java.util.Collections; 20 | import java.util.LinkedHashMap; 21 | import java.util.Map; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public class PropertyMapBuilder { 28 | 29 | private final Map map; 30 | 31 | public PropertyMapBuilder() { 32 | this.map = new LinkedHashMap<>(); 33 | } 34 | 35 | public PropertyMapBuilder put(K key, V value) { 36 | map.put(key, value); 37 | return this; 38 | } 39 | 40 | public Map create() { 41 | return Collections.unmodifiableMap(map); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /robo4j-core/src/test/java/com/robo4j/StringToolkit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import java.util.Random; 20 | 21 | /** 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public final class StringToolkit { 27 | private static final Random RND = new Random(); 28 | private StringToolkit() { 29 | throw new AssertionError("Toolkit!"); 30 | } 31 | 32 | public static String getRandomMessage(int size) { 33 | StringBuilder builder = new StringBuilder(); 34 | for (int i = 0; i < size; i++) { 35 | builder.append(String.valueOf((char) ('A' + RND.nextInt('Z' - 'A')))); 36 | } 37 | return builder.toString(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/ILegoMotor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego; 18 | 19 | import com.robo4j.hw.lego.enums.AnalogPortEnum; 20 | import com.robo4j.hw.lego.enums.MotorTypeEnum; 21 | 22 | /** 23 | * Basic functionality of the LegoMindstorm Motor 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miro Wengner (@miragemiko) 27 | */ 28 | public interface ILegoMotor { 29 | 30 | AnalogPortEnum getPort(); 31 | 32 | MotorTypeEnum getType(); 33 | 34 | void forward(); 35 | 36 | void backward(); 37 | 38 | void stop(); 39 | 40 | void rotate(int val); 41 | 42 | boolean isMoving(); 43 | 44 | void setSpeed(int speed); 45 | 46 | void close(); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /robo4j-math/src/main/java/com/robo4j/math/jfr/ScanId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.math.jfr; 18 | import static java.lang.annotation.ElementType.FIELD; 19 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.Target; 22 | import jdk.jfr.Description; 23 | import jdk.jfr.Name; 24 | import jdk.jfr.Relational; 25 | /** 26 | * This annotation defines a relation for future events that are related through the 27 | * same scan id. 28 | */ 29 | 30 | @Relational 31 | @Name("robo4j.math.ScanId") 32 | @Retention(RUNTIME) 33 | @Target(FIELD) 34 | @Description("Binds together scans with the id") 35 | public @interface ScanId { 36 | } -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/request/DefaultRequestFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.request; 18 | 19 | import com.robo4j.RoboContext; 20 | import com.robo4j.RoboReference; 21 | import com.robo4j.socket.http.units.ServerPathConfig; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | public interface DefaultRequestFactory { 28 | 29 | ResponseType processGet(RoboContext context); 30 | 31 | ResponseType processGet(ServerPathConfig pathConfig); 32 | 33 | ResponseType processServerGet(ServerPathConfig pathConfig); 34 | 35 | ResponseType processPost(RoboReference unitReference, String message); 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/resources/http_get.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | com.robo4j.reference.HttpServerUnit 22 | 23 | 8025 24 | request_consumer 25 | {"roboUnit":"controller","method":"GET"} 26 | 27 | 28 | 29 | com.robo4j.units.StringConsumer 30 | 31 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/util/DatagramBodyType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.util; 18 | 19 | /** 20 | * @author Marcus Hirt (@hirt) 21 | * @author Miroslav Wengner (@miragemiko) 22 | */ 23 | public enum DatagramBodyType { 24 | JSON (1), 25 | BYTE (2), 26 | TEXT (3) 27 | ; 28 | 29 | private final int type; 30 | 31 | DatagramBodyType(int type) { 32 | this.type = type; 33 | } 34 | 35 | public int getType() { 36 | return type; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "DatagramBodyType{" + 42 | "type=" + type + 43 | '}'; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/test/java/com/robo4j/hw/rpi/pad/LF710PadUtilsTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.pad; 18 | 19 | import org.junit.jupiter.api.Test; 20 | 21 | import static org.junit.jupiter.api.Assertions.assertTrue; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miro Wengner (@miragemiko) 26 | */ 27 | class LF710PadUtilsTests { 28 | 29 | @Test 30 | void testPercentageValues(){ 31 | assertTrue(LF710PadUtils.axesMiniStickToPercentage(0) == 0); 32 | assertTrue(LF710PadUtils.axesMiniStickToPercentage(32767) == 100); 33 | assertTrue(LF710PadUtils.axesMiniStickToValue(100) == 32767); 34 | assertTrue(LF710PadUtils.axesMiniStickToValue(0) == 0); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/MIMEContentTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http; 18 | 19 | /** 20 | * Standard Http MIME content types. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class MIMEContentTypes { 26 | public static final String APPLICATION_JSON = "application/json"; 27 | public static final String APPLICATION_IMAGE_JPG = "image/jpg"; 28 | public static final String APPLICATION_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; 29 | public static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; 30 | public static final String APPLICATION_ROBO4J = "application/vnd.robo4j.media"; 31 | } 32 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/java/com/robo4j/units/rpi/lcd/LcdDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.lcd; 18 | 19 | import java.io.IOException; 20 | 21 | /** 22 | * The interface for the demos. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public interface LcdDemo { 28 | /** 29 | * The name of the demo. Keep it shorter than 13 characters. 30 | * 31 | * @return the name of the demo. 32 | */ 33 | String getName(); 34 | 35 | /** 36 | * 37 | * @throws IOException 38 | * exception 39 | */ 40 | void run() throws IOException; 41 | 42 | /** 43 | * @return true if the demo is still running. 44 | */ 45 | boolean isRunning(); 46 | } 47 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/i2c/accelerometer/CalibratedAccelerometer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.i2c.accelerometer; 18 | 19 | import com.robo4j.hw.rpi.i2c.CalibratedFloat3DDevice; 20 | import com.robo4j.hw.rpi.i2c.ReadableDevice; 21 | import com.robo4j.math.geometry.Tuple3f; 22 | 23 | /** 24 | * Strictly not required, but provided for symmetry with the gyro package. 25 | * 26 | * @author Marcus Hirt (@hirt) 27 | * @author Miroslav Wengner (@miragemiko) 28 | */ 29 | public class CalibratedAccelerometer extends CalibratedFloat3DDevice { 30 | public CalibratedAccelerometer(ReadableDevice device, Tuple3f offsets, Tuple3f multipliers) { 31 | super(device, offsets, multipliers); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/main/java/com/robo4j/units/lego/infra/InfraSensorMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.infra; 18 | 19 | /** 20 | * InfraSensorMessage 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public class InfraSensorMessage { 26 | 27 | private final String distance; 28 | 29 | public InfraSensorMessage(String distance) { 30 | this.distance = distance; 31 | } 32 | 33 | public String getDistance() { 34 | return distance; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "InfraSensorMessage{" + 40 | "distance='" + distance + '\'' + 41 | '}'; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/net/MessageCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.net; 18 | 19 | /** 20 | * Message callback interface for handling a received message. 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public interface MessageCallback { 26 | /** 27 | * Handles an incoming message from a remote context. 28 | * 29 | * @param sourceUuid 30 | * the UUID of the remote context from which the message was 31 | * sent. 32 | * @param id 33 | * the id of the reference for the recipient. 34 | * @param message 35 | * the message sent. 36 | */ 37 | void handleMessage(String sourceUuid, String id, Object message); 38 | } 39 | -------------------------------------------------------------------------------- /robo4j-math/src/main/java/com/robo4j/math/geometry/MatrixEmpty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.math.geometry; 19 | 20 | /** 21 | * Empty Matrix dimensions equal to zero 22 | */ 23 | public class MatrixEmpty implements Matrix { 24 | public static final int DIMENSION_ZERO = 0; 25 | 26 | @Override 27 | public int getRows() { 28 | return DIMENSION_ZERO; 29 | } 30 | 31 | @Override 32 | public int getColumns() { 33 | return DIMENSION_ZERO; 34 | } 35 | 36 | @Override 37 | public Number getNumber(int row, int column) { 38 | return DIMENSION_ZERO; 39 | } 40 | 41 | @Override 42 | public void transpose() { 43 | throw new IllegalStateException("not valid operation"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/test/java/com/robo4j/hw/rpi/imu/bno/impl/BnoSerialTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.imu.bno.impl; 18 | 19 | import org.junit.jupiter.api.Test; 20 | 21 | import com.robo4j.hw.rpi.imu.bno.impl.Bno055SerialDevice; 22 | 23 | import static org.junit.jupiter.api.Assertions.assertEquals; 24 | 25 | /** 26 | * 27 | * @author Marcus Hirt (@hirt) 28 | * @author Miroslav Wengner (@miragemiko) 29 | */ 30 | class BnoSerialTests { 31 | 32 | @Test 33 | void testBNOSerialReadRequest() { 34 | byte[] readRequest = Bno055SerialDevice.createReadRequest(0x20, 2); 35 | assertEquals(0xAA, 0xFF & readRequest[0]); 36 | assertEquals(0x01, readRequest[1]); 37 | assertEquals(0x20, readRequest[2]); 38 | assertEquals(2, readRequest[3]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/test/java/com/robo4j/socket/http/test/codec/NSBETypesAndCollectionTestMessageCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.test.codec; 18 | 19 | import com.robo4j.socket.http.codec.AbstractHttpMessageCodec; 20 | import com.robo4j.socket.http.units.HttpProducer; 21 | import com.robo4j.socket.http.test.units.config.codec.NSBETypesAndCollectionTestMessage; 22 | 23 | /** 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | @HttpProducer 28 | public class NSBETypesAndCollectionTestMessageCodec extends AbstractHttpMessageCodec { 29 | 30 | public NSBETypesAndCollectionTestMessageCodec() { 31 | super(NSBETypesAndCollectionTestMessage.class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/enums/LcdFontEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego.enums; 18 | 19 | import lejos.hardware.lcd.Font; 20 | 21 | /** 22 | * LcdFontEnum provides mapping between Robo4j framework and lego fonts 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public enum LcdFontEnum { 28 | 29 | //@formatter:off 30 | LARGE (1, Font.getLargeFont()), 31 | MEDIUM (2, Font.getDefaultFont()), 32 | SMALL (3, Font.getSmallFont()),; 33 | //@formatter:on 34 | 35 | private final Font font; 36 | 37 | LcdFontEnum(int id, Font font) { 38 | this.font = font; 39 | } 40 | 41 | public Font getFont() { 42 | return font; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/i2c/adafruitbackpack/BiColor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.i2c.adafruitbackpack; 19 | 20 | /** 21 | * @author Marcus Hirt (@hirt) 22 | * @author Miroslav Wengner (@miragemiko) 23 | */ 24 | public enum BiColor { 25 | 26 | //@formatter:off 27 | OFF (0), 28 | RED (1), 29 | YELLOW (2), 30 | GREEN (3); 31 | //@formatter:on 32 | 33 | private final int value; 34 | 35 | BiColor(int value) { 36 | this.value = value; 37 | } 38 | 39 | public int getValue() { 40 | return value; 41 | } 42 | 43 | public static BiColor getByValue(int code) { 44 | for (BiColor r : values()) { 45 | if (code == r.value) { 46 | return r; 47 | } 48 | } 49 | return OFF; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/main/java/com/robo4j/units/rpi/camera/CameraUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.camera; 18 | 19 | /** 20 | * 21 | * @author Marcus Hirt (@hirt) 22 | * @author Miroslav Wengner (@miragemiko) 23 | */ 24 | public final class CameraUtil { 25 | 26 | public static ImageDTO createImageDTOBydMessageAndBytes(final RaspistillRequest message, final byte[] content){ 27 | return ImageDTOBuilder.Build() 28 | .setWidth(Integer.valueOf(message.getProperty(RpiCameraProperty.WIDTH))) 29 | .setHeight(Integer.valueOf(message.getProperty(RpiCameraProperty.HEIGHT))) 30 | .setEncoding(message.getProperty(RpiCameraProperty.ENCODING)) 31 | .setContent(content).build(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/configuration/ConfigurationFactoryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.configuration; 18 | 19 | import java.io.Serial; 20 | 21 | /** 22 | * Exception for when failing to create a configuration. 23 | * 24 | * @author Marcus Hirt (@hirt) 25 | * @author Miroslav Wengner (@miragemiko) 26 | */ 27 | public class ConfigurationFactoryException extends Exception { 28 | @Serial 29 | private static final long serialVersionUID = 1L; 30 | 31 | /** 32 | * Constructor. 33 | * 34 | * @param message 35 | * the exception message. 36 | * @param cause 37 | * the exception cause. 38 | */ 39 | public ConfigurationFactoryException(String message, Throwable cause) { 40 | super(message, cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /robo4j-core/src/main/java/com/robo4j/BlockingTrait.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j; 18 | 19 | import static java.lang.annotation.ElementType.TYPE; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * Annotate units with this annotation to declare that their onMessage methods 27 | * may take some time to finish, and that it will spend most of the time blocked 28 | * (for example on synchronous IO). The messages will be delivered using a 29 | * separate work pool. 30 | * 31 | * @author Marcus Hirt (@hirt) 32 | * @author Miroslav Wengner (@miragemiko) 33 | */ 34 | @Retention(RUNTIME) 35 | @Target(TYPE) 36 | public @interface BlockingTrait { 37 | 38 | } 39 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/dto/ClientClassPathDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.dto; 18 | 19 | import com.robo4j.socket.http.units.ClientPathConfig; 20 | 21 | /** 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miroslav Wengner (@miragemiko) 24 | */ 25 | public class ClientClassPathDTO { 26 | 27 | private final String clazz; 28 | private final ClientPathConfig clientPath; 29 | 30 | public ClientClassPathDTO(String clazz, ClientPathConfig clientPath) { 31 | this.clazz = clazz; 32 | this.clientPath = clientPath; 33 | } 34 | 35 | public String getClazz() { 36 | return clazz; 37 | } 38 | 39 | public ClientPathConfig getClientPath() { 40 | return clientPath; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /robo4j-core/src/test/resources/testsubconfig.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.ConfigurationConsumer 21 | 22 | consumer 23 | 24 | 0.064 25 | 0.001 26 | 0 27 | 28 | 29 | -0.969932 30 | 0.917431 31 | 0.943396 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/gps/AbstractGPSEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.gps; 18 | 19 | import com.robo4j.hw.rpi.serial.gps.MTK3339PositionEvent; 20 | import com.robo4j.hw.rpi.serial.gps.MTK3339VelocityEvent; 21 | 22 | /** 23 | * Abstract super class for GPS event classes. 24 | * 25 | * @see MTK3339PositionEvent 26 | * @see MTK3339VelocityEvent 27 | * 28 | * @author Marcus Hirt (@hirt) 29 | * @author Miro Wengner (@miragemiko) 30 | */ 31 | public abstract class AbstractGPSEvent { 32 | public static final float INVALID_VALUE = Float.NaN; 33 | 34 | private final GPS source; 35 | 36 | public AbstractGPSEvent(GPS source) { 37 | this.source = source; 38 | } 39 | 40 | public final GPS getSource() { 41 | return source; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/resources/bno080VectorExample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | com.robo4j.units.rpi.imu.Bno080Unit 21 | 22 | ROTATION_VECTOR 23 | 1000 24 | 25 | 26 | 27 | com.robo4j.units.rpi.imu.VectorEventListenerUnit 28 | 29 | cubeVizSystem 30 | bnoReceiver 31 | 32 | 33 | -------------------------------------------------------------------------------- /robo4j-hw-lego/src/main/java/com/robo4j/hw/lego/util/BrickUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.lego.util; 18 | 19 | /** 20 | * Some useful Lego Mindstorm brick utils 21 | * 22 | * @author Marcus Hirt (@hirt) 23 | * @author Miro Wengner (@miragemiko) 24 | */ 25 | public class BrickUtils { 26 | 27 | /* identifies Lego Brick Mindstorm buttons */ 28 | public static final String PREFIX_BUTTON = "button_"; 29 | 30 | /* identifies test resources */ 31 | private static final String PREFIX_TEST = "test_"; 32 | 33 | public static String getButton(String name){ 34 | return PREFIX_BUTTON.concat(name).toLowerCase(); 35 | } 36 | 37 | public static String getTestResource(String name){ 38 | return PREFIX_TEST.concat(name).toLowerCase(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/main/java/com/robo4j/hw/rpi/imu/bno/DataEventType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | 18 | package com.robo4j.hw.rpi.imu.bno; 19 | 20 | /** 21 | * The various types of {@link DataEvent3f}. 22 | * 23 | * @author Marcus Hirt (@hirt) 24 | * @author Miroslav Wengner (@miragemiko) 25 | */ 26 | public enum DataEventType { 27 | //@formatter:off 28 | NONE (-1), 29 | MAGNETOMETER (4), 30 | ACCELEROMETER (8), 31 | ACCELEROMETER_RAW (8), 32 | ACCELEROMETER_LINEAR (8), 33 | GYROSCOPE (9), 34 | VECTOR_GAME (14), 35 | VECTOR_ROTATION (14); 36 | //@formatter:on 37 | private final int qPoint; 38 | 39 | DataEventType(int qPoint) { 40 | this.qPoint = qPoint; 41 | } 42 | 43 | public int getQ() { 44 | return qPoint; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /robo4j-socket-http/src/main/java/com/robo4j/socket/http/units/SocketContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.socket.http.units; 18 | 19 | import java.util.Collection; 20 | import java.util.Map; 21 | 22 | /** 23 | * interface for channel context 24 | * 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public interface SocketContext { 29 | 30 | void addPaths(Map paths); 31 | 32 | boolean isEmpty(); 33 | 34 | boolean containsPath(PathHttpMethod pathMethod); 35 | 36 | Collection getPathConfigs(); 37 | 38 | T getPathConfig(PathHttpMethod pathMethod); 39 | 40 | void putProperty(String key, Object val); 41 | 42 | E getProperty(Class clazz, String key); 43 | 44 | E getPropertySafe(Class clazz, String key); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /robo4j-hw-rpi/src/test/java/com/robo4j/hw/rpi/gps/MockGPS.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.hw.rpi.gps; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import com.robo4j.hw.rpi.gps.GPS; 23 | import com.robo4j.hw.rpi.gps.GPSListener; 24 | 25 | public class MockGPS implements GPS { 26 | List listeners = new ArrayList<>(); 27 | 28 | @Override 29 | public void addListener(GPSListener gpsListener) { 30 | listeners.add(gpsListener); 31 | } 32 | 33 | @Override 34 | public void removeListener(GPSListener gpsListener) { 35 | listeners.remove(gpsListener); 36 | } 37 | 38 | @Override 39 | public void start() { 40 | } 41 | 42 | @Override 43 | public void shutdown() { 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "Mock GPS"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/examples/java/com/robo4j/units/lego/controller/ReportController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.lego.controller; 18 | 19 | import com.robo4j.RoboContext; 20 | import com.robo4j.RoboUnit; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | /** 25 | * @author Marcus Hirt (@hirt) 26 | * @author Miroslav Wengner (@miragemiko) 27 | */ 28 | public class ReportController extends RoboUnit { 29 | private static final Logger LOGGER = LoggerFactory.getLogger(ReportController.class); 30 | 31 | public ReportController(RoboContext context, String id) { 32 | super(Object.class, context, id); 33 | } 34 | 35 | @Override 36 | public void onMessage(Object message) { 37 | LOGGER.info("report: {}", message.toString()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /robo4j-units-lego/src/examples/resources/robo4jInfraExample.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | com.robo4j.units.lego.LcdUnit 20 | 21 | 22 | 23 | 24 | com.robo4j.units.lego.InfraSensorUnit 25 | 26 | reportController 27 | S2 28 | 29 | 30 | 31 | com.robo4j.units.lego.controller.ReportController 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /robo4j-units-rpi/src/examples/java/com/robo4j/units/rpi/lcd/ExitDemo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 2024, Marcus Hirt, Miroslav Wengner 3 | * 4 | * Robo4J is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * Robo4J is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with Robo4J. If not, see . 16 | */ 17 | package com.robo4j.units.rpi.lcd; 18 | 19 | import com.robo4j.RoboContext; 20 | import com.robo4j.RoboReference; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * This one really doesn't anything but clean up and exit. 26 | * 27 | * @author Marcus Hirt (@hirt) 28 | * @author Miroslav Wengner (@miragemiko) 29 | */ 30 | public class ExitDemo extends AbstractLcdDemo { 31 | 32 | private RoboContext ctx; 33 | public ExitDemo(RoboContext ctx, RoboReference lcd) { 34 | super(null, lcd); 35 | this.ctx = ctx; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return ""; 41 | } 42 | 43 | @Override 44 | public void runDemo() throws IOException { 45 | ctx.shutdown(); 46 | } 47 | 48 | } 49 | --------------------------------------------------------------------------------