Bluetooth scanning method and device, equipment and storage medium
By monitoring data service time slots in Bluetooth devices, prioritizing data service processing and performing scanning services during idle periods, the problem of conflict between Bluetooth device scanning and data service is solved, and the data transmission success rate and device efficiency are improved.
Patent Information
- Application Number
- CN202310648968.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2024-12-03
AI Technical Summary
In places with dense crowds, Bluetooth devices cannot avoid conflicts with data services when conducting scanning services, resulting in frequent packet loss and retransmission of data packets, causing audio service playback stuttering, and increasing power consumption and waste of hardware resources.
By monitoring the time slots of data services, prioritize data services when there is data services, determine the idle time period when there is no data services and execute scan services, dynamically adjust the service priority to avoid data retransmission caused by the scanning services occupying the air interface and Increased power consumption.
It reduces the probability of data retransmission caused by scanning services occupying air interfaces, avoids lag in audio services playback, and reduces the power consumption and hardware resource usage of Bluetooth devices.
Smart Images

Figure CN119071811A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to wireless communication technology, and in particular to a Bluetooth scanning method and apparatus, device, and storage medium. Background Art
[0002] With the popularity of Bluetooth headsets, the use scenarios of Bluetooth headsets have increased rapidly, especially in crowded places such as stations, shopping malls, airports, etc. One of the main reasons why Bluetooth technology can become a technology that supports stable audio transmission is its strong anti-interference characteristics. This is because Bluetooth was designed with frequency hopping characteristics at the beginning, that is, a frequency hopping working mechanism is adopted in the frequency band of 2402MHz-2480MHz, that is, both devices need to send and receive signals at the same frequency at the same time according to the same frequency hopping sequence (map).
[0003] In order to obtain the frequency hopping sequence, the master and slave devices need to perform channel scans regularly to evaluate the channel quality. In addition, in order to quickly scan and pair with surrounding Bluetooth devices that can be connected, the master Bluetooth device (referred to as the master device) and the slave Bluetooth device (referred to as the slave device) need to perform page scans, inquiry scans, or Bluetooth Low Energy scans (BLE scans) regularly. Figure 1 As shown, no matter which scanning behavior is used, it is impossible to normally receive business data packets (such as song data packets when listening to music) within the scanning time, and the scanning behavior of the slave device cannot avoid the data packets sent by the master device (referred to as T). On the one hand, it causes the master device to frequently retransmit data packets (referred to as RT), resulting in power consumption and hardware resource waste; on the other hand, it reduces the success rate of data transmission, and causes audio service playback to be stuck in harsh environments. Summary of the invention
[0004] The embodiments of the present application are intended to provide a Bluetooth scanning method and apparatus, device, and storage medium.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, a Bluetooth scanning method is provided, comprising:
[0007] When a trigger command for scanning services is obtained, monitoring whether there is data services in the data receiving time slot;
[0008] When the data service is detected, executing the data service;
[0009] In the case where the data service is not monitored, determining an idle time period of the data service;
[0010] The scanning service is performed during the idle time period.
[0011] In a second aspect, a Bluetooth scanning device is provided, comprising:
[0012] A monitoring unit, configured to monitor whether there is data service in a data receiving time slot when a trigger command for scanning service is obtained;
[0013] a data service processing unit, configured to execute the data service if the monitoring unit detects the data service;
[0014] The monitoring unit is further configured to determine an idle time period of the data service when the data service is not monitored;
[0015] The scanning service processing unit is used to execute the scanning service in the idle time period.
[0016] In a third aspect, a Bluetooth scanning device is provided, comprising: a processor and a processor, wherein the processor is configured to execute the steps of the aforementioned method when calling and running a computer program in a memory.
[0017] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.
[0018] In an embodiment of the present application, a Bluetooth scanning method and apparatus, device, and storage medium are provided, the method comprising: in the case of obtaining a trigger command for a scanning service, monitoring whether there is a data service in the data receiving time slot; in the case of monitoring a data service, executing the data service; in the case of not monitoring a data service, determining an idle time period for the data service; and executing the scanning service in the idle time period. In this way, before executing the scanning service, the priority of the data service and the data service is dynamically adjusted according to the air interface status, the data service is executed first when there is a data service, and the scanning service is executed in the idle time period when there is no data service, thereby reducing the probability of data retransmission caused by the scanning service occupying the air interface and avoiding audio service playback jams. At the same time, it reduces the power consumption loss and hardware resource occupation of Bluetooth devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a schematic diagram of the implementation process of traditional scanning services;
[0020] Figure 2 This is a schematic diagram of a first process of a Bluetooth scanning method in an embodiment of the present application;
[0021] Figure 3 This is a schematic diagram of the composition structure of the data transmission time slot in the embodiment of the present application;
[0022] Figure 4 This is a schematic diagram of the transition between the sending state and the receiving state of the slave device in an embodiment of the present application;
[0023] Figure 5 This is a schematic diagram of the idle time period position of the data service in the embodiment of the present application;
[0024] Figure 6 A schematic diagram of the location of the scanning start time point of a traditional scanning service;
[0025] Figure 7 A schematic diagram of the location of the scanning start time point of the scanning service in an embodiment of the present application;
[0026] Figure 8 This is a second flow chart of the Bluetooth scanning method in an embodiment of the present application;
[0027] Fig. 9 This is a schematic diagram of the structure of a Bluetooth scanning device in an embodiment of the present application;
[0028] Fig.10 Schematic diagram of the structure of the Bluetooth scanning device in the embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.
[0030] Page is called connection / paging, which refers to the operation of the master device (master) connecting / activating the corresponding slave device (slave).
[0031] Page Scan is called paging scan. This state corresponds to page and refers to the state of the slave device waiting to be connected.
[0032] Inquiry refers to the state of a Bluetooth device that actively initiates inquiries about surrounding devices. When a connection is established, the device is called the master device.
[0033] Inquiry Scan is called inquiry scan, which refers to the state of a Bluetooth device that can be searched by the master device. When a connection is established, the device is called a slave device.
[0034] BLE Scan is a low-power inquiry scan that scans for low-power Bluetooth devices in the surrounding environment.
[0035] Common inquiry scans include active scans and passive scans. The active scan process receives the broadcast data packets sent by the peer device through the scan service receiving channel and sends a scan response data packet to the peer device. The passive scan process receives the broadcast data packets sent by the peer device.
[0036] Channel scan is called channel scanning. The master and slave devices need to perform channel scanning regularly to evaluate the channel quality.
[0037] Figure 2 Schematic diagram of the first process of the Bluetooth scanning method in the embodiment of the present application. Figure 2 As shown, the method may specifically include:
[0038] Step 201: When a scanning service trigger command is obtained, monitoring whether there is a data service in the data receiving time slot;
[0039] It should be noted that the scanning service trigger command is used to trigger the electronic device to perform a scanning service. Exemplarily, the scanning service includes at least one of the following: channel scan, page scan, inquiry scan, or Bluetooth Low Energy scan (BLE scan), etc.
[0040] In some embodiments, the Bluetooth scanning behavior of the electronic device is determined by the Bluetooth host. The host sends a trigger command to execute the scanning behavior to the Bluetooth controller. The controller arranges the priority of each event according to its own business priority. The priority of the traditional Bluetooth scanning service is higher than the priority of the data service. That is to say, when the preset time point is reached, the scanning service event will be completed first, and then the data service event will be performed, which will cause frequent packet loss and frequent retransmission of data packets of the data service.
[0041] It should be noted that since the scanning service also needs to receive the data packets of the scanning service, in order to avoid conflicts with the data packets of the received data service, in the data receiving time slot, it is first monitored whether there are data packets of the data service to determine whether the opposite device sends the data packets of the data service. In some embodiments, when there is a data service, the priority of the data service is higher than the priority of the scanning service, and the data packets of the data service are received first; when there is no data service, the scanning service is performed in the idle time period, which reduces the probability of data retransmission caused by the scanning service occupying the air interface.
[0042] In some embodiments, the data packet header is monitored to determine whether there is data service. Exemplarily, when the data packet header of the data service is received, it is determined that the data service is monitored; when the data packet header of the data service is not received, it is determined that the data service is not monitored.
[0043] In some embodiments, the data receiving time slot includes a first time period and a second time period, the first time period is located before the second time period, and whether there is data service in the first time period is monitored, and if data service is detected in the first time period, the data service is continued in the second time period. If no data service is detected in the first time period, the second time period can be used as an idle time period to perform scanning services.
[0044] In some embodiments, monitoring whether there is a data service in the first time period of the data receiving time slot includes: opening a data service receiving path in the first time period of the data receiving time slot; monitoring whether a data packet header of the data service is received through the data service receiving path; determining that the data service is monitored when the data packet header of the data service is received; and determining that the data service is not monitored when the data packet header of the data service is not received.
[0045] That is, when a data packet header is received in the first time period, the device continues to receive data packets in the second time period until the data packet reception is completed, thereby achieving normal reception of data packets. When no data packet header is received in the first time period, the second time period is an idle time period, and performing scanning services in the idle time period will not affect the normal reception of data packets.
[0046] It should be noted that the data transmission time slots include data receiving time slots and data sending time slots, and the data receiving time slots and the data sending time slots are distributed at intervals. Figure 3 Schematic diagram of the composition structure of the data transmission time slot in the embodiment of the present application, such as Figure 3 As shown, after the slave device and the master device establish a connection, they will work in time division in the form of odd and even time slots. The length of each time slot is 625us, and the front 110us of each time slot is used to send / receive the packet header. That is to say, the data receiving time slot length is 625us, the first time slot length is 110us, and the second time slot length is 515us. For example, the master device can send data to the slave device in an odd time slot (k+2i), and the slave device can reply data to the master device in an even time slot (k+2i+1), where k is an integer greater than 0, and i is an integer greater than or equal to 0. It can be understood that for the master device, the odd time slot is a data sending time slot, and the even time slot is a data receiving time slot. For the slave device, the odd time slot is a data receiving time slot, and the even time slot is a data sending time slot.
[0047] When the master device sends data to the slave device, the slave device must be in the receiving state to receive the data normally; when the slave device replies with data, it will switch to the transmitting state. The slave device will not actively send data to the master device. If there is data to be sent to the master device, it must reply to the master device after the master device sends data to the slave device. Therefore, the conversion between the receiving state (RX) and the transmitting state (TX) of the slave device is as follows: Figure 4 As shown, after the slave device receives the data sent by the master device in the RX state in k odd time slots, it sends data to the master device in the TX state in k+1 even time slots. The slave device receives the data sent by the master device in the RX state in 5 consecutive time slots from k+6 to k+10, and can also send data to the master device in the TX state in 3 consecutive time slots from k+11 to k+13.
[0048] Step 202: When a data service is detected, execute the data service;
[0049] Furthermore, executing the data service may include: receiving a data packet of the data service through a data service receiving path in a second time period of the data receiving time slot; and closing the data service receiving path when the data packet of the data service is received.
[0050] Step 203: when no data service is detected, determining an idle time period of the data service;
[0051] In some embodiments, the data transmission time slot includes a data reception time slot and a data transmission time slot, the data reception time slot and the data transmission time slot are spaced apart, and the idle time period includes the second time period of the data reception time slot and the data transmission time slot after the data reception time slot.
[0052] Since the actual transmission data service does not completely occupy the entire time slot, for example, when the peer device transmits audio data, it packages the audio data buffer into data packets of a certain size and sends them out together, so there is no data transmission in many time slots. Figure 5 FIG. 1 is a schematic diagram of the idle time period of data services in the embodiment of the present application. Figure 5As shown, it can be seen that the master device does not send data to the slave device in the k+2 odd time slot, so the slave device opens the receiving path (RX path) at the beginning of the odd time slot, but does not receive a valid data packet header until the end of the data packet header, which means that the master device will not send data to the slave device in the entire odd time slot k+2. At the same time, the slave device can only reply to the data packet (packet) to the master device after receiving the data packet sent by the master device, so the slave device will not send data to the master device in the entire even time slot k+3. Therefore, from the beginning of the k+2 odd time slot when the slave device closes the RX path to the end of the k+3 even time slot, it is an idle time period for the slave device. Similarly, from the beginning of the k+4 odd time slot when the slave device closes the RX path to the end of the k+5 even time slot, it is an idle time period for the slave device. This idle time period lasts for about 625us*2-packet header 100us=1150us. That is to say, if the master device does not send a data packet during the master device's sending time slot, and no master device will send a data packet during the next slave device's sending time slot, then the master device's sending time slot (except the time when the slave device receives the data packet header) and the slave device's next sending time slot are both idle time periods of the slave device, and the scan service is performed during the idle time period.
[0053] Step 204: Perform scanning service in the idle time period.
[0054] Specifically, the scanning service is performed in at least one idle time period. It should be noted that one idle time period may not be able to perform a scanning service completely, so one or more idle time periods are required to perform the scanning service.
[0055] In some embodiments, when a scanning service trigger command is obtained, the method may further include: obtaining scanning configuration information of the scanning service; and executing the scanning service in at least one idle time period according to the scanning configuration information.
[0056] The scanning configuration information includes at least one of the following:
[0057] Scan type, for example, set to active scan, passive scan, standard type, Interlace type, etc.;
[0058] Scanning interval, how long does it take to scan once?
[0059] Scan window, the duration of each scan;
[0060] Scanning policy, for example, accept any broadcast packets or only accept broadcast packets from whitelisted devices.
[0061] In some embodiments, the Bluetooth scanning behavior of the electronic device is determined by the Bluetooth host. The host sends a scanning behavior trigger command and scanning configuration information to a Bluetooth controller. The controller performs the scanning service in at least one idle time period determined according to the scanning configuration information.
[0062] In some embodiments, the scanning configuration information at least includes a scanning window. Exemplarily, performing a scanning service in at least one idle time period according to the scanning configuration information includes: when the idle time period is greater than or equal to the scanning window, starting from the scanning start time point, performing a scanning service of the scanning window in the idle time period.
[0063] Exemplarily, based on the scanning configuration information, a scanning service is performed in at least one idle time period, including: determining a scanning start time point of a scanning window based on the idle time period; when the idle time period is smaller than the scanning window, dividing the scanning window into at least two scanning sub-windows based on the length of the idle time period; starting from the scanning start time point, performing scanning services corresponding to at least two scanning sub-windows in segments in at least two idle time periods.
[0064] It should be noted that when the length of the scanning window is less than or equal to the idle time period, the scanning service of one scanning window can be completed in one idle time period. When the length of the scanning window is greater than the idle time period, the scanning window is divided into at least two scanning sub-windows according to the idle time period, and the scanning service of one scanning window is completed in at least two idle time periods. Among them, the length of one scanning sub-window is less than or equal to the length of one idle time period.
[0065] In some embodiments, the scanning configuration information also includes a scanning start time point. The method also includes: adjusting the scanning start time point according to the idle time period, and determining a new scanning start time point. Exemplarily, the scanning start time point may be a start time point of the idle time period. In other embodiments, the scanning start time point may also be any time point within the idle time period.
[0066] In the traditional solution, the controller will start executing at the scanning start time sent by the host, that is, the host sends and the controller executes at the same time. However, the air interface may not be idle at the scanning start time sent by the host. Therefore, if the scanning service is started directly according to the scanning start time sent by the host, data service interruption and data packet transmission failure may occur. For example, Figure 6As shown in the figure, the slave device is in the BLE scan state for more than 2 slots. During this time, the master device fails to transmit data packet #1 sent at time k+2, and retransmits data packet #1 at time k+4, which is not until data packet #1 is successfully retransmitted at time k+6.
[0067] In the Bluetooth scanning solution provided in the embodiment of the present application, the starting time point of the scanning window is not the starting time point of the data receiving time slot, but the starting time point of the idle time period, such as Figure 7 As shown. Furthermore, if the scan window length is long, the controller selects an idle time point according to the scan configuration information sent by the host and the current air interface information (i.e., data service monitoring results) to complete the scan behavior in segments. At the odd time point k+2, the controller will first open the data receiving channel to detect whether there is a data packet header before executing the scan behavior to determine whether the master device has sent a data packet to the slave device. When it is determined that a data packet is sent, the slave device continues to receive the data packet state, thereby achieving normal reception of data packet #1. When it reaches the next odd time point k+4, the controller will also open the data receiving channel to detect whether there is a data packet header before executing the scan behavior. This process will last for about 100us. The controller will only execute the BLE scan when no data packet header is detected. Since a BLE scan will last for more than 2 slots, the traditional solution will also affect the reception of the k+6 time data packet. Therefore, it is proposed to complete the BLE Scan in segments, and interrupt the scan when the k+5 time slot end time point is reached, and retain the scan state. Then at the start time k+6, the controller will also open the data receiving channel to detect whether there is a packet header. If there is a packet service, the BLE scan will not be executed. It will be executed only if there is no BLE scan.
[0068] In some embodiments, the method further includes: when no data service is detected, closing the data service receiving path and opening the scanning service receiving path; and executing the scanning service in at least one idle time period according to the scanning configuration information through the scanning service receiving path.
[0069] The scanning service receiving channel is used to receive a data packet of the scanning service. Exemplarily, the data packet of the scanning service may be a broadcast data packet sent by the opposite end device or a specific data packet for the scanning service.
[0070] In some embodiments, after receiving the data packet of the scanning service, the method further includes: sending a response data packet to the opposite device.
[0071] The Bluetooth scanning method provided in the embodiment of the present application can be applied to any electronic device that performs Bluetooth connection, and the electronic device can be used as a master device or a slave device. The electronic device can include, for example, a mobile phone, a tablet computer, a laptop computer, a PDA, a wearable device, etc.
[0072] By adopting the above technical solution, before executing the scanning service, the priority of data service and data service is dynamically adjusted according to the air interface status. When there is data service, data service is executed first. When there is no data service, scanning service is executed in the idle time period according to the scanning configuration information, which reduces the probability of data retransmission caused by the scanning service occupying the air interface and avoids the jamming of audio service playback. At the same time, it reduces the power consumption loss and hardware resource occupation of Bluetooth devices.
[0073] Figure 8 : is a second flow chart of the Bluetooth scanning method in the embodiment of the present application, such as Figure 8 As shown, the method may specifically include:
[0074] Step 801: Obtain a trigger command and scanning configuration information for a scanning service;
[0075] In some embodiments, when a trigger command for a scanning service is obtained, the number of interruptions of the scanning service is initialized.
[0076] Step 802: monitor whether there is data service in the current data receiving time slot; if not, execute step 803; if yes, execute step 805;
[0077] Exemplarily, the host sends a trigger command and scan configuration information to the controller through the HCI command, and the controller monitors whether there is any data service on the air interface. If there is no data service, the scan service is executed during the idle time period according to the scan configuration information, which neither occupies unnecessary air interface behavior nor affects the transmission of the original normal data service.
[0078] After the slave device and the master device establish a connection, they will work in time division according to the odd-even time slot method. For example, it can be understood that for the master device, the odd time slot is the data transmission time slot, and the even time slot is the data reception time slot. For the slave device, the odd time slot is the data reception time slot, and the even time slot is the data transmission time slot.
[0079] Step 803: when no data service is detected, determining an idle time period corresponding to the current data receiving time slot;
[0080] Step 804: Execute a scanning service in an idle time period corresponding to the current data receiving time slot according to the scanning configuration information;
[0081] In some embodiments, the scan behavior is segmented and completed in multiple idle time periods, which neither occupies redundant air interface behaviors nor affects the transmission of original normal data services. Exemplarily, the starting time point of the idle time period corresponding to the current data receiving time slot is determined as the starting time point of the scan window (or scan sub-window).
[0082] In some embodiments, the method further includes obtaining interruption information of the scanning service, and executing the scanning service in the idle time period corresponding to the current data receiving time slot according to the interruption information. It should be noted that the interruption information here can be the interruption information caused by the interruption of the scanning service caused by the data service, or the interruption information corresponding to the end of each idle time period when the scanning service segment is connected.
[0083] Step 805: When a data service is detected, the scanning service is interrupted and the data service is executed;
[0084] In some embodiments, the method further includes: saving interrupt information corresponding to the current data receiving time slot. It should be noted that the interrupt information may be the interrupt information corresponding to the end of the last idle time period.
[0085] Step 806: the number of interruptions of the scanning service is incremented by 1;
[0086] Step 807: Determine whether the number of interruptions of the scanning service is greater than the number threshold; if not, continue to step 802; if yes, execute step 808;
[0087] It should be noted that determining whether the number of interruptions of the scanning service is greater than the number threshold can also be understood as being executed before step 802, that is, before each monitoring of whether there is data service in the data receiving time slot, it is first determined whether the number of interruptions is greater than the number threshold, and whether to execute the data service detection operation is determined based on the judgment result.
[0088] In some embodiments, the method further includes: when the current scanning service is completed or the scanning task of the current scanning window is completed, the number of interruptions is set to 0.
[0089] Step 808: Execute the scanning service in the next data receiving time slot.
[0090] Exemplarily, the starting time point of the next data receiving time slot is determined to be the starting time point of the scanning window (or scanning sub-window). That is, in the next data receiving time slot, there is no need to monitor whether there is data service, but directly execute the scanning service of the remaining scanning windows, or the scanning service of the remaining scanning sub-windows in the current scanning window.
[0091] It should be noted that by lowering the scan priority, that is, the scan priority is lower than the data service priority, the data service is guaranteed to be transmitted first and the user experience is optimized. For example, one scenario is that the stuttering of listening to music with Bluetooth headphones is reduced. At the same time, in order to ensure the normal scan service, the typical scenario is the interconnection discovery service. A method is proposed to gradually increase the priority of the scan service after it is interrupted. When the priority reaches the threshold (for example, it is interrupted more than 5 times), the scan service will be forced to execute, so that both data and scan services are taken into account.
[0092] To implement the method of the embodiment of the present application, based on the same inventive concept, the embodiment of the present application also provides a Bluetooth scanning device, such as Fig. 9 As shown, the Bluetooth scanning device 90 includes:
[0093] A monitoring unit 901 is used to monitor whether there is a data service in a data receiving time slot when a trigger command for scanning the service is obtained;
[0094] The data service processing unit 902 is used to execute the data service when the monitoring unit 901 detects the data service;
[0095] The monitoring unit 901 is further configured to determine an idle time period of the data service when no data service is monitored;
[0096] The scanning service processing unit 903 is configured to execute the scanning service in an idle time period.
[0097] In some embodiments, the data receiving time slot includes a first time period and a second time period, the first time period is located before the second time period,
[0098] The monitoring unit 901 is used to monitor whether there is a data service in the first time period of the data receiving time slot.
[0099] In some embodiments, the monitoring unit 901 is used to open a data service receiving path in a first time period; monitor whether a data packet header of the data service is received through the data service receiving path; when a data packet header of the data service is received, determine that the data service is monitored; when a data packet header of the data service is not received, determine that the data service is not monitored.
[0100] In some embodiments, the data service processing unit 902 is used to receive data packets of the data service through the data service receiving path in the second time period of the data receiving time slot; when the reception of the data packets of the data service is completed, close the data service receiving path.
[0101] In some embodiments, the data service processing unit 902 is used to close the data service receiving path when no data service is detected.
[0102] The scanning service processing unit 903 is used to open a scanning service receiving path; and execute the scanning service in an idle time period through the scanning service receiving path.
[0103] In some embodiments, the data transmission time slot includes a data reception time slot and a data transmission time slot, the data reception time slot and the data transmission time slot are spaced apart, and the idle time period includes the second time period of the data reception time slot and the data transmission time slot after the data reception time slot.
[0104] In some embodiments, the Bluetooth scanning device 90 includes: a scanning service processing unit 903, which is used to obtain scanning configuration information; and perform a scanning service in at least one idle time period according to the scanning configuration information.
[0105] In some embodiments, the scanning configuration information at least includes a scanning window, and a scanning service processing unit 903 is used to execute the scanning service of the scanning window in the idle time period when the idle time period is greater than or equal to the scanning window.
[0106] In some embodiments, the scanning configuration information includes at least a scanning window and a scanning service processing unit 903, which is used to divide the scanning window into at least two scanning sub-windows according to the length of the idle time period when the idle time period is smaller than the scanning window; and to execute the scanning services corresponding to at least two scanning sub-windows in segments in at least two idle time periods.
[0107] In some embodiments, the data service processing unit 902 is further configured to interrupt the scanning service when the monitoring unit 901 detects the data service;
[0108] The scanning service processing unit 903 is used to perform the scanning service in the idle time period corresponding to the current data receiving time slot when the monitoring unit 901 does not monitor the data receiving service;
[0109] The monitoring unit 901 is further configured to continue monitoring whether there is data service in the next data receiving time slot.
[0110] The monitoring unit 901 is also used to initialize the number of interruptions of the scanning service when a trigger command for the scanning service is obtained; when a data service is monitored, the number of interruptions of the scanning service is incremented by 1; when the number of interruptions of the scanning service is greater than the number threshold, the scanning service processing unit 903 is instructed to execute the scanning service in the next data receiving time slot.
[0111] In practical applications, the above device can be an electronic device or a chip applied to an electronic device. In the present application, the device can realize the functions of multiple units by software, hardware, or a combination of software and hardware, so that the device can execute the Bluetooth scanning method provided in any of the above embodiments. The technical effects of each technical solution of the device can refer to the technical effects of the corresponding technical solution in the Bluetooth scanning method, and this application will not elaborate on this one by one.
[0112] Based on the hardware implementation of each unit in the above Bluetooth scanning, the embodiment of the present application also provides a Bluetooth scanning device, such as Fig.10 As shown, the Bluetooth scanning device 100 includes: a processor 1010 and a memory 1020. The processor 1010 is configured to execute the method steps in the above-mentioned embodiment when calling and running a computer program from the memory 1020.
[0113] The memory 1020 may be a separate device independent of the processor 1010 , or may be integrated into the processor 1010 .
[0114] Optionally, the Bluetooth scanning device 100 may further include an input interface 1030. The processor 1010 may control the input interface 1030 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0115] Optionally, the Bluetooth scanning device 100 may be a Bluetooth scanning device used in a foldable electronic device and may further include an output interface 1040. The processor 1010 may control the output interface 1040 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0116] Optionally, the Bluetooth scanning device 100 can implement the corresponding processes of each method of the embodiment of the present application, which will not be described here for brevity. The Bluetooth scanning device 100 can be a foldable electronic device, or a chip used in a foldable electronic device.
[0117] Of course, in practical applications, Fig.10 As shown, the various components in the Bluetooth scanning device are coupled together through a bus system. It can be understood that the bus system is used to realize the connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Fig.10 In the specification, various buses are labeled as bus systems.
[0118] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.
[0119] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.
[0120] In an exemplary embodiment, the present application also provides a computer-readable storage medium, such as a memory including a computer program, and the computer program can be executed by a processor of a Bluetooth scanning device to complete the steps of the aforementioned method.
[0121] An embodiment of the present application also provides a computer program product, including computer program instructions.
[0122] Optionally, the computer program product can be applied to the Bluetooth scanning device in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the Bluetooth scanning device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0123] The embodiment of the present application also provides a computer program.
[0124] Optionally, the computer program can be applied to the Bluetooth scanning device in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes implemented by the Bluetooth scanning device in the various methods of the embodiments of the present application. For the sake of brevity, they will not be repeated here.
[0125] It should be understood that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0126] It should be understood that the terms used in the present application are only for the purpose of describing specific embodiments, but are not intended to limit the present application. The singular forms of "a", "said" and "the" used in the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items. The expressions "having", "may have", "include" and "include", or "may include" and "may include" in this application can be used to indicate the presence of corresponding features (e.g., elements such as numerical values, functions, operations or components), but the presence of additional features is not excluded.
[0127] It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other and are not necessarily used to describe a specific order or sequence. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
[0128] The technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0129] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and equipment can be implemented in other ways. The embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0130] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0131] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0132] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A Bluetooth scanning method, It is characterized in that The method comprises: When a trigger command for scanning services is obtained, monitoring whether there is data services in the data receiving time slot; When the data service is detected, executing the data service; In the case where the data service is not monitored, determining an idle time period of the data service; The scanning service is performed during the idle time period.
2. The method according to claim 1, It is characterized in that The data receiving time slot includes a first time period and a second time period, the first time period is located before the second time period, The monitoring of whether there is data service in the data receiving time slot includes: In the first time period of the data receiving time slot, monitoring is performed to determine whether there is data traffic.
3. The method according to claim 2, It is characterized in that The monitoring whether there is data service in the first time period of the data receiving time slot includes: In the first time period, opening a data service receiving channel; Monitoring whether a data packet header of the data service is received through the data service receiving path; When receiving a data packet header of the data service, determining that the data service is monitored; When the data packet header of the data service is not received, it is determined that the data service is not monitored.
4. The method according to claim 3, It is characterized in that The executing the data service includes: In the second time period of the data receiving time slot, receiving a data packet of the data service through the data service receiving path; When the data packet reception of the data service is completed, the data service receiving path is closed.
5. The method according to claim 3, It is characterized in that The method further comprises: When the data service is not detected, closing the data service receiving path and opening the scanning service receiving path; The scanning service is performed during the idle time period through the scanning service receiving path.
6. The method according to claim 2, It is characterized in that The data transmission time slot includes the data receiving time slot and the data sending time slot, and the data receiving time slot and the data sending time slot are distributed at intervals. The idle time period includes the second time period of the data reception time slot and a data transmission time slot after the data reception time slot.
7. The method according to any one of claims 1 to 6, It is characterized in that In the case where a scanning service trigger command is obtained, the method further includes: Get scan configuration information; The performing of the scanning service in the idle time period includes: The scanning service is performed in at least one of the idle time periods according to the scanning configuration information.
8. The method according to claim 7, It is characterized in that The scanning configuration information includes a scanning window, The performing the scanning service in at least one idle time period according to the scanning configuration information includes: When the idle time period is greater than or equal to the scanning window, a scanning service of the scanning window is performed in the idle time period.
9. The method according to claim 7, It is characterized in that The scanning configuration information includes a scanning window, The performing the scanning service in at least one idle time period according to the scanning configuration information includes: When the idle time period is smaller than the scanning window, dividing the scanning window into at least two scanning sub-windows according to the length of the idle time period; The scanning services corresponding to the at least two scanning sub-windows are executed in segments during at least two of the idle time periods.
10. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: When the data service is detected, interrupting the scanning service; When the data receiving service is not detected, executing the scanning service in the idle time period corresponding to the current data receiving time slot; Continue to monitor whether there is data service during the next data receiving time slot.
11. The method according to claim 10, It is characterized in that The method further comprises: When a trigger command for a scanning service is obtained, initializing the number of interruptions of the scanning service; When the data service is detected, the number of interruptions of the scanning service is incremented by 1; When the number of interruptions of the scanning service is greater than a number threshold, the scanning service is executed in the next data receiving time slot.
12. A Bluetooth scanning device, It is characterized in that The Bluetooth scanning device comprises: A monitoring unit, configured to monitor whether there is data service in a data receiving time slot when a trigger command for scanning service is obtained; a data service processing unit, configured to execute the data service if the monitoring unit detects the data service; The monitoring unit is further configured to determine an idle time period of the data service when the data service is not monitored; The scanning service processing unit is used to execute the scanning service in the idle time period.
13. A Bluetooth scanning device, It is characterized in that The Bluetooth scanning device comprises: a processor and a memory, Wherein, the processor is configured to execute the steps of the method described in any one of claims 1 to 11 when calling and running a computer program from the memory.
14. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
