public void connect() { hub = new Hub("com.example.hello-myo"); System.out.println("Attempting to find a Myo..."); log.info("Attempting to find a Myo"); myo = hub.waitForMyo(10000); if (myo == null) { // throw new RuntimeException("Unable to find a Myo!"); log.info("Unable to find a Myo"); } System.out.println("Connected to a Myo armband!"); log.info("Connected to a Myo armband"); hub.addListener(this); if (hubThread == null) { hubThread = new HubThread(this); hubThread.start(); } }
public void disconnect() { if (hubThread != null) { hubThread.running = false; hubThread = null; } }