Hi,
From below code I'm fetching the mac address of device but unable to get it. Is their anything goes wrong in the code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
char * getMacAddress() { int i; unsigned char macAddressVal[SL_MAC_ADDR_LEN]; unsigned char macAddressLen = SL_MAC_ADDR_LEN; sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(unsigned char *)macAddressVal); char macAddressPart[2]; static char macAddressFull[18]; //18 for (i = 0 ; i < 6 ; i++) { sprintf (macAddressPart, "%02X" , macAddressVal[i]); strcat (macAddressFull, ( char *)macAddressPart); strcat (macAddressFull, ":" ); } macAddressFull[17] = '\0' ; // Replace the the last : with a zero termination return macAddressFull; } |
Thanks & Regards,
Shashank