예제 #1
0
  /** Disconnect Android from USB */
  public void disconnect() {
    if (m_connected) {
      m_connected = false;
    }

    if (m_handler != null) {
      m_handler.stop();
    }

    if (m_sender != null && m_sender.is_active()) {
      if (m_sender.stop()) {
        Log.d(LinkManager.class.getSimpleName(), "There was non-send message !");
        // TODO : autre traitement ?
      }
    }
    if (m_receiver != null && m_receiver.is_active()) {
      if (m_receiver.stop()) {
        Log.d(LinkManager.class.getSimpleName(), "All the message were not handled !");
        // TODO : autre traitement ?
      }
    }

    if (m_device != null) {
      /*    try {
          m_device.close();
      } catch (IOException e) { }*/
      m_device = null;
    }

    m_listener.UsbStop();
  }
예제 #2
0
 /**
  * Get the last String sent
  *
  * @return The last String sent
  */
 public String getLastReceived() {
   return m_receiver.getLast();
 }
예제 #3
0
 /**
  * Say if Sender and Receiver are running
  *
  * @return True or false
  */
 public boolean isOK() {
   return (m_receiver.is_active() && m_sender.is_active());
 }