@Override
 protected void onDestroy() {
   mHandler.removeMessages(HANDLER_EVENT_RX);
   if (EMWifi.sIsInitialed) {
     EMWifi.setATParam(1, 0);
   }
   super.onDestroy();
 }
 /** Invoked when "Stop" button clicked */
 private void onClickBtnRxStop() {
   // long i4RxCntOk = -1;
   // long i4RxCntFcsErr = -1;
   // long i4RxPer = -1;
   // long[] i4Rx = new long[2];
   long[] u4Value = new long[1];
   mHandler.removeMessages(HANDLER_EVENT_RX);
   for (int i = 0; i < WAIT_COUNT; i++) {
     u4Value[0] = EMWifi.setATParam(ATPARAM_INDEX_COMMAND, 0);
     if (u4Value[0] == 0) {
       break;
     } else {
       SystemClock.sleep(WAIT_COUNT);
       Xlog.w(TAG, "stop Rx test failed at the " + i + "times try");
     }
   }
   setViewEnabled(true);
 }
  /** Invoked when "Go" button clicked */
  private void onClickBtnRxGo() {
    int i = -1;
    int len = 2;
    setViewEnabled(false);
    EMWifi.getPacketRxStatus(mInitData, 2);
    Xlog.d(TAG, "before rx test: rx ok = " + String.valueOf(mInitData[0]));
    Xlog.d(TAG, "before rx test: fcs error = " + String.valueOf(mInitData[1]));
    // if (mALCCheck.isChecked() == false) {
    i = 0;
    // } else {
    // i = 1;
    // }
    // temperature conpensation
    EMWifi.setATParam(ATPARAM_INDEX_TEMP_COMPENSATION, i);

    // Bandwidth setting
    if (BW_INDX_ADVANCED == mBandwidthIndex) {
      Xlog.d(
          TAG,
          "mChannelBandwidth:"
              + mChannelBandwidth
              + " mDataBandwidth:"
              + mDataBandwidth
              + " mPrimarySetting:"
              + mPrimarySetting);
      EMWifi.setATParam(ATPARAM_INDEX_CHANNEL_BANDWIDTH, mChannelBandwidth);
      EMWifi.setATParam(ATPARAM_INDEX_DATA_BANDWIDTH, mDataBandwidth);
      EMWifi.setATParam(ATPARAM_INDEX_PRIMARY_SETTING, mPrimarySetting);
    } else {
      EMWifi.setATParam(ATPARAM_INDEX_BANDWIDTH, mBandwidthIndex);
    }
    // start Rx
    EMWifi.setATParam(ATPARAM_INDEX_COMMAND, 2);
    mHandler.sendEmptyMessage(HANDLER_EVENT_RX);
    mTvFcs.setText(TEXT_ZERO);
    mTvRx.setText(TEXT_ZERO);
    mTvPer.setText(TEXT_ZERO);
  }