@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    UtilDBG.logMethod();

    mActivity = (MXWActivity) getActivity();
    mMaxwellBLE = MGActivityTracker.getInstance(mActivity);

    View view =
        inflater.inflate(R.layout.df_add_new_device, (mFragment == null) ? container : null);

    mFAddSelectType = new FAddSelectType();
    mFAddSearch = new FAddSearch();
    mFAddTrouble = new FAddTrouble();
    mFAdd60 = new FAdd60();
    mDFDeviceInfo = new DFDeviceInfo();

    mFAddSelectType.setDFAddNew(this);
    mFAddSelectType.setIsFirstLaunch(mFragment != null);
    mFAddSearch.setDFAddNew(this);
    mFAddTrouble.setDFAddNew(this);
    mFAdd60.setDFAddNew(this);
    mDFDeviceInfo.setDFAddNew(this);

    mPD = DBProgramData.getInstance();

    initViewPager(view);
    setCancelable(false);
    return view;
  }
  private void handleDevicePair(MGPeripheral sender) {
    if (isDevicePairFinished) {
      return;
    }
    isDevicePairFinished = true;
    mActivity.stopScanDevice();
    mFAddSearch.pairFinished();
    String address = sender.getTargetAddress();
    if (inUserMode()) {
      ProfileData profile = new ProfileData();
      profile.name = "User";

      mPD.setTargetDeviceMac(address);
      mPD.saveUserProfile(profile);
    } else {
      GroupMemberData member = getGroupMember();
      mPD.setMemberTargetDeviceMac(member.member_Id, address);
    }
    goToEditDevice();
  }
 @Override
 public void onConnectTimeOut(MGPeripheral sender) {
   mFAddSearch.pairFinished();
   showPairFailed();
 }
 @Override
 public void onDeviceDiscover(MGPeripheral sender, AdvertisingData device) {
   mFAddSearch.addScanDevice(device);
 }