package com.endovectors.uta.hardware;

import com.endovectors.uta.centralcontroller.MasterController;
import com.endovectors.uta.presentation.button.ButtonStatesEnum;
import com.endovectors.uta.processing.MoveInterface;

import java.util.ArrayList;
import java.util.Observable;

/**
 * Created by asham_000 on 7/20/2015.
 */
public class HardwareRequestHandler extends Observable implements Runnable, HardwareRequestHandlerInterface {

    UsbComm usbComm;
    MasterController masterController;
    ArrayList<MoveInterface> moves;

    public HardwareRequestHandler (MasterController masterController){
        usbComm = new UsbComm();
        this.masterController = masterController;
    }

    public void run(){
        try {
            usbComm.connect();
            moves = masterController.getMoves();
            //do hardwaresy stuff
            setChanged();
            notifyObservers(ButtonStatesEnum.PLAY_STATE); //this is how you notify central controller when move is complete or other data
        }
        catch(Exception e){
            System.out.println(e);
        }
    }


    public void makeMove(){
    }
}

@@ -212,16 +212,60 @@
 terface;
+%0Aimport com.endovectors.uta.processing.Move;
 %0A%0Aimport
@@ -568,16 +568,43 @@
 %3E moves;
+%0A    ArrayList%3Cmoves%3E Move;
 %0A%0A    pu
@@ -747,24 +747,58 @@
 Controller;%0A
+        //Move move = new Move();%0A
     %7D%0A%0A    p
@@ -905,24 +905,37 @@
 getMoves();%0A
+            %0A
             
@@ -956,16 +956,569 @@
 y stuff%0A
+            //char coor%5B%5D = %7B0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31%7D;%0A            char coor%5B%5D = Move.Move();%0A            StringBuilder position = new StringBuilder();%0A            position.append(coor%5B0%5D);%0A            position.append(/);%0A            position.append(%221%22);%0A            position.append(/);%0A            position.append(coor%5B1%5D);%0A            position.append(/);%0A            position.append(%220%22);%0A            position.append(/);%0A            String coordinates = position.toString();%0A            %0A
         

Update HardwareRequestHandler.java