Bluetooth uses the protocol stack API to read device MAC addresses

Source: Internet
Author: User

Recently in the porting QQ IoT protocol, you need to read the device MAC address.

Read the CC2541 device MAC address method, there is a direct read Mac register, you can also call the protocol stack API. This takes the form of a call API.

1   /*use the protocol stack API to read MAC addresses*/2     StaticUint8 macaddr[b_addr_len]={0};//MAC address3uint8_t macstr[ -] = {0};4     5 Gaprole_getparameter (gaprole_bd_addr, MACADDR); 6sprintf ((Char*) Macstr,"%02x%02x%02x%02x%02x%02x", macaddr[0], macaddr[1], macaddr[2], 7macaddr[3], macaddr[4], macaddr[5]); 8memcpy (Zone, MACSTR, A);

The core content is Api:gaprole_getparameter

This API can refer to the 102th page of CC2541 Software Developer's Guide, where you can find the definition of this function in the IAR itself, and gaprole_bd_addr is a type that represents the MAC address of the Bluetooth device.



Bluetooth uses the protocol stack API to read device MAC addresses

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.