Retrieving MAC(WLAN) from XDK
答复
19-6-14 上午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: https://xdk.bosch-connectivity.com/de/community/-/message_boards/message/360209

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

WlanConnect_Init();
_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 票)
RE: Retrieving MAC(WLAN) from XDK
答复
19-6-14 下午2:18 回复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.

regards

Saeid

 

+1 (1 投票)
RE: Retrieving MAC(WLAN) from XDK
答复
19-6-17 上午10:57 回复Saeid Kajlar。
Works perfectly now. Thank you very much!
0 (0 票)