This one is probably a little over the top ;-)

package demo;

import icommand.platform.nxt.FileSystem;
import icommand.platform.nxt.Speaker;

import java.io.File;

public class Demo implements NXTable {

        private static final String SOUND_FILE = "Hello.rso";
                
        public static void main(String[] args) {
                Demo demo = new Demo();
                new NXTMind(demo).storm();
        }

        public void nxt() {
                
                File myFile = new File(SOUND_FILE);
                byte status = FileSystem.upload(myFile);
                if (status != 0) {
                        return;
                }

                Speaker.playSoundFile(SOUND_FILE);
        }
}

-----------------------------------------------------------------------

package demo;


public interface NXTable {
        
        public void nxt();
        
}
--------------------------------------------------------------------------

package demo;

import icommand.nxtcomm.NXTCommand;

public class NXTMind {

        private NXTable exe;
        
        public NXTMind(NXTable exe) {
                this.exe = exe;
                init();
        }

        public void storm() {
                exe.nxt();      
        }
        
        private void init() {
                System.out.println("Adding ShutdownHook ...");
                ShutdownHook shutdownHook = new ShutdownHook();
                Runtime.getRuntime().addShutdownHook(shutdownHook);
        }
        

        private class ShutdownHook extends Thread {
                public void run() {
                        System.out.println("Closing BT Connection to NXT ...");
                        NXTCommand.close();

                }
        }
}

Greetings,
Peter Joosten.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion

Reply via email to