Retrieving MAC(WLAN) from XDK
14/06/19 11.36

Hi everyone,

I want to retrieve the unique WLAN Mac Adress of the XDK. in the: XX-XX-XX-XX-XX-XX format.

If found this thread:

but it doesn't work for me. They used the following code snippet:

_u8 macAddressVal[SL_MAC_ADDR_LEN];
_u8 macAddressLen = SL_MAC_ADDR_LEN;
sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(_u8 *)macAddressVal);
 // The 6 bytes of the Mac address are now stored in the array macAddressVal

The reason (probably) beeing is that it dont know where/what to initialize/define the "SL_MAC_ADDR_LEN".

Is this the only/fastest way to get the Mac Adress?

And another question is, that this example code uses "WlanConnect_Init()" i use for my sourcecode "Wlan_Enable()" does that make a difference or may i be able to get the Mac Adress the same way?


Thank you in advance for your help.

0 (0 Voti)
RE: Retrieving MAC(WLAN) from XDK
14/06/19 14.18 come risposta a Martin Scheck.

Hi Martin,

Define it like this:
#define SL_MAC_ADDR_LEN                    UINT8_C(6)

I think that's the easiest and fastest way to get the MAC address. Regarding your last question, It should work because the function Wlan_Enable() initializes the WLAN connection.




+1 (1 Voto)
RE: Retrieving MAC(WLAN) from XDK
17/06/19 10.57 come risposta a Saeid Kajlar.
Works perfectly now. Thank you very much!
0 (0 Voti)