KT6368A Bluetooth Module: Explanation of Methods for Obtaining Bluetooth MAC Address on iOS Systems or Phones

 I. Introduction

KT6368A Bluetooth Module: Explanation of Methods for Obtaining Bluetooth MAC Address on iOS Systems or Phones

During APP development, customers often encounter issues with iOS. Therefore, we have summarized and categorized the solutions here, hoping to assist everyone. The core focus lies in the handling on the Bluetooth chip side.

Since we do not have APP development capabilities, the collected information and experience are based on communication with customers. Many of these customers' APP or mini-program developments involve our full participation, so we can provide some practical suggestions in this regard.

There are differences in obtaining the Bluetooth module's MAC address when developing APPs for Android and iOS:

1. Android systems provide an interface for obtaining the Bluetooth module's MAC address, so it can be used directly.

This includes Android-side WeChat mini-programs or other mini-programs.

2. iOS, however, is more restrictive and does not allow the retrieval of the Bluetooth module's MAC address, as it does not provide the corresponding API. Therefore, special settings must be implemented on the Bluetooth module side.

==> Method 1: Set a fixed UUID specifically for interaction with the APP. This means that after the APP connects, it can read the Bluetooth module's MAC address through this UUID.

==> Method 2: Store the Bluetooth module's MAC address in the broadcast packet, allowing iOS Bluetooth to directly obtain the MAC address during scanning.


II. Detailed Description

2.1 Method 1Reading the MAC Address via a Specific UUID

This type of application is not common because it requires establishing a connection before obtaining the MAC address, making it impractical.

Among the many customers we have collaborated with, very few adopt this approach. The implementation is actually quite simple and easy to understand once explained.

Thus, this method is not recommended for now. Please refer to Method 2 for details.


2.2 Method 2Storing the MAC Address in the Bluetooth Module's Broadcast Packet

Here, we reference the broadcast packet specifications of the KT6368A Bluetooth chip.


We have added the Bluetooth chip's MAC address to the broadcast packet. By comparing the screenshot on the right, the pattern can be identified.

This is referred to as "advertisData", and its purpose includes the following:

1. WeChat Mini-Program Development: There is no direct API to obtain the Bluetooth chip's MAC address, so this method can be used instead. Specific details can be found online.

2. APP DevelopmentiOS Side: Similarly, there is no direct way to obtain the MAC address, so this method is used to retrieve the Bluetooth chip's MAC address.

3. APP DevelopmentAndroid Side: This is not an issue, as the MAC address can be directly obtained via API. Therefore, whether or not this feature is used does not matter.

2.3 Method 2Testing Procedure


1. For iOS testing, the APP used here is "BLEHelper".

2. Testing with nRF Connect is more cumbersome.

3. These two APPs are tools developed for iOS, so they use the same API interfaces. This confirms that storing the MAC address in the broadcast packet is feasible.

4. The MAC address is stored in manufacturerData, e.g., 0x724c21cb1c93.

5. Since these tool APPs can retrieve the MAC address from the broadcast packet, your own iOS APP or WeChat mini-program development should also be able to achieve this.

HCI_EIR_DATATYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF  

For Android testing, nRF Connect is used.

The Android side will not be elaborated further here.

III. Summary

We strongly recommend Method 2, as it perfectly resolves this issue. You can also test it with the KT6368A Bluetooth chip.

评论

此博客中的热门博文

KT148A Voice Chip at Baidu Baike

KT148A Voice Chip Issue: Difficult to Play with Code Sending - Normal Playback After Grounding Pin 4, What’s the Reason?

KT1025A Dual-Mode Bluetooth Audio Chip Layout Description and Design Precautions