コード例 #1
0
 @Override
 public void handleMessage(Message msg) {
   if (!EMWifi.sIsInitialed) {
     showDialog(DIALOG_WIFI_ERROR);
     return;
   }
   if (HANDLER_EVENT_RX == msg.what) {
     long[] i4Rx = new long[2];
     long i4RxCntOk = -1;
     long i4RxCntFcsErr = -1;
     long i4RxPer = -1;
     Xlog.i(TAG, "The Handle event is : HANDLER_EVENT_RX");
     try {
       i4RxPer = Long.parseLong(mTvPer.getText().toString());
     } catch (NumberFormatException e) {
       Xlog.d(TAG, "Long.parseLong NumberFormatException: " + e.getMessage());
     }
     EMWifi.getPacketRxStatus(i4Rx, 2);
     Xlog.d(TAG, "after rx test: rx ok = " + String.valueOf(i4Rx[0]));
     Xlog.d(TAG, "after rx test: fcs error = " + String.valueOf(i4Rx[1]));
     i4RxCntOk = i4Rx[0] /* - i4Init[0] */;
     i4RxCntFcsErr = i4Rx[1] /* - i4Init[1] */;
     if (i4RxCntFcsErr + i4RxCntOk != 0) {
       i4RxPer = i4RxCntFcsErr * PERCENT / (i4RxCntFcsErr + i4RxCntOk);
     }
     mTvFcs.setText(String.valueOf(i4RxCntFcsErr));
     mTvRx.setText(String.valueOf(i4RxCntOk));
     mTvPer.setText(String.valueOf(i4RxPer));
   }
   mHandler.sendEmptyMessageDelayed(HANDLER_EVENT_RX, HANDLER_RX_DELAY_TIME);
 }
コード例 #2
0
  /** 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);
  }