* removed old (ant and launch4j) build files
* switched from log4j to slf4j
This commit is contained in:
@@ -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'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':itunescontroller')
|
||||
compile project(':wiiusej')
|
||||
compile project(':wiigee')
|
||||
|
||||
compile 'commons-collections:commons-collections:3.+'
|
||||
compile 'commons-logging:commons-logging:1.+'
|
||||
compile 'log4j:log4j:1.2.17'
|
||||
compile 'com.melloware:jintellitype:1.3.7'
|
||||
|
||||
//compile files('lib/jxinput.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 {
|
||||
|
||||
@@ -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 void processWindowEvent(WindowEvent event) {
|
||||
if (event.getID() == WindowEvent.WINDOW_CLOSING) {
|
||||
log.debug("Window closing");
|
||||
logger.debug("Window closing");
|
||||
component.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Main extends Mimis {
|
||||
protected void deactivate() throws DeactivateException {
|
||||
super.deactivate();
|
||||
|
||||
log.debug("Stop managers");
|
||||
logger.debug("Stop managers");
|
||||
applicationManager.stop();
|
||||
deviceManager.stop();
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class Main extends Mimis {
|
||||
public void exit() {
|
||||
super.exit();
|
||||
|
||||
log.debug("Exit managers");
|
||||
logger.debug("Exit managers");
|
||||
applicationManager.exit();
|
||||
deviceManager.exit();
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ public abstract class Mimis extends Component {
|
||||
route(new Feedback("Current component: " + componentCycle.current().getTitle()));
|
||||
break;
|
||||
case NEXT:
|
||||
log.debug("Next component");
|
||||
logger.debug("Next component");
|
||||
route(new Feedback("Next component: " + componentCycle.next().getTitle()));
|
||||
break;
|
||||
case PREVIOUS:
|
||||
log.debug("Previous component");
|
||||
logger.debug("Previous component");
|
||||
route(new Feedback("Previous component: " + componentCycle.previous().getTitle()));
|
||||
break;
|
||||
case EXIT:
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class CMDApplication extends Component implements Application {
|
||||
command = replaceVariables(command);
|
||||
process = Runtime.getRuntime().exec(command);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error(e.getMessage());
|
||||
throw new ActivateException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void begin(Action action) {
|
||||
log.trace("GomPlayerApplication begin: " + action);
|
||||
logger.trace("GomPlayerApplication begin: " + action);
|
||||
switch (action) {
|
||||
case VOLUME_UP:
|
||||
volumeWorker.start();
|
||||
@@ -61,7 +61,7 @@ public class GomPlayerApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("GomPlayerApplication end: " + action);
|
||||
logger.trace("GomPlayerApplication end: " + action);
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
command(0x800C);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PhotoViewerApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("PhotoViewerApplication end: " + action);
|
||||
logger.trace("PhotoViewerApplication end: " + action);
|
||||
switch (action) {
|
||||
case VOLUME_UP:
|
||||
case VOLUME_DOWN:
|
||||
|
||||
@@ -62,7 +62,7 @@ public class WinampApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void begin(Action action) {
|
||||
log.trace("WinampApplication begin: " + action);
|
||||
logger.trace("WinampApplication begin: " + action);
|
||||
switch (action) {
|
||||
case VOLUME_UP:
|
||||
volumeWorker.start(1);
|
||||
@@ -80,10 +80,10 @@ public class WinampApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("WinampApplication end: " + action);
|
||||
logger.trace("WinampApplication end: " + action);
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
log.debug("play");
|
||||
logger.debug("play");
|
||||
switch (user(0, IPC_ISPLAYING)) {
|
||||
case STATUS_STOPPED:
|
||||
command(WINAMP_BUTTON2);
|
||||
|
||||
@@ -19,7 +19,7 @@ public class WMPApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void begin(Action action) {
|
||||
log.trace("WMPApplication begin: " + action);
|
||||
logger.trace("WMPApplication begin: " + action);
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
command(18808);
|
||||
@@ -55,7 +55,7 @@ public class WMPApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("WMPApplication end: " + action);
|
||||
logger.trace("WMPApplication end: " + action);
|
||||
switch (action) {
|
||||
case FORWARD:
|
||||
command(18813);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
||||
try {
|
||||
iTunes.release();
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
throw new DeactivateException();
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
||||
}
|
||||
|
||||
protected void begin(Action action) {
|
||||
log.trace("iTunesApplication begin: " + action);
|
||||
logger.trace("iTunesApplication begin: " + action);
|
||||
if (!active) return;
|
||||
switch (action) {
|
||||
case FORWARD:
|
||||
@@ -97,7 +97,7 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
||||
}
|
||||
|
||||
protected void end(Action action) {
|
||||
log.trace("iTunesApplication end: " + action);
|
||||
logger.trace("iTunesApplication end: " + action);
|
||||
if (!active) return;
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
@@ -144,13 +144,13 @@ public class iTunesApplication extends Component implements Application, iTunesE
|
||||
public void onDatabaseChangedEvent(int[][] deletedObjectIDs, int[][] changedObjectIDs) {}
|
||||
public void onPlayerPlayEvent(ITTrack iTrack) {
|
||||
if (active) {
|
||||
log.trace("iTunesEvent: play");
|
||||
logger.trace("iTunesEvent: play");
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerStopEvent(ITTrack iTrack) {
|
||||
if (active) {
|
||||
log.trace("iTunesEvent: stop");
|
||||
logger.trace("iTunesEvent: stop");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,28 +29,28 @@ public class iPodApplication extends LircApplication {
|
||||
}
|
||||
|
||||
protected void begin(Action action) {
|
||||
log.trace("iPodApplication begin: " + action);
|
||||
logger.trace("iPodApplication begin: " + action);
|
||||
if (!active) return;
|
||||
switch (action) {
|
||||
case VOLUME_UP:
|
||||
try {
|
||||
volumeWorker.activate(1);
|
||||
} catch (ActivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
break;
|
||||
case VOLUME_DOWN:
|
||||
try {
|
||||
volumeWorker.activate(-1);
|
||||
} catch (ActivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void end(Action action) {
|
||||
log.trace("iPodApplication end: " + action);
|
||||
logger.trace("iPodApplication end: " + action);
|
||||
if (!active) return;
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MPCApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void begin(Action action) {
|
||||
log.trace("MPCApplication: " + action);
|
||||
logger.trace("MPCApplication: " + action);
|
||||
switch (action) {
|
||||
case FORWARD:
|
||||
seekWorker.start(1);
|
||||
@@ -40,7 +40,7 @@ public class MPCApplication extends WindowsApplication {
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("MPCApplication: " + action);
|
||||
logger.trace("MPCApplication: " + action);
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
command(889);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class RobotApplication extends Component {
|
||||
robot = new Robot();
|
||||
robot.setAutoWaitForIdle(true);
|
||||
} catch (AWTException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
}
|
||||
super.activate();
|
||||
|
||||
@@ -55,11 +55,11 @@ public class VLCApplication extends CMDApplication {
|
||||
URL url = new URL(request);
|
||||
HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
|
||||
int response = httpUrlConnection.getResponseCode();
|
||||
log.trace("Response: " + response);
|
||||
logger.trace("Response: " + response);
|
||||
} catch (MalformedURLException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class VLCApplication extends CMDApplication {
|
||||
}
|
||||
|
||||
public void begin(Action action) {
|
||||
log.trace("VLCApplication begin: " + action);
|
||||
logger.trace("VLCApplication begin: " + action);
|
||||
try {
|
||||
switch (action) {
|
||||
case VOLUME_UP:
|
||||
@@ -94,12 +94,12 @@ public class VLCApplication extends CMDApplication {
|
||||
break;
|
||||
}
|
||||
} catch (ActivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void end(Action action) {
|
||||
log.trace("VLCApplication end: " + action);
|
||||
logger.trace("VLCApplication end: " + action);
|
||||
switch (action) {
|
||||
case PLAY:
|
||||
command("pl_pause");
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class JavaInputDevice extends Component implements Device {
|
||||
super.activate();
|
||||
try {
|
||||
JXInputDevice jxinputDevice = getDevice(name);
|
||||
log.debug(jxinputDevice);
|
||||
logger.debug(jxinputDevice.getName());
|
||||
javaInputListener = new JavaInputListener(this, jxinputDevice);
|
||||
} catch (DeviceNotFoundException e) {
|
||||
active = false;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JIntellitypeDevice extends Component implements Device, HotkeyListe
|
||||
route(new Press(commandButton));
|
||||
route(new Release(commandButton));
|
||||
} 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 {
|
||||
log.debug("Deactivate LircDevice");
|
||||
logger.debug("Deactivate LircDevice");
|
||||
super.deactivate();
|
||||
lircService.stop();
|
||||
multiplexer.stop();
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
log.debug("Exit LircDevice");
|
||||
logger.debug("Exit LircDevice");
|
||||
super.exit();
|
||||
lircService.exit();
|
||||
multiplexer.exit();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class LircService extends Worker {
|
||||
}
|
||||
|
||||
public void activate() throws ActivateException {
|
||||
log.trace("Activate LircService");
|
||||
logger.trace("Activate LircService");
|
||||
try {
|
||||
socket = new Socket(ip, port);
|
||||
socket.setSoTimeout(SLEEP);
|
||||
@@ -73,10 +73,10 @@ public class LircService extends Worker {
|
||||
outputStream = socket.getOutputStream();
|
||||
printWriter = new PrintWriter(outputStream);
|
||||
} catch (UnknownHostException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
}
|
||||
super.activate();
|
||||
@@ -90,14 +90,14 @@ public class LircService extends Worker {
|
||||
}
|
||||
|
||||
public void deactivate() throws DeactivateException {
|
||||
log.trace("Deactivate LircService");
|
||||
logger.trace("Deactivate LircService");
|
||||
super.deactivate();
|
||||
try {
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ public class LircService extends Worker {
|
||||
lircbuttonListener.add(lircButton);
|
||||
}
|
||||
} catch (UnknownButtonException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
} catch (SocketTimeoutException e) {
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class LircService extends Worker {
|
||||
scanner.next();
|
||||
String code = 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);
|
||||
if (buttonArray != null) {
|
||||
for (LircButton button : buttonArray) {
|
||||
@@ -138,9 +138,9 @@ public class LircService extends Worker {
|
||||
}
|
||||
}
|
||||
} catch (InputMismatchException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (NoSuchElementException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
throw new UnknownButtonException();
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
route(new Feedback("[NetworkDevice] Closing server socket"));
|
||||
serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
for (Client client : clientList) {
|
||||
client.stop();
|
||||
@@ -114,7 +114,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
client.start();
|
||||
route(new Feedback("[NetworkDevice] Client connected: " + socket.getInetAddress()));
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,15 +152,15 @@ public class NetworkDevice extends Component implements Device {
|
||||
do {
|
||||
object = objectInputStream.readObject();
|
||||
if (object instanceof Input) {
|
||||
log.trace(object);
|
||||
logger.trace("", object);
|
||||
route((Input) object);
|
||||
}
|
||||
} while (object != null);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
stop();
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
outputStream.close();
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
route(new Feedback("[NetworkDevice] Client disconnected: " + socket.getInetAddress()));
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class NetworkDevice extends Component implements Device {
|
||||
try {
|
||||
objectOutputStream.writeObject(object);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
try {
|
||||
connect();
|
||||
} catch (DeviceNotFoundException e) {
|
||||
log.warn(e);
|
||||
logger.warn("", e);
|
||||
}
|
||||
super.activate();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
try {
|
||||
wait(CONNECTED_TIMEOUT);
|
||||
} catch (InterruptedException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
if (!connected) {
|
||||
try {
|
||||
@@ -121,37 +121,37 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
public void begin(Action action) {
|
||||
switch (action) {
|
||||
case SHIFT:
|
||||
log.debug("Shift");
|
||||
logger.debug("Shift");
|
||||
parser(Action.RESET, taskMapCycle.player);
|
||||
parser(Action.ADD, taskMapCycle.mimis);
|
||||
parser(Action.ADD, taskMapCycle.like);
|
||||
break;
|
||||
case UNSHIFT:
|
||||
log.debug("Unshift");
|
||||
logger.debug("Unshift");
|
||||
parser(Action.RESET, taskMapCycle.mimis);
|
||||
parser(Action.RESET, taskMapCycle.like);
|
||||
parser(Action.ADD, taskMapCycle.player);
|
||||
break;
|
||||
case RECOGNIZE:
|
||||
log.debug("Gesture recognize press");
|
||||
logger.debug("Gesture recognize press");
|
||||
gestureDevice.recognize(Signal.BEGIN);
|
||||
break;
|
||||
case TRAIN:
|
||||
log.debug("Gesture train press");
|
||||
logger.debug("Gesture train press");
|
||||
gestureDevice.train(Signal.BEGIN);
|
||||
break;
|
||||
case CLOSE:
|
||||
log.debug("Gesture close press");
|
||||
logger.debug("Gesture close press");
|
||||
gestureDevice.close(Signal.BEGIN);
|
||||
break;
|
||||
case SAVE:
|
||||
log.debug("Gesture save");
|
||||
logger.debug("Gesture save");
|
||||
gestureDevice.close(Signal.END);
|
||||
gestureDevice.saveGesture(gestureId, "tmp/gesture #" + gestureId);
|
||||
++gestureId;
|
||||
break;
|
||||
case LOAD:
|
||||
log.debug("Gesture load");
|
||||
logger.debug("Gesture load");
|
||||
for (int i = 0; i < gestureId; ++i) {
|
||||
gestureDevice.loadGesture("tmp/gesture #" + gestureId);
|
||||
}
|
||||
@@ -162,15 +162,15 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
public void end(Action action) {
|
||||
switch (action) {
|
||||
case RECOGNIZE:
|
||||
log.debug("Gesture recognize release");
|
||||
logger.debug("Gesture recognize release");
|
||||
gestureDevice.recognize(Signal.END);
|
||||
break;
|
||||
case TRAIN:
|
||||
log.debug("Gesture train release");
|
||||
logger.debug("Gesture train release");
|
||||
gestureDevice.train(Signal.END);
|
||||
break;
|
||||
case CLOSE:
|
||||
log.debug("Gesture close release");
|
||||
logger.debug("Gesture close release");
|
||||
gestureDevice.close(Signal.END);
|
||||
break;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
|
||||
public void feedback(Feedback feedback) {
|
||||
if (wiimote != null && active()) {
|
||||
log.debug("Wiimote rumble feedback");
|
||||
logger.debug("Wiimote rumble feedback");
|
||||
wiimote.rumble(RUMBLE);
|
||||
}
|
||||
}
|
||||
@@ -201,11 +201,11 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
try {
|
||||
if (pressed != 0 && released == 0) {
|
||||
Button button = WiimoteButton.create(pressed);
|
||||
log.trace("Press: " + button);
|
||||
logger.trace("Press: " + button);
|
||||
route(new Press(button));
|
||||
} else if (pressed == 0 && released != 0) {
|
||||
Button button = WiimoteButton.create(released);
|
||||
log.trace("Release: " + button);
|
||||
logger.trace("Release: " + button);
|
||||
route(new Release(button));
|
||||
}
|
||||
} catch (UnknownButtonException e) {}
|
||||
@@ -224,7 +224,6 @@ public class WiimoteDevice extends Component implements Device, GestureListener
|
||||
}
|
||||
|
||||
public void gestureReceived(GestureEvent event) {
|
||||
log.debug(event.isValid());
|
||||
if (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() {
|
||||
log.debug("Connect");
|
||||
logger.debug("Connect");
|
||||
return execute("-c nintendo"); // Nintendo RVL-CNT-01 RVL-WBC-01
|
||||
}
|
||||
|
||||
protected boolean disconnect() {
|
||||
log.debug("Disconnect");
|
||||
logger.debug("Disconnect");
|
||||
return execute("-d nintendo");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class WiimoteDiscovery extends Worker {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
process = null;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class WiimoteDiscovery extends Worker {
|
||||
disconnect = false;
|
||||
}
|
||||
if (connect()) {
|
||||
log.debug("Connected");
|
||||
logger.debug("Connected");
|
||||
try {
|
||||
sleep(TIMEOUT);
|
||||
wiimoteDevice.connect();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class MotionDevice extends Component {
|
||||
public void release(Button button) {
|
||||
if (button instanceof LircButton) {
|
||||
PhiliphsRCLE011Button lircButton = (PhiliphsRCLE011Button) button;
|
||||
log.debug(lircButton);
|
||||
logger.debug(lircButton.getName());
|
||||
switch (lircButton) {
|
||||
case CLOCK:
|
||||
action = Action.TRAIN;
|
||||
@@ -84,24 +84,24 @@ public class MotionDevice extends Component {
|
||||
if (replay == false) {
|
||||
release(ColorButton.YELLOW);
|
||||
} else {
|
||||
log.debug("Set file to #" + id);
|
||||
logger.debug("Set file to #" + id);
|
||||
}
|
||||
} else if (button instanceof ColorButton) {
|
||||
ColorButton colorButton = (ColorButton) button;
|
||||
log.debug(colorButton.name());
|
||||
logger.debug(colorButton.name());
|
||||
synchronized (motionList) {
|
||||
switch (colorButton) {
|
||||
case GREEN:
|
||||
log.debug("Start capturing motion");
|
||||
logger.debug("Start capturing motion");
|
||||
motionList.clear();
|
||||
start = System.currentTimeMillis();
|
||||
break;
|
||||
case RED:
|
||||
if (replayWorker.active()) {
|
||||
log.debug("Stop replaying motion");
|
||||
logger.debug("Stop replaying motion");
|
||||
replayWorker.stop();
|
||||
} else {
|
||||
log.debug("Writing motion to file #" + id);
|
||||
logger.debug("Writing motion to file #" + id);
|
||||
try {
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(String.format("tmp/motion #%d.bin", id));
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
|
||||
@@ -111,14 +111,14 @@ public class MotionDevice extends Component {
|
||||
}
|
||||
objectOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
motionList.clear();
|
||||
start = -1;
|
||||
}
|
||||
break;
|
||||
case YELLOW:
|
||||
log.debug("Replaying motion from file #" + id);
|
||||
logger.debug("Replaying motion from file #" + id);
|
||||
replay = true;
|
||||
replayWorker.start();
|
||||
break;
|
||||
@@ -149,22 +149,22 @@ public class MotionDevice extends Component {
|
||||
super.activate();
|
||||
return;
|
||||
} catch (FileNotFoundException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
replay = false;
|
||||
try {
|
||||
objectInputStream.close();
|
||||
} catch (IOException e) {
|
||||
log.debug(e);
|
||||
logger.debug("", e);
|
||||
}
|
||||
super.deactivate();
|
||||
}
|
||||
@@ -178,9 +178,9 @@ public class MotionDevice extends Component {
|
||||
time = motionData.getTime();
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
stop();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Parser extends Component {
|
||||
}
|
||||
|
||||
public void input(ParserInput parserInput) {
|
||||
log.trace("input(ParserInput)");
|
||||
logger.trace("input(ParserInput)");
|
||||
Action action = parserInput.getAction();
|
||||
try {
|
||||
switch (action) {
|
||||
@@ -57,7 +57,7 @@ public class Parser extends Component {
|
||||
return;
|
||||
}
|
||||
} 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) {
|
||||
log.trace("add(TaskMap)");
|
||||
logger.trace("add(TaskMap)");
|
||||
this.taskMap.putAll(taskMap);
|
||||
sequenceList.addAll(taskMap.keySet());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class GlobalRouter extends Router {
|
||||
try {
|
||||
client = new Client(ip, port);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
throw new ActivateException();
|
||||
}
|
||||
super.activate();
|
||||
@@ -40,7 +40,7 @@ public class GlobalRouter extends Router {
|
||||
try {
|
||||
client.send(task);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class GlobalRouter extends Router {
|
||||
}
|
||||
} while (object != null);
|
||||
} catch (IOException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class GlobalRouter extends Router {
|
||||
objectOutputStream.close();
|
||||
socket.close();
|
||||
} 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) {
|
||||
// log.debug(event);
|
||||
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) {
|
||||
double w = r.getX(raw.y) - l.getX(raw.y);
|
||||
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) {
|
||||
if (router == null) {
|
||||
log.error("Router not set");
|
||||
logger.error("Router not set");
|
||||
} else {
|
||||
router.listen(this, clazz);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public abstract class Component extends Listener<Input> {
|
||||
|
||||
public void ignore(Class<? extends Input> clazz) {
|
||||
if (router == null) {
|
||||
log.error("Router not set");
|
||||
logger.error("Router not set");
|
||||
} else {
|
||||
router.ignore(this, clazz);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public abstract class Component extends Listener<Input> {
|
||||
|
||||
public void route(Input input) {
|
||||
if (router == null) {
|
||||
log.error("Router not set");
|
||||
logger.error("Router not set");
|
||||
} else {
|
||||
if (input instanceof State) {
|
||||
State state = (State) input;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class IntervalWorker extends Worker {
|
||||
wait();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.info(e);
|
||||
logger.info("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class IntervalWorker extends Worker {
|
||||
try {
|
||||
super.activate();
|
||||
} catch (ActivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
activate = false;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class IntervalWorker extends Worker {
|
||||
try {
|
||||
super.deactivate();
|
||||
} catch (DeactivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
deactivate = false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class Listener<E> extends Worker {
|
||||
try {
|
||||
wait();
|
||||
} 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.DeactivateException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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 int SLEEP = 100;
|
||||
@@ -33,10 +33,10 @@ public abstract class Worker implements Runnable {
|
||||
if (!run) {
|
||||
run = true;
|
||||
if (thread) {
|
||||
log.debug("Start thread");
|
||||
logger.debug("Start thread");
|
||||
new Thread(this, getClass().getName()).start();
|
||||
} else {
|
||||
log.debug("Run directly");
|
||||
logger.debug("Run directly");
|
||||
run();
|
||||
}
|
||||
} else {
|
||||
@@ -66,7 +66,7 @@ public abstract class Worker implements Runnable {
|
||||
Thread.sleep(time);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.info(e);
|
||||
logger.info("", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class Worker implements Runnable {
|
||||
try {
|
||||
activate();
|
||||
} catch (ActivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
activate = false;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public abstract class Worker implements Runnable {
|
||||
try {
|
||||
deactivate();
|
||||
} catch (DeactivateException e) {
|
||||
log.error(e);
|
||||
logger.error("", e);
|
||||
} finally {
|
||||
deactivate = false;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public abstract class Worker implements Runnable {
|
||||
wait();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.info(e);
|
||||
logger.info("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user