Fusion API call to identify AP's MAC that MC device is associated to?

// Expert user has replied.
C Charles Brugger 3 years 7 months ago
3 4 0

Have looked thru the Fusion API and can not find a call to find the MAC of the AP that the MC device is associated to. Does anyone know if there is a API call to do this? Thanks.

Please Register or Login to post a reply

4 Replies

C Charles Brugger

Thank you so much for helping, but I have a couple more questions.I still don't understand how to get the info in the managed world. I have a 2.57 fusion with EMDK 2.1. I get the Adapter, then using  WLAN.Adapter.GetAccessPoints("myEssid") to get an array of APs that can be seen by the device.

I can see several , all of them with "myEssid", what I can't find is any way (other then the native interface) to determine which AP is the one that I'm currently associated with.

   

 I certainly can PInvoke the native interface and get the info, but surely this wasn't overlooked in the managed interface.

 

 Also , the sample code in the EMDK for C has none of this. Is there a separate Fusion SDK?

Y Yanis Dalabiras

This particular call isn't in the FusionSample distributed with the "C"EMDK.  I had customer who also needed the information, so I based the code on the FusionSample from the SDK (it was still called the SDK at the time) code and enhanced it. I looked through the Symbol.Fusion Assembly and didn't see anything equivalent.  I'm not surprised, The .NET implementation sometimes lags behind the "C" SDK when adding functionality. However, look at the Symbol.WirelessLAN Assembly.  It appears to support what you need in the MACAddress class.  It's worth a try, although the documentation recommends using the Fusion Assembly if the device has a Fusion Radio.

P Prashanth Kadur

EMDK for .NET v2.2 will provide ways to make NDIS calls.  This version is due in a few weeks.

Y Yanis Dalabiras

In the "C" EMDK, the command is "NDIS_STAT_WLAN_GET_DATA".  In the following code snippet, FusionOpenEx() is loading the Fusion Library and Opening the API in "Status" Mode along with doing a find first adapter which is then stored in g_dwAdapter.  You can find all of that in the sample code which comes with the SDK.  For .NET, the Adapter.SSIDInfo class is used from the Symbol.Fusion Assembly.  This is only available for Fusion 2.55 and later.  Otherwise, you'll have to use managed code with the following example.Following is a code snippet illustrating the call in "C":/******************************************************************************* SYNOPSIS: FusionGetAPMacAddress(TCHAR *szAPMacAddress)** DESCRIPTION: Return the current AP's Mac Address.** PARAMETERS: szAPMacAddress - Pointer to storage for MAC Address.* dwLen - Length of szAPMacAddress Buffer.** RETURN VALUE: FUSION_SUCCESS - AP returned, otherwise error.********************************************************************************/

HRESULT FusionGetAPMacAddress(TCHAR *szAPMacAddress){    DWORD dwResult;    DWORD dwStatBufLen;    FAPI_AdapterNDISStat fapiAdapterNDISStat;    NDIS_802_11_MAC_ADDRESS FusionData;

    // Check to see if Fusion API has been initialized. If not, try to    // initialize it first.

    if ((dwResult = FusionInitEx(FALSE)) != FUSION_SUCCESS)    {         return dwResult;    }

    _stprintf(szAPMacAddress, _T("000000000000"));

    memset(&fapiAdapterNDISStat, 0x0, sizeof(FAPI_AdapterNDISStat));

    fapiAdapterNDISStat.dwType = FAPI_ADAPTER_NDIS_STAT_TYPE;    fapiAdapterNDISStat.dwVersion = FAPI_ADAPTER_NDIS_STAT_VERSION;    fapiAdapterNDISStat.dwAdapterHandle = g_dwAdapter;    fapiAdapterNDISStat.dwOid = OID_802_11_BSSID; // Get Mac Address

    // Obtain the length of the buffer to contain the returned data.

    dwResult = lpfn_CommandFusionAPI( g_dwFusion,                                    NDIS_STAT_WLAN_GET_BUFFER_SIZE,                                      &fapiAdapterNDISStat, sizeof(FAPI_AdapterNDISStat),                                     &dwStatBufLen, sizeof(DWORD),                                     NULL);

    if ((dwResult == FAPI_SUCCESS) && (dwStatBufLen == sizeof                                            (NDIS_802_11_MAC_ADDRESS)))    {        dwResult = lpfn_CommandFusionAPI( g_dwFusion,                             NDIS_STAT_WLAN_GET_DATA,                             &fapiAdapterNDISStat, sizeof(FAPI_AdapterNDISStat),                             (PBYTE) &FusionData[0], sizeof                            (NDIS_802_11_MAC_ADDRESS),  NULL);

        if( dwResult == FAPI_SUCCESS )        {            _stprintf(szAPMacAddress, _T("%02x%02x%02x%02x%02x%02x"),                                FusionData[0], FusionData[1],                                 FusionData[2], FusionData[3],                                 FusionData[4], FusionData[5]);        }    }

    if (dwResult == FAPI_FAILURE)            FusionDisplayLastError(NULL);

    return dwResult;}If you'd like the full source to the file, email me and I'll send you the source file which has the FusionDisplayLastError (just calls ERROR_INFO_GET_LAST_ERROR).

CONTACT
Can’t find what you’re looking for?