* removed old (ant and launch4j) build files
* switched from log4j to slf4j
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
subprojects {
|
subprojects {
|
||||||
|
version = '0.1'
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
|
apply plugin: 'cpp-lib'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -8,9 +11,4 @@ subprojects {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
version = '0.1'
|
|
||||||
|
|
||||||
jar {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,17 @@
|
|||||||
import java.util.jar.JarEntry;
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'eclipse'
|
|
||||||
apply plugin: 'cpp-lib'
|
|
||||||
|
|
||||||
version = '0.1'
|
|
||||||
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
targetCompatibility = 1.6
|
|
||||||
|
|
||||||
def mainClass = 'mimis.Main'
|
def mainClass = 'mimis.Main'
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':itunescontroller')
|
compile project(':itunescontroller')
|
||||||
compile project(':wiiusej')
|
compile project(':wiiusej')
|
||||||
compile project(':wiigee')
|
compile project(':wiigee')
|
||||||
|
|
||||||
compile 'commons-collections:commons-collections:3.+'
|
//compile files('lib/jxinput.jar')
|
||||||
compile 'commons-logging:commons-logging:1.+'
|
|
||||||
compile 'log4j:log4j:1.2.17'
|
|
||||||
compile 'com.melloware:jintellitype:1.3.7'
|
|
||||||
|
|
||||||
compile fileTree(dir: 'lib', include: '*.jar')
|
compile fileTree(dir: 'lib', include: '*.jar')
|
||||||
|
|
||||||
|
compile 'commons-collections:commons-collections:3.+'
|
||||||
|
compile 'org.slf4j:slf4j-api:1.+'
|
||||||
|
compile 'org.slf4j:slf4j-log4j12:1.7.5'
|
||||||
|
compile 'com.melloware:jintellitype:1.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<project default="jar" name="Build file for Project Mimis">
|
|
||||||
<!-- All -->
|
|
||||||
<target name="all" depends="javadoc, jar, launch4j"></target>
|
|
||||||
|
|
||||||
<!-- Javadoc -->
|
|
||||||
<target name="javadoc">
|
|
||||||
<javadoc access="private" author="true" classpath="cfg;resource;lib/log4j-1.2.16.jar;lib/jxinput.jar;lib/commons-logging-1.1.1.jar;lib/jacob-1.15-M3.jar" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="mimis.exception.macro,mimis.device.network,wiiusej,mimis.application.itunes,mimis.exception.util,mimis.device.javainput,wiiusej.wiiusejevents,wiiusej.wiiusejevents.utils,mimis.util.swing,mimis.exception.worker,mimis.application.lirc,mimis.application.cmd.windows.winamp,wiiusej.values,mimis.exception.event,mimis.device.lirc.remote,mimis.device.panel,mimis.exception.device,mimis.exception.button,mimis.application.robot,mimis.application.lirc.ipod,mimis.exception.task.action,mimis.exception.application,wiiusej.wiiusejevents.wiiuseapievents,mimis.application.cmd.windows.gomplayer,mimis.application.mpc,org.wiigee.logic,mimis.device.lirc,mimis.sequence,mimis.manager,org.wiigee.util,mimis.event,mimis.application.cmd.windows.wmp,mimis.value,mimis.device.javainput.extreme3d,mimis.event.router,mimis.application.cmd,mimis.worker,org.wiigee.event,mimis.device.wiimote,mimis.device.wiimote.gesture.event,wiiusej.wiiusejevents.physicalevents,mimis.util.multiplexer,mimis,org.wiigee.control,mimis.exception.device.javainput,mimis.util,mimis.application.cmd.windows,com.dt.iTunesController,org.wiigee.device,mimis.application.vlc,mimis.device.wiimote.gesture,mimis.device.jintellitype,mimis.event.feedback,mimis.device,org.wiigee.filter,mimis.exception.application.windows,mimis.application,mimis.sequence.state,mimis.device.javainput.rumblepad,com.melloware.jintellitype,mimis.exception.event.router,mimis.exception.task,mimis.exception" source="1.6" sourcepath="src" splitindex="true" use="true" version="true" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Jar -->
|
|
||||||
<target name="jar">
|
|
||||||
<property name="jar.dir" value="." />
|
|
||||||
<jar destfile="${jar.dir}/main.jar" filesetmanifest="mergewithoutmain">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="mimis.Main" />
|
|
||||||
<attribute name="Class-Path" value="." />
|
|
||||||
</manifest>
|
|
||||||
<fileset dir="bin" />
|
|
||||||
<fileset dir="resource" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/commons-logging-1.1.1.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/log4j-1.2.16.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/jacob-1.15-M3.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/jxinput.jar" />
|
|
||||||
<fileset dir="cfg" />
|
|
||||||
</jar>
|
|
||||||
<jar destfile="${jar.dir}/client.jar" filesetmanifest="mergewithoutmain">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="mimis.Client" />
|
|
||||||
<attribute name="Class-Path" value="." />
|
|
||||||
</manifest>
|
|
||||||
<fileset dir="bin" />
|
|
||||||
<fileset dir="resource" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/commons-logging-1.1.1.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/log4j-1.2.16.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/jacob-1.15-M3.jar" />
|
|
||||||
<zipfileset excludes="META-INF/*.SF" src="lib/jxinput.jar" />
|
|
||||||
<fileset dir="cfg" />
|
|
||||||
</jar>
|
|
||||||
<copy todir="${jar.dir}">
|
|
||||||
<fileset dir=".">
|
|
||||||
<include name="*.dll" />
|
|
||||||
<include name="*.exe" />
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!-- Launch4j -->
|
|
||||||
<target name="launch4j" depends="jar">
|
|
||||||
<property name="launch4j.dir" location="C:\Program Files (x86)\Launch4j" />
|
|
||||||
<path id="launch4j">
|
|
||||||
<pathelement location="${launch4j.dir}/launch4j.jar" />
|
|
||||||
<pathelement location="${launch4j.dir}/lib/xstream.jar" />
|
|
||||||
</path>
|
|
||||||
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask">
|
|
||||||
<classpath refid="launch4j" />
|
|
||||||
</taskdef>
|
|
||||||
<launch4j configFile="launch4j.xml" />
|
|
||||||
<delete file="launch4j.log" />
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
|||||||
<launch4jConfig>
|
|
||||||
<dontWrapJar>false</dontWrapJar>
|
|
||||||
<headerType>gui</headerType>
|
|
||||||
<jar>main.jar</jar>
|
|
||||||
<outfile>mimis.exe</outfile>
|
|
||||||
<errTitle>Mimis</errTitle>
|
|
||||||
<cmdLine></cmdLine>
|
|
||||||
<chdir></chdir>
|
|
||||||
<priority>normal</priority>
|
|
||||||
<downloadUrl>http://java.com/download</downloadUrl>
|
|
||||||
<supportUrl></supportUrl>
|
|
||||||
<customProcName>true</customProcName>
|
|
||||||
<stayAlive>false</stayAlive>
|
|
||||||
<manifest></manifest>
|
|
||||||
<icon>resource\M.ico</icon>
|
|
||||||
<jre>
|
|
||||||
<path></path>
|
|
||||||
<minVersion>1.6.0</minVersion>
|
|
||||||
<maxVersion></maxVersion>
|
|
||||||
<jdkPreference>preferJre</jdkPreference>
|
|
||||||
</jre>
|
|
||||||
</launch4jConfig>
|
|
||||||
Binary file not shown.
@@ -28,7 +28,7 @@ public class Gui extends Component {
|
|||||||
protected static final long serialVersionUID = 1L;
|
protected static final long serialVersionUID = 1L;
|
||||||
protected void processWindowEvent(WindowEvent event) {
|
protected void processWindowEvent(WindowEvent event) {
|
||||||
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
|
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
|
||||||
log.debug("Window closing");
|
logger.debug("Window closing");
|
||||||
component.exit();
|
component.exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class Main extends Mimis {
|
|||||||
protected void deactivate() throws DeactivateException {
|
protected void deactivate() throws DeactivateException {
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
|
|
||||||
log.debug("Stop managers");
|
logger.debug("Stop managers");
|
||||||
applicationManager.stop();
|
applicationManager.stop();
|
||||||
deviceManager.stop();
|
deviceManager.stop();
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ public class Main extends Mimis {
|
|||||||
public void exit() {
|
public void exit() {
|
||||||
super.exit();
|
super.exit();
|
||||||
|
|
||||||
log.debug("Exit managers");
|
logger.debug("Exit managers");
|
||||||
applicationManager.exit();
|
applicationManager.exit();
|
||||||
deviceManager.exit();
|
deviceManager.exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ public abstract class Mimis extends Component {
|
|||||||
route(new Feedback("Current component: " + componentCycle.current().getTitle()));
|
route(new Feedback("Current component: " + componentCycle.current().getTitle()));
|
||||||
break;
|
break;
|
||||||
case NEXT:
|
case NEXT:
|
||||||
log.debug("Next component");
|
logger.debug("Next component");
|
||||||
route(new Feedback("Next component: " + componentCycle.next().getTitle()));
|
route(new Feedback("Next component: " + componentCycle.next().getTitle()));
|
||||||
break;
|
break;
|
||||||
case PREVIOUS:
|
case PREVIOUS:
|
||||||
log.debug("Previous component");
|
logger.debug("Previous component");
|
||||||
route(new Feedback("Previous component: " + componentCycle.previous().getTitle()));
|
route(new Feedback("Previous component: " + componentCycle.previous().getTitle()));
|
||||||
break;
|
break;
|
||||||
case EXIT:
|
case EXIT:
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public abstract class CMDApplication extends Component implements Application {
|
|||||||
command = replaceVariables(command);
|
command = replaceVariables(command);
|
||||||
process = Runtime.getRuntime().exec(command);
|
process = Runtime.getRuntime().exec(command);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error(e.getMessage());
|
||||||
throw new ActivateException();
|
throw new ActivateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("GomPlayerApplication begin: " + action);
|
logger.trace("GomPlayerApplication begin: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
volumeWorker.start();
|
volumeWorker.start();
|
||||||
@@ -61,7 +61,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("GomPlayerApplication end: " + action);
|
logger.trace("GomPlayerApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command(0x800C);
|
command(0x800C);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class PhotoViewerApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("PhotoViewerApplication end: " + action);
|
logger.trace("PhotoViewerApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
case VOLUME_DOWN:
|
case VOLUME_DOWN:
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class WinampApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("WinampApplication begin: " + action);
|
logger.trace("WinampApplication begin: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
volumeWorker.start(1);
|
volumeWorker.start(1);
|
||||||
@@ -80,10 +80,10 @@ public class WinampApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("WinampApplication end: " + action);
|
logger.trace("WinampApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
log.debug("play");
|
logger.debug("play");
|
||||||
switch (user(0, IPC_ISPLAYING)) {
|
switch (user(0, IPC_ISPLAYING)) {
|
||||||
case STATUS_STOPPED:
|
case STATUS_STOPPED:
|
||||||
command(WINAMP_BUTTON2);
|
command(WINAMP_BUTTON2);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class WMPApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("WMPApplication begin: " + action);
|
logger.trace("WMPApplication begin: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command(18808);
|
command(18808);
|
||||||
@@ -55,7 +55,7 @@ public class WMPApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("WMPApplication end: " + action);
|
logger.trace("WMPApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case FORWARD:
|
case FORWARD:
|
||||||
command(18813);
|
command(18813);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
|||||||
try {
|
try {
|
||||||
iTunes.release();
|
iTunes.release();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
throw new DeactivateException();
|
throw new DeactivateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void begin(Action action) {
|
protected void begin(Action action) {
|
||||||
log.trace("iTunesApplication begin: " + action);
|
logger.trace("iTunesApplication begin: " + action);
|
||||||
if (!active) return;
|
if (!active) return;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case FORWARD:
|
case FORWARD:
|
||||||
@@ -97,7 +97,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void end(Action action) {
|
protected void end(Action action) {
|
||||||
log.trace("iTunesApplication end: " + action);
|
logger.trace("iTunesApplication end: " + action);
|
||||||
if (!active) return;
|
if (!active) return;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
@@ -144,13 +144,13 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
|||||||
public void onDatabaseChangedEvent(int[][] deletedObjectIDs, int[][] changedObjectIDs) {}
|
public void onDatabaseChangedEvent(int[][] deletedObjectIDs, int[][] changedObjectIDs) {}
|
||||||
public void onPlayerPlayEvent(ITTrack iTrack) {
|
public void onPlayerPlayEvent(ITTrack iTrack) {
|
||||||
if (active) {
|
if (active) {
|
||||||
log.trace("iTunesEvent: play");
|
logger.trace("iTunesEvent: play");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerStopEvent(ITTrack iTrack) {
|
public void onPlayerStopEvent(ITTrack iTrack) {
|
||||||
if (active) {
|
if (active) {
|
||||||
log.trace("iTunesEvent: stop");
|
logger.trace("iTunesEvent: stop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,28 +29,28 @@ public class iPodApplication extends LircApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void begin(Action action) {
|
protected void begin(Action action) {
|
||||||
log.trace("iPodApplication begin: " + action);
|
logger.trace("iPodApplication begin: " + action);
|
||||||
if (!active) return;
|
if (!active) return;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
try {
|
try {
|
||||||
volumeWorker.activate(1);
|
volumeWorker.activate(1);
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VOLUME_DOWN:
|
case VOLUME_DOWN:
|
||||||
try {
|
try {
|
||||||
volumeWorker.activate(-1);
|
volumeWorker.activate(-1);
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void end(Action action) {
|
protected void end(Action action) {
|
||||||
log.trace("iPodApplication end: " + action);
|
logger.trace("iPodApplication end: " + action);
|
||||||
if (!active) return;
|
if (!active) return;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class MPCApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("MPCApplication: " + action);
|
logger.trace("MPCApplication: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case FORWARD:
|
case FORWARD:
|
||||||
seekWorker.start(1);
|
seekWorker.start(1);
|
||||||
@@ -40,7 +40,7 @@ public class MPCApplication extends WindowsApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("MPCApplication: " + action);
|
logger.trace("MPCApplication: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command(889);
|
command(889);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class RobotApplication extends Component {
|
|||||||
robot = new Robot();
|
robot = new Robot();
|
||||||
robot.setAutoWaitForIdle(true);
|
robot.setAutoWaitForIdle(true);
|
||||||
} catch (AWTException e) {
|
} catch (AWTException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
throw new ActivateException();
|
throw new ActivateException();
|
||||||
}
|
}
|
||||||
super.activate();
|
super.activate();
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ public class VLCApplication extends CMDApplication {
|
|||||||
URL url = new URL(request);
|
URL url = new URL(request);
|
||||||
HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
|
||||||
int response = httpUrlConnection.getResponseCode();
|
int response = httpUrlConnection.getResponseCode();
|
||||||
log.trace("Response: " + response);
|
logger.trace("Response: " + response);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public class VLCApplication extends CMDApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
log.trace("VLCApplication begin: " + action);
|
logger.trace("VLCApplication begin: " + action);
|
||||||
try {
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VOLUME_UP:
|
case VOLUME_UP:
|
||||||
@@ -94,12 +94,12 @@ public class VLCApplication extends CMDApplication {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
log.trace("VLCApplication end: " + action);
|
logger.trace("VLCApplication end: " + action);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
command("pl_pause");
|
command("pl_pause");
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public abstract class JavaInputDevice extends Component implements Device {
|
|||||||
super.activate();
|
super.activate();
|
||||||
try {
|
try {
|
||||||
JXInputDevice jxinputDevice = getDevice(name);
|
JXInputDevice jxinputDevice = getDevice(name);
|
||||||
log.debug(jxinputDevice);
|
logger.debug(jxinputDevice.getName());
|
||||||
javaInputListener = new JavaInputListener(this, jxinputDevice);
|
javaInputListener = new JavaInputListener(this, jxinputDevice);
|
||||||
} catch (DeviceNotFoundException e) {
|
} catch (DeviceNotFoundException e) {
|
||||||
active = false;
|
active = false;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class JIntellitypeDevice extends Component implements Device, HotkeyListe
|
|||||||
route(new Press(commandButton));
|
route(new Press(commandButton));
|
||||||
route(new Release(commandButton));
|
route(new Release(commandButton));
|
||||||
} catch (UnknownButtonException e) {
|
} catch (UnknownButtonException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ public class LircDevice extends CMDApplication implements Device, LircButtonList
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void deactivate() throws DeactivateException {
|
protected void deactivate() throws DeactivateException {
|
||||||
log.debug("Deactivate LircDevice");
|
logger.debug("Deactivate LircDevice");
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
lircService.stop();
|
lircService.stop();
|
||||||
multiplexer.stop();
|
multiplexer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exit() {
|
public void exit() {
|
||||||
log.debug("Exit LircDevice");
|
logger.debug("Exit LircDevice");
|
||||||
super.exit();
|
super.exit();
|
||||||
lircService.exit();
|
lircService.exit();
|
||||||
multiplexer.exit();
|
multiplexer.exit();
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class LircService extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate() throws ActivateException {
|
public void activate() throws ActivateException {
|
||||||
log.trace("Activate LircService");
|
logger.trace("Activate LircService");
|
||||||
try {
|
try {
|
||||||
socket = new Socket(ip, port);
|
socket = new Socket(ip, port);
|
||||||
socket.setSoTimeout(SLEEP);
|
socket.setSoTimeout(SLEEP);
|
||||||
@@ -73,10 +73,10 @@ public class LircService extends Worker {
|
|||||||
outputStream = socket.getOutputStream();
|
outputStream = socket.getOutputStream();
|
||||||
printWriter = new PrintWriter(outputStream);
|
printWriter = new PrintWriter(outputStream);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
throw new ActivateException();
|
throw new ActivateException();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
throw new ActivateException();
|
throw new ActivateException();
|
||||||
}
|
}
|
||||||
super.activate();
|
super.activate();
|
||||||
@@ -90,14 +90,14 @@ public class LircService extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deactivate() throws DeactivateException {
|
public void deactivate() throws DeactivateException {
|
||||||
log.trace("Deactivate LircService");
|
logger.trace("Deactivate LircService");
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
try {
|
try {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +114,11 @@ public class LircService extends Worker {
|
|||||||
lircbuttonListener.add(lircButton);
|
lircbuttonListener.add(lircButton);
|
||||||
}
|
}
|
||||||
} catch (UnknownButtonException e) {
|
} catch (UnknownButtonException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ public class LircService extends Worker {
|
|||||||
scanner.next();
|
scanner.next();
|
||||||
String code = scanner.next();
|
String code = scanner.next();
|
||||||
String remote = scanner.next();
|
String remote = scanner.next();
|
||||||
log.trace(String.format("%s: %s", remote, code));
|
logger.trace(String.format("%s: %s", remote, code));
|
||||||
LircButton[] buttonArray = buttonMap.get(remote);
|
LircButton[] buttonArray = buttonMap.get(remote);
|
||||||
if (buttonArray != null) {
|
if (buttonArray != null) {
|
||||||
for (LircButton button : buttonArray) {
|
for (LircButton button : buttonArray) {
|
||||||
@@ -138,9 +138,9 @@ public class LircService extends Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InputMismatchException e) {
|
} catch (InputMismatchException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
throw new UnknownButtonException();
|
throw new UnknownButtonException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class NetworkDevice extends Component implements Device {
|
|||||||
route(new Feedback("[NetworkDevice] Closing server socket"));
|
route(new Feedback("[NetworkDevice] Closing server socket"));
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
for (Client client : clientList) {
|
for (Client client : clientList) {
|
||||||
client.stop();
|
client.stop();
|
||||||
@@ -114,7 +114,7 @@ public class NetworkDevice extends Component implements Device {
|
|||||||
client.start();
|
client.start();
|
||||||
route(new Feedback("[NetworkDevice] Client connected: " + socket.getInetAddress()));
|
route(new Feedback("[NetworkDevice] Client connected: " + socket.getInetAddress()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,15 +152,15 @@ public class NetworkDevice extends Component implements Device {
|
|||||||
do {
|
do {
|
||||||
object = objectInputStream.readObject();
|
object = objectInputStream.readObject();
|
||||||
if (object instanceof Input) {
|
if (object instanceof Input) {
|
||||||
log.trace(object);
|
logger.trace("", object);
|
||||||
route((Input) object);
|
route((Input) object);
|
||||||
}
|
}
|
||||||
} while (object != null);
|
} while (object != null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
stop();
|
stop();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public class NetworkDevice extends Component implements Device {
|
|||||||
outputStream.close();
|
outputStream.close();
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
route(new Feedback("[NetworkDevice] Client disconnected: " + socket.getInetAddress()));
|
route(new Feedback("[NetworkDevice] Client disconnected: " + socket.getInetAddress()));
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ public class NetworkDevice extends Component implements Device {
|
|||||||
try {
|
try {
|
||||||
objectOutputStream.writeObject(object);
|
objectOutputStream.writeObject(object);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
try {
|
try {
|
||||||
connect();
|
connect();
|
||||||
} catch (DeviceNotFoundException e) {
|
} catch (DeviceNotFoundException e) {
|
||||||
log.warn(e);
|
logger.warn("", e);
|
||||||
}
|
}
|
||||||
super.activate();
|
super.activate();
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
try {
|
try {
|
||||||
wait(CONNECTED_TIMEOUT);
|
wait(CONNECTED_TIMEOUT);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
try {
|
try {
|
||||||
@@ -121,37 +121,37 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
public void begin(Action action) {
|
public void begin(Action action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case SHIFT:
|
case SHIFT:
|
||||||
log.debug("Shift");
|
logger.debug("Shift");
|
||||||
parser(Action.RESET, taskMapCycle.player);
|
parser(Action.RESET, taskMapCycle.player);
|
||||||
parser(Action.ADD, taskMapCycle.mimis);
|
parser(Action.ADD, taskMapCycle.mimis);
|
||||||
parser(Action.ADD, taskMapCycle.like);
|
parser(Action.ADD, taskMapCycle.like);
|
||||||
break;
|
break;
|
||||||
case UNSHIFT:
|
case UNSHIFT:
|
||||||
log.debug("Unshift");
|
logger.debug("Unshift");
|
||||||
parser(Action.RESET, taskMapCycle.mimis);
|
parser(Action.RESET, taskMapCycle.mimis);
|
||||||
parser(Action.RESET, taskMapCycle.like);
|
parser(Action.RESET, taskMapCycle.like);
|
||||||
parser(Action.ADD, taskMapCycle.player);
|
parser(Action.ADD, taskMapCycle.player);
|
||||||
break;
|
break;
|
||||||
case RECOGNIZE:
|
case RECOGNIZE:
|
||||||
log.debug("Gesture recognize press");
|
logger.debug("Gesture recognize press");
|
||||||
gestureDevice.recognize(Signal.BEGIN);
|
gestureDevice.recognize(Signal.BEGIN);
|
||||||
break;
|
break;
|
||||||
case TRAIN:
|
case TRAIN:
|
||||||
log.debug("Gesture train press");
|
logger.debug("Gesture train press");
|
||||||
gestureDevice.train(Signal.BEGIN);
|
gestureDevice.train(Signal.BEGIN);
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
log.debug("Gesture close press");
|
logger.debug("Gesture close press");
|
||||||
gestureDevice.close(Signal.BEGIN);
|
gestureDevice.close(Signal.BEGIN);
|
||||||
break;
|
break;
|
||||||
case SAVE:
|
case SAVE:
|
||||||
log.debug("Gesture save");
|
logger.debug("Gesture save");
|
||||||
gestureDevice.close(Signal.END);
|
gestureDevice.close(Signal.END);
|
||||||
gestureDevice.saveGesture(gestureId, "tmp/gesture #" + gestureId);
|
gestureDevice.saveGesture(gestureId, "tmp/gesture #" + gestureId);
|
||||||
++gestureId;
|
++gestureId;
|
||||||
break;
|
break;
|
||||||
case LOAD:
|
case LOAD:
|
||||||
log.debug("Gesture load");
|
logger.debug("Gesture load");
|
||||||
for (int i = 0; i < gestureId; ++i) {
|
for (int i = 0; i < gestureId; ++i) {
|
||||||
gestureDevice.loadGesture("tmp/gesture #" + gestureId);
|
gestureDevice.loadGesture("tmp/gesture #" + gestureId);
|
||||||
}
|
}
|
||||||
@@ -162,15 +162,15 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
public void end(Action action) {
|
public void end(Action action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case RECOGNIZE:
|
case RECOGNIZE:
|
||||||
log.debug("Gesture recognize release");
|
logger.debug("Gesture recognize release");
|
||||||
gestureDevice.recognize(Signal.END);
|
gestureDevice.recognize(Signal.END);
|
||||||
break;
|
break;
|
||||||
case TRAIN:
|
case TRAIN:
|
||||||
log.debug("Gesture train release");
|
logger.debug("Gesture train release");
|
||||||
gestureDevice.train(Signal.END);
|
gestureDevice.train(Signal.END);
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
log.debug("Gesture close release");
|
logger.debug("Gesture close release");
|
||||||
gestureDevice.close(Signal.END);
|
gestureDevice.close(Signal.END);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
|
|
||||||
public void feedback(Feedback feedback) {
|
public void feedback(Feedback feedback) {
|
||||||
if (wiimote != null && active()) {
|
if (wiimote != null && active()) {
|
||||||
log.debug("Wiimote rumble feedback");
|
logger.debug("Wiimote rumble feedback");
|
||||||
wiimote.rumble(RUMBLE);
|
wiimote.rumble(RUMBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,11 +201,11 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
try {
|
try {
|
||||||
if (pressed != 0 && released == 0) {
|
if (pressed != 0 && released == 0) {
|
||||||
Button button = WiimoteButton.create(pressed);
|
Button button = WiimoteButton.create(pressed);
|
||||||
log.trace("Press: " + button);
|
logger.trace("Press: " + button);
|
||||||
route(new Press(button));
|
route(new Press(button));
|
||||||
} else if (pressed == 0 && released != 0) {
|
} else if (pressed == 0 && released != 0) {
|
||||||
Button button = WiimoteButton.create(released);
|
Button button = WiimoteButton.create(released);
|
||||||
log.trace("Release: " + button);
|
logger.trace("Release: " + button);
|
||||||
route(new Release(button));
|
route(new Release(button));
|
||||||
}
|
}
|
||||||
} catch (UnknownButtonException e) {}
|
} catch (UnknownButtonException e) {}
|
||||||
@@ -224,7 +224,6 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void gestureReceived(GestureEvent event) {
|
public void gestureReceived(GestureEvent event) {
|
||||||
log.debug(event.isValid());
|
|
||||||
if (event.isValid()) {
|
if (event.isValid()) {
|
||||||
System.out.printf("id #%d, prob %.0f%%, valid %b\n", event.getId(), 100 * event.getProbability(), event.isValid());
|
System.out.printf("id #%d, prob %.0f%%, valid %b\n", event.getId(), 100 * event.getProbability(), event.isValid());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ public class WiimoteDiscovery extends Worker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean connect() {
|
protected boolean connect() {
|
||||||
log.debug("Connect");
|
logger.debug("Connect");
|
||||||
return execute("-c nintendo"); // Nintendo RVL-CNT-01 RVL-WBC-01
|
return execute("-c nintendo"); // Nintendo RVL-CNT-01 RVL-WBC-01
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean disconnect() {
|
protected boolean disconnect() {
|
||||||
log.debug("Disconnect");
|
logger.debug("Disconnect");
|
||||||
return execute("-d nintendo");
|
return execute("-d nintendo");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ public class WiimoteDiscovery extends Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
process = null;
|
process = null;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public class WiimoteDiscovery extends Worker {
|
|||||||
disconnect = false;
|
disconnect = false;
|
||||||
}
|
}
|
||||||
if (connect()) {
|
if (connect()) {
|
||||||
log.debug("Connected");
|
logger.debug("Connected");
|
||||||
try {
|
try {
|
||||||
sleep(TIMEOUT);
|
sleep(TIMEOUT);
|
||||||
wiimoteDevice.connect();
|
wiimoteDevice.connect();
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class MotionDevice extends Component {
|
|||||||
public void release(Button button) {
|
public void release(Button button) {
|
||||||
if (button instanceof LircButton) {
|
if (button instanceof LircButton) {
|
||||||
PhiliphsRCLE011Button lircButton = (PhiliphsRCLE011Button) button;
|
PhiliphsRCLE011Button lircButton = (PhiliphsRCLE011Button) button;
|
||||||
log.debug(lircButton);
|
logger.debug(lircButton.getName());
|
||||||
switch (lircButton) {
|
switch (lircButton) {
|
||||||
case CLOCK:
|
case CLOCK:
|
||||||
action = Action.TRAIN;
|
action = Action.TRAIN;
|
||||||
@@ -84,24 +84,24 @@ public class MotionDevice extends Component {
|
|||||||
if (replay == false) {
|
if (replay == false) {
|
||||||
release(ColorButton.YELLOW);
|
release(ColorButton.YELLOW);
|
||||||
} else {
|
} else {
|
||||||
log.debug("Set file to #" + id);
|
logger.debug("Set file to #" + id);
|
||||||
}
|
}
|
||||||
} else if (button instanceof ColorButton) {
|
} else if (button instanceof ColorButton) {
|
||||||
ColorButton colorButton = (ColorButton) button;
|
ColorButton colorButton = (ColorButton) button;
|
||||||
log.debug(colorButton.name());
|
logger.debug(colorButton.name());
|
||||||
synchronized (motionList) {
|
synchronized (motionList) {
|
||||||
switch (colorButton) {
|
switch (colorButton) {
|
||||||
case GREEN:
|
case GREEN:
|
||||||
log.debug("Start capturing motion");
|
logger.debug("Start capturing motion");
|
||||||
motionList.clear();
|
motionList.clear();
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
break;
|
break;
|
||||||
case RED:
|
case RED:
|
||||||
if (replayWorker.active()) {
|
if (replayWorker.active()) {
|
||||||
log.debug("Stop replaying motion");
|
logger.debug("Stop replaying motion");
|
||||||
replayWorker.stop();
|
replayWorker.stop();
|
||||||
} else {
|
} else {
|
||||||
log.debug("Writing motion to file #" + id);
|
logger.debug("Writing motion to file #" + id);
|
||||||
try {
|
try {
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(String.format("tmp/motion #%d.bin", id));
|
FileOutputStream fileOutputStream = new FileOutputStream(String.format("tmp/motion #%d.bin", id));
|
||||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
|
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
|
||||||
@@ -111,14 +111,14 @@ public class MotionDevice extends Component {
|
|||||||
}
|
}
|
||||||
objectOutputStream.close();
|
objectOutputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
motionList.clear();
|
motionList.clear();
|
||||||
start = -1;
|
start = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YELLOW:
|
case YELLOW:
|
||||||
log.debug("Replaying motion from file #" + id);
|
logger.debug("Replaying motion from file #" + id);
|
||||||
replay = true;
|
replay = true;
|
||||||
replayWorker.start();
|
replayWorker.start();
|
||||||
break;
|
break;
|
||||||
@@ -149,22 +149,22 @@ public class MotionDevice extends Component {
|
|||||||
super.activate();
|
super.activate();
|
||||||
return;
|
return;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void deactivate() throws DeactivateException {
|
protected void deactivate() throws DeactivateException {
|
||||||
log.debug(String.format("Replay stopped (%d ms)", time));
|
logger.debug(String.format("Replay stopped (%d ms)", time));
|
||||||
wiimoteDevice.end(action);
|
wiimoteDevice.end(action);
|
||||||
replay = false;
|
replay = false;
|
||||||
try {
|
try {
|
||||||
objectInputStream.close();
|
objectInputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.debug(e);
|
logger.debug("", e);
|
||||||
}
|
}
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
}
|
}
|
||||||
@@ -178,9 +178,9 @@ public class MotionDevice extends Component {
|
|||||||
time = motionData.getTime();
|
time = motionData.getTime();
|
||||||
return;
|
return;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class Parser extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void input(ParserInput parserInput) {
|
public void input(ParserInput parserInput) {
|
||||||
log.trace("input(ParserInput)");
|
logger.trace("input(ParserInput)");
|
||||||
Action action = parserInput.getAction();
|
Action action = parserInput.getAction();
|
||||||
try {
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@@ -57,7 +57,7 @@ public class Parser extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
log.error("Illegal use of ParserInput");
|
logger.error("Illegal use of ParserInput");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class Parser extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void add(TaskMap taskMap) {
|
protected void add(TaskMap taskMap) {
|
||||||
log.trace("add(TaskMap)");
|
logger.trace("add(TaskMap)");
|
||||||
this.taskMap.putAll(taskMap);
|
this.taskMap.putAll(taskMap);
|
||||||
sequenceList.addAll(taskMap.keySet());
|
sequenceList.addAll(taskMap.keySet());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class GlobalRouter extends Router {
|
|||||||
try {
|
try {
|
||||||
client = new Client(ip, port);
|
client = new Client(ip, port);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
throw new ActivateException();
|
throw new ActivateException();
|
||||||
}
|
}
|
||||||
super.activate();
|
super.activate();
|
||||||
@@ -40,7 +40,7 @@ public class GlobalRouter extends Router {
|
|||||||
try {
|
try {
|
||||||
client.send(task);
|
client.send(task);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,9 +65,9 @@ public class GlobalRouter extends Router {
|
|||||||
}
|
}
|
||||||
} while (object != null);
|
} while (object != null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class GlobalRouter extends Router {
|
|||||||
objectOutputStream.close();
|
objectOutputStream.close();
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class Ir extends WiimoteDevice implements LircButtonListener {
|
|||||||
public void onIrEvent(IREvent event) {
|
public void onIrEvent(IREvent event) {
|
||||||
// log.debug(event);
|
// log.debug(event);
|
||||||
raw = new Point(event.getAx(), event.getAy());
|
raw = new Point(event.getAx(), event.getAy());
|
||||||
log.debug(String.format("%d %d", raw.x, raw.y));
|
logger.debug(String.format("%d %d", raw.x, raw.y));
|
||||||
if (t != null && r != null && b != null && l != null) {
|
if (t != null && r != null && b != null && l != null) {
|
||||||
double w = r.getX(raw.y) - l.getX(raw.y);
|
double w = r.getX(raw.y) - l.getX(raw.y);
|
||||||
double h = t.getY(raw.x) - b.getY(raw.x);
|
double h = t.getY(raw.x) - b.getY(raw.x);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public abstract class Component extends Listener<Input> {
|
|||||||
|
|
||||||
public void listen(Class<? extends Input> clazz) {
|
public void listen(Class<? extends Input> clazz) {
|
||||||
if (router == null) {
|
if (router == null) {
|
||||||
log.error("Router not set");
|
logger.error("Router not set");
|
||||||
} else {
|
} else {
|
||||||
router.listen(this, clazz);
|
router.listen(this, clazz);
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public abstract class Component extends Listener<Input> {
|
|||||||
|
|
||||||
public void ignore(Class<? extends Input> clazz) {
|
public void ignore(Class<? extends Input> clazz) {
|
||||||
if (router == null) {
|
if (router == null) {
|
||||||
log.error("Router not set");
|
logger.error("Router not set");
|
||||||
} else {
|
} else {
|
||||||
router.ignore(this, clazz);
|
router.ignore(this, clazz);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public abstract class Component extends Listener<Input> {
|
|||||||
|
|
||||||
public void route(Input input) {
|
public void route(Input input) {
|
||||||
if (router == null) {
|
if (router == null) {
|
||||||
log.error("Router not set");
|
logger.error("Router not set");
|
||||||
} else {
|
} else {
|
||||||
if (input instanceof State) {
|
if (input instanceof State) {
|
||||||
State state = (State) input;
|
State state = (State) input;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class IntervalWorker extends Worker {
|
|||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.info(e);
|
logger.info("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ public class IntervalWorker extends Worker {
|
|||||||
try {
|
try {
|
||||||
super.activate();
|
super.activate();
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
activate = false;
|
activate = false;
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ public class IntervalWorker extends Worker {
|
|||||||
try {
|
try {
|
||||||
super.deactivate();
|
super.deactivate();
|
||||||
} catch (DeactivateException e) {
|
} catch (DeactivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
deactivate = false;
|
deactivate = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public abstract class Listener<E> extends Worker {
|
|||||||
try {
|
try {
|
||||||
wait();
|
wait();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.info(e);
|
logger.info("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package mimis.worker;
|
|||||||
import mimis.exception.worker.ActivateException;
|
import mimis.exception.worker.ActivateException;
|
||||||
import mimis.exception.worker.DeactivateException;
|
import mimis.exception.worker.DeactivateException;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public abstract class Worker implements Runnable {
|
public abstract class Worker implements Runnable {
|
||||||
protected Log log = LogFactory.getLog(getClass());
|
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
protected static final boolean THREAD = true;
|
protected static final boolean THREAD = true;
|
||||||
protected static final int SLEEP = 100;
|
protected static final int SLEEP = 100;
|
||||||
@@ -33,10 +33,10 @@ public abstract class Worker implements Runnable {
|
|||||||
if (!run) {
|
if (!run) {
|
||||||
run = true;
|
run = true;
|
||||||
if (thread) {
|
if (thread) {
|
||||||
log.debug("Start thread");
|
logger.debug("Start thread");
|
||||||
new Thread(this, getClass().getName()).start();
|
new Thread(this, getClass().getName()).start();
|
||||||
} else {
|
} else {
|
||||||
log.debug("Run directly");
|
logger.debug("Run directly");
|
||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -66,7 +66,7 @@ public abstract class Worker implements Runnable {
|
|||||||
Thread.sleep(time);
|
Thread.sleep(time);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.info(e);
|
logger.info("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ public abstract class Worker implements Runnable {
|
|||||||
try {
|
try {
|
||||||
activate();
|
activate();
|
||||||
} catch (ActivateException e) {
|
} catch (ActivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
activate = false;
|
activate = false;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ public abstract class Worker implements Runnable {
|
|||||||
try {
|
try {
|
||||||
deactivate();
|
deactivate();
|
||||||
} catch (DeactivateException e) {
|
} catch (DeactivateException e) {
|
||||||
log.error(e);
|
logger.error("", e);
|
||||||
} finally {
|
} finally {
|
||||||
deactivate = false;
|
deactivate = false;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ public abstract class Worker implements Runnable {
|
|||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.info(e);
|
logger.info("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
dependencies {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user