Subversion Repositories Code-Repo

Rev

Blame | Last modification | View Log | RSS feed

package ioio.debugger.server;

import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;

public class Main {

        /**
         * @param args
         */
        public static void main(String[] args) {
                
                /** Dont Change **/
                // Initialize and start the server
                IOIODebuggerServer server = new IOIODebuggerServer(8080);
                // Setup the message handler class
                IOIODebuggerServerHandler msgHandler = server.getPipeline().getUpstreamHandler();
                final ServerHelper msgHelper = new ServerHelper(msgHandler);
                msgHandler.setServerHelper(msgHelper);
                /** Dont Change **/
                
                
                
                
                /** Initialize the GUI here **/
                // I would suggest you pass msgHelper into your GUI so you can call its functions
                
                /** Initialize the GUI here **/
                
                
                
                
                /** Test/Example Code **/
                try {
                        while (true) {
                                byte[] b = new byte[100];
                                System.in.read(b);
                                msgHelper.sendAddNewAnalogIn(40, 5000);
                                System.in.read(b);
                                msgHelper.sendAddNewAnalogIn(41, 5000);
                                System.in.read(b);
                                msgHelper.sendAddNewDigitalIn(20, 5000, "Float");
                                System.in.read(b);
                                msgHelper.sendAddNewDigitalIn(21, 5000, "Pull Up");
                                System.in.read(b);
                                msgHelper.sendAddNewDigitalIn(22, 5000, "Pull Down");
                                System.in.read(b);
                                msgHelper.sendAddNewDigitalOut(1, "Low", true);
                                System.in.read(b);
                                msgHelper.sendAddNewDigitalOut(2, "High", false);
                                System.in.read(b);
                                msgHelper.sendHardReset();
                        }
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                /** Test/Example Code **/
                
        }

}