├── Deploy ├── .gitignore ├── rootfolder │ ├── Notes.odt │ ├── Notes.pdf │ ├── lib │ │ ├── LibusbJava.dll │ │ └── rxtxSerial.dll │ ├── winDLLs │ │ ├── 32bit │ │ │ ├── RXTXcomm.jar │ │ │ ├── LibusbJava.dll │ │ │ └── rxtxSerial.dll │ │ └── 64bit │ │ │ ├── RXTXcomm.jar │ │ │ ├── LibusbJava.dll │ │ │ └── rxtxSerial.dll │ ├── 3rds │ │ ├── rxtx-2.1-7-bins-r2.zip │ │ ├── LibusbJava_dll_0.2.4.0.zip │ │ ├── libusb-win32-bin-1.2.6.0.zip │ │ ├── LibusbJava_dll_64bit_0.2.4.0.zip │ │ └── mfz-rxtx-2.2-20081207-win-x64.zip │ ├── examples │ │ ├── SimpleSmartCarDriver │ │ │ └── README.txt │ │ ├── DataReceiver │ │ │ ├── rxtxSerial.dll │ │ │ └── README.txt │ │ └── JoystickSmartCarDriver │ │ │ └── README.txt │ ├── bin │ │ ├── set32bitWindowsRXTX.bat │ │ ├── set64bitWindowsRXTX.bat │ │ └── how_to_start.txt │ ├── License.txt │ ├── conf │ │ └── ardulinkmail-conf.properties │ └── sketches │ │ ├── JustReading4Uno32 │ │ └── JustReading4Uno32.pde │ │ ├── SimpleProtocol4Digispark │ │ └── SimpleProtocol4Digispark.ino │ │ └── SimpleProtocol │ │ └── SimpleProtocol.ino ├── .project ├── pom.xml └── assembly.xml ├── ArdulinkCore ├── .gitignore ├── resources │ └── org │ │ └── zu │ │ └── ardulink │ │ └── gui │ │ └── icons │ │ ├── uv-on-32.png │ │ ├── amber-on-32.png │ │ ├── blue-off-32.png │ │ ├── blue-on-32.png │ │ ├── connect_no.png │ │ ├── green-on-32.png │ │ ├── logo_icon.png │ │ ├── red-off-32.png │ │ ├── red-on-32.png │ │ ├── search_icon.png │ │ ├── uv-off-32.png │ │ ├── white-on-32.png │ │ ├── amber-off-32.png │ │ ├── green-off-32.png │ │ ├── white-off-32.png │ │ ├── yellow-off-32.png │ │ ├── yellow-on-32.png │ │ └── connect_established.png ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── src │ └── org │ │ └── zu │ │ └── ardulink │ │ ├── protocol │ │ ├── parser │ │ │ ├── MessageType.java │ │ │ ├── IProtocolMessageStore.java │ │ │ ├── ParseException.java │ │ │ ├── ALProtocolMessageStore.java │ │ │ ├── IProtocolParser.java │ │ │ └── ProtocolParserHandler.java │ │ ├── ReplyMessageCallback.java │ │ ├── custommessages │ │ │ ├── CustomMessageMaker.java │ │ │ ├── CustomMessageSender.java │ │ │ └── SimpleCustomMessageMaker.java │ │ ├── LoggerReplyMessageCallback.java │ │ └── MessageInfo.java │ │ ├── connection │ │ ├── bluetooth │ │ │ └── package-info.java │ │ ├── Connection.java │ │ ├── proxy │ │ │ └── NetworkProxyMessages.java │ │ └── FakeConnection.java │ │ ├── util │ │ ├── Integers.java │ │ ├── Strings.java │ │ ├── SetMultiMap.java │ │ ├── ListMultiMap.java │ │ ├── ListBuilder.java │ │ ├── Preconditions.java │ │ ├── AbstractMultiMap.java │ │ └── Primitive.java │ │ ├── RawDataListener.java │ │ ├── event │ │ ├── ConnectionListener.java │ │ ├── DigitalReadChangeListener.java │ │ ├── AnalogReadChangeListener.java │ │ ├── AnalogReadChangeEvent.java │ │ ├── DigitalReadChangeEvent.java │ │ ├── DisconnectionEvent.java │ │ ├── ConnectionEvent.java │ │ └── IncomingMessageEvent.java │ │ ├── gui │ │ └── Linkable.java │ │ └── io │ │ ├── ReadingException.java │ │ └── WritingException.java ├── .project ├── test │ └── org │ │ └── zu │ │ └── ardulink │ │ ├── util │ │ ├── PrimitiveTest.java │ │ ├── StringsTest.java │ │ └── SetMultiMapTest.java │ │ └── protocol │ │ └── custommessages │ │ └── SimpleCustomMessageMakerTest.java ├── .classpath └── pom.xml ├── DataReceiver ├── .gitignore ├── rxtxSerial.dll ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── .project ├── .classpath └── pom.xml ├── .gitignore ├── ArdulinkPI ├── .gitignore ├── .project ├── .classpath ├── test │ └── org │ │ └── zu │ │ └── ardulink │ │ └── connection │ │ └── pi │ │ └── RaspberryPIConnectionTest.java └── pom.xml ├── JoystickSmartCarDriver ├── .gitignore ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── .project ├── .classpath └── pom.xml ├── Mqtt ├── .gitignore ├── rxtxSerial.dll ├── .project ├── src │ └── com │ │ └── github │ │ └── pfichtner │ │ └── ardulink │ │ └── compactors │ │ ├── TimeSlicer.java │ │ ├── SlicedAnalogReadChangeListenerAdapter.java │ │ ├── Tolerance.java │ │ ├── AnalogReadChangeListenerAdapter.java │ │ ├── TimeSliceCompactorLast.java │ │ ├── ThreadTimeSlicer.java │ │ ├── AnalogReadChangeListenerToleranceAdapter.java │ │ └── TimeSliceCompactorAvg.java ├── .classpath ├── test │ └── com │ │ └── github │ │ └── pfichtner │ │ └── ardulink │ │ └── util │ │ ├── StopWatch.java │ │ ├── Message.java │ │ ├── ProtoBuilder.java │ │ └── MqttMessageBuilder.java └── pom.xml ├── ArdulinkSwing ├── .gitignore ├── src │ └── org │ │ └── zu │ │ └── ardulink │ │ └── gui │ │ ├── PWMController.java │ │ ├── AnalogPinStatus.java │ │ ├── customcomponents │ │ └── joystick │ │ │ ├── package-info.java │ │ │ └── SimplePositionListener.java │ │ ├── event │ │ ├── PositionListener.java │ │ ├── PWMControllerListener.java │ │ ├── PositionEvent.java │ │ └── PWMChangeEvent.java │ │ ├── OptionMessageCallback.java │ │ ├── facility │ │ ├── UtilityColor.java │ │ ├── UtilityGeometry.java │ │ └── IntMinMaxModel.java │ │ ├── KeyPressController.java │ │ ├── PortListCallbackDialog.java │ │ └── KeyPressListener.java ├── .project ├── .classpath └── pom.xml ├── ArdulinkConsole ├── .gitignore ├── LibusbJava.dll ├── rxtxSerial.dll ├── .project ├── .classpath └── pom.xml ├── SimpleSmartCarDriver ├── .gitignore ├── resources │ └── org │ │ └── zu │ │ └── ardulink │ │ └── gui │ │ └── icons │ │ ├── arrow-up.png │ │ ├── arrow-down.png │ │ ├── arrow-left.png │ │ └── arrow-right.png ├── .project ├── .classpath └── pom.xml ├── ArdulinkNetworkProxyServer ├── .gitignore ├── rxtxSerial.dll ├── .project ├── .classpath └── pom.xml ├── .classpath ├── ArdulinkMail ├── LibusbJava.dll ├── rxtxSerial.dll ├── .gitignore ├── src │ └── org │ │ └── zu │ │ └── ardulink │ │ └── mail │ │ └── server │ │ ├── MailListener.java │ │ ├── contentmanagement │ │ ├── IContentManager.java │ │ └── SimpleContentManager.java │ │ ├── links │ │ └── configuration │ │ │ ├── ALinkList.java │ │ │ ├── ACommandList.java │ │ │ ├── AConnectionList.java │ │ │ ├── AConfiguration.java │ │ │ ├── ConfigurationSerializer.java │ │ │ └── utils │ │ │ └── ConfigurationUtility.java │ │ ├── ArdulinkMailConstants.java │ │ ├── ArdulinkExecutor.java │ │ └── MailSender.java ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── .project ├── testResources │ └── ardulinkmail-conf.properties ├── .classpath ├── test │ └── org │ │ └── zu │ │ └── ardulink │ │ └── mail │ │ └── server │ │ ├── MailSenderTest.java │ │ └── contentmanagement │ │ └── ProtocolContentManagerTest.java └── pom.xml ├── local-repo ├── ch │ └── ntb │ │ └── usb │ │ ├── 0.5.9 │ │ ├── usb-0.5.9.jar │ │ └── usb-0.5.9.pom │ │ └── maven-metadata-local.xml ├── net │ └── sf │ │ └── bluecove │ │ └── bluecove │ │ ├── 2.1.1-SNAPSHOT │ │ ├── bluecove-2.1.1-SNAPSHOT.jar │ │ └── bluecove-2.1.1-SNAPSHOT.pom │ │ └── maven-metadata-local.xml └── .project ├── JavadocUtils ├── .project └── build.xml ├── .project └── README.md /Deploy/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /ArdulinkCore/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /bin/ 3 | -------------------------------------------------------------------------------- /DataReceiver/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /RemoteSystemsTempFiles/ 3 | -------------------------------------------------------------------------------- /ArdulinkPI/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /bin/ 3 | -------------------------------------------------------------------------------- /Mqtt/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | /target/ 4 | -------------------------------------------------------------------------------- /ArdulinkSwing/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /ArdulinkConsole/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /SimpleSmartCarDriver/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | /bin/ 4 | -------------------------------------------------------------------------------- /ArdulinkNetworkProxyServer/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /.settings/ 4 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Mqtt/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Mqtt/rxtxSerial.dll -------------------------------------------------------------------------------- /ArdulinkMail/LibusbJava.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkMail/LibusbJava.dll -------------------------------------------------------------------------------- /ArdulinkMail/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkMail/rxtxSerial.dll -------------------------------------------------------------------------------- /DataReceiver/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/DataReceiver/rxtxSerial.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/Notes.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/Notes.odt -------------------------------------------------------------------------------- /Deploy/rootfolder/Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/Notes.pdf -------------------------------------------------------------------------------- /ArdulinkConsole/LibusbJava.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkConsole/LibusbJava.dll -------------------------------------------------------------------------------- /ArdulinkConsole/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkConsole/rxtxSerial.dll -------------------------------------------------------------------------------- /ArdulinkMail/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /ardulinkmail-conf.properties 4 | /ArdulinkMailConfiguration.xml 5 | -------------------------------------------------------------------------------- /Deploy/rootfolder/lib/LibusbJava.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/lib/LibusbJava.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/lib/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/lib/rxtxSerial.dll -------------------------------------------------------------------------------- /ArdulinkNetworkProxyServer/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkNetworkProxyServer/rxtxSerial.dll -------------------------------------------------------------------------------- /local-repo/ch/ntb/usb/0.5.9/usb-0.5.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/local-repo/ch/ntb/usb/0.5.9/usb-0.5.9.jar -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/32bit/RXTXcomm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/32bit/RXTXcomm.jar -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/64bit/RXTXcomm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/64bit/RXTXcomm.jar -------------------------------------------------------------------------------- /DataReceiver/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=CP1252 3 | encoding/src=CP1252 4 | -------------------------------------------------------------------------------- /Deploy/rootfolder/3rds/rxtx-2.1-7-bins-r2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/3rds/rxtx-2.1-7-bins-r2.zip -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/32bit/LibusbJava.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/32bit/LibusbJava.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/32bit/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/32bit/rxtxSerial.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/64bit/LibusbJava.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/64bit/LibusbJava.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/winDLLs/64bit/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/winDLLs/64bit/rxtxSerial.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/3rds/LibusbJava_dll_0.2.4.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/3rds/LibusbJava_dll_0.2.4.0.zip -------------------------------------------------------------------------------- /Deploy/rootfolder/3rds/libusb-win32-bin-1.2.6.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/3rds/libusb-win32-bin-1.2.6.0.zip -------------------------------------------------------------------------------- /Deploy/rootfolder/examples/SimpleSmartCarDriver/README.txt: -------------------------------------------------------------------------------- 1 | To run this example: upload the sketch and then double click on simple smart car driver jar. 2 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=CP1252 3 | encoding/src=CP1252 4 | -------------------------------------------------------------------------------- /Deploy/rootfolder/examples/DataReceiver/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/examples/DataReceiver/rxtxSerial.dll -------------------------------------------------------------------------------- /Deploy/rootfolder/examples/JoystickSmartCarDriver/README.txt: -------------------------------------------------------------------------------- 1 | To run this example: upload the sketch and then double click on joystick smart car driver jar. 2 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/PWMController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkSwing/src/org/zu/ardulink/gui/PWMController.java -------------------------------------------------------------------------------- /Deploy/rootfolder/3rds/LibusbJava_dll_64bit_0.2.4.0.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/3rds/LibusbJava_dll_64bit_0.2.4.0.zip -------------------------------------------------------------------------------- /Deploy/rootfolder/3rds/mfz-rxtx-2.2-20081207-win-x64.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/Deploy/rootfolder/3rds/mfz-rxtx-2.2-20081207-win-x64.zip -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/AnalogPinStatus.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkSwing/src/org/zu/ardulink/gui/AnalogPinStatus.java -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/uv-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/uv-on-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/amber-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/amber-on-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/blue-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/blue-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/blue-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/blue-on-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/connect_no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/connect_no.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/green-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/green-on-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/logo_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/logo_icon.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/red-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/red-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/red-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/red-on-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/search_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/search_icon.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/uv-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/uv-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/white-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/white-on-32.png -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/MailListener.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkMail/src/org/zu/ardulink/mail/server/MailListener.java -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/amber-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/amber-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/green-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/green-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/white-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/white-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/yellow-off-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/yellow-off-32.png -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/yellow-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/yellow-on-32.png -------------------------------------------------------------------------------- /SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-up.png -------------------------------------------------------------------------------- /SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-down.png -------------------------------------------------------------------------------- /SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-left.png -------------------------------------------------------------------------------- /ArdulinkCore/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=CP1252 3 | encoding/resources=CP1252 4 | encoding/src=CP1252 5 | encoding/test=CP1252 6 | -------------------------------------------------------------------------------- /ArdulinkCore/resources/org/zu/ardulink/gui/icons/connect_established.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/ArdulinkCore/resources/org/zu/ardulink/gui/icons/connect_established.png -------------------------------------------------------------------------------- /SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/SimpleSmartCarDriver/resources/org/zu/ardulink/gui/icons/arrow-right.png -------------------------------------------------------------------------------- /ArdulinkMail/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=CP1252 3 | encoding/src=CP1252 4 | encoding/test=CP1252 5 | encoding/testResources=CP1252 6 | -------------------------------------------------------------------------------- /local-repo/net/sf/bluecove/bluecove/2.1.1-SNAPSHOT/bluecove-2.1.1-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ardulink/Ardulink-1/HEAD/local-repo/net/sf/bluecove/bluecove/2.1.1-SNAPSHOT/bluecove-2.1.1-SNAPSHOT.jar -------------------------------------------------------------------------------- /Deploy/rootfolder/bin/set32bitWindowsRXTX.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem copy ..\winDLLs\32bit\RXTXcomm.jar ..\lib 4 | copy ..\winDLLs\32bit\rxtxSerial.dll ..\lib 5 | copy ..\winDLLs\32bit\LibusbJava.dll ..\lib 6 | pause -------------------------------------------------------------------------------- /Deploy/rootfolder/bin/set64bitWindowsRXTX.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem copy ..\winDLLs\64bit\RXTXcomm.jar ..\lib 4 | copy ..\winDLLs\64bit\rxtxSerial.dll ..\lib 5 | copy ..\winDLLs\64bit\LibusbJava.dll ..\lib 6 | pause -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/MessageType.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | public enum MessageType { 4 | PPSW, PPIN, KPRS, TONE, NOTN, SRLD, SPLD, SRLA, SPLA, CUST, ARED, DRED, RPLY; 5 | } 6 | -------------------------------------------------------------------------------- /Deploy/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Deploy 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JavadocUtils/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JavadocUtils 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /local-repo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | local-repo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ArdulinkMail/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /DataReceiver/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/IProtocolMessageStore.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | public interface IProtocolMessageStore { 4 | 5 | public void addMessageChunck(String chunck); 6 | 7 | public boolean isMessageComplete(); 8 | 9 | public String getNextMessage(); 10 | } 11 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/customcomponents/joystick/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 3 | * In this package there are classes that implements a Joystick swing component 4 | * and that send custom messages to Arduino. 5 | * 6 | */ 7 | package org.zu.ardulink.gui.customcomponents.joystick; -------------------------------------------------------------------------------- /local-repo/ch/ntb/usb/maven-metadata-local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ch.ntb 4 | usb 5 | 6 | 0.5.9 7 | 8 | 0.5.9 9 | 10 | 20150812210253 11 | 12 | 13 | -------------------------------------------------------------------------------- /Deploy/rootfolder/examples/DataReceiver/README.txt: -------------------------------------------------------------------------------- 1 | To run this example double click on data receiver jar or use java -jar command. 2 | This example accepts arguments. Please run it with -h option to read the usage. 3 | 4 | 5 | For Windows 32 bit systems. 6 | 7 | This example has rxtxSerial.dll for 64 bit systems, if yours is a 32 bit system replace this dll 8 | with the right one that you can find in winDLLs folder. -------------------------------------------------------------------------------- /local-repo/net/sf/bluecove/bluecove/maven-metadata-local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | net.sf.bluecove 4 | bluecove 5 | 6 | 2.1.1-SNAPSHOT 7 | 8 | 0.5.9 9 | 10 | 20101024214945 11 | S 12 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ardulink 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/connection/bluetooth/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * [ardulinktitle] [ardulinkversion] 3 | * Used to simplify communication over a Bluetooth connection. Using the bluecove library 4 | * , one connection per instance of this class can be handled. 5 | * 6 | * It uses bluecove java library 7 | * 8 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 9 | * 10 | * [adsense] 11 | */ 12 | package org.zu.ardulink.connection.bluetooth; -------------------------------------------------------------------------------- /local-repo/net/sf/bluecove/bluecove/2.1.1-SNAPSHOT/bluecove-2.1.1-SNAPSHOT.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | net.sf.bluecove 6 | bluecove 7 | 2.1.1-SNAPSHOT 8 | 9 | -------------------------------------------------------------------------------- /local-repo/ch/ntb/usb/0.5.9/usb-0.5.9.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | ch.ntb 6 | usb 7 | 0.5.9 8 | POM was created from install:install-file 9 | 10 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/ParseException.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | public class ParseException extends Exception { 4 | 5 | private static final long serialVersionUID = 1686450598892458046L; 6 | 7 | public ParseException() { 8 | super(); 9 | } 10 | 11 | public ParseException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | 15 | public ParseException(String message) { 16 | super(message); 17 | } 18 | 19 | public ParseException(Throwable cause) { 20 | super(cause); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ArdulinkPI/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkPI 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /Deploy/rootfolder/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /Mqtt/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.github.ardulink.Mqtt-0.5.1-SNAPSHOT 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkCore/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkCore 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkMail/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkMail 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /DataReceiver/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | DataReceiver 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkConsole/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkNetworkProxyServer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkSwing/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkNetworkProxyServer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /SimpleSmartCarDriver/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimpleSmartCarDriver 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JoystickSmartCarDriver 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkNetworkProxyServer/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ArdulinkNetworkProxyServer 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /ArdulinkCore/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 13 | org.eclipse.jdt.core.compiler.source=1.6 14 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/Integers.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | import java.util.Collection; 4 | 5 | /** 6 | * [ardulinktitle] [ardulinkversion] 7 | * @author Peter Fichtner 8 | * 9 | * [adsense] 10 | */ 11 | public final class Integers { 12 | 13 | private Integers() { 14 | super(); 15 | } 16 | 17 | public static Integer tryParse(String string) { 18 | try { 19 | return Integer.valueOf(string); 20 | } catch (NumberFormatException e) { 21 | return null; 22 | } 23 | } 24 | 25 | public static int average(Collection values) { 26 | return sum(values) / values.size(); 27 | } 28 | 29 | public static int sum(Iterable values) { 30 | int sum = 0; 31 | for (Integer integer : values) { 32 | sum += integer; 33 | } 34 | return sum; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Deploy/rootfolder/conf/ardulinkmail-conf.properties: -------------------------------------------------------------------------------- 1 | # IMAP CONFIGURATION 2 | mail.store.protocol=imaps 3 | 4 | host=imap.gmail.com 5 | port=993 6 | user=@gmail.com 7 | password= 8 | 9 | #if validateFrom = true then is checked if the mail is sent from a valid address specified in from field (a list of addresses separated by ";") 10 | validateFrom=false 11 | fromAddresses=; 12 | 13 | #if validateContentPassword = true then is checked if the mail has the content password in its body message 14 | validateContentPassword=false 15 | contentPassword= 16 | 17 | 18 | # SMTP CONFIGURATION 19 | mail.smtp.host=smtp.gmail.com 20 | mail.smtp.auth=true 21 | mail.smtp.port=587 22 | mail.smtp.starttls.enable=true 23 | mail.smtp.connectiontimeout=10000 24 | mail.smtp.timeout=10000 25 | 26 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/Strings.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | /** 4 | * [ardulinktitle] [ardulinkversion] 5 | * @author Peter Fichtner 6 | * 7 | * [adsense] 8 | */ 9 | public final class Strings { 10 | 11 | private Strings() { 12 | super(); 13 | } 14 | 15 | public static boolean nullOrEmpty(String string) { 16 | return string == null || string.isEmpty(); 17 | } 18 | 19 | public static String bytes2String(byte in) { 20 | return bytes2String(new byte[]{in}); 21 | } 22 | 23 | public static String bytes2String(byte[] in) { 24 | return new String(in); 25 | } 26 | 27 | public static int[] string2Ints(String in) { 28 | byte[] bytes = in.getBytes(); 29 | int[] retvalue = new int[bytes.length]; 30 | for (int i = 0; i < retvalue.length; i++) { 31 | retvalue[i] = bytes[i]; 32 | } 33 | return retvalue; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /DataReceiver/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Deploy/rootfolder/bin/how_to_start.txt: -------------------------------------------------------------------------------- 1 | HOW TO START ARDULINK'S APPLICATIONS 2 | 3 | Ardulink has several applications you can start. You can double click on the right jar file or run they with 4 | you system command line. Of course some applications need for parameters, so you have to start they from the 5 | command line. 6 | 7 | From your linux/windows/apple shell you can run these commands (from Ardulink's lib folder): 8 | 9 | java -jar ardulink-console-${project.version}.jar 10 | java -jar ardulink-networkproxyserver-${project.version}.jar 11 | java -jar ardulink-mail-${project.version}.jar 12 | java -jar ardulink-mqtt-${project.version}.jar 13 | 14 | 15 | The Network Proxy Server accepts a mandatory argument. Please run it without arguments to read the usage. 16 | 17 | The MQTT bridge accepts arguments. Please run it with -h option to read the usage. 18 | 19 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Deploy/rootfolder/sketches/JustReading4Uno32/JustReading4Uno32.pde: -------------------------------------------------------------------------------- 1 | #define INDEX 14 2 | 3 | int lastValue = -1; 4 | 5 | void setup() { 6 | Serial.begin(115200); 7 | while(Serial.available() <= 0); // Wait until Serial not connected 8 | } 9 | 10 | void loop() { 11 | int value = highPrecisionAnalogRead(INDEX); 12 | if(lastValue != value) { 13 | lastValue = value; 14 | Serial.print("alp://ared/"); 15 | Serial.print(INDEX); 16 | Serial.print("/"); 17 | Serial.print(value); 18 | Serial.write(255); // End of Message 19 | Serial.flush(); 20 | } 21 | } 22 | 23 | // Reads 4 times and computes the average value 24 | int highPrecisionAnalogRead(int pin) { 25 | int value1 = analogRead(pin); 26 | int value2 = analogRead(pin); 27 | int value3 = analogRead(pin); 28 | int value4 = analogRead(pin); 29 | 30 | int retvalue = (value1 + value2 + value3 + value4) / 4; 31 | } 32 | -------------------------------------------------------------------------------- /ArdulinkPI/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ArdulinkCore/test/org/zu/ardulink/util/PrimitiveTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | import static org.hamcrest.CoreMatchers.nullValue; 4 | import static org.hamcrest.core.Is.is; 5 | import static org.junit.Assert.assertThat; 6 | 7 | import org.hamcrest.core.Is; 8 | import org.junit.Test; 9 | 10 | public class PrimitiveTest { 11 | 12 | @Test 13 | public void testParseAs() { 14 | assertThat(Primitive.parseAs(int.class, "123"), 15 | Is. is(Integer.valueOf(123))); 16 | assertThat(Primitive.parseAs(double.class, "123"), 17 | Is. is(Double.valueOf(123))); 18 | } 19 | 20 | @Test 21 | public void testForClassName() { 22 | assertThat(Primitive.forClassName("int"), is(Primitive.INT)); 23 | assertThat(Primitive.forClassName("double"), is(Primitive.DOUBLE)); 24 | assertThat(Primitive.forClassName(String.class.getName()), 25 | is(nullValue())); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SimpleSmartCarDriver/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ArdulinkCore/test/org/zu/ardulink/protocol/custommessages/SimpleCustomMessageMakerTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.custommessages; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | 5 | import org.junit.After; 6 | import org.junit.Before; 7 | import org.junit.Test; 8 | 9 | public class SimpleCustomMessageMakerTest { 10 | 11 | private SimpleCustomMessageMaker maker; 12 | 13 | @Before 14 | public void setUp() { 15 | maker = new SimpleCustomMessageMaker(); 16 | } 17 | 18 | @After 19 | public void cleanUp() { 20 | maker = null; 21 | } 22 | 23 | @Test 24 | public void simpleCustomMessageMakerTest() { 25 | 26 | assertEquals("ID1/5", maker.getCustomMessage("ID1", String.valueOf(5))); 27 | assertEquals("ID1/TEXT1", maker.getCustomMessage("ID1", "TEXT1")); 28 | assertEquals("ID1/5/TEXT1", maker.getCustomMessage("ID1", String.valueOf(5), "TEXT1")); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /ArdulinkCore/test/org/zu/ardulink/util/StringsTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | import java.util.Arrays; 4 | 5 | import static org.junit.Assert.assertTrue; 6 | import static org.junit.Assert.assertEquals; 7 | 8 | import org.junit.Test; 9 | import org.zu.ardulink.protocol.ALProtocol; 10 | 11 | public class StringsTest { 12 | 13 | 14 | @Test 15 | public void string2IntsTest() { 16 | 17 | String message = "alp://rply/ok?id=781"; 18 | int[] expected = {97, 108, 112, 58, 47, 47, 114, 112, 108, 121, 47, 111, 107, 63, 105, 100, 61, 55, 56, 49}; 19 | // byte[] bytes = message.getBytes(); 20 | // for (int i = 0; i < bytes.length; i++) { 21 | // System.out.print(bytes[i] + ", "); 22 | // } 23 | 24 | assertTrue(Arrays.equals(expected, Strings.string2Ints(message))); 25 | } 26 | 27 | @Test 28 | public void bytes2StringTest() { 29 | 30 | assertEquals("\n", Strings.bytes2String(ALProtocol.DEFAULT_OUTGOING_MESSAGE_DIVIDER)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/TimeSlicer.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | /** 20 | * [ardulinktitle] [ardulinkversion] 21 | * @author Peter Fichtner 22 | * 23 | * [adsense] 24 | */ 25 | public interface TimeSlicer { 26 | 27 | void add(SlicedAnalogReadChangeListenerAdapter worker); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ArdulinkConsole/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ArdulinkSwing/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ArdulinkMail/testResources/ardulinkmail-conf.properties: -------------------------------------------------------------------------------- 1 | # IMAP CONFIGURATION 2 | mail.store.protocol=imaps 3 | 4 | host=imap.gmail.com 5 | port=993 6 | # please for your production or test environment use another mail user. 7 | # this user is for develop test purpose and it is not safe since everyone 8 | # can know its password 9 | user=ardulinkmail.test 10 | password=ardulinkmail.test123 11 | 12 | #if validateFrom = true then is checked if the mail is sent from a valid address specified in from field (a list of addresses separated by ";") 13 | validateFrom=false 14 | fromAddresses=; 15 | 16 | #if validateContentPassword = true then is checked if the mail has the content password in its body message 17 | validateContentPassword=false 18 | contentPassword= 19 | 20 | 21 | # SMTP CONFIGURATION 22 | mail.smtp.host=smtp.gmail.com 23 | mail.smtp.auth=true 24 | mail.smtp.port=587 25 | mail.smtp.starttls.enable=true 26 | mail.smtp.connectiontimeout=10000 27 | mail.smtp.timeout=10000 28 | 29 | -------------------------------------------------------------------------------- /ArdulinkNetworkProxyServer/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/event/PositionListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 24 | * 25 | * [adsense] 26 | */ 27 | public interface PositionListener { 28 | 29 | public void positionChanged(PositionEvent e); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Mqtt/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/RawDataListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * 24 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 25 | * 26 | * [adsense] 27 | * 28 | */ 29 | public interface RawDataListener { 30 | 31 | void parseInput(String id, int numBytes, int[] message); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/ReplyMessageCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.protocol; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * An interface to manage reply message from arduino. 24 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 25 | * @see Link 26 | * [adsense] 27 | * 28 | */ 29 | public interface ReplyMessageCallback { 30 | 31 | public void replyInfo(MessageInfo messageInfo); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/ConnectionListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * ConnectionListener interface 24 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 25 | * 26 | * [adsense] 27 | * 28 | */ 29 | public interface ConnectionListener { 30 | 31 | void connected(ConnectionEvent e); 32 | 33 | void disconnected(DisconnectionEvent e); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/DigitalReadChangeListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 24 | * 25 | * [adsense] 26 | * 27 | */ 28 | public interface DigitalReadChangeListener { 29 | 30 | public static final int ALL_PINS = -1; 31 | 32 | public void stateChanged(DigitalReadChangeEvent e); 33 | public int getPinListening(); 34 | } 35 | -------------------------------------------------------------------------------- /ArdulinkMail/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/AnalogReadChangeListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * AnalogReadChangeListener interface 24 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 25 | * 26 | * [adsense] 27 | * 28 | */ 29 | public interface AnalogReadChangeListener { 30 | 31 | int ALL_PINS = -1; 32 | 33 | void stateChanged(AnalogReadChangeEvent e); 34 | int getPinListening(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/ALProtocolMessageStore.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | import org.zu.ardulink.protocol.ALProtocol; 4 | import org.zu.ardulink.util.Strings; 5 | 6 | public class ALProtocolMessageStore implements IProtocolMessageStore { 7 | 8 | // implementation can be better than a simple String 9 | private String buffer = ""; 10 | 11 | 12 | @Override 13 | public void addMessageChunck(String chunck) { 14 | buffer += chunck; 15 | } 16 | 17 | @Override 18 | public boolean isMessageComplete() { 19 | boolean retvalue = false; 20 | 21 | int messageEnd = buffer.indexOf(Strings.bytes2String(ALProtocol.DEFAULT_OUTGOING_MESSAGE_DIVIDER)); 22 | if(messageEnd != -1) { 23 | retvalue = true; 24 | } 25 | return retvalue; 26 | } 27 | 28 | @Override 29 | public String getNextMessage() { 30 | String retvalue = null; 31 | int messageEnd = buffer.indexOf(Strings.bytes2String(ALProtocol.DEFAULT_OUTGOING_MESSAGE_DIVIDER)); 32 | if(messageEnd != -1) { 33 | retvalue = buffer.substring(0, messageEnd + 1); 34 | buffer = buffer.substring(messageEnd + 1); 35 | } 36 | return retvalue; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/custommessages/CustomMessageMaker.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | package org.zu.ardulink.protocol.custommessages; 19 | 20 | /** 21 | * [ardulinktitle] [ardulinkversion] 22 | * This interface is used from custom components that need for generate 23 | * custom messages. 24 | * 25 | * @author Luciano Zu 26 | * @see SimpleCustomMessageMaker 27 | * 28 | * [adsense] 29 | */ 30 | public interface CustomMessageMaker { 31 | 32 | public String getCustomMessage(String... args); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/event/PWMControllerListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.event; 20 | 21 | import org.zu.ardulink.gui.PWMController; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * Defines an interface that receives events from a PWMController 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | * @see PWMController 30 | */ 31 | public interface PWMControllerListener { 32 | 33 | public void pwmChanged(PWMChangeEvent event); 34 | } 35 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/gui/Linkable.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui; 20 | 21 | import org.zu.ardulink.Link; 22 | import org.zu.ardulink.protocol.ReplyMessageCallback; 23 | 24 | /** 25 | * [ardulinktitle] [ardulinkversion] 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | */ 30 | public interface Linkable { 31 | 32 | void setLink(Link link); 33 | ReplyMessageCallback getReplyMessageCallback(); 34 | void setReplyMessageCallback(ReplyMessageCallback replyMessageCallback); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/SlicedAnalogReadChangeListenerAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import org.zu.ardulink.event.AnalogReadChangeListener; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Peter Fichtner 24 | * 25 | * [adsense] 26 | */ 27 | public abstract class SlicedAnalogReadChangeListenerAdapter extends 28 | AnalogReadChangeListenerAdapter { 29 | 30 | public SlicedAnalogReadChangeListenerAdapter( 31 | AnalogReadChangeListener delegate) { 32 | super(delegate); 33 | } 34 | 35 | public abstract void ticked(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/custommessages/CustomMessageSender.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | package org.zu.ardulink.protocol.custommessages; 19 | 20 | /** 21 | * [ardulinktitle] [ardulinkversion] 22 | * This interface is used from custom components that need for generate 23 | * custom messages. 24 | * 25 | * @author Luciano Zu 26 | * @see SimpleCustomMessageMaker 27 | * @see CustomMessageMaker 28 | * 29 | * [adsense] 30 | */ 31 | public interface CustomMessageSender { 32 | public void setCustomMessageMaker(CustomMessageMaker customMessageMaker); 33 | public CustomMessageMaker getCustomMessageMaker(); 34 | } 35 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/contentmanagement/IContentManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.contentmanagement; 20 | 21 | import java.util.List; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | * 30 | */ 31 | public interface IContentManager { 32 | 33 | boolean isForContent(String content, List mailContentHooks); 34 | 35 | String execute(String content, List values, 36 | List mailContentHooks, List aLinkNames); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /ArdulinkCore/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Deploy/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | org.ardulink 5 | Deploy 6 | 0.6.2-SNAPSHOT 7 | pom 8 | 9 | 10 | org.ardulink 11 | parent 12 | 0.6.2-SNAPSHOT 13 | 14 | 15 | 16 | 17 | 18 | maven-assembly-plugin 19 | 20 | ardulink-V${project.version}-${maven.build.timestamp} 21 | false 22 | 23 | 24 | 25 | 26 | distro-assembly 27 | package 28 | 29 | single 30 | 31 | 32 | 33 | assembly.xml 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/AnalogReadChangeEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * Event raised when arduino send message about an analog pin change value. 24 | * 25 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 26 | * 27 | * [adsense] 28 | * 29 | */ 30 | public class AnalogReadChangeEvent extends IncomingMessageEvent { 31 | 32 | public AnalogReadChangeEvent() { 33 | super(); 34 | } 35 | 36 | public AnalogReadChangeEvent(int pin, int value, String incomingMessage) { 37 | super(pin, value, incomingMessage); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/DigitalReadChangeEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * Event raised when arduino send message about a digital pin change value. 24 | * 25 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 26 | * 27 | * [adsense] 28 | * 29 | */ 30 | public class DigitalReadChangeEvent extends IncomingMessageEvent { 31 | 32 | public DigitalReadChangeEvent() { 33 | super(); 34 | } 35 | 36 | public DigitalReadChangeEvent(int pin, int value, String incomingMessage) { 37 | super(pin, value, incomingMessage); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/IProtocolParser.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | public interface IProtocolParser { 4 | 5 | /** 6 | * 7 | * @return the protocol name 8 | */ 9 | public String getProtocolName(); 10 | 11 | 12 | /** 13 | * Parse an incoming message. 14 | * @param message 15 | * @return MessageParsedInfo 16 | * @throws ParseException 17 | */ 18 | public MessageParsedInfo parse(String message) throws ParseException; 19 | 20 | 21 | /** 22 | * write a Reply message like arduino that use a specific protocol 23 | * @param success 24 | * @param messageParsedInfo 25 | * @return 26 | */ 27 | public int[] reply(boolean success, MessageParsedInfo messageParsedInfo); 28 | 29 | /** 30 | * write a message for an analog read event 31 | * @param pin 32 | * @param value 33 | * @return 34 | */ 35 | public int[] analogRead(int pin, int value); 36 | 37 | /** 38 | * write a message for a digital read event 39 | * @param pin 40 | * @param value 41 | * @return 42 | */ 43 | public int[] digitalRead(int pin, int value); 44 | 45 | /** 46 | * write a custom message 47 | * @param message 48 | * @return 49 | */ 50 | public int[] customMessage(String message); 51 | 52 | public IProtocolMessageStore getMessageStore(); 53 | } 54 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/connection/Connection.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.connection; 20 | 21 | import java.util.List; 22 | 23 | import org.zu.ardulink.ConnectionContact; 24 | 25 | /** 26 | * [ardulinktitle] [ardulinkversion] 27 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 28 | * 29 | * [adsense] 30 | */ 31 | public interface Connection { 32 | 33 | List getPortList(); 34 | boolean connect(Object... params); 35 | boolean disconnect(); 36 | boolean isConnected(); 37 | boolean writeSerial(String message); 38 | boolean writeSerial(int numBytes, int message[]); 39 | void setConnectionContact(ConnectionContact contact); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/ALinkList.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration; 20 | 21 | import java.util.List; 22 | 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | /** 26 | * [ardulinktitle] [ardulinkversion] 27 | * 28 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 29 | * 30 | * [adsense] 31 | * 32 | */ 33 | public class ALinkList { 34 | 35 | private List alinks; 36 | 37 | @XmlElement(name = "alinks") 38 | public List getALinks() { 39 | return alinks; 40 | } 41 | 42 | public void setALinks(List links) { 43 | this.alinks = links; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/Tolerance.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import static java.lang.Math.abs; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Peter Fichtner 24 | * 25 | * [adsense] 26 | */ 27 | public class Tolerance { 28 | 29 | private final int maxTolerance; 30 | 31 | public Tolerance(int maxTolerance) { 32 | this.maxTolerance = maxTolerance; 33 | } 34 | 35 | public static Tolerance maxTolerance(int maxTolerance) { 36 | return new Tolerance(maxTolerance); 37 | } 38 | 39 | public boolean isZero() { 40 | return maxTolerance == 0; 41 | } 42 | 43 | protected boolean inTolerance(int oldValue, int newValue) { 44 | return abs(oldValue - newValue) <= maxTolerance; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/ACommandList.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration; 20 | 21 | import java.util.List; 22 | 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | /** 26 | * [ardulinktitle] [ardulinkversion] 27 | * 28 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 29 | * 30 | * [adsense] 31 | * 32 | */ 33 | public class ACommandList { 34 | 35 | private List acommands; 36 | 37 | @XmlElement(name = "acommands") 38 | public List getACommands() { 39 | return acommands; 40 | } 41 | 42 | public void setACommands(List commands) { 43 | this.acommands = commands; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/AnalogReadChangeListenerAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import org.zu.ardulink.event.AnalogReadChangeListener; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Peter Fichtner 24 | * 25 | * [adsense] 26 | */ 27 | public abstract class AnalogReadChangeListenerAdapter implements 28 | AnalogReadChangeListener { 29 | 30 | private final AnalogReadChangeListener delegate; 31 | 32 | public AnalogReadChangeListenerAdapter(AnalogReadChangeListener delegate) { 33 | this.delegate = delegate; 34 | } 35 | 36 | public AnalogReadChangeListener getDelegate() { 37 | return delegate; 38 | } 39 | 40 | @Override 41 | public int getPinListening() { 42 | return delegate.getPinListening(); 43 | } 44 | } -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/io/ReadingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | package org.zu.ardulink.io; 19 | 20 | /** 21 | * [ardulinktitle] [ardulinkversion] 22 | * 23 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 24 | * 25 | * [adsense] 26 | * 27 | */ 28 | public class ReadingException extends Exception { 29 | 30 | private static final long serialVersionUID = -4573858746170282126L; 31 | 32 | public ReadingException() { 33 | super(); 34 | } 35 | 36 | public ReadingException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public ReadingException(String message) { 41 | super(message); 42 | } 43 | 44 | public ReadingException(Throwable cause) { 45 | super(cause); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/io/WritingException.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | package org.zu.ardulink.io; 19 | 20 | /** 21 | * [ardulinktitle] [ardulinkversion] 22 | * 23 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 24 | * 25 | * [adsense] 26 | * 27 | */ 28 | public class WritingException extends Exception { 29 | 30 | private static final long serialVersionUID = 7380824605617847898L; 31 | 32 | public WritingException() { 33 | super(); 34 | } 35 | 36 | public WritingException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | public WritingException(String message) { 41 | super(message); 42 | } 43 | 44 | public WritingException(Throwable cause) { 45 | super(cause); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/AConnectionList.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration; 20 | 21 | import java.util.List; 22 | 23 | import javax.xml.bind.annotation.XmlElement; 24 | 25 | /** 26 | * [ardulinktitle] [ardulinkversion] 27 | * 28 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 29 | * 30 | * [adsense] 31 | * 32 | */ 33 | public class AConnectionList { 34 | 35 | private List aconnections; 36 | 37 | @XmlElement(name = "aconnections") 38 | public List getAConnections() { 39 | return aconnections; 40 | } 41 | 42 | public void setAConnections(List connections) { 43 | this.aconnections = connections; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/connection/proxy/NetworkProxyMessages.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.connection.proxy; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 24 | * 25 | * [adsense] 26 | */ 27 | public interface NetworkProxyMessages { 28 | public static final String NUMBER_OF_PORTS = "NUMBER_OF_PORTS="; 29 | public static final String OK = "OK"; 30 | public static final String KO = "KO"; 31 | 32 | public static final String STOP_SERVER_CMD = "ardulink:networkproxyserver:stop_server"; 33 | public static final String GET_PORT_LIST_CMD = "ardulink:networkproxyserver:get_port_list"; 34 | public static final String CONNECT_CMD = "ardulink:networkproxyserver:connect"; 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ardulink-1 2 | ======== 3 | 4 | This is the repository for Ardulink 1. Ardulink 1 is a complete, open source, java solution for the control and coordination of Arduino boards. This repository contains Ardulink Version 0.6.1 – MAGNUM PI and of course all the previous releases. 5 | 6 | Ardulink is heavily re engineerd in order to adhere to several international IoT standards. So, please, see Ardulink-2 repository for the last release. 7 | 8 | 9 | 10 | public static void main(String[] args) { 11 | try { 12 | Link link = Link.getDefaultInstance(); 13 | 14 | List portList = link.getPortList(); 15 | if(portList != null && portList.size() > 0) { 16 | String port = portList.get(0); 17 | System.out.println("Connecting on port: " + port); 18 | boolean connected = link.connect(port); 19 | System.out.println("Connected:" + connected); 20 | Thread.sleep(2000); // Wait some seconds for Arduino reboot 21 | int power = IProtocol.HIGH; 22 | while(true) { 23 | System.out.println("Send power:" + power); 24 | link.sendPowerPinSwitch(2, power); 25 | if(power == IProtocol.HIGH) { 26 | power = IProtocol.LOW; 27 | } else { 28 | power = IProtocol.HIGH; 29 | } 30 | Thread.sleep(2000); 31 | } 32 | } else { 33 | System.out.println("No port found!"); 34 | } 35 | 36 | } 37 | catch(Exception e) { 38 | e.printStackTrace(); 39 | } 40 | 41 | 42 | see Ardulink site: www.ardulink.org 43 | 44 | 45 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/DisconnectionEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | import java.util.Date; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * Event raised when disconnection occurs. 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | * 30 | */ 31 | public class DisconnectionEvent { 32 | private String connectionId; 33 | private Date timestamp = new Date(); 34 | 35 | public DisconnectionEvent() { 36 | } 37 | 38 | public DisconnectionEvent(String connectionId) { 39 | this.connectionId = connectionId; 40 | } 41 | 42 | public String getConnectionId() { 43 | return connectionId; 44 | } 45 | 46 | public Date getTimestamp() { 47 | return timestamp; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/SetMultiMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.util; 18 | 19 | import java.util.Collection; 20 | import java.util.HashMap; 21 | import java.util.HashSet; 22 | import java.util.Map; 23 | import java.util.Map.Entry; 24 | import java.util.Set; 25 | 26 | /** 27 | * [ardulinktitle] [ardulinkversion] 28 | * 29 | * @author Peter Fichtner 30 | * 31 | * [adsense] 32 | */ 33 | public class SetMultiMap extends AbstractMultiMap { 34 | 35 | protected Collection make() { 36 | return new HashSet(); 37 | } 38 | 39 | public Map> asMap() { 40 | Map> map = new HashMap>(); 41 | for (Entry> entry : data.entrySet()) { 42 | map.put(entry.getKey(), (Set) entry.getValue()); 43 | } 44 | return map; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/ListMultiMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.util; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Collection; 21 | import java.util.HashMap; 22 | import java.util.List; 23 | import java.util.Map; 24 | import java.util.Map.Entry; 25 | 26 | /** 27 | * [ardulinktitle] [ardulinkversion] 28 | * 29 | * @author Peter Fichtner 30 | * 31 | * [adsense] 32 | */ 33 | public class ListMultiMap extends AbstractMultiMap { 34 | 35 | protected Collection make() { 36 | return new ArrayList(); 37 | } 38 | 39 | public Map> asMap() { 40 | Map> map = new HashMap>(); 41 | for (Entry> entry : data.entrySet()) { 42 | map.put(entry.getKey(), (List) entry.getValue()); 43 | } 44 | return map; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/event/PositionEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.event; 20 | 21 | import java.awt.Point; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 26 | * 27 | * [adsense] 28 | */ 29 | public class PositionEvent { 30 | 31 | private String id; 32 | private Point position; 33 | private int maxSize; 34 | 35 | public PositionEvent(Point position, int maxSize, String id) { 36 | super(); 37 | this.position = position; 38 | this.maxSize = maxSize; 39 | this.id = id; 40 | } 41 | 42 | public Point getPosition() { 43 | return position; 44 | } 45 | 46 | public int getMaxSize() { 47 | return maxSize; 48 | } 49 | 50 | public String getId() { 51 | return id; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ArdulinkMail/test/org/zu/ardulink/mail/server/MailSenderTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.mail.server; 2 | 3 | import static org.junit.Assert.assertNotNull; 4 | import static org.junit.Assert.fail; 5 | 6 | import javax.mail.Address; 7 | import javax.mail.MessagingException; 8 | import javax.mail.internet.AddressException; 9 | import javax.mail.internet.InternetAddress; 10 | 11 | import org.junit.After; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | 15 | public class MailSenderTest { 16 | 17 | private InternetAddress address = null; 18 | private String subject = null; 19 | private String body = null; 20 | 21 | @Before 22 | public void setUp() { 23 | try { 24 | address = new InternetAddress("luciano.zu@gmail.com"); 25 | } catch (AddressException e) { 26 | e.printStackTrace(); 27 | } 28 | assertNotNull(address); 29 | subject = "test message"; 30 | body = "this is a test message body"; 31 | } 32 | 33 | @After 34 | public void cleanUp() { 35 | address = null; 36 | subject = null; 37 | body = null; 38 | } 39 | 40 | @Test 41 | public void sendMail() { 42 | Address[] to = {address}; 43 | try { 44 | MailSender.sendMail(to, subject, body); 45 | } catch (AddressException e) { 46 | e.printStackTrace(); 47 | fail("ADDRESS:" + address.getAddress() + " - " + e.getMessage()); 48 | } catch (MessagingException e) { 49 | e.printStackTrace(); 50 | fail(e.getMessage()); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/event/PWMChangeEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.event; 20 | 21 | import org.zu.ardulink.gui.PWMController; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * It implements an event from PWMController 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | * @see PWMController, PWMControllerListener 30 | */ 31 | public class PWMChangeEvent { 32 | 33 | private int pwmValue = 0; 34 | private PWMController source; 35 | 36 | public PWMChangeEvent(PWMController source, int pwmValue) { 37 | super(); 38 | this.pwmValue = pwmValue; 39 | this.source = source; 40 | } 41 | 42 | public int getPwmValue() { 43 | return pwmValue; 44 | } 45 | 46 | public PWMController getSource() { 47 | return source; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /DataReceiver/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | org.ardulink.examples 5 | datareceiver 6 | 7 | 8 | org.ardulink 9 | parent 10 | 0.6.2-SNAPSHOT 11 | 12 | 13 | 14 | src 15 | 16 | 17 | org.apache.maven.plugins 18 | maven-jar-plugin 19 | 2.4 20 | 21 | 22 | 23 | true 24 | org.zu.ardulink.DataReceiver 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.ardulink 35 | ardulink-core 36 | ${project.version} 37 | 38 | 39 | org.slf4j 40 | slf4j-jdk14 41 | runtime 42 | 43 | 44 | args4j 45 | args4j 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Mqtt/test/com/github/pfichtner/ardulink/util/StopWatch.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.util; 18 | 19 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 20 | import static org.zu.ardulink.util.Preconditions.checkState; 21 | 22 | import java.util.concurrent.TimeUnit; 23 | 24 | /** 25 | * [ardulinktitle] [ardulinkversion] 26 | * @author Peter Fichtner 27 | * 28 | * [adsense] 29 | */ 30 | public class StopWatch { 31 | 32 | private Long started; 33 | 34 | public StopWatch start() { 35 | checkState(this.started == null, "StopWatch already started"); 36 | this.started = Long.valueOf(System.currentTimeMillis()); 37 | return this; 38 | } 39 | 40 | public long getTime() { 41 | Long tmp = started; 42 | return tmp == null ? 0 : System.currentTimeMillis() - tmp.longValue(); 43 | } 44 | 45 | public long getTime(TimeUnit timeUnit) { 46 | return timeUnit.convert(getTime(), MILLISECONDS); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/ListBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.util; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.Collection; 22 | import java.util.List; 23 | 24 | /** 25 | * [ardulinktitle] [ardulinkversion] 26 | * @author Peter Fichtner 27 | * 28 | * [adsense] 29 | */ 30 | public class ListBuilder { 31 | 32 | private final List data = new ArrayList(); 33 | 34 | private ListBuilder() { 35 | super(); 36 | } 37 | 38 | public static ListBuilder newBuilder() { 39 | return new ListBuilder(); 40 | } 41 | 42 | public ListBuilder addAll(T... ts) { 43 | return addAll(Arrays.asList(ts)); 44 | } 45 | 46 | public ListBuilder addAll(Collection ts) { 47 | this.data.addAll(ts); 48 | return this; 49 | } 50 | 51 | public ListBuilder add(T t) { 52 | this.data.add(t); 53 | return this; 54 | } 55 | 56 | public List build() { 57 | return new ArrayList(this.data); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/custommessages/SimpleCustomMessageMaker.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | package org.zu.ardulink.protocol.custommessages; 19 | 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * This is a simple implementation for CustomMessageMaker interface 24 | * custom messages. 25 | * 26 | * @author Luciano Zu 27 | * @see CustomMessageSender 28 | * @see CustomMessageMaker 29 | * 30 | * [adsense] 31 | */ 32 | public class SimpleCustomMessageMaker implements CustomMessageMaker { 33 | 34 | @Override 35 | public String getCustomMessage(String... args) { 36 | 37 | StringBuilder builder = new StringBuilder(); 38 | if(args.length > 0) { 39 | for (int i = 0; i < args.length - 1; i++) { 40 | builder.append(args[i]); 41 | builder.append("/"); 42 | } 43 | builder.append(args[args.length - 1]); 44 | } 45 | 46 | String retvalue = builder.toString(); 47 | return retvalue; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /JoystickSmartCarDriver/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | org.ardulink.examples 5 | joysticksmartcardriver 6 | 7 | 8 | org.ardulink 9 | parent 10 | 0.6.2-SNAPSHOT 11 | 12 | 13 | 14 | src 15 | 16 | 17 | org.apache.maven.plugins 18 | maven-jar-plugin 19 | 2.4 20 | 21 | 22 | 23 | true 24 | org.zu.ardulink.gui.JoystickSmartCarDriver 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | org.ardulink 35 | ardulink-core 36 | ${project.version} 37 | 38 | 39 | org.ardulink 40 | ardulink-swing 41 | ${project.version} 42 | 43 | 44 | org.slf4j 45 | slf4j-jdk14 46 | runtime 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /JavadocUtils/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
9 | 10 | 20 | ]]> 21 |
22 |
23 |
24 | 25 | 26 | 27 | Ardulink -
return to homepage]]> 28 | 29 | 30 | 31 | 32 | 33 | v0.6.2-SNAPSHOT Magnum PI

]]>
34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/TimeSliceCompactorLast.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import org.zu.ardulink.event.AnalogReadChangeEvent; 20 | import org.zu.ardulink.event.AnalogReadChangeListener; 21 | 22 | /** 23 | * [ardulinktitle] [ardulinkversion] 24 | * @author Peter Fichtner 25 | * 26 | * [adsense] 27 | */ 28 | public class TimeSliceCompactorLast extends 29 | SlicedAnalogReadChangeListenerAdapter { 30 | 31 | private boolean firstCall = true; 32 | private AnalogReadChangeEvent lastEvent; 33 | 34 | public TimeSliceCompactorLast(AnalogReadChangeListener delegate) { 35 | super(delegate); 36 | } 37 | 38 | @Override 39 | public void stateChanged(AnalogReadChangeEvent event) { 40 | if (this.firstCall) { 41 | getDelegate().stateChanged(event); 42 | this.firstCall = false; 43 | } else { 44 | this.lastEvent = event; 45 | } 46 | } 47 | 48 | @Override 49 | public void ticked() { 50 | AnalogReadChangeEvent event = this.lastEvent; 51 | if (event != null) { 52 | getDelegate().stateChanged(event); 53 | } 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/ConnectionEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | import java.util.Date; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * Event raised when connection occurs. 26 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 27 | * 28 | * [adsense] 29 | * 30 | */ 31 | public class ConnectionEvent { 32 | private String connectionId; 33 | private String portName; 34 | private Date timestamp = new Date(); 35 | 36 | public ConnectionEvent() { 37 | } 38 | 39 | public ConnectionEvent(String connectionId) { 40 | this.connectionId = connectionId; 41 | } 42 | 43 | public ConnectionEvent(String connectionId, String portName) { 44 | this.connectionId = connectionId; 45 | this.portName = portName; 46 | } 47 | 48 | public String getConnectionId() { 49 | return connectionId; 50 | } 51 | 52 | public Date getTimestamp() { 53 | return timestamp; 54 | } 55 | 56 | public String getPortName() { 57 | return portName; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/LoggerReplyMessageCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.protocol; 20 | 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | /** 25 | * [ardulinktitle] [ardulinkversion] 26 | * A simple ReplyMessageCallback implementation just to log MessageInfo values. 27 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 28 | * @see ReplyMessageCallback 29 | * [adsense] 30 | * 31 | */ 32 | public class LoggerReplyMessageCallback implements ReplyMessageCallback { 33 | 34 | private static final Logger logger = LoggerFactory.getLogger(LoggerReplyMessageCallback.class); 35 | 36 | @Override 37 | public void replyInfo(MessageInfo messageInfo) { 38 | logger.info("Reply Message has arrived"); 39 | logger.info("ID: {}", messageInfo.getMessageID()); 40 | logger.info("Message sent: {}", messageInfo.getMessageSent()); 41 | logger.info("Message received: {}", messageInfo.getMessageReceived()); 42 | logger.info("Result: {}", messageInfo.getReply()); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/Preconditions.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.util; 18 | 19 | /** 20 | * [ardulinktitle] [ardulinkversion] 21 | * 22 | * @author Peter Fichtner 23 | * 24 | * [adsense] 25 | */ 26 | public final class Preconditions { 27 | 28 | private Preconditions() { 29 | super(); 30 | } 31 | 32 | public static T checkNull(T t, String message, Object... args) { 33 | if (t != null) { 34 | throw new IllegalStateException(String.format(message, args)); 35 | } 36 | return t; 37 | } 38 | 39 | public static T checkNotNull(T t, String message, Object... args) { 40 | if (t == null) { 41 | throw new IllegalStateException(String.format(message, args)); 42 | } 43 | return t; 44 | } 45 | 46 | public static void checkArgument(boolean state, String message, Object... args) { 47 | if (!state) { 48 | throw new IllegalArgumentException(String.format(message, args)); 49 | } 50 | } 51 | 52 | public static void checkState(boolean state, String message, Object... args) { 53 | if (!state) { 54 | throw new IllegalStateException(String.format(message, args)); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /SimpleSmartCarDriver/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | org.ardulink.examples 5 | simplesmartcardriver 6 | 7 | 8 | org.ardulink 9 | parent 10 | 0.6.2-SNAPSHOT 11 | 12 | 13 | 14 | src 15 | 16 | 17 | resources 18 | 19 | 20 | 21 | 22 | 23 | org.apache.maven.plugins 24 | maven-jar-plugin 25 | 2.4 26 | 27 | 28 | 29 | true 30 | org.zu.ardulink.gui.SimpleSmartCarDriver 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | org.ardulink 41 | ardulink-core 42 | ${project.version} 43 | 44 | 45 | org.ardulink 46 | ardulink-swing 47 | ${project.version} 48 | 49 | 50 | org.slf4j 51 | slf4j-jdk14 52 | runtime 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/OptionMessageCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui; 20 | 21 | import java.awt.Component; 22 | 23 | import javax.swing.JOptionPane; 24 | 25 | import org.zu.ardulink.protocol.IProtocol; 26 | import org.zu.ardulink.protocol.MessageInfo; 27 | import org.zu.ardulink.protocol.ReplyMessageCallback; 28 | 29 | /** 30 | * [ardulinktitle] [ardulinkversion] 31 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 32 | * 33 | * [adsense] 34 | */ 35 | public class OptionMessageCallback implements ReplyMessageCallback { 36 | 37 | private Component component; 38 | 39 | public OptionMessageCallback(Component component) { 40 | super(); 41 | this.component = component; 42 | } 43 | 44 | @Override 45 | public void replyInfo(MessageInfo messageInfo) { 46 | if(messageInfo.getReply() == IProtocol.REPLY_OK) { 47 | JOptionPane.showMessageDialog(component, "Done", "Ok", JOptionPane.INFORMATION_MESSAGE); 48 | } else { 49 | JOptionPane.showMessageDialog(component, "Error", "Ko", JOptionPane.ERROR_MESSAGE); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/ArdulinkMailConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * 24 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 25 | * 26 | * [adsense] 27 | * 28 | */ 29 | public class ArdulinkMailConstants { 30 | 31 | public static final String TRUE = "true"; 32 | public static final String FALSE = "false"; 33 | 34 | public static final String MAIL_CONF_PROPERTIES_FILENAME = "ardulinkmail-conf.properties"; 35 | public static final String MAIL_STORE_PROTOCOL_KEY = "mail.store.protocol"; 36 | public static final String MAIL_HOST_KEY = "host"; 37 | public static final String MAIL_USER_KEY = "user"; 38 | public static final String MAIL_PASSWORD_KEY = "password"; 39 | 40 | public static final String MAIL_VALIDATE_FROM_KEY= "validateFrom"; 41 | public static final String MAIL_FROM_ADDRESSES_KEY= "fromAddresses"; 42 | 43 | public static final String MAIL_VALIDATE_CONTENT_PASSWORD_KEY = "validateContentPassword"; 44 | public static final String MAIL_CONTENT_PASSWORD_KEY = "contentPassword"; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/AbstractMultiMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.util; 18 | 19 | import java.util.Collection; 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * 26 | * @author Peter Fichtner 27 | * 28 | * [adsense] 29 | */ 30 | public abstract class AbstractMultiMap { 31 | 32 | protected final Map> data = new HashMap>(); 33 | 34 | public boolean isEmpty() { 35 | return this.data.isEmpty(); 36 | } 37 | 38 | public boolean put(K key, V value) { 39 | Collection values = this.data.get(key); 40 | if (values == null) { 41 | this.data.put(key, values = make()); 42 | } 43 | return values.add(value); 44 | } 45 | 46 | public boolean remove(K key, V value) { 47 | Collection values = this.data.get(key); 48 | boolean removed = values != null && values.remove(value); 49 | if (removed && values.isEmpty()) { 50 | this.data.remove(key); 51 | } 52 | return removed; 53 | } 54 | 55 | protected abstract Collection make(); 56 | 57 | public void clear() { 58 | this.data.clear(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/ThreadTimeSlicer.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * @author Peter Fichtner 26 | * 27 | * [adsense] 28 | */ 29 | public class ThreadTimeSlicer implements TimeSlicer { 30 | 31 | private final List runnables = new ArrayList(); 32 | 33 | public ThreadTimeSlicer(final long value, final TimeUnit timeUnit) { 34 | new Thread() { 35 | { 36 | setDaemon(true); 37 | start(); 38 | } 39 | 40 | @Override 41 | public void run() { 42 | while (true) { 43 | try { 44 | timeUnit.sleep(value); 45 | } catch (InterruptedException e) { 46 | Thread.currentThread().interrupt(); 47 | } 48 | for (SlicedAnalogReadChangeListenerAdapter runnable : runnables) { 49 | runnable.ticked(); 50 | } 51 | } 52 | } 53 | }; 54 | } 55 | 56 | public void add(SlicedAnalogReadChangeListenerAdapter runnable) { 57 | this.runnables.add(runnable); 58 | }; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/AnalogReadChangeListenerToleranceAdapter.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import org.zu.ardulink.event.AnalogReadChangeEvent; 20 | import org.zu.ardulink.event.AnalogReadChangeListener; 21 | 22 | /** 23 | * [ardulinktitle] [ardulinkversion] 24 | * @author Peter Fichtner 25 | * 26 | * [adsense] 27 | */ 28 | public class AnalogReadChangeListenerToleranceAdapter extends 29 | AnalogReadChangeListenerAdapter { 30 | 31 | private Integer cachedValue; 32 | private final Tolerance tolerance; 33 | 34 | public AnalogReadChangeListenerToleranceAdapter(Tolerance tolerance, 35 | AnalogReadChangeListener delegate) { 36 | super(delegate); 37 | this.tolerance = tolerance; 38 | } 39 | 40 | @Override 41 | public void stateChanged(AnalogReadChangeEvent e) { 42 | int newValue = e.getValue(); 43 | if (this.cachedValue == null 44 | || !tolerance 45 | .inTolerance(this.cachedValue.intValue(), newValue) 46 | || isHighOrLowValue(newValue)) { 47 | this.cachedValue = Integer.valueOf(newValue); 48 | getDelegate().stateChanged(e); 49 | } 50 | } 51 | 52 | private boolean isHighOrLowValue(int value) { 53 | return value == 0 || value == 255; 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/facility/UtilityColor.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.facility; 20 | 21 | import static java.awt.Color.BLACK; 22 | import static java.lang.Integer.toHexString; 23 | import static org.zu.ardulink.util.Strings.nullOrEmpty; 24 | 25 | import java.awt.Color; 26 | 27 | /** 28 | * [ardulinktitle] [ardulinkversion] 29 | * 30 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 31 | * @author Peter Fichtner 32 | * 33 | * [adsense] 34 | * 35 | */ 36 | public final class UtilityColor { 37 | 38 | private UtilityColor() { 39 | super(); 40 | } 41 | 42 | public static Color toColor(String hexString) { 43 | hexString = normalize(hexString); 44 | return hexString.isEmpty() ? BLACK : Color.decode(hexString); 45 | } 46 | 47 | private static String normalize(String hexString) { 48 | if (hexString != null && hexString.startsWith("#")) { 49 | hexString = hexString.substring(1); 50 | } 51 | return nullOrEmpty(hexString) ? "" : "#" + hexString; 52 | } 53 | 54 | public static String toString(Color color) { 55 | return "#" + toHexString(color.getRGB()).substring(2).toUpperCase(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /ArdulinkPI/test/org/zu/ardulink/connection/pi/RaspberryPIConnectionTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.connection.pi; 2 | 3 | import static org.junit.Assert.assertArrayEquals; 4 | import static org.junit.Assert.assertTrue; 5 | 6 | import org.junit.After; 7 | import org.junit.Before; 8 | import org.junit.FixMethodOrder; 9 | import org.junit.Test; 10 | import org.junit.runners.MethodSorters; 11 | import org.zu.ardulink.Link; 12 | import org.zu.ardulink.protocol.IProtocol; 13 | import org.zu.ardulink.protocol.LoggerReplyMessageCallback; 14 | import org.zu.ardulink.protocol.MessageInfo; 15 | 16 | @FixMethodOrder(MethodSorters.NAME_ASCENDING) 17 | public class RaspberryPIConnectionTest { 18 | 19 | private Link link; 20 | 21 | private boolean isInitialized = false; 22 | private boolean isLastTest = false; 23 | 24 | @Before 25 | public void setUp() { 26 | if(!isInitialized) { 27 | RaspberryPIConnection connection = new RaspberryPIConnection(); 28 | link = Link.createInstance("Rasp Link", connection); 29 | isInitialized = true; 30 | } 31 | } 32 | 33 | @After 34 | public void cleanUp() { 35 | if(link != null && isLastTest) { 36 | link.disconnect(); 37 | link = null; 38 | } 39 | } 40 | 41 | @Test 42 | public void t01GetPortList() { 43 | Object[] portlist = link.getPortList().toArray(); 44 | assertArrayEquals(new Object[]{"Raspberry PI"}, portlist); 45 | } 46 | 47 | @Test 48 | public void t02Connect() { 49 | assertTrue(link.connect()); 50 | } 51 | 52 | @Test 53 | public void t03SendPowerPinSwitch() { 54 | MessageInfo info = link.sendPowerPinSwitch(0, IProtocol.HIGH); 55 | assertTrue(info.isSent()); 56 | } 57 | 58 | @Test 59 | public void t04SendPowerPinSwitch() { 60 | MessageInfo info = link.sendPowerPinSwitch(0, IProtocol.HIGH, new LoggerReplyMessageCallback()); 61 | isLastTest = true; 62 | assertTrue(info.isSent()); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/parser/ProtocolParserHandler.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.protocol.parser; 2 | 3 | import static java.util.Collections.synchronizedMap; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import java.util.Set; 8 | 9 | import org.zu.ardulink.protocol.ALProtocol; 10 | import org.zu.ardulink.protocol.IProtocol; 11 | 12 | /** 13 | * [ardulinktitle] [ardulinkversion] 14 | * Class to manage the protocol parser available set. With this class you can install a new protocol parser for ardulink. 15 | * 16 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 17 | * @see IProtocol 18 | * @see ALProtocol 19 | * 20 | * [adsense] 21 | * 22 | */ 23 | public class ProtocolParserHandler { 24 | 25 | private static final Map installedParserImplementations = synchronizedMap(new HashMap()); 26 | 27 | static { 28 | ALProtocolParser alProtocolParser = new ALProtocolParser(); 29 | installProtocolParserImplementation(alProtocolParser); 30 | } 31 | 32 | /** 33 | * @param implementationName 34 | * @return return the protocol implementation called implementationName (if installed) 35 | */ 36 | public static IProtocolParser getProtocolParserImplementation(String implementationName) { 37 | return installedParserImplementations.get(implementationName); 38 | } 39 | 40 | /** 41 | * @return all available parser protocol implementations 42 | */ 43 | public static Set getInstalledProtocolParserImplementationNames() { 44 | return installedParserImplementations.keySet(); 45 | } 46 | 47 | /** 48 | * Install a protocol. 49 | * @param protocol 50 | * @return 51 | */ 52 | public static boolean installProtocolParserImplementation(IProtocolParser parserProtocol) { 53 | boolean retvalue = false; 54 | if(parserProtocol != null) { 55 | installedParserImplementations.put(parserProtocol.getProtocolName(), parserProtocol); 56 | retvalue = true; 57 | } 58 | return retvalue; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/facility/UtilityGeometry.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.facility; 20 | 21 | import java.awt.Component; 22 | import java.awt.Dimension; 23 | import java.awt.Point; 24 | 25 | import javax.swing.SwingUtilities; 26 | 27 | /** 28 | * [ardulinktitle] [ardulinkversion] 29 | * This class has utility methods for GUI components 30 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 31 | * 32 | * [adsense] 33 | * 34 | */ 35 | public class UtilityGeometry { 36 | 37 | public static void setAlignmentCentered(Component component, Component referredComponent) { 38 | if(referredComponent == null) { 39 | referredComponent = SwingUtilities.getRoot(component); 40 | } 41 | Point rootLocation = referredComponent.getLocation(); 42 | Dimension rootDimension = referredComponent.getSize(); 43 | Dimension componentDimension = component.getSize(); 44 | 45 | Point componentLocation = new Point(rootLocation); 46 | int dx = (rootDimension.width - componentDimension.width) / 2; 47 | int dy = (rootDimension.height - componentDimension.height) / 2; 48 | componentLocation.translate(dx, dy); 49 | 50 | component.setLocation(componentLocation); 51 | 52 | } 53 | public static void setAlignmentCentered(Component component) { 54 | setAlignmentCentered(component, null); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/AConfiguration.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration; 20 | 21 | import javax.xml.bind.annotation.XmlElement; 22 | import javax.xml.bind.annotation.XmlRootElement; 23 | 24 | /** 25 | * [ardulinktitle] [ardulinkversion] 26 | * 27 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 28 | * 29 | * [adsense] 30 | * 31 | */ 32 | @XmlRootElement(name="configuration") 33 | public class AConfiguration { 34 | 35 | private AConnectionList aConnectionList; 36 | private ALinkList aLinkList; 37 | private ACommandList aCommandList; 38 | 39 | @XmlElement(name="aConnectionList") 40 | public AConnectionList getaConnectionList() { 41 | return aConnectionList; 42 | } 43 | public void setaConnectionList(AConnectionList aConnectionList) { 44 | this.aConnectionList = aConnectionList; 45 | } 46 | 47 | @XmlElement(name="aLinkList") 48 | public ALinkList getaLinkList() { 49 | return aLinkList; 50 | } 51 | public void setaLinkList(ALinkList aLinkList) { 52 | this.aLinkList = aLinkList; 53 | } 54 | 55 | @XmlElement(name="aCommandList") 56 | public ACommandList getaCommandList() { 57 | return aCommandList; 58 | } 59 | public void setaCommandList(ACommandList aCommandList) { 60 | this.aCommandList = aCommandList; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Mqtt/test/com/github/pfichtner/ardulink/util/Message.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.util; 18 | 19 | /** 20 | * [ardulinktitle] [ardulinkversion] 21 | * @author Peter Fichtner 22 | * 23 | * [adsense] 24 | */ 25 | public class Message { 26 | 27 | private final String topic; 28 | private final String message; 29 | 30 | public Message(String topic, String message) { 31 | this.topic = topic; 32 | this.message = message; 33 | } 34 | 35 | public String getTopic() { 36 | return topic; 37 | } 38 | 39 | public String getMessage() { 40 | return message; 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | final int prime = 31; 46 | int result = 1; 47 | result = prime * result + ((message == null) ? 0 : message.hashCode()); 48 | result = prime * result + ((topic == null) ? 0 : topic.hashCode()); 49 | return result; 50 | } 51 | 52 | @Override 53 | public boolean equals(Object obj) { 54 | if (this == obj) 55 | return true; 56 | if (obj == null) 57 | return false; 58 | if (getClass() != obj.getClass()) 59 | return false; 60 | Message other = (Message) obj; 61 | if (message == null) { 62 | if (other.message != null) 63 | return false; 64 | } else if (!message.equals(other.message)) 65 | return false; 66 | if (topic == null) { 67 | if (other.topic != null) 68 | return false; 69 | } else if (!topic.equals(other.topic)) 70 | return false; 71 | return true; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "Message [topic=" + topic + ", message=" + message + "]"; 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /Mqtt/test/com/github/pfichtner/ardulink/util/ProtoBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.util; 18 | 19 | import static org.zu.ardulink.util.Preconditions.checkArgument; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * @author Peter Fichtner 24 | * 25 | * [adsense] 26 | */ 27 | public class ProtoBuilder { 28 | 29 | private final String command; 30 | private int pin; 31 | 32 | public enum ALPProtocolKeys { 33 | 34 | POWER_PIN_SWITCH("ppsw"), POWER_PIN_INTENSITY("ppin"), DIGITAL_PIN_READ( 35 | "dred"), ANALOG_PIN_READ("ared"), START_LISTENING_DIGITAL( 36 | "srld"), START_LISTENING_ANALOG("srla"), STOP_LISTENING_DIGITAL( 37 | "spld"), STOP_LISTENING_ANALOG("spla"); 38 | 39 | private String proto; 40 | 41 | private ALPProtocolKeys(String proto) { 42 | this.proto = proto; 43 | } 44 | } 45 | 46 | public static ProtoBuilder alpProtocolMessage(ALPProtocolKeys command) { 47 | return new ProtoBuilder(command.proto); 48 | } 49 | 50 | public static ProtoBuilder arduinoCommand(String command) { 51 | return new ProtoBuilder(command); 52 | } 53 | 54 | private ProtoBuilder(String command) { 55 | this.command = command; 56 | } 57 | 58 | public String withoutValue() { 59 | return "alp://" + command + "/" + pin + "\n"; 60 | } 61 | 62 | public String withValue(int value) { 63 | return "alp://" + command + "/" + pin + "/" + value + "\n"; 64 | } 65 | 66 | public ProtoBuilder forPin(int pin) { 67 | checkArgument(pin >= 0, "Pin must not be negative but was %s", pin); 68 | this.pin = pin; 69 | return this; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/util/Primitive.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | /** 4 | * [ardulinktitle] [ardulinkversion] 5 | * 6 | * @author Peter Fichtner 7 | * 8 | * [adsense] 9 | */ 10 | public enum Primitive { 11 | 12 | INT(Integer.TYPE) { 13 | @Override 14 | public Object parse(String value) { 15 | return Integer.parseInt(value); 16 | } 17 | }, 18 | BYTE(Byte.TYPE) { 19 | @Override 20 | public Object parse(String value) { 21 | return Byte.parseByte(value); 22 | } 23 | }, 24 | SHORT(Short.TYPE) { 25 | @Override 26 | public Object parse(String value) { 27 | return Short.parseShort(value); 28 | } 29 | }, 30 | LONG(Long.TYPE) { 31 | @Override 32 | public Object parse(String value) { 33 | return Long.parseLong(value); 34 | } 35 | }, 36 | FLOAT(Float.TYPE) { 37 | @Override 38 | public Object parse(String value) { 39 | return Float.parseFloat(value); 40 | } 41 | }, 42 | DOUBLE(Double.TYPE) { 43 | @Override 44 | public Object parse(String value) { 45 | return Double.parseDouble(value); 46 | } 47 | }, 48 | BOOLEAN(Boolean.TYPE) { 49 | @Override 50 | public Object parse(String value) { 51 | return Boolean.parseBoolean(value); 52 | } 53 | }, 54 | CHAR(Character.TYPE) { 55 | @Override 56 | public Object parse(String value) { 57 | return value.length() == 0 ? null : Character.valueOf(value 58 | .charAt(0)); 59 | } 60 | }; 61 | 62 | private final Class type; 63 | 64 | private Primitive(Class type) { 65 | this.type = type; 66 | } 67 | 68 | public abstract Object parse(String value); 69 | 70 | public static Object parseAs(Class type, String value) { 71 | for (Primitive primitive : Primitive.values()) { 72 | if (type.isAssignableFrom(primitive.getType())) { 73 | return primitive.parse(value); 74 | } 75 | } 76 | return null; 77 | } 78 | 79 | public static Primitive forClassName(String name) { 80 | for (Primitive primitives : values()) { 81 | if (primitives.getType().getName().equals(name)) { 82 | return primitives; 83 | } 84 | } 85 | return null; 86 | } 87 | 88 | public Class getType() { 89 | return type; 90 | } 91 | 92 | } -------------------------------------------------------------------------------- /ArdulinkPI/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-pi 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | 15 | 16 | resources 17 | 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-jar-plugin 23 | 2.4 24 | 25 | 26 | org.apache.maven.plugins 27 | maven-surefire-plugin 28 | 2.12.4 29 | 30 | true 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 2.10.3 37 | 38 | public 39 | ${project.basedir}/../JavadocUtils/generated 40 | ardulink-pi 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.ardulink 49 | ardulink-core 50 | ${project.version} 51 | 52 | 53 | org.slf4j 54 | slf4j-jdk14 55 | runtime 56 | 57 | 58 | args4j 59 | args4j 60 | 61 | 62 | junit 63 | junit 64 | test 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /ArdulinkCore/test/org/zu/ardulink/util/SetMultiMapTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.util; 2 | 3 | import static java.lang.Boolean.FALSE; 4 | import static java.lang.Boolean.TRUE; 5 | import static org.hamcrest.core.Is.is; 6 | import static org.junit.Assert.assertThat; 7 | 8 | import java.util.Collections; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | import java.util.Set; 12 | 13 | import org.junit.Test; 14 | 15 | public class SetMultiMapTest { 16 | 17 | @Test 18 | public void canPut() { 19 | SetMultiMap s = new SetMultiMap(); 20 | assertThat(s.put(1, "foo"), is(TRUE)); 21 | assertThat(s.asMap(), is(buildMap(1, Collections.singleton("foo")))); 22 | } 23 | 24 | @Test 25 | public void canPutTwice() { 26 | SetMultiMap s = new SetMultiMap(); 27 | assertThat(s.put(1, "foo"), is(TRUE)); 28 | assertThat(s.put(1, "foo"), is(FALSE)); 29 | assertThat(s.asMap(), is(buildMap(1, Collections.singleton("foo")))); 30 | } 31 | 32 | @Test 33 | public void canRemoveExistingValue() { 34 | SetMultiMap s = new SetMultiMap(); 35 | assertThat(s.put(1, "foo"), is(TRUE)); 36 | assertThat(s.remove(1, "foo"), is(TRUE)); 37 | assertThat(s.asMap(), is(Collections.> emptyMap())); 38 | } 39 | 40 | @Test 41 | public void canHandleRemovesOfNonExistingValues() { 42 | SetMultiMap s = new SetMultiMap(); 43 | assertThat(s.put(1, "foo"), is(TRUE)); 44 | assertThat(s.remove(1, "bar"), is(FALSE)); 45 | assertThat(s.asMap(), is(buildMap(1, Collections.singleton("foo")))); 46 | } 47 | 48 | @Test 49 | public void canHandleRemovesOfNonExistingKeys() { 50 | SetMultiMap s = new SetMultiMap(); 51 | assertThat(s.put(1, "foo"), is(TRUE)); 52 | assertThat(s.remove(2, "foo"), is(FALSE)); 53 | assertThat(s.asMap(), is(buildMap(1, Collections.singleton("foo")))); 54 | } 55 | 56 | private static Map> buildMap(Integer key, 57 | Set value) { 58 | Map> m = new HashMap>(); 59 | m.put(key, value); 60 | return m; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/event/IncomingMessageEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.event; 20 | 21 | import org.zu.ardulink.protocol.IProtocol; 22 | 23 | /** 24 | * [ardulinktitle] [ardulinkversion] 25 | * Abstract class with info about message incoming to ardulink from arduino board. 26 | * 27 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 28 | * 29 | * [adsense] 30 | * 31 | */ 32 | public abstract class IncomingMessageEvent { 33 | 34 | public static final int UNDEFINED_PIN = -1; 35 | public static final int UNDEFINED_VALUE = -1; 36 | public static final int POWER_HIGH = IProtocol.POWER_HIGH; 37 | public static final int POWER_LOW = IProtocol.POWER_LOW; 38 | 39 | private int pin = UNDEFINED_PIN; 40 | private int value = UNDEFINED_VALUE; 41 | private String incomingMessage; 42 | 43 | public IncomingMessageEvent() { 44 | super(); 45 | } 46 | 47 | public IncomingMessageEvent(int pin, int value, String incomingMessage) { 48 | this.pin = pin; 49 | this.value = value; 50 | this.incomingMessage = incomingMessage; 51 | } 52 | 53 | public int getPin() { 54 | return pin; 55 | } 56 | public void setPin(int pin) { 57 | this.pin = pin; 58 | } 59 | public int getValue() { 60 | return value; 61 | } 62 | public void setValue(int value) { 63 | this.value = value; 64 | } 65 | public String getIncomingMessage() { 66 | return incomingMessage; 67 | } 68 | public void setIncomingMessage(String incomingMessage) { 69 | this.incomingMessage = incomingMessage; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ArdulinkMail/test/org/zu/ardulink/mail/server/contentmanagement/ProtocolContentManagerTest.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.mail.server.contentmanagement; 2 | 3 | import static org.junit.Assert.assertFalse; 4 | import static org.junit.Assert.assertTrue; 5 | import static org.junit.Assert.assertEquals; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | import org.junit.After; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | 14 | public class ProtocolContentManagerTest { 15 | 16 | private ProtocolContentManager protocolContentManager; 17 | private String content4ProtocolContentManager; 18 | private String contentNot4ProtocolContentManager; 19 | private List mailContentHooks; 20 | private List values; 21 | private List aLinkNames; 22 | 23 | @Before 24 | public void setUp() { 25 | protocolContentManager = new ProtocolContentManager(); 26 | content4ProtocolContentManager = "hi this is a content good for hooks"; 27 | contentNot4ProtocolContentManager = "hello this is not a content good for hooks"; 28 | mailContentHooks = Arrays.asList(new String[] {"is a"}); 29 | values = Arrays.asList(new String[] {"sendPowerPinSwitch(32, 1)"}); 30 | aLinkNames = Arrays.asList(new String[] {"FAKE LINK"}); 31 | } 32 | 33 | @After 34 | public void cleanUp() { 35 | protocolContentManager = null; 36 | content4ProtocolContentManager = null; 37 | contentNot4ProtocolContentManager = null; 38 | mailContentHooks = null; 39 | values = null; 40 | aLinkNames = null; 41 | } 42 | 43 | @Test 44 | public void isForContentOk() { 45 | 46 | assertTrue(protocolContentManager.isForContent(content4ProtocolContentManager, mailContentHooks)); 47 | } 48 | 49 | @Test 50 | public void isForContentKo() { 51 | 52 | assertFalse(protocolContentManager.isForContent(contentNot4ProtocolContentManager, mailContentHooks)); 53 | } 54 | 55 | @Test 56 | public void execute() { 57 | String message = protocolContentManager.execute(content4ProtocolContentManager, values, mailContentHooks, aLinkNames); 58 | assertEquals("message sendPowerPinSwitch(32, 1) sent for link: FAKE LINK with this result: OK\n", message); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/facility/IntMinMaxModel.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package org.zu.ardulink.gui.facility; 18 | 19 | import javax.swing.AbstractListModel; 20 | import javax.swing.ComboBoxModel; 21 | 22 | /** 23 | * [ardulinktitle] [ardulinkversion] 24 | * @author Peter Fichtner 25 | * 26 | * [adsense] 27 | */ 28 | public class IntMinMaxModel extends AbstractListModel implements 29 | ComboBoxModel { 30 | 31 | private static final long serialVersionUID = -6314940179491347446L; 32 | 33 | private final int low; 34 | private final int size; 35 | 36 | private Integer selectedItem; 37 | 38 | public IntMinMaxModel(int low, int high) { 39 | this.low = low; 40 | this.size = high - low + 1; 41 | } 42 | 43 | @Override 44 | public int getSize() { 45 | return this.size; 46 | } 47 | 48 | @Override 49 | public Integer getElementAt(int index) { 50 | return Integer.valueOf(index + this.low); 51 | } 52 | 53 | @Override 54 | public void setSelectedItem(Object selectedItem) { 55 | this.selectedItem = (Integer) selectedItem; 56 | } 57 | 58 | @Override 59 | public Integer getSelectedItem() { 60 | return this.selectedItem; 61 | } 62 | 63 | public IntMinMaxModel withSelectedItem(int selectedItem) { 64 | setSelectedItem(Integer.valueOf(selectedItem)); 65 | return this; 66 | } 67 | 68 | public IntMinMaxModel withFirstItemSelected() { 69 | selectIndex(0); 70 | return this; 71 | } 72 | 73 | public IntMinMaxModel withLastItemSelected() { 74 | selectIndex(getSize() - 1); 75 | return this; 76 | } 77 | 78 | private void selectIndex(int index) { 79 | int size = getSize(); 80 | if (size != 0 && index >= 0 && index < size) { 81 | withSelectedItem(getElementAt(index)); 82 | } 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /Mqtt/src/com/github/pfichtner/ardulink/compactors/TimeSliceCompactorAvg.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.compactors; 18 | 19 | import static org.zu.ardulink.util.Integers.average; 20 | 21 | import java.util.List; 22 | import java.util.Map.Entry; 23 | 24 | import org.zu.ardulink.event.AnalogReadChangeEvent; 25 | import org.zu.ardulink.event.AnalogReadChangeListener; 26 | import org.zu.ardulink.util.ListMultiMap; 27 | 28 | /** 29 | * [ardulinktitle] [ardulinkversion] 30 | * @author Peter Fichtner 31 | * 32 | * [adsense] 33 | */ 34 | public class TimeSliceCompactorAvg extends 35 | SlicedAnalogReadChangeListenerAdapter { 36 | 37 | private boolean firstCall = true; 38 | private final ListMultiMap data = new ListMultiMap(); 39 | 40 | public TimeSliceCompactorAvg(AnalogReadChangeListener delegate) { 41 | super(delegate); 42 | } 43 | 44 | @Override 45 | public void stateChanged(AnalogReadChangeEvent event) { 46 | if (this.firstCall) { 47 | getDelegate().stateChanged(event); 48 | this.firstCall = false; 49 | } else { 50 | synchronized (this.data) { 51 | this.data.put(event.getPin(), event.getValue()); 52 | } 53 | } 54 | } 55 | 56 | @Override 57 | public void ticked() { 58 | synchronized (this.data) { 59 | if (!data.isEmpty()) { 60 | for (Entry> entry : data.asMap() 61 | .entrySet()) { 62 | getDelegate() 63 | .stateChanged( 64 | new AnalogReadChangeEvent(entry.getKey(), 65 | average(entry.getValue()), 66 | "alp://todo/rebuild/message")); 67 | } 68 | data.clear(); 69 | } 70 | } 71 | } 72 | 73 | 74 | } -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/connection/FakeConnection.java: -------------------------------------------------------------------------------- 1 | package org.zu.ardulink.connection; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.zu.ardulink.ConnectionContact; 7 | 8 | /** 9 | * [ardulinktitle] [ardulinkversion] 10 | * 11 | * This is a fake connection used to create a Link without an Arduino. It hasn't a thread to manage messages coming from Arduino. 12 | * It manages only link created with ALProtocol and it manages call backs with all ok messages. Since it hasn't a thread for 13 | * incoming messages be careful with call backs that are done with the same caller thread. 14 | * 15 | * @author Luciano Zu 16 | * [adsense] 17 | */ 18 | public class FakeConnection implements Connection { 19 | 20 | private boolean connected = false; 21 | private ConnectionContact contact; 22 | 23 | @Override 24 | public List getPortList() { 25 | return Arrays.asList(new String[]{"COM999"}); 26 | } 27 | 28 | @Override 29 | public boolean connect(Object... params) { 30 | connected = true; 31 | return isConnected(); 32 | } 33 | 34 | @Override 35 | public boolean disconnect() { 36 | connected = false; 37 | return !isConnected(); 38 | } 39 | 40 | @Override 41 | public boolean isConnected() { 42 | return connected; 43 | } 44 | 45 | @Override 46 | public boolean writeSerial(String message) { 47 | 48 | String id = null; 49 | int idPosition = message.indexOf("?id="); 50 | if (idPosition != -1) { 51 | id = message.substring(idPosition + 4); 52 | } 53 | 54 | sendReply(id); 55 | return true; 56 | } 57 | 58 | @Override 59 | public boolean writeSerial(int numBytes, int[] message) { 60 | throw new RuntimeException("binary writeSerial should not be called for this connection"); 61 | } 62 | 63 | /* 64 | * Sends a reply in ALProtocol 65 | */ 66 | private void sendReply(String id) { 67 | if(id != null) { 68 | byte[] bytes = ("alp://rply/ok?id=" + id).getBytes(); 69 | int[] retmessage = new int[bytes.length]; 70 | for (int i = 0; i < retmessage.length; i++) { 71 | retmessage[i] = bytes[i]; 72 | } 73 | contact.parseInput("FAKE", retmessage.length, retmessage); 74 | } 75 | } 76 | 77 | @Override 78 | public void setConnectionContact(ConnectionContact contact) { 79 | this.contact = contact; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/ArdulinkExecutor.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server; 20 | 21 | import java.util.List; 22 | 23 | import javax.mail.MessagingException; 24 | 25 | import org.zu.ardulink.mail.server.links.configuration.ACommand; 26 | import org.zu.ardulink.mail.server.links.configuration.ConfigurationFacade; 27 | 28 | /** 29 | * [ardulinktitle] [ardulinkversion] 30 | * 31 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 32 | * 33 | * [adsense] 34 | * 35 | */ 36 | public class ArdulinkExecutor { 37 | 38 | /** 39 | * This method execute the request embedded in mail content. If is returned 40 | * a string not null then it should be used as body for the reply message 41 | * 42 | * @param content 43 | * @return 44 | */ 45 | public String execute(String content) throws MessagingException { 46 | 47 | StringBuilder builder = new StringBuilder(); 48 | 49 | List commands = findCommands(content); 50 | for (ACommand aCommand : commands) { 51 | System.out.println("Command: " + aCommand.getName() + " executing..."); 52 | String reply = aCommand.execute(content); 53 | System.out.println("Command: " + aCommand.getName() + " executed"); 54 | builder.append(reply); 55 | builder.append("\n\n"); 56 | } 57 | 58 | return builder.toString(); 59 | } 60 | 61 | private List findCommands(String content) 62 | throws MessagingException { 63 | List commands = ConfigurationFacade.findCommands(content); 64 | if (commands.isEmpty()) { 65 | throw new MessagingException("No command is found for content: " 66 | + content); 67 | } 68 | return commands; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/ConfigurationSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration; 20 | 21 | import java.io.File; 22 | import java.io.InputStream; 23 | 24 | import org.zu.ardulink.io.JAXBReaderWriter; 25 | import org.zu.ardulink.io.ReadingException; 26 | import org.zu.ardulink.io.WritingException; 27 | 28 | /** 29 | * [ardulinktitle] [ardulinkversion] 30 | * 31 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 32 | * 33 | * [adsense] 34 | * 35 | */ 36 | public class ConfigurationSerializer { 37 | 38 | public static final String CONFIGURATION_FILE_NAME = "ArdulinkMailConfiguration.xml"; 39 | 40 | public static AConfiguration read(String file) throws ReadingException { 41 | return read(new File(file)); 42 | } 43 | 44 | public static AConfiguration read(File file) throws ReadingException { 45 | JAXBReaderWriter reader = new JAXBReaderWriter(AConfiguration.class); 46 | return reader.read(file); 47 | } 48 | 49 | public static AConfiguration read(InputStream is) throws ReadingException { 50 | JAXBReaderWriter reader = new JAXBReaderWriter(AConfiguration.class); 51 | return reader.read(is); 52 | } 53 | 54 | public static void write(AConfiguration configuration, String file) throws WritingException { 55 | write(configuration, new File(file)); 56 | } 57 | 58 | public static void write(AConfiguration configuration, File file) throws WritingException { 59 | JAXBReaderWriter writer = new JAXBReaderWriter(AConfiguration.class); 60 | writer.write(configuration, file); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ArdulinkNetworkProxyServer/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-networkproxyserver 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | 15 | 16 | resources 17 | 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-jar-plugin 23 | 2.4 24 | 25 | 26 | 27 | true 28 | org.zu.ardulink.connection.proxy.NetworkProxyServer 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 2.10.3 37 | 38 | public 39 | ${project.basedir}/../JavadocUtils/generated 40 | ardulink-networkproxyserver 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.ardulink 49 | ardulink-core 50 | ${project.version} 51 | 52 | 53 | org.ardulink 54 | ardulink-pi 55 | ${project.version} 56 | 57 | 58 | org.rxtx 59 | rxtx 60 | 2.1.7 61 | 62 | 63 | org.slf4j 64 | slf4j-jdk14 65 | runtime 66 | 67 | 68 | args4j 69 | args4j 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /ArdulinkCore/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-core 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | test 15 | 16 | 17 | resources 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-jar-plugin 24 | 2.4 25 | 26 | 27 | 28 | true 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 2.10.3 37 | 38 | public 39 | ${project.basedir}/../JavadocUtils/generated 40 | ardulink-core 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.rxtx 49 | rxtx 50 | 2.1.7 51 | 52 | 53 | ch.ntb 54 | usb 55 | 0.5.9 56 | 57 | 58 | net.sf.bluecove 59 | bluecove 60 | 2.1.1-SNAPSHOT 61 | 62 | 63 | org.slf4j 64 | slf4j-api 65 | 66 | 67 | com.pi4j 68 | pi4j-core 69 | 1.0 70 | 71 | 72 | junit 73 | junit 74 | test 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ArdulinkSwing/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-swing 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | 15 | 16 | resources 17 | 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-jar-plugin 23 | 2.4 24 | 25 | 26 | 27 | true 28 | org.zu.ardulink.gui.Console 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 2.10.3 37 | 38 | public 39 | ${project.basedir}/../JavadocUtils/generated 40 | ardulink-swing 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.ardulink 49 | ardulink-core 50 | ${project.version} 51 | 52 | 53 | org.rxtx 54 | rxtx 55 | 2.1.7 56 | 57 | 58 | ch.ntb 59 | usb 60 | 0.5.9 61 | 62 | 63 | net.sf.bluecove 64 | bluecove 65 | 2.1.1-SNAPSHOT 66 | 67 | 68 | org.slf4j 69 | slf4j-jdk14 70 | runtime 71 | 72 | 73 | args4j 74 | args4j 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/KeyPressController.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui; 20 | 21 | import java.awt.BorderLayout; 22 | 23 | import javax.swing.JLabel; 24 | import javax.swing.JPanel; 25 | import javax.swing.SwingConstants; 26 | 27 | import org.zu.ardulink.Link; 28 | import org.zu.ardulink.protocol.ReplyMessageCallback; 29 | 30 | /** 31 | * [ardulinktitle] [ardulinkversion] 32 | * This class captures key press events and sends messages to arduino board with key press 33 | * information. 34 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 35 | * @see KeyPressListener 36 | * [adsense] 37 | * 38 | */ 39 | public class KeyPressController extends JPanel implements Linkable { 40 | 41 | private static final long serialVersionUID = -1842577141033747612L; 42 | private KeyPressListener keyPressListener; 43 | 44 | /** 45 | * Create the panel. 46 | */ 47 | public KeyPressController() { 48 | setLayout(new BorderLayout(0, 0)); 49 | 50 | JLabel lblPressAnyKey = new JLabel("Press any key"); 51 | lblPressAnyKey.setHorizontalAlignment(SwingConstants.CENTER); 52 | add(lblPressAnyKey, BorderLayout.NORTH); 53 | 54 | JLabel pressedKeyLabel = new JLabel(""); 55 | pressedKeyLabel.setHorizontalAlignment(SwingConstants.CENTER); 56 | add(pressedKeyLabel, BorderLayout.CENTER); 57 | 58 | keyPressListener = new KeyPressListener(); 59 | addKeyListener(keyPressListener); 60 | keyPressListener.setGuiInteractionLabel(pressedKeyLabel); 61 | setFocusTraversalKeysEnabled(false); 62 | } 63 | 64 | public void setLink(Link link) { 65 | keyPressListener.setLink(link); 66 | } 67 | 68 | public ReplyMessageCallback getReplyMessageCallback() { 69 | throw new RuntimeException("Not developed yet"); 70 | } 71 | 72 | public void setReplyMessageCallback(ReplyMessageCallback replyMessageCallback) { 73 | throw new RuntimeException("Not developed yet"); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/customcomponents/joystick/SimplePositionListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui.customcomponents.joystick; 20 | 21 | import java.awt.Color; 22 | import java.awt.Dimension; 23 | import java.awt.Graphics; 24 | import java.awt.Graphics2D; 25 | import java.awt.Point; 26 | import java.awt.RenderingHints; 27 | 28 | import javax.swing.JPanel; 29 | 30 | import org.zu.ardulink.gui.event.PositionEvent; 31 | import org.zu.ardulink.gui.event.PositionListener; 32 | 33 | /** 34 | * [ardulinktitle] [ardulinkversion] 35 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 36 | * 37 | * [adsense] 38 | */ 39 | public class SimplePositionListener extends JPanel implements PositionListener { 40 | 41 | private static final long serialVersionUID = -315437517373209646L; 42 | private Point position; 43 | private int maxSize = 1; 44 | 45 | private static final int POINT_DIM = 15; 46 | 47 | @Override 48 | protected void paintComponent(Graphics g) { 49 | super.paintComponent(g); 50 | Graphics2D g2 = (Graphics2D) g; 51 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, 52 | RenderingHints.VALUE_ANTIALIAS_ON); 53 | g2.setColor(Color.RED); 54 | int x = 0; 55 | int y = 0; 56 | Dimension dimension = getSize(); 57 | int dim = Math.min(dimension.width, dimension.height) / 2; 58 | if(position != null) { 59 | x = position.x * dim / maxSize; 60 | y = position.y * dim / maxSize; 61 | } 62 | g2.fillOval((dimension.width / 2) + x - (POINT_DIM / 2), (dimension.height / 2) - y - (POINT_DIM / 2), POINT_DIM, POINT_DIM); 63 | // g2.drawRect(0, 0, dimension.width - 1, dimension.height - 1); 64 | } 65 | 66 | @Override 67 | public void positionChanged(PositionEvent e) { 68 | position = e.getPosition(); 69 | maxSize = e.getMaxSize(); 70 | repaint(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Deploy/rootfolder/sketches/SimpleProtocol4Digispark/SimpleProtocol4Digispark.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | This sketch is an example to understand how Digispark/PicoDuino can recognize SimpleBynaryProtocol. 17 | However, it can easily be reused for your own purposes or as a base for a library. 18 | 19 | This sketch is for Digispark/PicoDuino that doesn't support Serial library. Actually it manages 20 | SimpleBynaryProtocol (without responses from Digispark) but just for PIN Power Switch messages. 21 | If you have different needs you have to modify this sketch accordingly. 22 | 23 | Remember: Digispark/PicoDuino has just 6.012 bytes memory available for sketches. 24 | 25 | */ 26 | 27 | #include 28 | 29 | #define POWER_PIN_INTENSITY_MESSAGE 11 30 | #define POWER_PIN_SWITCH_MESSAGE 12 31 | 32 | 33 | byte inputMessage[10]; 34 | byte position = 0; 35 | 36 | void setup() { 37 | DigiUSB.begin(); 38 | pinMode(0,OUTPUT); 39 | pinMode(1,OUTPUT); 40 | pinMode(2,OUTPUT); 41 | } 42 | 43 | void get_input() { 44 | position = 0; 45 | byte lastRead; 46 | // when there are no characters to read, or the character isn't a newline 47 | while (true) { // loop forever 48 | if (DigiUSB.available()) { 49 | // something to read 50 | lastRead = DigiUSB.read(); 51 | DigiUSB.print(lastRead); 52 | if (lastRead == 255) { 53 | break; // when we get a divider message, break out of loop 54 | } else { 55 | // add it to the inputString: 56 | inputMessage[position] = lastRead; 57 | position++; 58 | } 59 | } 60 | 61 | // refresh the usb port for 10 milliseconds 62 | DigiUSB.delay(10); 63 | } 64 | } 65 | 66 | void loop() { 67 | 68 | get_input(); 69 | 70 | if(inputMessage[0] == POWER_PIN_SWITCH_MESSAGE) { // Power Pin Switch (this is general code you can reuse) 71 | digitalWrite(inputMessage[1], inputMessage[2]); 72 | } else if(inputMessage[0] == POWER_PIN_INTENSITY_MESSAGE) { // Power Pin Intensity (this is general code you can reuse) 73 | analogWrite(inputMessage[1], inputMessage[2]); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ArdulinkConsole/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-console 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | 15 | 16 | resources 17 | 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-jar-plugin 23 | 2.4 24 | 25 | 26 | 27 | true 28 | org.zu.ardulink.gui.Console 29 | 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-javadoc-plugin 36 | 2.10.3 37 | 38 | public 39 | ${project.basedir}/../JavadocUtils/generated 40 | ardulink-console 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.ardulink 49 | ardulink-core 50 | ${project.version} 51 | 52 | 53 | org.ardulink 54 | ardulink-swing 55 | ${project.version} 56 | 57 | 58 | org.rxtx 59 | rxtx 60 | 2.1.7 61 | 62 | 63 | ch.ntb 64 | usb 65 | 0.5.9 66 | 67 | 68 | net.sf.bluecove 69 | bluecove 70 | 2.1.1-SNAPSHOT 71 | 72 | 73 | org.slf4j 74 | slf4j-jdk14 75 | runtime 76 | 77 | 78 | args4j 79 | args4j 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/contentmanagement/SimpleContentManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.contentmanagement; 20 | 21 | import java.util.List; 22 | 23 | import org.zu.ardulink.Link; 24 | import org.zu.ardulink.mail.server.links.configuration.utils.ConfigurationUtility; 25 | import org.zu.ardulink.protocol.IProtocol; 26 | 27 | /** 28 | * This simple IContentManager implementation sends strings in values ACommand instance when mail body content 29 | * contains (case insensitive) one or more than a mail content hook in a ACommand instance. It sends strings with Link.writeSerial(String) method. 30 | * Link.writeSerial(String) method doesn't care about protocol in use with the Link instance. 31 | * 32 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 33 | * 34 | */ 35 | public class SimpleContentManager implements IContentManager { 36 | 37 | @Override 38 | public boolean isForContent(String content, List mailContentHooks) { 39 | for (String hook : mailContentHooks) { 40 | if(content.toUpperCase().contains(hook.toUpperCase())) { 41 | return true; 42 | } 43 | } 44 | return false; 45 | } 46 | 47 | @Override 48 | public String execute(String content, List values, List mailContentHooks, List aLinkNames) { 49 | 50 | StringBuilder builder = new StringBuilder(); 51 | 52 | List links = ConfigurationUtility.getConnectedLinks(aLinkNames); 53 | for (Link link : links) { 54 | for (String string : values) { 55 | StringBuilder value = new StringBuilder(string); 56 | value.append(new String(new byte[] { IProtocol.DEFAULT_OUTGOING_MESSAGE_DIVIDER })); 57 | boolean isOk = link.writeSerial(value.toString()); 58 | builder.append("message ").append(value).append(" "); 59 | if (!isOk) { 60 | builder.append("NOT "); 61 | } 62 | builder.append("sent for link: ").append(link.getName()); 63 | builder.append("\n"); 64 | } 65 | } 66 | 67 | return builder.toString(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Deploy/rootfolder/sketches/SimpleProtocol/SimpleProtocol.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | This sketch is an example to understand how Digispark/PicoDuino can recognize SimpleBynaryProtocol. 17 | However, it can easily be reused for your own purposes or as a base for a library. 18 | 19 | This sketch is for Digispark/PicoDuino that doesn't support Serial library. Actually it manages 20 | SimpleBynaryProtocol (without responses from Digispark) but just for PIN Power Switch messages. 21 | If you have different needs you have to modify this sketch accordingly. 22 | 23 | Remember: Digispark/PicoDuino has just 6.012 bytes memory available for sketches. 24 | 25 | */ 26 | 27 | #include 28 | 29 | #define POWER_PIN_INTENSITY_MESSAGE 11 30 | #define POWER_PIN_SWITCH_MESSAGE 12 31 | #define digitalPinListeningNum 14 // Change 14 if you have a different number of pins. 32 | 33 | byte inputMessage[10]; 34 | byte position = 0; 35 | 36 | void setup() { 37 | // initialize serial: (this is general code you can reuse) 38 | Serial.begin(115200); 39 | 40 | // Turn off everything (not on RXTX) 41 | int index = 0; 42 | for (index = 2; index < digitalPinListeningNum; index++) { 43 | pinMode(index, OUTPUT); 44 | digitalWrite(index, LOW); 45 | } 46 | 47 | } 48 | 49 | void get_input() { 50 | position = 0; 51 | byte lastRead; 52 | // when there are no characters to read, or the character isn't a newline 53 | while (true) { // loop forever 54 | if (Serial.available()) { 55 | // something to read 56 | lastRead = Serial.read(); 57 | if (lastRead == 255) { 58 | break; // when we get a divider message, break out of loop 59 | } else { 60 | // add it to the inputString: 61 | inputMessage[position] = lastRead; 62 | position++; 63 | } 64 | } 65 | 66 | } 67 | } 68 | 69 | void loop() { 70 | 71 | get_input(); 72 | 73 | if(inputMessage[0] == POWER_PIN_SWITCH_MESSAGE) { // Power Pin Switch (this is general code you can reuse) 74 | digitalWrite(inputMessage[1], inputMessage[2]); 75 | } else if(inputMessage[0] == POWER_PIN_INTENSITY_MESSAGE) { // Power Pin Intensity (this is general code you can reuse) 76 | analogWrite(inputMessage[1], inputMessage[2]); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ArdulinkMail/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-mail 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | src 14 | test 15 | 16 | 17 | 18 | testResources 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-jar-plugin 26 | 2.4 27 | 28 | 29 | 30 | ../conf/ 31 | 32 | 33 | true 34 | org.zu.ardulink.mail.server.MailListener 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-surefire-plugin 42 | 2.12.4 43 | 44 | true 45 | 46 | 47 | 48 | org.apache.maven.plugins 49 | maven-javadoc-plugin 50 | 2.10.3 51 | 52 | public 53 | ${project.basedir}/../JavadocUtils/generated 54 | ardulink-mail 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | org.ardulink 63 | ardulink-core 64 | ${project.version} 65 | 66 | 67 | com.sun.mail 68 | javax.mail 69 | 1.5.4 70 | 71 | 72 | org.slf4j 73 | slf4j-api 74 | 75 | 76 | org.slf4j 77 | slf4j-jdk14 78 | runtime 79 | 80 | 81 | junit 82 | junit 83 | test 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Deploy/assembly.xml: -------------------------------------------------------------------------------- 1 | 5 | bin 6 | 7 | zip 8 | 9 | 10 | false 11 | ardulink 12 | 13 | 14 | 15 | true 16 | 17 | *:ardulink-core 18 | *:ardulink-swing 19 | *:ardulink-console 20 | *:ardulink-mail 21 | *:ardulink-networkproxyserver 22 | *:ardulink-mqtt 23 | 24 | 25 | 26 | ardulink/lib 27 | false 28 | 29 | 30 | 31 | true 32 | 33 | *:datareceiver:* 34 | 35 | 36 | 37 | ardulink/examples/DataReceiver 38 | false 39 | 40 | 41 | 42 | true 43 | 44 | *:joysticksmartcardriver:* 45 | 46 | 47 | 48 | ardulink/examples/JoystickSmartCarDriver 49 | false 50 | 51 | 52 | 53 | true 54 | 55 | *:simplesmartcardriver:* 56 | 57 | 58 | 59 | ardulink/examples/SimpleSmartCarDriver 60 | false 61 | 62 | 63 | 64 | 65 | 66 | 67 | rootfolder 68 | ardulink 69 | 70 | bin/* 71 | 72 | 73 | 74 | 75 | rootfolder/bin 76 | ardulink/bin 77 | true 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/PortListCallbackDialog.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui; 20 | 21 | import java.awt.BorderLayout; 22 | import java.awt.FlowLayout; 23 | import java.awt.event.ActionEvent; 24 | import java.awt.event.ActionListener; 25 | 26 | import javax.swing.JButton; 27 | import javax.swing.JDialog; 28 | import javax.swing.JPanel; 29 | import javax.swing.JProgressBar; 30 | import javax.swing.border.EmptyBorder; 31 | 32 | public class PortListCallbackDialog extends JDialog { 33 | 34 | private static final long serialVersionUID = -7897193872896320730L; 35 | 36 | private final JPanel contentPanel = new JPanel(); 37 | private final JButton cancelButton; 38 | private final JProgressBar progressBar; 39 | 40 | /** 41 | * Launch the application. 42 | */ 43 | public static void main(String[] args) { 44 | new PortListCallbackDialog().setVisible(true); 45 | } 46 | 47 | /** 48 | * Create the dialog. 49 | */ 50 | public PortListCallbackDialog() { 51 | setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); 52 | setResizable(false); 53 | setModal(true); 54 | setTitle("Searching..."); 55 | setBounds(100, 100, 335, 112); 56 | getContentPane().setLayout(new BorderLayout()); 57 | contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); 58 | getContentPane().add(contentPanel, BorderLayout.CENTER); 59 | contentPanel.setLayout(new BorderLayout(0, 0)); 60 | { 61 | progressBar = new JProgressBar(0, 1); 62 | progressBar.setIndeterminate(true); 63 | contentPanel.add(progressBar); 64 | } 65 | { 66 | JPanel buttonPane = new JPanel(); 67 | buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); 68 | getContentPane().add(buttonPane, BorderLayout.SOUTH); 69 | { 70 | cancelButton = new JButton("Cancel"); 71 | cancelButton.addActionListener(new ActionListener() { 72 | public void actionPerformed(ActionEvent e) { 73 | dispose(); 74 | } 75 | }); 76 | cancelButton.setActionCommand("Cancel"); 77 | buttonPane.add(cancelButton); 78 | } 79 | } 80 | } 81 | 82 | public void stopProgressBar() { 83 | progressBar.setIndeterminate(false); 84 | progressBar.setValue(1); 85 | } 86 | 87 | public void setButtonText(String text) { 88 | cancelButton.setText(text); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /ArdulinkCore/src/org/zu/ardulink/protocol/MessageInfo.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.protocol; 20 | 21 | /** 22 | * [ardulinktitle] [ardulinkversion] 23 | * MessageInfo collects information about messages sent to the Arduino board. 24 | * An instance of this class is returned by the methods defined in the IProtocol interface. 25 | * If a ReplyMessageCallback handler is set then MessageInfo is completed with other 26 | * information. 27 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 28 | * @see IProtocol 29 | * [adsense] 30 | * 31 | */ 32 | public class MessageInfo { 33 | private boolean sent; 34 | private long messageID = IProtocol.UNDEFINED_ID; 35 | private String messageSent; 36 | private String messageReceived; 37 | private int reply = IProtocol.UNDEFINED_REPLY; 38 | private ReplyMessageCallback callback; 39 | 40 | public MessageInfo() { 41 | super(); 42 | } 43 | 44 | /** 45 | * 46 | * @param result 47 | * @param messageID 48 | */ 49 | public MessageInfo(boolean result, long messageID) { 50 | this.sent = result; 51 | this.messageID = messageID; 52 | } 53 | 54 | public MessageInfo(boolean result) { 55 | this.sent = result; 56 | } 57 | 58 | public boolean isSent() { 59 | return sent; 60 | } 61 | public void setSent(boolean result) { 62 | this.sent = result; 63 | } 64 | public long getMessageID() { 65 | return messageID; 66 | } 67 | public void setMessageID(long messageID) { 68 | this.messageID = messageID; 69 | } 70 | 71 | public String getMessageSent() { 72 | return messageSent; 73 | } 74 | 75 | public void setMessageSent(String messageSent) { 76 | this.messageSent = messageSent; 77 | } 78 | 79 | public int getReply() { 80 | return reply; 81 | } 82 | 83 | public void setReply(int reply) { 84 | this.reply = reply; 85 | } 86 | 87 | public ReplyMessageCallback getCallback() { 88 | return callback; 89 | } 90 | 91 | public void setCallback(ReplyMessageCallback callback) { 92 | this.callback = callback; 93 | } 94 | 95 | public String getMessageReceived() { 96 | return messageReceived; 97 | } 98 | 99 | public void setMessageReceived(String messageReceived) { 100 | this.messageReceived = messageReceived; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /ArdulinkSwing/src/org/zu/ardulink/gui/KeyPressListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.gui; 20 | 21 | import java.awt.event.KeyAdapter; 22 | import java.awt.event.KeyEvent; 23 | 24 | import javax.swing.JLabel; 25 | 26 | import org.zu.ardulink.Link; 27 | 28 | /** 29 | * [ardulinktitle] [ardulinkversion] 30 | * Class used by KeyPressController class to capture key press events. 31 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 32 | * @see KeyPressController 33 | * [adsense] 34 | * 35 | */ 36 | public class KeyPressListener extends KeyAdapter { 37 | 38 | private JLabel guiInteractionLabel; 39 | private Link link = Link.getDefaultInstance(); 40 | 41 | public JLabel getGuiInteractionLabel() { 42 | return guiInteractionLabel; 43 | } 44 | 45 | public void setGuiInteractionLabel(JLabel guiInteractionLabel) { 46 | this.guiInteractionLabel = guiInteractionLabel; 47 | } 48 | 49 | public void removeGuiInteractionLabel() { 50 | this.guiInteractionLabel = null; 51 | } 52 | 53 | 54 | @Override 55 | public void keyPressed(KeyEvent e) { 56 | keyPressedGUIInteraction(e); 57 | 58 | link.sendKeyPressEvent(e.getKeyChar(), e.getKeyCode(), e.getKeyLocation(), e.getModifiers(), e.getModifiersEx()); 59 | } 60 | 61 | @Override 62 | public void keyReleased(KeyEvent e) { 63 | keyReleasedGUIInteraction(); 64 | } 65 | 66 | private void keyPressedGUIInteraction(KeyEvent e) { 67 | if(guiInteractionLabel != null) { 68 | String text = computeText4GUIInteraction(e); 69 | guiInteractionLabel.setText(text); 70 | } 71 | } 72 | 73 | private String computeText4GUIInteraction(KeyEvent e) { 74 | StringBuilder builder = new StringBuilder("Char: "); 75 | builder.append(e.getKeyChar()); 76 | builder.append(" - Key Code: "); 77 | builder.append(e.getKeyCode()); 78 | builder.append(" - Key Location: "); 79 | builder.append(e.getKeyLocation()); 80 | builder.append(" - Modifiers: "); 81 | builder.append(e.getModifiers()); 82 | builder.append(" - Modifiers Ex: "); 83 | builder.append(e.getModifiersEx()); 84 | 85 | return builder.toString(); 86 | } 87 | 88 | private void keyReleasedGUIInteraction() { 89 | if(guiInteractionLabel != null) { 90 | guiInteractionLabel.setText(""); 91 | } 92 | } 93 | 94 | public void setLink(Link link) { 95 | this.link = link; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/MailSender.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server; 20 | 21 | import static org.zu.ardulink.mail.server.ArdulinkMailConstants.MAIL_PASSWORD_KEY; 22 | import static org.zu.ardulink.mail.server.ArdulinkMailConstants.MAIL_USER_KEY; 23 | import static org.zu.ardulink.util.Preconditions.checkNotNull; 24 | 25 | import java.util.Properties; 26 | 27 | import javax.mail.Address; 28 | import javax.mail.Authenticator; 29 | import javax.mail.Message; 30 | import javax.mail.MessagingException; 31 | import javax.mail.PasswordAuthentication; 32 | import javax.mail.Session; 33 | import javax.mail.Transport; 34 | import javax.mail.internet.AddressException; 35 | import javax.mail.internet.InternetAddress; 36 | import javax.mail.internet.MimeMessage; 37 | 38 | /** 39 | * [ardulinktitle] [ardulinkversion] 40 | * 41 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 42 | * 43 | * [adsense] 44 | * 45 | */ 46 | public class MailSender { 47 | 48 | private static final Properties mailConfig = MailListener.getMailConfig(); 49 | private static final Session session = Session.getDefaultInstance( 50 | mailConfig, new Authenticator() { 51 | 52 | private final PasswordAuthentication passwordAuthentication = new PasswordAuthentication( 53 | getUser(), getPassword()); 54 | 55 | protected PasswordAuthentication getPasswordAuthentication() { 56 | return passwordAuthentication; 57 | } 58 | 59 | }); 60 | 61 | public static void sendMail(Address[] to, String subject, String body) 62 | throws AddressException, MessagingException { 63 | 64 | Message message = new MimeMessage(session); 65 | message.setFrom(new InternetAddress(getUser())); 66 | message.setRecipients(Message.RecipientType.TO, to); 67 | message.setSubject(subject); 68 | message.setText(body); 69 | 70 | Transport.send(message); 71 | } 72 | 73 | private static String getUser() { 74 | return getNonNull(MAIL_USER_KEY); 75 | } 76 | 77 | private static String getPassword() { 78 | // TODO Luciano what to return if unset? null? empty String? Throw RTE? 79 | // For RTE see #getUser() 80 | return mailConfig.getProperty(MAIL_PASSWORD_KEY); 81 | } 82 | 83 | private static String getNonNull(String key) { 84 | return checkNotNull(mailConfig.getProperty(key), "%s must not be null", 85 | key); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /Mqtt/test/com/github/pfichtner/ardulink/util/MqttMessageBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | package com.github.pfichtner.ardulink.util; 18 | 19 | import static java.lang.String.format; 20 | import static org.zu.ardulink.util.Preconditions.checkArgument; 21 | 22 | /** 23 | * [ardulinktitle] [ardulinkversion] 24 | * @author Peter Fichtner 25 | * 26 | * [adsense] 27 | */ 28 | public class MqttMessageBuilder { 29 | 30 | public enum Type { 31 | SET("set"), GET("get"); 32 | 33 | private final String name; 34 | 35 | private Type(String name) { 36 | this.name = name; 37 | } 38 | } 39 | 40 | private final StringBuilder topic; 41 | 42 | public static MqttMessageBuilder mqttMessageWithBasicTopic(String basicTopic) { 43 | return new MqttMessageBuilder(basicTopic); 44 | } 45 | 46 | private MqttMessageBuilder(String basicTopic) { 47 | this.topic = new StringBuilder(normalize(basicTopic)); 48 | } 49 | 50 | private static String normalize(String string) { 51 | return string.replaceAll("/$", ""); 52 | } 53 | 54 | public MqttMessageBuilder digitalPin(int pin) { 55 | return pin("D", pin); 56 | } 57 | 58 | public MqttMessageBuilder analogPin(int pin) { 59 | return pin("A", pin); 60 | } 61 | 62 | private MqttMessageBuilder pin(String type, int pin) { 63 | checkArgument(pin >= 0, "Pin must not be negative but was %s", pin); 64 | return appendTopic(type + pin); 65 | } 66 | 67 | public MqttMessageBuilder appendTopic(String subTopic) { 68 | return new MqttMessageBuilder(topic.toString() + '/' + subTopic); 69 | } 70 | 71 | public MqttMessageBuilder digitalListener(int pin) { 72 | return listener().digitalPin(pin); 73 | } 74 | 75 | public MqttMessageBuilder analogListener(int pin) { 76 | return listener().analogPin(pin); 77 | } 78 | 79 | public MqttMessageBuilder listener() { 80 | return appendTopic("system/listening/"); 81 | } 82 | 83 | public Message enable() { 84 | return setValue(true); 85 | } 86 | 87 | public Message disable() { 88 | return setValue(false); 89 | } 90 | 91 | public Message setValue(Object value) { 92 | return value(Type.SET, value); 93 | } 94 | 95 | public Message hasValue(Object value) { 96 | return value(Type.GET, value); 97 | } 98 | 99 | protected Message value(Type type, Object value) { 100 | return new Message(format("%s/value/%s", this.topic, type.name), 101 | mqttMessage(value)); 102 | } 103 | 104 | private String mqttMessage(Object message) { 105 | return String.valueOf(message); 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /Mqtt/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | ardulink-mqtt 5 | 6 | 7 | org.ardulink 8 | parent 9 | 0.6.2-SNAPSHOT 10 | 11 | 12 | 13 | 14 | 15 | Eclipse Paho Repo 16 | https://repo.eclipse.org/content/repositories/paho-releases/ 17 | 18 | 19 | 20 | bintray 21 | http://dl.bintray.com/andsel/maven/ 22 | 23 | 24 | 25 | 26 | src 27 | test 28 | 29 | 30 | org.apache.maven.plugins 31 | maven-jar-plugin 32 | 2.4 33 | 34 | 35 | 36 | true 37 | com.github.pfichtner.ardulink.MqttMain 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-javadoc-plugin 45 | 2.10.3 46 | 47 | public 48 | ${project.basedir}/../JavadocUtils/generated 49 | ardulink-mqtt 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | org.ardulink 58 | ardulink-core 59 | ${project.version} 60 | 61 | 62 | org.slf4j 63 | slf4j-api 64 | 65 | 66 | org.slf4j 67 | slf4j-jdk14 68 | runtime 69 | 70 | 71 | org.eclipse.paho 72 | mqtt-client 73 | 0.4.0 74 | 75 | 76 | args4j 77 | args4j 78 | 79 | 80 | junit 81 | junit 82 | test 83 | 84 | 85 | org.mockito 86 | mockito-all 87 | 1.9.0 88 | test 89 | 90 | 91 | org.dna.mqtt 92 | moquette-broker 93 | 0.6 94 | test 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ArdulinkMail/src/org/zu/ardulink/mail/server/links/configuration/utils/ConfigurationUtility.java: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2013 Luciano Zu project Ardulink http://www.ardulink.org/ 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | @author Luciano Zu 17 | */ 18 | 19 | package org.zu.ardulink.mail.server.links.configuration.utils; 20 | 21 | import java.lang.reflect.InvocationTargetException; 22 | import java.util.Iterator; 23 | import java.util.LinkedList; 24 | import java.util.List; 25 | import java.util.concurrent.TimeUnit; 26 | 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | import org.zu.ardulink.Link; 30 | import org.zu.ardulink.mail.server.links.configuration.ALink; 31 | import org.zu.ardulink.mail.server.links.configuration.AParameter; 32 | import org.zu.ardulink.mail.server.links.configuration.ConfigurationFacade; 33 | 34 | /** 35 | * [ardulinktitle] [ardulinkversion] 36 | * 37 | * @author Luciano Zu project Ardulink http://www.ardulink.org/ 38 | * 39 | * [adsense] 40 | * 41 | */ 42 | public class ConfigurationUtility { 43 | 44 | private static final Logger logger = LoggerFactory.getLogger(ConfigurationUtility.class); 45 | 46 | public static List getConnectedLinks(List aLinkNames) { 47 | List aLinks = ConfigurationFacade.getALinks(aLinkNames); 48 | List links = new LinkedList(); 49 | for (ALink aLink : aLinks) { 50 | Link link = aLink.getLink(); 51 | if(!link.isConnected()) { 52 | try { 53 | boolean isConnected = connect(aLink, link); 54 | if(isConnected) { 55 | links.add(link); 56 | } 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | logger.info("Connection failed."); 60 | } 61 | } else { 62 | links.add(link); 63 | } 64 | } 65 | return links; 66 | } 67 | 68 | public static boolean connect(ALink aLink, Link link) throws IllegalArgumentException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException { 69 | 70 | List connectParamenter = aLink.getConnectParameters(); 71 | Object[] params = new Object[connectParamenter.size()]; 72 | 73 | Iterator it = connectParamenter.iterator(); 74 | int index = 0; 75 | while (it.hasNext()) { 76 | AParameter aParameter = (AParameter) it.next(); 77 | params[index] = aParameter.getValueForClass(); 78 | index++; 79 | } 80 | boolean retvalue = link.connect(params); 81 | 82 | // wait for Arduino bootstrap 83 | try { 84 | TimeUnit.SECONDS.sleep(aLink.getWaitSecondsAfterConnection()); 85 | } catch (InterruptedException e) { 86 | e.printStackTrace(); 87 | } 88 | 89 | return retvalue; 90 | } 91 | 92 | } 93 | --------------------------------------------------------------------------------