A maintenance detection method for Bluetooth low energy
Through phased functional and stability testing, combined with protocol stack inter-layer jumps and event information analysis, the problems of insufficient device internal mechanisms and connection stability in traditional Bluetooth testing methods are solved, and efficient and accurate testing of low-power Bluetooth devices is achieved.
Patent Information
- Application Number
- CN202411083060.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-08-08
AI Technical Summary
Traditional Bluetooth testing methods cannot effectively test the internal mechanisms of devices, ignore the relationship between modules, and cannot simultaneously test the connection stability between devices, making problem location difficult and time-consuming.
A phased functional test and stability test method is adopted. The host and the device under test are connected through the serial port. The test script is used to simulate the device application, generate data frames and establish a connection through the air interface. The HCI log and event information are recorded to achieve synchronous testing of the opposite device. The jump between protocol stack layers and event information analysis are combined to improve the test accuracy.
It achieves accurate functional and stability testing of low-power Bluetooth devices, can locate the cause of errors in real time, improve developers' debugging efficiency, and enhance testing efficiency and accuracy.
Smart Images

Figure CN119052844B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and in particular relates to a maintenance detection method for low-power Bluetooth. Background Art
[0002] The Internet of Things (IoT) is considered the third wave of the information industry, following computers and the internet. The IoT integrates multiple sensing, communication, and computing technologies, extending information exchange and communication from human-to-human (H2H) to human-to-thing (H2T) and thing-to-thing (T2T). Ultimately, it will integrate human society, cyberspace, and the physical world (human-machine-thing). Wireless communication is an advanced information exchange technology encompassing microwave and satellite communications. It boasts low energy consumption, miniaturization, and cost-effectiveness. Currently, mature short-range wireless communication technologies include Bluetooth Low Energy (BLE), WiFi, ZigBee, and infrared direct access (IrDA). BLE, with its low power consumption, interference immunity, and flexibility, holds strong competitiveness in the IoT era and is widely used in various fields, including smart wearables and smart homes.
[0003] Bluetooth technology is a form of mobile communications. Traditional testing methods primarily fall into the following categories: First, device testing tests the entire Bluetooth device to verify its functionality. Next, functional testing tests the device's overall functionality to ensure that all features are functioning properly. Furthermore, there's pure software testing of internal functions, primarily verifying the Bluetooth device's internal functions. Finally, modular testing independently tests each module within the system and determines whether the output meets expectations based on the interfaces between modules.
[0004] Traditional Bluetooth testing requires connecting a PC to the test device via a serial port. Testing is performed by capturing HCI logs using HCI log capture software. HCI commands, events, and data packets are then parsed to determine whether functional performance passes test points. This traditional testing method only studies a single device and does not correlate with the paired Bluetooth device. Furthermore, a single PC can only capture the HCI logs of one test device. This testing approach is highly limited and offers incomplete judgment criteria. When testing the entire device, the system's external output is often the only means of determining whether the test met the expected standards. This approach provides relatively simplistic and abstract information. If problems arise during testing, identifying and resolving them is often time-consuming due to the lack of detailed information about the internal mechanisms. Testing of internal device functions often fails to explicitly consider other aspects of the system, potentially leading to a lack of integration with the overall system. Similarly, testing of functional modules often overlooks the interrelationships between modules. Summary of the Invention
[0005] In response to the problems existing in the prior art, the present invention proposes a maintenance and detection method for low-power Bluetooth, which is divided into two stages to perform functional testing and stability testing respectively, and specifically includes the following steps:
[0006] When performing functional testing, two devices under test are connected to the host through serial ports respectively. The host simulates the Bluetooth device applications at both ends through the test script. When the host initiates the test, the two devices under test process the data frames generated by the test script and establish a connection with the other device under test through the air interface. The devices under test send the HCI log and event information generated during the connection establishment process to the host. The host determines whether the test result is correct based on the event information. If it is correct, the test is terminated. Otherwise, the cause of the test error is located based on the HCI log and event information.
[0007] When conducting stability testing, a connection and communication is established with another device under test through the air interface, and the test script is automatically started. The auxiliary information and time information during the communication process are stored on the storage device. When the device under test completes the test, the stability is analyzed by viewing the auxiliary information and event information in the storage device.
[0008] Furthermore, the process of the device under test processing the data frames generated by the test script and establishing a connection includes:
[0009] A device under test maps the parameters in the payload field of the data frame to the payload field of the message interaction within the protocol stack, composes a new protocol stack message and sends it to the scheduling thread for scheduling;
[0010] The message includes multiple IDs. The protocol stack thread searches the function registry according to the multiple ID numbers to make function calls and jump between layers.
[0011] When the device under test processes the data frame to generate a complete data packet required by the Bluetooth connection protocol and sends it to another device under test;
[0012] The other device under test maps the parameters in the payload field of the received data packet to the payload field of the message interaction within the protocol stack, composes a new protocol stack message and sends it to the scheduling thread for scheduling. After being processed by the protocol stack, the data packet containing the test data is transmitted to the other device.
[0013] Furthermore, the event information includes timestamp, running thread information, protocol stack location information, and output information, wherein the timestamp is used to record the start time and end time of the test item, the running thread information is used to record the currently running thread, the protocol stack location information is used to record the location of the current test code running in the protocol stack, and the output information is used to record the test results of the current test script.
[0014] Furthermore, the protocol stack location information is the function name corresponding to the ID number in the function registry, and the function name naming rule is: protocol stack layer name+operation name+request or event name.
[0015] Furthermore, the output information is empty by default. When performing related operations in the GATT or GAP layer, the output information will be filled in. The filling content includes:
[0016] When the device under test performs a connection test, the output information includes the peer device address and the local end role identifier. When the local end is the initiator, the value of the local end role identifier is set to 0, and when the local end is the receiver, the value of the local end role identifier is set to 1.
[0017] When a connection parameter update is executed, the output information indicates the updated connection parameters;
[0018] When the device performs an MTU negotiation test, the output information is the data length negotiated by both ends;
[0019] When a device performs a GATT service discovery test, the output information is a description of the service UUID.
[0020] Furthermore, the auxiliary information includes the current power level of the device under test and the current transmit power of the device under test.
[0021] Based on traditional Bluetooth testing, the present invention pairs and connects two test devices to form a piconet, which can simultaneously test the transceiver functions of the Bluetooth device. During the test process, real-time information can be continuously output and saved, such as battery power, data rate, etc. Through the logical feedback of the test device on the test script, the cause of the error can be accurately located, thereby improving the debugging efficiency of developers.
[0022] The test script of the present invention exists as a software system. During the test process, the system can accurately observe the smallest functional unit within the system based on the test data stream generated by the test script. At the same time, the result information verification can reflect the behavioral accuracy of the entire Bluetooth protocol stack function. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a schematic diagram of the system architecture of low-power Bluetooth maintenance and detection of the present invention;
[0024] Figure 2 Schematic diagram of data frame processing of the present invention;
[0025] Figure 3 This is a schematic diagram of the maintenance and detection process of the first stage of a maintenance and detection method for low-power Bluetooth according to the present invention;
[0026] Figure 4 The figure is a flow chart of the second stage maintenance detection of a maintenance detection method for low-power Bluetooth of the present invention. DETAILED DESCRIPTION
[0027] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0028] The present invention proposes a maintenance and detection method for low-power Bluetooth, which is divided into two stages to perform functional testing and stability testing respectively, and specifically includes the following steps:
[0029] When performing a functional test, two devices under test are connected to the host through serial ports. The host simulates the Bluetooth device applications at both ends through the test script. When the host initiates the test, the two devices under test process the data frames generated by the test script and establish a connection with the other device under test through the air interface. The devices under test send the HCI log and event information generated during the functional test to the host. The host determines whether the test results are correct based on the event information. If correct, the test ends. Otherwise, the cause of the test error is located based on the HCI log and event information.
[0030] When conducting stability testing, a connection and communication is established with another device under test through the air interface, and the test script is automatically started. The auxiliary information and time information during the communication process are stored on the storage device. When the device under test completes the test, the stability is analyzed by viewing the auxiliary information and event information in the storage device.
[0031] like Figure 1 The hardware devices mainly involved in the present invention include a host, a device under test, and a storage device mounted on the device under test. A low-power Bluetooth maintenance and detection method of the present invention is applied to the product development stage to test the device function. The test script is used to generate the data required for the test. The Bluetooth device under test is connected to the PC host through a serial port, and is paired and connected and communicated with the opposite device under test through an air interface. The device under test outputs the output information to the PC through the serial port; after the product has passed the development stage, the product performance and stability are tested. The device under test is no longer connected to the PC through a serial port, but is paired and connected and communicated with the opposite device under test through an air interface. The storage device is mounted on the device under test, and the file system in the real-time operating system is mounted on the storage device. The log log is output to the file backend, and the log log file stores the output information of the test.
[0032] When executing the test, the test script will generate the corresponding data frame, which will be sent to the different protocol layers within the protocol stack of the low-power Bluetooth device under test for processing after some processing. Figure 2 As shown, the following steps are included:
[0033] The parameters in the payload field of the data frame are mapped to the payload field of the message interaction within the protocol stack, forming a new protocol stack message and sending it to the scheduling thread for scheduling;
[0034] The message contains different IDs. The protocol stack thread searches the function registry for the corresponding ID numbers to make function calls and jump between layers at the same time.
[0035] Finally, the complete data packet is sent to the peer device via the air interface;
[0036] After receiving the complete data packet, the peer device extracts the payload field in the data packet, composes a new protocol stack message, sends it to the scheduling thread for scheduling, and jumps between different layers of the protocol stack.
[0037] When jumping between different protocol stack layers, the Bluetooth devices at both ends will output HCI LOG and event information as well as auxiliary information (device power level, device transmission power, etc.) when passing through the test point. The completion or failure of the test function is determined based on whether the predetermined event information is generated.
[0038] In the present invention, the structure of event information includes timestamp, running thread information, protocol stack location information, and output information, wherein:
[0039] Timestamp, used to record the start and end time of the test item, which can be obtained by the standard library function;
[0040] Running thread information, used to record the name of the currently running thread. The thread name is named by the developer when the thread is created;
[0041] Protocol stack location information, used to record the location of the current test code running in the protocol stack, that is, the function name corresponding to the ID number in the function registry. The function name naming rule is: protocol stack layer (such as GAP, GATT, L2CAP, HCI) + operation (such as value reading, value writing, scanning, broadcasting, setting parameters, establishing connection, etc.) + request / event (such as request indicates sending, event indicates peer return);
[0042] Output information is used to record the test results of the current test script. Output information is optional and is empty by default. The output information will be filled in only when the device performs related operations in the GATT or GAP layer. When the device performs a connection test, the output information includes the address of the other device and the role flag of the local end (that is, whether the local end is the connection initiator or the connection receiver. When the local end is the initiator, the value of the flag is set to 0, and when the local end is the receiver, the value of the flag is set to 1); when performing a connection parameter update, the output information indicates the updated connection parameters; when the device performs an MTU negotiation test, the output information is the data length negotiated by both ends; when the device performs a GATT service discovery test, the output information is the service UUID description.
[0043] When executing related processes, the protocol stack obtains event information and stores it in a structure. The output thread then transmits the event information back to the PC. For example, when the test device initiates a connection test, it calls the GAP_CONNECT_REQ function in the registration function table. After processing by the protocol stack, the other end returns a data packet. The local end then jumps between protocol stack layers and calls the GAP_CONNECT_Complete_EVT function.
[0044] In this embodiment, if Figure 3When performing a functional test, the host controls the two devices under test to initiate a functional test. The devices under test perform protocol processing based on the received data and send data packets containing test data to the peer device through the air interface. The purpose of sending data packets between the devices under test is to negotiate and establish a connection. The data packets sent must comply with the Bluetooth protocol. The HCI LOG and event information generated during the test are sent back to the host through the serial port. The host can determine whether the event information received is consistent with the expected event information, that is, whether the event information generated by the device under test is consistent with the event information corresponding to the executed test. If they are consistent, the test is completed. If they are inconsistent, it means that an error occurred during the test, and the error is located through the HCI LOG and event information.
[0045] like Figure 4 When conducting device performance and stability tests, the devices at both ends store the data generated during the protocol processing in the mounted storage device. During the device performance and stability test, the two devices under test establish a connection and communication through the air interface, and automatically start the test script, and store the auxiliary information and event information in the communication process in the storage device mounted on the local end. After the device completes the data sending and other tests, technical personnel in this field analyze the stability and device performance of the device under test by checking the auxiliary information and event information stored in the storage device.
[0046] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A maintenance detection method for low-power Bluetooth, characterized in that: Functional testing and stability testing are carried out in two phases, including the following steps: When performing functional testing, the two devices under test are connected to the host through the serial port respectively. The host simulates the Bluetooth device applications at both ends through the test script. When the host initiates the test, the two devices under test process the data frames generated by the test script and establish a connection with the other device under test through the air interface. The devices under test send the HCILOG and event information generated during the functional test to the host. The host determines whether the test result is correct based on the event information. If it is correct, the test is terminated. Otherwise, the cause of the test error is located through the HCILOG and event information. When conducting stability testing, it establishes a connection and communication with another device under test through the air interface, automatically starts the test script, and stores the auxiliary information and event information during the communication process on the storage device. When the device under test completes the test, the stability is analyzed by viewing the auxiliary information and event information in the storage device; Event information includes timestamp, running thread information, protocol stack location information, and output information. The timestamp is used to record the start and end time of the test item, the running thread information is used to record the currently running thread, the protocol stack location information is used to record the location of the current test code in the protocol stack, and the output information is used to record the test results of the current test script. The output information is empty by default and will be filled in when executing related operations in the GATT or GAP layer. The filled content includes: When the device under test performs a connection test, the output information includes the peer device address and the local end role identifier. When the local end is the initiator, the value of the local end role identifier is set to 0, and when the local end is the receiver, the value of the local end role identifier is set to 1. When a connection parameter update is executed, the output information indicates the updated connection parameters; When the device performs an MTU negotiation test, the output information is the data length negotiated by both ends; When the device performs a GATT service discovery test, the output information is the service UUID description; The auxiliary information includes the current power level of the device under test and the current transmit power of the device under test.
2. A maintenance and detection method for low-power Bluetooth according to claim 1, characterized in that: The process by which the device under test processes the data frames generated by the test script and establishes a connection includes: A device under test maps the parameters in the payload field of the data frame to the payload field of the message interaction within the protocol stack, composes a new protocol stack message and sends it to the scheduling thread for scheduling; The message includes multiple IDs. The protocol stack thread searches the function registry according to the multiple ID numbers to make function calls and jump between layers. When the device under test processes the data frame to generate a complete data packet required by the Bluetooth connection protocol and sends it to another device under test; The other device under test maps the parameters in the payload field of the received data packet to the payload field of the message interaction within the protocol stack, composes a new protocol stack message and sends it to the scheduling thread for scheduling. After being processed by the protocol stack, the data packet containing the test data is transmitted to the other device.
3. The maintenance and detection method of low-power Bluetooth according to claim 1, characterized in that: The protocol stack location information is the function name corresponding to the ID number in the function registry. The function name naming rule is: protocol stack layer name + operation name + request or event name.
Citation Information
Patent Citations
Bluetooth function compatibility test system, method, device, equipment and medium
CN115567122A
Rigid-flex Bluetooth function test method and system
CN115694676A