Пример #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
 /**
  * Say if Sender and Receiver are running
  *
  * @return True or false
  */
 public boolean isOK() {
   return (m_receiver.is_active() && m_sender.is_active());
 }