@Override public void connect(String username, String robotBtName, String robotBtAddr) { super.connect(username, robotBtName, robotBtAddr); robotController = new RobotBtController(username, robotBtName, robotBtAddr); if (robotController.startConnection()) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } mCurrentState = STATE_SUCCESS; } else { mCurrentState = STATE_BLUETOOTH_FAIL; } }
@Override public void sendCommand(String cmd) { super.sendCommand(cmd); if (robotController != null && mCurrentState == STATE_SUCCESS) robotController.write(cmd); }
@Override public void disconnect() { super.disconnect(); if (robotController != null) robotController.disconnect(); }