Author: tchemit Date: 2014-01-30 22:52:42 +0100 (Thu, 30 Jan 2014) New Revision: 1560 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1560 Log: add some tools for bigfin debug Added: trunk/tutti-ichtyometer/src/main/assembly/ trunk/tutti-ichtyometer/src/main/assembly/README trunk/tutti-ichtyometer/src/main/assembly/build-checksum.bat trunk/tutti-ichtyometer/src/main/assembly/build-checksum.sh trunk/tutti-ichtyometer/src/main/assembly/feed-reader.bat trunk/tutti-ichtyometer/src/main/assembly/feed-reader.sh trunk/tutti-ichtyometer/src/main/assembly/log4j.properties trunk/tutti-ichtyometer/src/main/assembly/tools.xml trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/ trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/CRCBuilderTool.java trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/FeedReaderTool.java Modified: trunk/tutti-ichtyometer/pom.xml trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/feed/FeedReaderRecord.java Modified: trunk/tutti-ichtyometer/pom.xml =================================================================== --- trunk/tutti-ichtyometer/pom.xml 2014-01-30 19:15:37 UTC (rev 1559) +++ trunk/tutti-ichtyometer/pom.xml 2014-01-30 21:52:42 UTC (rev 1560) @@ -21,7 +21,8 @@ #L% --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -87,11 +88,57 @@ </dependencies> - <build> + <profiles> + <profile> + <id>tools</id> + <build> + <defaultGoal>package</defaultGoal> - <plugins> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>jar</id> + <goals> + <goal>assembly</goal> + </goals> + <phase>package</phase> + <configuration> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + <finalName>${project.build.finalName}-tools</finalName> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>zip</id> + <goals> + <goal>assembly</goal> + </goals> + <phase>package</phase> + <configuration> + <descriptor>src/main/assembly/tools.xml</descriptor> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> - </plugins> - </build> + <dependencies> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>runtime</scope> + </dependency> + + </dependencies> + </profile> + </profiles> + </project> Added: trunk/tutti-ichtyometer/src/main/assembly/README =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/README (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/README 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,29 @@ +Abstract +-------- + +Here is some little tools around Ichtyometer BigFin. + +You need to have java installed on your computer (at least java 7.0). + +build-checksum +-------------- + +Tool to compute some checksum + +To start, launch command + +build-checksum.bat (on windows OS) +build-checksum.sh (on linux OS) + +feed-mode +--------- + +Tool to listen records for the board + +To start, launch command + +feed-reader.bat (on windows OS) +feed-reader.sh (on linux OS) + + +Tony Chemit @copyright Code Lutin 2014 \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/README ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/build-checksum.bat =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/build-checksum.bat (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/build-checksum.bat 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1 @@ +java -cp ${project.build.finalName}-tools.${project.packaging} -Dlog4j.configuration=file://%CD%/log4j.properties fr.ifremer.tutti.ichtyometer.tool.CRCBuilderTool \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/build-checksum.bat ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/build-checksum.sh =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/build-checksum.sh (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/build-checksum.sh 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,2 @@ +#!/bin/sh +java -cp ${project.build.finalName}-tools.${project.packaging} -Dlog4j.configuration=file://$(pwd)/log4j.properties fr.ifremer.tutti.ichtyometer.tool.CRCBuilderTool \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/build-checksum.sh ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/feed-reader.bat =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/feed-reader.bat (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/feed-reader.bat 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1 @@ +java -cp ${project.build.finalName}-tools.${project.packaging} -Dlog4j.configuration=file://%CD%/log4j.properties fr.ifremer.tutti.ichtyometer.tool.FeadReaderTool \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/feed-reader.bat ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/feed-reader.sh =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/feed-reader.sh (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/feed-reader.sh 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,2 @@ +#!/bin/sh +java -cp ${project.build.finalName}-tools.${project.packaging} -Dlog4j.configuration=file://$(pwd)/log4j.properties fr.ifremer.tutti.ichtyometer.tool.FeadReaderTool \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/feed-reader.sh ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/log4j.properties =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/log4j.properties (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/log4j.properties 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,32 @@ +### +# #%L +# Tutti :: Ichtyometer API +# $Id$ +# $HeadURL:$ +# %% +# Copyright (C) 2012 - 2014 Ifremer +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### +log4j.rootCategory=INFO, A1 +log4j.appender.A1=org.apache.log4j.ConsoleAppender +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%d %-4r [%t] %-5p %c %x - %m%n + +log4j.logger.javax.bluetooth=DEBUG + +#Uncomment this for some debug informations +#log4j.logger.fr.ifremer.tutti.ichtyometer.feed=DEBUG \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/assembly/tools.xml =================================================================== --- trunk/tutti-ichtyometer/src/main/assembly/tools.xml (rev 0) +++ trunk/tutti-ichtyometer/src/main/assembly/tools.xml 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,60 @@ +<!-- + #%L + Tutti :: Ichtyometer API + $Id$ + $HeadURL:$ + %% + Copyright (C) 2012 - 2014 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>standalone</id> + <formats> + <format>zip</format> + </formats> + + <fileSets> + + <fileSet> + <directory>target</directory> + <outputDirectory/> + <includes> + <include>${project.build.finalName}-tools.${project.packaging}</include> + </includes> + </fileSet> + + <fileSet> + <directory>src/main/assembly</directory> + <outputDirectory/> + <filtered>true</filtered> + <fileMode>0755</fileMode> + <includes> + <include>*</include> + </includes> + </fileSet> + + <fileSet> + <includes> + <include>LICENSE*</include> + </includes> + </fileSet> + + </fileSets> +</assembly> \ No newline at end of file Property changes on: trunk/tutti-ichtyometer/src/main/assembly/tools.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/feed/FeedReaderRecord.java =================================================================== --- trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/feed/FeedReaderRecord.java 2014-01-30 19:15:37 UTC (rev 1559) +++ trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/feed/FeedReaderRecord.java 2014-01-30 21:52:42 UTC (rev 1560) @@ -107,7 +107,7 @@ .toString(); } - protected String computeCRC(String record) { + public static String computeCRC(String record) { // use long because int are signed and add doesn't work correctly long checksum = 0; Added: trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/CRCBuilderTool.java =================================================================== --- trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/CRCBuilderTool.java (rev 0) +++ trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/CRCBuilderTool.java 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,60 @@ +package fr.ifremer.tutti.ichtyometer.tool; + +/* + * #%L + * Tutti :: Ichtyometer API + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2012 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.ichtyometer.feed.FeedReaderRecord; + +import java.io.Console; +import java.io.PrintWriter; + +/** + * Created on 1/30/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 3.2 + */ +public class CRCBuilderTool { + + public static void main(String[] args) { + + Console console = System.console(); + PrintWriter writer = console.writer(); + writer.println("CRCBuilderTool: to build CRC code v1.0"); + + while (true) { + + writer.print("Enter new record (or q to quit): "); + writer.flush(); + String command = console.readLine(); + + if ("q".equals(command)) { + break; + } + + String crc = FeedReaderRecord.computeCRC(command); + writer.println("CRC= " + crc); + } + } +} Property changes on: trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/CRCBuilderTool.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/FeedReaderTool.java =================================================================== --- trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/FeedReaderTool.java (rev 0) +++ trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/FeedReaderTool.java 2014-01-30 21:52:42 UTC (rev 1560) @@ -0,0 +1,98 @@ +package fr.ifremer.tutti.ichtyometer.tool; + +/* + * #%L + * Tutti :: Ichtyometer API + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2012 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.common.collect.Lists; +import fr.ifremer.tutti.ichtyometer.IchtyometerClient; +import fr.ifremer.tutti.ichtyometer.RemoteDeviceChooser; +import fr.ifremer.tutti.ichtyometer.feed.FeedReader; +import fr.ifremer.tutti.ichtyometer.feed.FeedReaderEvent; +import fr.ifremer.tutti.ichtyometer.feed.FeedReaderListener; + +import java.io.Console; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.List; +import java.util.Set; + +/** + * Created on 1/30/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 3.2 + */ +public class FeedReaderTool { + + public static void main(String[] args) throws IOException { + + final PrintWriter writer = System.console().writer(); + writer.println("FeedReaderTool: to display record in feed mode v1.0"); + + RemoteDeviceChooser remoteDeviceChooser = new RemoteDeviceChooser() { + @Override + public String chooseRemoteDevice(Set<String> remoteDeviceNames) { + List<String> remoteDeviceNameList = Lists.newArrayList(remoteDeviceNames); + Console console = System.console(); + writer.println("Choose you device"); + int i = 0; + for (String remoteDeviceName : remoteDeviceNameList) { + writer.println(i++ + " for device " + remoteDeviceName); + } + writer.println("q (to quit)"); + String command = console.readLine(); + + if ("q".equals(command)) { + System.exit(0); + } + String deviceName = remoteDeviceNameList.get(Integer.valueOf(command)); + return deviceName; + } + }; + + IchtyometerClient client = new IchtyometerClient(); + + client.open(remoteDeviceChooser, true); + + FeedReader reader = new FeedReader(); + + writer.println("client " + client + " is open and listen the board"); + + FeedReaderListener listener = new FeedReaderListener() { + + @Override + public void recordRead(FeedReaderEvent event) { + + writer.println("New record: " + event.getRecord()); + } + }; + + reader.addFeedModeReaderListener(listener); + reader.start(client); + + while (true) { + + } + } +} Property changes on: trunk/tutti-ichtyometer/src/main/java/fr/ifremer/tutti/ichtyometer/tool/FeedReaderTool.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native