.classpath
.idea
.settings
+./jpinet.sh
--- /dev/null
+Installation of jpinet:
+
+unzip jpinet*.zip
+./install_jpinet.sh
+
--- /dev/null
+#! /bin/bash
+
+cp -v resources/pinet-*-jar-with-dependencies.jar \
+ resources/jpinet.sh \
+ /usr/local/bin
--- /dev/null
+#! /bin/bash
+
+FN=/tmp/jdoc.list
+FN2=/tmp/jdoc2.list
+PATTERN_SRC_JAR=pinet-*-sources.jar
+PATTERN_FULL_JAR=pinet-*-jar-with-dependencies.jar
+DIR_DOC=target/doc
+
+echo "mvn clean install..."
+mvn clean install -Dmaven.test.skip=true | tail -n 10
+echo "mvn assembly:single..."
+mvn assembly:single | tail -n 10
+
+function buildPath(){
+ BASE=$1
+ find -name "*.java" >$FN
+ while read line ; do
+ dir=$(dirname $line)
+ echo $dir >>$FN2
+ done <$FN
+ sort -u <$FN2 >$FN
+ while read line ; do
+ dir=$(echo $line | awk '{ print $1; };')
+ list="$list;$dir"
+ done < $FN
+ echo ${list:1}
+}
+
+rm -Rf $FN $FN2 $DIR_DOC
+mkdir -p $DIR_DOC
+CLASSES=$(buildPath target)
+find src/main/java -name "*.java" >$FN
+FULL_JAR=$(ls target/$PATTERN_FULL_JAR)
+set -x
+javadoc -cp $FULL_JAR -d target/doc @$FN
+set +x
+cd target
+zip -9r ../$PATTERN_SRC_JAR doc
+cd ..
--- /dev/null
+#! /bin/bash
+
+cp target/pinet-*-jar-with-dependencies.jar resources
+zip jpinet.zip resources/* install_jpinet.sh
+rm -f resources/pinet-*-jar-with-dependencies.jar
<name>Controlling a Raspberry Pi</name>
<url>https://sourcefourge.net</url>
-
+ <scm>
+ <connection>scm:git:git@git.hamatoma.de:repo/jpinet</connection>
+ <developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
+ <url>http://somerepository.com/view.cvs</url>
+ </scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<logback.version>1.1.7</logback.version>
- <slf4j.version>1.7.21</slf4j.version>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
+ <slf4j.version>1.5.6</slf4j.version>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
<dependencies>
<dependency>
<threadCount>4</threadCount>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <instrumentation>
+ <ignores>
+ <ignore>com.example.boringcode.*</ignore>
+ </ignores>
+ <excludes>
+ <exclude>com/example/dullcode/**/*.class</exclude>
+ <exclude>com/example/**/*Test.class</exclude>
+ </excludes>
+ </instrumentation>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<!-- Allows the example to be run via 'mvn compile exec:java' -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
- <mainClass>de.republlb.MainApp</mainClass>
+ <mainClass>de.republib.pinet.Client</mainClass>
<includePluginDependencies>false</includePluginDependencies>
</configuration>
</plugin>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>de.republib.pinet.Client</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <mainClass>de.republib.pinet.Client</mainClass>
+ </manifest>
+ </archive>
</configuration>
</plugin>
<plugin>
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.5.3</version>
+ <configuration>
+ <tagNameFormat>v@{project.version}</tagNameFormat>
+ </configuration>
+ </plugin>
</plugins>
</build>
<reporting>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ </plugin>
</plugins>
</reporting>
</project>
--- /dev/null
+#! /bin/bash
+set -x
+found=
+for dir in . /usr/bin /usr/local/bin target ; do
+ full=$(echo $dir/pinet*-with-dependencies.jar)
+ part=${full#$dir/pinet}
+ part=${part:0:1}
+ if [ $part != '*' ] ; then
+ found=$(ls -1 $dir/pinet*-with-dependencies.jar | tail -n 1)
+ break
+ fi
+done
+if [ -z "$found" ] ; then
+ echo "+++ missing pinet*-with-dependencies.jar"
+else
+ echo "starting $full..."
+ java -jar $full de.republib.pinet.Client
+fi
+
+
+
+
*
*/
public enum DataType {
- UNDEF, BOOLEAN, LONG, DOUBLE, STRING, OBJECT, VARIABLE
+ /**
+ * undefined type
+ */
+ UNDEF,
+ /**
+ * true or false
+ */
+ BOOLEAN,
+ /**
+ * 64 bit integer number
+ */
+ LONG,
+ /**
+ * 64 bit floating point number
+ */
+ DOUBLE,
+ /**
+ * a sequence of characters
+ */
+ STRING,
+ /**
+ * an object not defined closer
+ */
+ OBJECT,
+ /**
+ * an instance of the class <i>Variable</i>
+ */
+ VARIABLE,
}
package de.republib.expr;
+/**
+ * Enumerates operation codes used from a parser.
+ *
+ * @author hm
+ *
+ */
public enum OpCode {
UNDEF(0), ASSIGNMENT(1, false, true), //
PLUS(10, true), MINUS(10, true), //
/**
* Handles scanner and parser errors like "unknown token".
*
+ * The error message contains the position of the error.
+ *
* @author hm
*
*/
package de.republib.expr;
/**
+ * Enumerates the several types of tokens recognized from a scanner.
+ *
* @author hm
*
*/
public enum TokenType {
- UNDEF, INTEGER, OP, ID, STRING, SPACE, END_OF_STRING, UNKNOWN
+ UNDEF,
+ /**
+ * integer number.
+ */
+ INTEGER,
+ /**
+ * operator (unary or binary).
+ */
+ OP,
+ /**
+ * identificator (variable...).
+ */
+ ID,
+ /**
+ * Character sequences.
+ */
+ STRING,
+ /**
+ * a whitespace like blank, tabulator, newline...
+ */
+ SPACE,
+ /**
+ * end of input has been reached.
+ */
+ END_OF_STRING,
+ /**
+ * unknown token: error occurred.
+ */
+ UNKNOWN
}
* @param op
* unary operator to check
* @throws VariantException
+ * informs about a wrong data type
*/
protected void wrongDataType(Variant operand, OpCode op) throws VariantException {
throw new VariantException(String.format(I18N.tr("unexpected unary operation %s (not matching %s)"), op.name(),
* @param op2
* second operand
* @throws VariantException
+ * informs about a wrong data type
*/
protected void wrongDataType(Variant op1, OpCode op, Variant op2) throws VariantException {
throw new VariantException(String.format(I18N.tr("wrong operators (%s - %s) for operator %s"),
--- /dev/null
+/**
+ * Provides classes for a scanner and/or a parser.
+ *
+ * <p>
+ * Scanner:<br>
+ * A tool to divide a text (source code) into tokens (syntactical element).
+ * </p>
+ *
+ * <p>
+ * Parser:<br>
+ * A tool to analyse a programming language.
+ * </p>
+ *
+ * @author hm
+ *
+ */
+package de.republib.expr;
\ No newline at end of file
--- /dev/null
+/**
+ * Utilities for Graphical User Interface.
+ *
+ * @author hm
+ *
+ */
+package de.republib.gui;
\ No newline at end of file
--- /dev/null
+/**
+ * Utilities for IP communication, specially TCP.
+ *
+ * @author hm
+ *
+ */
+package de.republib.net;
\ No newline at end of file
final int high = this.comboHigh.getIntValue();
final int low = this.ComboLow.getIntValue();
if (this.center.reconnect()) {
- this.center.say(Announcer.LOG,
+ this.center.say(Announcer.INFO,
String.format(I18N.tr("blinking started on pin %d"), current.getPinNumber().getNumber()));
final DynBytes answer = client.blink(current.getPinNumber(), count, high, low);
if (answer.startsWith("OK")) {
- this.center.say(Announcer.LOG, String.format(I18N.tr("pin %d blinks %d times"),
+ this.center.say(Announcer.INFO, String.format(I18N.tr("pin %d blinks %d times"),
current.getPinNumber().getNumber(), count));
}
}
final int functionSteps = this.comboFunctionSteps.getIntValue();
final int count = this.comboCount.getIntValue();
if (this.center.reconnect()) {
- this.center.say(Announcer.LOG,
+ this.center.say(Announcer.INFO,
String.format(I18N.tr("PWM output: period: %d start: %f Mode: %s"), period, startValue, mode));
final DynBytes answer = client.pwmOutput(current.getPinNumber(), period, startValue, function,
functionSteps, count);
if (answer.startsWith("OK")) {
- this.center.say(Announcer.LOG, String.format(I18N.tr("pin %d puts pwm %d times"),
+ this.center.say(Announcer.INFO, String.format(I18N.tr("pin %d puts pwm %d times"),
current.getPinNumber().getNumber(), count));
}
}
--- /dev/null
+/**
+ *
+ */
+/**
+ * Utilities for Graphical User Interface only usable in the project pinet.
+ *
+ * @author hm
+ *
+ */
+package de.republib.pinet.gui;
\ No newline at end of file
--- /dev/null
+/**
+ * Utilities only usable in the project pinet.
+ *
+ * @author hm
+ *
+ */
+package de.republib.pinet;
\ No newline at end of file
package de.republib.util;
/**
+ * Handles the output to a medium.
+ *
* @author hm
*
*/
public interface Announcer {
+ /**
+ * Indicate an error.
+ *
+ * The program's flow is influenced usually. The user must be informed.
+ */
final int ERROR = 1;
+ /**
+ * Indicates a warning.
+ *
+ * The program's flow is not influenced usually. The user should be
+ * informed.
+ */
final int WARNING = 2;
- final int LOG = 3;
+ /**
+ * Indicates an info.
+ *
+ * The user should be informed.
+ */
+ final int INFO = 3;
+ /**
+ * Indicates an additional info used for debugging purpose.
+ */
final int DEBUG = 4;
+ /**
+ * Puts a message depending of the given level.
+ *
+ * @param level
+ * the type of the message: ERROR ... DEBUG
+ * @param message
+ * the message to display
+ */
void say(int level, String message);
}
import org.slf4j.LoggerFactory;
/**
+ * A data container usable for curves.
+ *
+ * Data are specified by a x range (minimum and maximum) and an array of y
+ * values.
+ *
+ * The number of x steps is given by the number of elements in the y array.
+ *
+ * The y data are integer. The <b>data width</b> can be defined between 1 and 8
+ * bytes per value.
+ *
* @author hm
*
*/
package de.republib.util;
/**
+ * Utilities for curve data: a set of (x, y) pairs.
+ *
+ * This class contains only static methods.
+ *
* @author hm
*
*/
--- /dev/null
+/**
+ * Generally usable utility classes.
+ *
+ * @author hm
+ *
+ */
+package de.republib.util;
\ No newline at end of file