/** * \fn mlme_sendAssocRequest * \brief sends association request * * The function builds and sends the association request according to the * mlme parames * * \param pMlme - pointer to mlme_t * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_sendAssocRequest(mlme_t *pMlme) { TI_STATUS status = TI_OK; static TI_UINT8 assocMsg[MAX_ASSOC_MSG_LENGTH]; TI_UINT32 msgLen; dot11MgmtSubType_e assocType=ASSOC_REQUEST; if ( pMlme->assocInfo.retryCount >= pMlme->assocInfo.maxCount) { TRACE0(pMlme->hReport, REPORT_SEVERITY_ERROR, "mlme_sendAssocRequest: retry count - failed to send assoc request\n"); pMlme->mlmeData.mgmtStatus = STATUS_UNSPECIFIED; pMlme->mlmeData.uStatusCode = TI_NOK; mlme_smEvent(pMlme->hMlmeSm, MLME_SM_EVENT_FAIL, pMlme); return TI_NOK; } pMlme->assocInfo.retryCount++; if (pMlme->reAssoc) { assocType = RE_ASSOC_REQUEST; } status = mlme_assocRequestMsgBuild(pMlme, assocMsg, &msgLen); if (status == TI_OK) { TRACE_INFO_HEX(pMlme->hReport,(TI_UINT8 *)assocMsg, msgLen); /* Save the association request message */ mlme_saveAssocReqMessage(pMlme, assocMsg, msgLen); status = mlmeBuilder_sendFrame(pMlme, assocType, assocMsg, msgLen, 0); } return status; }
/**************************************************************************** * cmdBld_ItrIeDataFilterStatistics() **************************************************************************** * DESCRIPTION: Get the ACX GWSI counters * * INPUTS: * * OUTPUT: None * * RETURNS: TI_OK or TI_NOK ****************************************************************************/ TI_STATUS cmdBld_ItrIeDataFilterStatistics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb) { TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; ACXDataFilteringStatistics_t acx; ACXDataFilteringStatistics_t * pCfg = &acx; /* Set information element header */ pCfg->EleHdr.id = ACX_GET_DATA_FILTER_STATISTICS; pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct); TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(ACXDataFilteringStatistics_t)); /* Send the interrogation command */ return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb); }
/** * \\n * \date 16-November-2005\n * \brief Callback for noise histogram get param call.\n * * Function Scope \e Public.\n * \param hMeasurementSRV - handle to the measurement SRV object.\n * \param status - the get_param call status.\n * \param CB_buf - pointer to the results buffer (already on the measurement SRV object) */ void MacServices_measurementSRV_noiseHistCallBack( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf ) { measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV; TI_UINT8 index; TI_UINT32 sumOfSamples; TI_INT32 requestIndex; TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": noise histogram CB called, status: %d\n", status); TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "result address (reported): 0x%x, result address (assumed): 0x%x, results (reported):\n", CB_buf, &(pMeasurementSRV->noiseHistogramResults)); TRACE_INFO_HEX( pMeasurementSRV->hReport, CB_buf, sizeof(TNoiseHistogramResults)); /* setting Off the Waitng for noise histogram Results Bit */ pMeasurementSRV->pendingParamCBs &= ~MSR_SRV_WAITING_NOISE_HIST_RESULTS; /* find the request index */ requestIndex = measurementSRVFindIndexByType( hMeasurementSRV, MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT ); if ( -1 == requestIndex ) { /* indicates we can't find the request in the requets array. Shouldn't happen, but nothing to do */ TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request index from measurementSRVFindIndexByType is -1?!?"); return; } if ( TI_OK == status ) { sumOfSamples = pMeasurementSRV->noiseHistogramResults.numOfLostCycles; /* Print For Debug */ TRACE4( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": numOfLostCycles = %d numOfTxHwGenLostCycles = %d numOfRxLostCycles = %d numOfExceedLastThresholdLostCycles = %d\n", pMeasurementSRV->noiseHistogramResults.numOfLostCycles, pMeasurementSRV->noiseHistogramResults.numOfTxHwGenLostCycles, pMeasurementSRV->noiseHistogramResults.numOfRxLostCycles, pMeasurementSRV->noiseHistogramResults.numOfLostCycles - (pMeasurementSRV->noiseHistogramResults.numOfTxHwGenLostCycles + pMeasurementSRV->noiseHistogramResults.numOfRxLostCycles)); for ( index = 0; index < NUM_OF_NOISE_HISTOGRAM_COUNTERS; index++ ) { sumOfSamples += pMeasurementSRV->noiseHistogramResults.counters[ index ]; /* Print For Debug */ TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Counter #%d = %x\n", index, pMeasurementSRV->noiseHistogramResults.counters[index]); } /* If there weren't enough samples --> Reject the Request */ if ( (sumOfSamples - pMeasurementSRV->noiseHistogramResults.numOfLostCycles) < NOISE_HISTOGRAM_THRESHOLD ) { TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": noise histogram CB, rejecting request because %d samples received.\n", sumOfSamples - pMeasurementSRV->noiseHistogramResults.numOfLostCycles); /* set negative result status */ pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK; } else { for (index = 0; index < NUM_OF_NOISE_HISTOGRAM_COUNTERS; index++) { pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ index ] = ( 255 * pMeasurementSRV->noiseHistogramResults.counters[ index ]) / sumOfSamples; } TRACE8( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Valid noise histogram reply. RPIDensity: %d %d %d %d %d %d %d %d\n", pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 0 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 1 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 2 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 3 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 4 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 5 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 6 ], pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 7 ]); } } else { TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": noise histogram CB with status: %d, rejecting request.\n", status); /* set negative result status */ pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK; } /* if no measurement are running and no CBs are pending, send ALL TYPES COMPLETE event */ if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV )) { /* send the event */ measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), MSR_SRV_EVENT_ALL_TYPES_COMPLETE ); } }
/** * \\n * \date 16-November-2005\n * \brief Callback for channel load get param call.\n * * Function Scope \e Public.\n * \param hMeasurementSRV - handle to the measurement SRV object.\n * \param status - the get_param call status.\n * \param CB_buf - pointer to the results buffer (already on the measurement SRV object) */ void MacServices_measurementSRV_channelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf ) { measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV; TI_UINT32 mediumUsageInMs, periodInMs; TI_INT32 requestIndex; /* when this CB is called as a result of the nulify call at the measurement beginning, the handle will be NULL. In this case, nothing needs to be done. */ if ( NULL == hMeasurementSRV ) { return; } TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Channel load CB called, status:%d\n", status); TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "result address (reported): 0x%x, result address (assumed): 0x%x, results (reported):\n", CB_buf, &(pMeasurementSRV->mediumOccupancyResults)); TRACE_INFO_HEX( pMeasurementSRV->hReport, CB_buf, sizeof(TMediumOccupancy)); /* setting Off the Waitng for Channel Load Results Bit */ pMeasurementSRV->pendingParamCBs &= ~MSR_SRV_WAITING_CHANNEL_LOAD_RESULTS; /* find the request index */ requestIndex = measurementSRVFindIndexByType( hMeasurementSRV, MSR_TYPE_CCA_LOAD_MEASUREMENT ); if ( -1 == requestIndex ) { /* indicates we can't find the request in the requets array. Shouldn't happen, but nothing to do */ TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request index from measurementSRVFindIndexByType is -1?!?"); return; } if ( (TI_OK == status) && (0 != pMeasurementSRV->mediumOccupancyResults.Period)) { /* calculate results */ mediumUsageInMs = pMeasurementSRV->mediumOccupancyResults.MediumUsage / 1000; periodInMs = pMeasurementSRV->mediumOccupancyResults.Period / 1000; TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": MediumUsage = %d Period = %d\n",mediumUsageInMs, periodInMs); if ( periodInMs <= pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration ) { pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.CCABusyFraction = ( 255 * pMeasurementSRV->mediumOccupancyResults.MediumUsage ) / pMeasurementSRV->mediumOccupancyResults.Period; } else { pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.CCABusyFraction = ( 255 * pMeasurementSRV->mediumOccupancyResults.MediumUsage ) / (pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration * 1000); } } else { TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": channel load failed. Status=%d, period=%d\n", status, pMeasurementSRV->mediumOccupancyResults.Period); /* mark result status */ pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK; } /* if no measurement are running and no CBs are pending, send ALL TYPES COMPLETE event */ if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV )) { /* send the event */ measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), MSR_SRV_EVENT_ALL_TYPES_COMPLETE ); } }