/**
   * Start as a client to search WiFi Direct server.
   *
   * @param searchListener
   * @param user
   */
  public void searchDirectServer(OnSearchListener searchListener, User user) {
    // TODO This method is not be called
    if (!NetWorkUtil.isWifiDirectSupport(mContext)) {
      Toast.makeText(mContext, "Not support wifi-direct", Toast.LENGTH_SHORT).show();
      return;
    }

    // Disable WiFi AP if WiFi AP is enabled.
    if (NetWorkUtil.isWifiApEnabled(mContext)) {
      NetWorkUtil.setWifiAPEnabled(mContext, null, false);
    }

    if (mDirectService != null) {
      mDirectService.startDirect(false, user, searchListener);
    } else {
      Intent intent = new Intent();
      intent.setClass(mContext, DirectService.class);
      bindService(intent, new DirectServiceConnection(false, user, searchListener));
    }
  }
  private void startWifiDirectServer(User user, OnSearchListener searchListener) {
    if (!NetWorkUtil.isWifiDirectSupport(mContext)) {
      Toast.makeText(mContext, "Not support wifi-direct", Toast.LENGTH_SHORT).show();
      return;
    }

    // Unbind wifiOrAPService
    if (mWifiOrAPServiceConnection != null) {
      unbindService(mWifiOrAPServiceConnection);
    }

    // Disable WiFi AP if AP is enabled.
    if (NetWorkUtil.isWifiApEnabled(mContext)) {
      NetWorkUtil.setWifiAPEnabled(mContext, null, false);
    }

    if (mDirectService != null) {
      mDirectService.startDirect(true, user, searchListener);
    }

    Intent intent = new Intent();
    intent.setClass(mContext, DirectService.class);
    bindService(intent, new DirectServiceConnection(true, user, searchListener));
  }