Method and device for processing Bluetooth broadcast request

By entering the waiting state in the Bluetooth monitor and monitoring the call information, the Bluetooth broadcast request is not processed until the Bluetooth status is updated to be available, which solves the problem of packet loss caused by the unavailability of Bluetooth broadcast and improves the processing reliability of Bluetooth broadcast requests.

CN118540684APending Publication Date: 2024-08-23HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410662215.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-10
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Bluetooth broadcast is temporarily unavailable during the startup or stop process, causing the received Bluetooth broadcast request to be discarded, resulting in the loss of some Bluetooth messages.

Method used

Enter the waiting state through the Bluetooth monitor, monitor the call information sent by Bluetooth, and only respond to the Bluetooth broadcast request when the Bluetooth status is updated to be available, avoiding discarding requests in the unavailable state and reducing message loss.

Benefits of technology

This effectively avoids packet loss caused by the unavailability of Bluetooth broadcasts, and improves the processing reliability and availability of Bluetooth broadcast requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540684A
    Figure CN118540684A
Patent Text Reader

Abstract

The embodiment of the invention provides a method and equipment for processing a Bluetooth broadcast request, relates to a Bluetooth technology, and is used for solving the problem that a Bluetooth broadcast request triggered in a first Bluetooth broadcast state of Bluetooth may be discarded, resulting in the loss of a part of Bluetooth messages. The method is applied to the electronic equipment, and comprises the following steps: in response to a first Bluetooth broadcast request, a Bluetooth monitor acquires a current Bluetooth broadcast state stored in the Bluetooth monitor; when the current Bluetooth broadcast state is the first Bluetooth broadcast state, the Bluetooth monitor enters a first waiting state; the first Bluetooth broadcast state comprises a starting state or a stopping state; in the first waiting state, the Bluetooth monitor monitors calling information sent by Bluetooth; and after calling success information sent by the Bluetooth is received, the Bluetooth monitor updates the current Bluetooth broadcast state to an idle state or a broadcast state, and the Bluetooth monitor responds to the first Bluetooth broadcast request and executes a Bluetooth broadcast operation.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202310154910.4, and the original application date is February 10, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field

[0002] The present application relates to Bluetooth technology, and more particularly to a method and device for processing Bluetooth broadcast requests. Background Art

[0003] Bluetooth broadcast is the core of self-discovery and self-organizing network between terminals. Proximity discovery between devices and various upper-layer services all rely on Bluetooth broadcast. Therefore, the high reliability and high availability of Bluetooth broadcast are related to whether it can bring users the ultimate near-field device interaction experience.

[0004] Bluetooth provides an application programming interface (API) for starting and stopping. However, there is still a short period of unavailability between calling the Bluetooth broadcast start API and the Bluetooth broadcast start success, and between calling the Bluetooth broadcast stop API and the Bluetooth broadcast stop success.

[0005] In the related art, if a Bluetooth broadcast request is received in the above unavailable state, since the current Bluetooth broadcast is unavailable, this part of the Bluetooth broadcast request may be discarded, resulting in the problem of some Bluetooth messages being lost. Summary of the invention

[0006] The embodiments of the present application provide a method and device for processing a Bluetooth broadcast request, which are used to solve the problem that a Bluetooth broadcast request triggered in a first Bluetooth broadcast state may be discarded, resulting in the loss of some Bluetooth messages.

[0007] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0008] In a first aspect, a method for processing a Bluetooth broadcast request is provided, the method being applied to an electronic device; the electronic device comprises Bluetooth and a Bluetooth monitor, the electronic device calls a Bluetooth interface through the Bluetooth monitor, the method comprising:

[0009] In response to the first Bluetooth broadcast request, the Bluetooth monitor obtains the current Bluetooth broadcast state saved in the Bluetooth monitor. When it is determined that the current Bluetooth broadcast state is the first Bluetooth broadcast state, it indicates that the current Bluetooth broadcast is unavailable, so the Bluetooth monitor enters the first waiting state for the first Bluetooth broadcast request; the first Bluetooth broadcast state includes a starting state or a stopping state. In the first waiting state, the Bluetooth monitor monitors the call information sent by Bluetooth. When monitoring the call success information of Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state to the second Bluetooth broadcast state, indicating that the current Bluetooth broadcast is updated to an available state. At this point, the Bluetooth monitor can perform a Bluetooth broadcast operation in response to the first Bluetooth broadcast request. Among them. The call information includes a call success information, and the call success information is used to indicate that the Bluetooth broadcast start interface call is successful, or the Bluetooth broadcast stop interface call is successful; the second Bluetooth broadcast state includes an idle state or a broadcasting state.

[0010] In this solution, the first Bluetooth broadcast request received when the Bluetooth broadcast is unavailable will not be discarded directly, but will wait for a period of time. After receiving the call success information fed back by Bluetooth, the Bluetooth broadcast state will be updated to the available state (the second Bluetooth broadcast state), and the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request can be executed. In this way, the Bluetooth broadcast request can be prevented from being discarded due to the current Bluetooth broadcast being unavailable, and the loss of Bluetooth broadcast messages can be reduced.

[0011] In some possible implementations, after the Bluetooth monitor enters the first waiting state, the method further includes: in the first waiting state, the Bluetooth monitor obtains the first dwell time of the Bluetooth in the first Bluetooth broadcast state; if the first dwell time does not exceed the first preset time, the Bluetooth monitor maintains the first waiting state. In this way, it can be ensured that the current Bluetooth broadcast state can be updated to an available state in the first waiting state.

[0012] In some possible implementations, after the Bluetooth monitor enters the first waiting state, the above method further includes: in the first waiting state, if the first stay time exceeds the first preset time, the Bluetooth monitor calls the Bluetooth interface. Wherein, the first stay time of the Bluetooth broadcast state in the startup state exceeds the first preset time, and it is possible that the Bluetooth monitor has not received the call feedback information, or the Bluetooth fails. At this time, the Bluetooth monitor can directly call the Bluetooth broadcast stop interface to update the Bluetooth broadcast state to an accurate Bluetooth broadcast state. Similarly, when the first stay time of the Bluetooth broadcast state in the stopping state exceeds the first preset time, the Bluetooth monitor can directly call the Bluetooth broadcast start interface to update the Bluetooth broadcast state to an accurate Bluetooth broadcast state. In this way, the problem that the first Bluetooth broadcast request cannot be broadcast via Bluetooth for a long time can be avoided.

[0013] In some possible implementations, the method further includes: if the Bluetooth monitor monitors the first call success information indicating that the Bluetooth broadcast start interface call is successful, the current Bluetooth broadcast state can be updated to the broadcasting state. If the Bluetooth monitor receives the second call success information indicating that the Bluetooth broadcast stop interface call is successful, the Bluetooth monitor updates the current Bluetooth broadcast state to the idle state. In this way, in the first waiting state, the Bluetooth broadcast state will continue to be updated. Therefore, for the first Bluetooth broadcast request, the corresponding Bluetooth broadcast operation can be executed after the current Bluetooth broadcast state is updated to the available state.

[0014] In some possible implementations, after the Bluetooth monitor obtains the current Bluetooth broadcast state in response to the first Bluetooth broadcast request, the above method further includes: when it is determined that the current Bluetooth broadcast state is in an idle state, it indicates that the current Bluetooth broadcast can be used directly. At this time, the Bluetooth monitor calls the Bluetooth broadcast startup interface of Bluetooth in response to the first Bluetooth broadcast request; and the Bluetooth monitor updates the current Bluetooth broadcast state from an idle state to a starting state. After the Bluetooth monitor receives the first call success information fed back by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from a starting state to a broadcasting state; the first call success information is used to indicate that the Bluetooth broadcast startup interface call is successful. The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request; the updated broadcast message is used for Bluetooth broadcasting. If the first Bluetooth broadcast request is received in an idle state, the Bluetooth monitor can call the Bluetooth broadcast startup interface in response to the first Bluetooth broadcast request to broadcast the broadcast content corresponding to the first Bluetooth broadcast request.

[0015] In some possible implementations, after the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface of Bluetooth, the above method also includes: the Bluetooth monitor sets a first timer based on the to-be-broadcasted duration corresponding to the first Bluetooth broadcast request, and the first timer starts timing. In this way, the Bluetooth monitor can determine the remaining broadcast duration of the current Bluetooth broadcast according to the timing time of the first timer. In this implementation, after the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the above method also includes: when the remaining broadcast duration of the current Bluetooth is determined to be 0 according to the timing time of the first timer, it means that the current Bluetooth broadcast has been completed, and the Bluetooth monitor calls the Bluetooth broadcast stop interface of Bluetooth and updates the current Bluetooth broadcast state to the stopped state. And after receiving the second call success information fed back by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful. In this way, in the broadcasting state, it can be determined whether the Bluetooth broadcast is completed in combination with the timing time of the first timer, and when the Bluetooth broadcast is completed, the Bluetooth monitor calls the Bluetooth broadcast stop interface. Thereby, the problem of unnecessary power consumption caused by the Bluetooth broadcast still being in the broadcasting state after the Bluetooth broadcast is completed can be avoided.

[0016] In some possible implementations, before the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface of Bluetooth, the above method also includes: when it is determined that the current Bluetooth broadcast state is in an idle state, the Bluetooth monitor obtains the second stay time of Bluetooth in the idle state. In this implementation, the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface of Bluetooth, which can specifically include: when the Bluetooth monitor determines that the second stay time exceeds the second preset time, the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface of Bluetooth. In this solution, for the situation that the Bluetooth broadcast is still unavailable within a short period of time when the state of some Bluetooth broadcasts has just changed from the stopped state to the idle state, the Bluetooth monitor can also wait for a period of time. After the Bluetooth broadcast state is updated to the idle state for a period of time, the Bluetooth broadcast start interface is called in response to the first Bluetooth broadcast request. In this way, the problem of failure to call the Bluetooth broadcast start interface within a period of time when the Bluetooth broadcast state has just been updated to the idle state can be avoided.

[0017] In some possible implementations, the Bluetooth monitor calls the Bluetooth broadcast start interface of Bluetooth in response to the first Bluetooth broadcast request, which may specifically include: the Bluetooth monitor sends a call request for the Bluetooth broadcast start interface to Bluetooth. The call request includes a third preset time, and the third preset time is used to instruct Bluetooth to turn off the Bluetooth broadcast at a time point corresponding to the third preset time starting from the current time. In this solution, the Bluetooth monitor configures a time value for Bluetooth when calling the Bluetooth broadcast start interface. When the timer fails or other circumstances cause the Bluetooth monitor to fail to call the Bluetooth broadcast stop interface in time to turn off the Bluetooth broadcast after the Bluetooth broadcast is completed, the Bluetooth control can actively stop the Bluetooth broadcast after a period of time. In this way, unnecessary power consumption can be avoided.

[0018] In some possible implementations, after the Bluetooth monitor obtains the current Bluetooth broadcast state in response to the first Bluetooth broadcast request, the above method further includes: when it is determined that the current Bluetooth broadcast state is in a broadcasting state, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request. The updated broadcast message is used for Bluetooth broadcasting. In this way, the Bluetooth broadcast request can be responded to quickly.

[0019] In some possible implementations, before the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the above method also includes: the Bluetooth monitor determines whether the broadcast content corresponding to the first Bluetooth broadcast request is a preset periodic broadcast; the preset periodic broadcast is used to instruct the Bluetooth monitor to restart the Bluetooth broadcast. Therefore, if the first Bluetooth broadcast request corresponds to the preset periodic broadcast, then if the current Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor needs to restart the Bluetooth broadcast. In this implementation, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, which may specifically include: the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request when it determines that the broadcast content corresponding to the first Bluetooth broadcast request is not the preset periodic broadcast.

[0020] In some possible implementations, before the Bluetooth monitor updates the Bluetooth broadcast message, the method further includes: the Bluetooth monitor obtains the timing time of the second timer; the timing time of the second timer is used to indicate the remaining broadcast duration of Bluetooth. In this implementation, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, which may specifically include: when it is determined according to the timing time of the timer that the remaining broadcast duration of the current Bluetooth exceeds the fourth preset time, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request; the fourth preset time is used to indicate the minimum broadcast duration required for the Bluetooth broadcast. Only when the remaining duration of the Bluetooth broadcast in the current broadcasting state is sufficient, the Bluetooth broadcast message will be updated based on the first Bluetooth broadcast request. In this way, the problem that the broadcast content corresponding to the first Bluetooth broadcast request cannot be received by other electronic devices due to the Bluetooth monitor shutting down the Bluetooth broadcast in response to the previous second Bluetooth broadcast request can be reduced. Ensure that the broadcast content corresponding to the first Bluetooth broadcast request can be received by other electronic devices in the current broadcasting state.

[0021] In some possible implementations, after the Bluetooth monitor obtains the timing time of the second timer, the above method further includes: when it is determined according to the timing time of the second timer that the remaining broadcast duration of the current Bluetooth does not exceed the fourth preset time, the Bluetooth monitor enters a second waiting state; in the second waiting state, the Bluetooth monitor listens to the call information of the Bluetooth feedback. After receiving the call success information of the Bluetooth feedback, the Bluetooth monitor updates the current Bluetooth broadcast state to an idle state, and the Bluetooth monitor responds to the first Bluetooth broadcast request and performs a Bluetooth broadcast operation. If the current Bluetooth broadcast state is a broadcasting state, but the current remaining broadcast duration is not enough to meet the minimum duration required for the Bluetooth broadcast, then for the first Bluetooth broadcast request, it is necessary to wait for the current Bluetooth broadcast to be completed, and after the Bluetooth broadcast state is updated to an idle state, the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request is executed. In this way, the broadcast content corresponding to the first Bluetooth broadcast request can be more likely to be received by other electronic devices, thereby improving the broadcast effect.

[0022] In some possible implementations, after the Bluetooth monitor obtains the current Bluetooth broadcast state in response to the first Bluetooth broadcast request, the above method further includes: when it is determined that the current Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request, and the third timer restarts the timing; the timing time of the third timer is used to indicate the remaining broadcast duration of the current Bluetooth. Wherein, after the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the above method further includes: when it is determined that the remaining broadcast duration of the current Bluetooth is 0 according to the timing time of the third timer, the Bluetooth monitor calls the Bluetooth broadcast stop interface of Bluetooth and updates the current Bluetooth broadcast state to the stopped state; after receiving the second call success information fed back by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful. When the first Bluetooth broadcast request is received in the broadcasting state, after the Bluetooth broadcast message is updated based on the first Bluetooth broadcast request, the Bluetooth broadcast can also be renewed according to the first Bluetooth broadcast request. In this way, the renewal of the Bluetooth broadcast can ensure that the broadcast content corresponding to the first Bluetooth broadcast request can be fully broadcast in the current broadcasting state, which can improve the broadcast effect.

[0023] In some possible implementations, the third timer is a countdown timer, and the countdown time of the countdown timer is used to indicate the remaining broadcast duration of the current Bluetooth. The above-mentioned Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request, including: the Bluetooth monitor obtains the pending broadcast duration corresponding to the first Bluetooth broadcast request; the Bluetooth monitor compares the countdown time with the pending broadcast duration. If the pending broadcast duration is greater than the countdown time, the Bluetooth monitor updates the countdown time of the current countdown timer to the pending broadcast duration corresponding to the first Bluetooth broadcast request. This ensures that the broadcast content corresponding to the first Bluetooth broadcast request is fully broadcast in the current broadcast state. If the countdown time is greater than the pending broadcast duration, it means that the broadcast content corresponding to the first Bluetooth broadcast request can be fully broadcast in the current broadcast state, so the timing time of the countdown timer can remain unchanged at this time.

[0024] In some possible implementations, after the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the above method further includes: when the third timer expires, the Bluetooth monitor calls the Bluetooth broadcast stop interface of Bluetooth and updates the current Bluetooth broadcast state to the stopped state. When the Bluetooth monitor receives the second call success information fed back by Bluetooth, the current Bluetooth broadcast state is updated from the stopped state to the idle state; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful. In this way, when the third timer expires, the Bluetooth broadcast can be turned off in time to avoid unnecessary power consumption caused by the failure of the third timer.

[0025] In some possible implementations, the method further includes: when it is determined that the broadcast content corresponding to the first Bluetooth broadcast request is a preset periodic broadcast, it indicates that the Bluetooth broadcast needs to be restarted. Therefore, at this time, the Bluetooth monitor calls the Bluetooth broadcast stop interface of Bluetooth and updates the current Bluetooth broadcast state from the broadcasting state to the stopped state. And when receiving the second call success information fed back by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state. In this solution, by setting a preset periodic broadcast, the Bluetooth broadcast is restarted at regular intervals. In this way, problems that may occur in Bluetooth due to long-term continuous broadcasting of Bluetooth broadcasts can be avoided.

[0026] In some possible implementations, the preset periodic broadcast is also used to broadcast the current device status information of the electronic device. In this implementation, after the Bluetooth monitor updates the current Bluetooth broadcast status from the stopped state to the idle state, the above method further includes: the Bluetooth monitor executes the broadcast operation corresponding to the preset periodic broadcast by calling the Bluetooth interface to broadcast the current device status information of the electronic device. In this solution, the preset periodic broadcast is set to broadcast the latest device status information of the mobile phone at every preset time interval, so that the connection between the mobile phone and other electronic devices can be maintained.

[0027] In a second aspect, an electronic device is provided, comprising: a processor and a memory; the memory is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory to enable the electronic device to perform a method for processing Bluetooth broadcast requests as described in any one of the above-mentioned first aspects.

[0028] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer can execute the method for processing a Bluetooth broadcast request described in any one of the first aspects.

[0029] In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute the method for processing a Bluetooth broadcast request described in any one of the above-mentioned first aspects.

[0030] In a fifth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.

[0031] Among them, the technical effects brought about by any design method in the second to fifth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;

[0033] Figure 2 A schematic diagram of the Bluetooth broadcast state provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0035] Figure 4A A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0036] Figure 4B A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0037] Figure 5A A time sequence diagram of processing when a Bluetooth monitor provided in an embodiment of the present application successively receives two Bluetooth broadcast requests;

[0038] Figure 5B A schematic diagram of a flow chart of a Bluetooth broadcast operation performed after a Bluetooth broadcast request is received in an idle state according to an embodiment of the present application;

[0039] Fig. 6A A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0040] Figure 6B A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0041] Figure 6CA flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0042] Figure 7 A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0043] Figure 8 A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0044] Fig. 9 A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0045] Fig. 10A A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0046] Fig. 10B A schematic diagram of restarting Bluetooth broadcast according to a preset periodic broadcast (heartbeat broadcast) provided in an embodiment of the present application;

[0047] Fig. 10C A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0048] Fig.11 A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0049] Fig.12 A flowchart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application;

[0050] Fig.13 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] In electronic devices that support Bluetooth function, the underlying Bluetooth hardware provides an API for starting and stopping. However, there is still a short period of unavailability between calling the Bluetooth broadcast start API and the Bluetooth broadcast starting success, and between calling the Bluetooth broadcast stop API and the Bluetooth broadcast stopping success.

[0052] In the related art, if a Bluetooth broadcast request is received in the above-mentioned Bluetooth broadcast unavailable state, since the current Bluetooth broadcast is unavailable, this part of the Bluetooth broadcast request may be discarded, resulting in the problem of some Bluetooth messages being lost.

[0053] In some embodiments, Figure 1As shown, a mobile phone 1 can establish an ad hoc network with electronic devices such as a tablet computer 2 and a laptop computer 3. After the mobile phone 1 establishes an ad hoc network with the tablet computer 2 and the laptop computer 3, the mobile phone 1 can synchronize data with the tablet computer 2 and the laptop computer 3. In the related art, after the ad hoc network is established, the communication between the mobile phone 1 and the tablet computer 2 and the laptop computer 3, such as data synchronization, synchronization of device status information, etc., can be achieved by Bluetooth broadcasting. In this scenario, for example, if the mobile phone 1 needs to notify other electronic devices in the ad hoc network of the current device status information of the mobile phone 1, a Bluetooth broadcast request will be triggered to the Bluetooth monitor of the mobile phone 1. However, if the Bluetooth monitor determines that the current Bluetooth hardware is in an unavailable state, the Bluetooth broadcast request may be discarded by the Bluetooth monitor. This may cause the Bluetooth broadcast message used to broadcast the current device status information of the mobile phone 1 to be lost, so that other electronic devices in the ad hoc network cannot obtain the latest device status information of the mobile phone 1.

[0054] like Figure 2 2 shows several different Bluetooth broadcast states in an embodiment of the present application. In the embodiment of the present application, the Bluetooth broadcast state includes an idle state 21, a starting state 22, a broadcasting state 23, and a stopping state 24. Figure 2 As shown, the update order of the above four Bluetooth broadcast states can usually be updated in the following order: from idle state 21 to starting state 22, from starting state 22 to broadcasting state 23, from broadcasting state 23 to stopped state 24, and from stopped state 24 to idle state 21. Usually, Bluetooth broadcast needs to be updated in the above order, and the states cannot be skipped or updated in reverse order.

[0055] The idle state of the Bluetooth broadcasting state indicates that the Bluetooth is not currently performing any Bluetooth broadcasting operation and is in an idle state. In the idle state, the Bluetooth monitor can call the Bluetooth broadcasting start interface in response to the Bluetooth broadcasting request.

[0056] The startup state indicates that the current Bluetooth is being started and is about to perform Bluetooth broadcasting. In some embodiments, in the idle state, after the Bluetooth monitor calls the Bluetooth broadcast startup interface, the Bluetooth monitor can update the Bluetooth broadcast state from the idle state to the startup state.

[0057] The broadcasting state indicates that the current Bluetooth is performing Bluetooth broadcasting. In some embodiments, after receiving feedback information that the Bluetooth broadcasting startup interface is successfully called in the startup state, the Bluetooth monitor can update the Bluetooth broadcasting state from the startup state to the broadcasting state.

[0058] The stopped state indicates that the current Bluetooth broadcast is completed and the Bluetooth broadcast is being closed. In some embodiments, in the broadcast state, after the Bluetooth monitor calls the Bluetooth broadcast stop interface, the Bluetooth monitor can update the Bluetooth broadcast state from the broadcast state to the stopped state.

[0059] Further, if the Bluetooth monitor receives feedback information that the Bluetooth broadcast stop interface call is successful in the stopped state, the Bluetooth monitor can update the Bluetooth broadcast state from the stopped state to the idle state. It should be understood that in other embodiments, the above-mentioned Bluetooth broadcast states can also be named by other names.

[0060] It can be seen from the above description that the Bluetooth broadcast state in the starting state corresponds to: the time period from the Bluetooth monitor calling the Bluetooth broadcast starting interface until the Bluetooth monitor receives the feedback information of the successful call of the Bluetooth broadcast starting interface. The Bluetooth broadcast state in the stopping state corresponds to: the time period from the Bluetooth monitor calling the Bluetooth broadcast stopping interface until the Bluetooth monitor receives the feedback information of the successful call of the Bluetooth broadcast stopping interface. When Bluetooth is in a normal state, the time between calling the interface and receiving the call feedback information is usually relatively short. In other words, the above-mentioned starting state and stopping state usually last for a short time. If, when a Bluetooth broadcast request is received, it is judged that the current Bluetooth broadcast state is in the two unavailable states of the above-mentioned starting state and stopping state, it means that Bluetooth is currently still executing the broadcast operation corresponding to the previous Bluetooth broadcast request, and Bluetooth broadcast is unavailable at the current moment. Since Bluetooth broadcast is unavailable, the newly received Bluetooth broadcast request may be discarded, resulting in the problem of Bluetooth message loss.

[0061] It should be noted that the above-mentioned Bluetooth broadcast status is saved in the Bluetooth monitor and updated by the Bluetooth monitor. Bluetooth broadcast unavailable specifically means that the Bluetooth monitor determines that the current Bluetooth broadcast status is unavailable based on the Bluetooth broadcast status saved in the Bluetooth monitor. In some scenarios, for example, if Bluetooth feeds back a call success message to the Bluetooth monitor, but the Bluetooth monitor fails to receive the call success message, the Bluetooth monitor fails to update the Bluetooth broadcast status saved in the Bluetooth monitor in time. At this time, it is possible that the Bluetooth broadcast status saved in the Bluetooth monitor is inconsistent with the actual Bluetooth broadcast status.

[0062] Based on this, the embodiment of the present application provides a method for processing a Bluetooth broadcast request, which can be applied to electronic devices supporting Bluetooth function; Figure 1The mobile phone 1, tablet computer 2 or laptop computer 3 shown in the figure, etc. In the method for processing the Bluetooth broadcast request provided in the embodiment of the present application, when the Bluetooth broadcast request is received, the Bluetooth monitor first obtains the current Bluetooth broadcast state. If the current Bluetooth broadcast state is in the starting state or the stopping state, the Bluetooth monitor will enter the waiting state. And, in the waiting state, the Bluetooth monitor continues to listen to the call information from the Bluetooth feedback. The Bluetooth broadcast state saved in the Bluetooth monitor can be updated based on the call information fed back by the Bluetooth. Then, when the Bluetooth monitor receives the call success information fed back by the Bluetooth, it updates the current Bluetooth broadcast state to the idle state or the broadcasting state, and then the Bluetooth monitor performs the corresponding Bluetooth broadcast operation in response to the Bluetooth broadcast request.

[0063] In this way, for a Bluetooth broadcast request received when the current Bluetooth is in an unavailable state (starting state or stopping state), the corresponding Bluetooth broadcast operation will be performed after the Bluetooth broadcast state is updated to an available state (idle state or broadcasting state). This prevents the Bluetooth broadcast request from being discarded due to Bluetooth broadcast being unavailable and reduces the loss of Bluetooth broadcast messages.

[0064] In some embodiments, the above-mentioned electronic device can specifically be a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as a cellular phone, a personal digital assistant (PDA), a wearable device, an augmented reality (AR) / virtual reality (VR) device, a media player, a television set and other devices. The embodiments of the present application do not impose any special restrictions on the specific form of the device.

[0065] like Figure 3The figure shows a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.

[0066] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0067] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the processing method of the Bluetooth broadcast request in the embodiment of the present application.

[0068] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0069] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0070] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.

[0071] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0072] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and an application required for at least one function (such as a sound playback function, an image playback function, etc.).

[0073] In addition, the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0074] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .

[0075] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

[0076] In some other embodiments, the power management module 141 may also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.

[0077] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0078] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0079] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.

[0080] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0081] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0082] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.

[0083] The audio module 170 is used to convert digital audio signals into analog audio signals for output, and is also used to convert analog audio inputs into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0084] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.

[0085] The touch sensor 180B is also called a "touch panel". The touch sensor 180B can be arranged on the display screen 194, and the touch sensor 180B and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180B can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0086] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0087] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.

[0088] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0089] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.

[0090] The camera 193 is used to capture still images or videos. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0091] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting or removing the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.

[0092] The methods for processing Bluetooth broadcast requests in the following embodiments can all be implemented in the electronic device 100 having the above hardware structure.

[0093] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100. Figure 4A It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0094] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime (Android runtime) and system library, and the kernel layer.

[0095] The application layer can include a series of application packages.

[0096] like Figure 4A As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, etc.

[0097] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0098] like Figure 4A As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0099] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0100] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0101] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0102] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).

[0103] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0104] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0105] The system library may include multiple functional modules, such as a surface manager, a media library, a 3D graphics processing library (such as OpenGL ES), a 2D graphics engine (such as SGL), etc.

[0106] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.

[0107] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0108] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0109] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0110] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0111] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0112] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0113] A 2D graphics engine is a drawing engine for 2D drawings.

[0114] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0115] like Figure 4B The following is a schematic diagram of some software architectures that may be involved in the embodiments of the present application. Super incoming calls, super connections, super notifications, and multi-screen collaboration represent the business modules of upper-layer applications. The self-discovery module is used for electronic devices to self-discover and self-organize networks with other electronic devices. The account authentication module is used to perform account authentication on electronic devices that perform self-organizing networks. The Bluetooth monitor is used to execute the processing method of Bluetooth broadcast requests provided in the embodiments of the present application.

[0116] The embodiment of the present application proposes a method for processing a Bluetooth broadcast request, which can be applied to a scenario where the interval between two adjacent Bluetooth broadcast requests is relatively close. Among them, when receiving a subsequent first Bluetooth broadcast request, the Bluetooth monitor has been performing a Bluetooth broadcast operation in response to a previous second Bluetooth broadcast request, and the current Bluetooth is in a starting state or a stopping state. At this time, for the subsequent first Bluetooth broadcast request, since the current Bluetooth broadcast state is in a starting state or a stopping state, the Bluetooth monitor will enter a waiting state. Under normal circumstances, during the Bluetooth broadcast operation performed by the Bluetooth monitor based on the previous second Bluetooth broadcast request, the Bluetooth broadcast state will continue to be updated. When waiting until the Bluetooth broadcast state is updated to a broadcasting state or an idle state, the Bluetooth monitor responds to the subsequent first Bluetooth broadcast request and performs the corresponding Bluetooth broadcast operation.

[0117] like Figure 5A The figure shows a processing time sequence diagram of the Bluetooth monitor provided by the embodiment of the present application receiving two Bluetooth broadcast requests in succession. Figure 5AIn the example shown, when the Bluetooth monitor receives the second Bluetooth broadcast request when the Bluetooth is in an idle state, the startup interface of the underlying Bluetooth hardware will be called in response to the second Bluetooth broadcast request, and the Bluetooth broadcast state will be updated from the idle state to the startup state. Combined with the above description, it can be seen that in response to the second Bluetooth broadcast request, the Bluetooth broadcast state will also be updated to the broadcasting state, the stopped state, etc. in sequence. When the Bluetooth broadcast state is updated to the started state or the stopped state in response to the second Bluetooth broadcast request, the Bluetooth monitor receives the first Bluetooth broadcast request. At this time, since the Bluetooth broadcast is unavailable, the Bluetooth monitor cannot immediately respond to the first Bluetooth broadcast request to perform the corresponding operation.

[0118] In the processing method of the Bluetooth broadcast request provided in the embodiment of the present application, if the Bluetooth monitor receives the first Bluetooth broadcast request when the Bluetooth broadcast state is in the starting state or the stopping state, the Bluetooth monitor will enter the waiting state for the first Bluetooth broadcast request. And in the waiting state, the Bluetooth monitor monitors the call information from the Bluetooth feedback in real time. The Bluetooth broadcast state stored in the Bluetooth monitor can be updated based on the call information of the Bluetooth feedback. And after the Bluetooth broadcast state is updated to the broadcasting state or the idle state, the Bluetooth monitor can perform the corresponding Bluetooth broadcast operation in response to the first Bluetooth broadcast request. In this way, the Bluetooth broadcast request received in the Bluetooth broadcast unavailable state can be avoided from being discarded, and the possibility of Bluetooth message loss can be reduced.

[0119] like Figure 5B The figure is a flow chart of a Bluetooth broadcast operation performed after a Bluetooth broadcast request is received in an idle state, provided in an embodiment of the present application.

[0120] S501. The Bluetooth monitor receives a Bluetooth broadcast request.

[0121] In some embodiments, the Bluetooth broadcast request may be specifically triggered by a user; for example, when a user wishes to transmit data to other electronic devices via Bluetooth, a Bluetooth broadcast request may be triggered. In other embodiments, some scheduled tasks may be set in the electronic device and need to be implemented via Bluetooth broadcast. In this embodiment, the Bluetooth monitor will receive Bluetooth broadcast requests triggered by scheduled tasks at regular intervals. It should be understood that in other embodiments, Bluetooth broadcast requests may also be triggered by other means.

[0122] S502. The Bluetooth monitor obtains the current Bluetooth broadcast status.

[0123] In some embodiments, the Bluetooth broadcast state can be stored in the storage space of the Bluetooth monitor. After receiving the Bluetooth broadcast request, the Bluetooth monitor will obtain the current Bluetooth broadcast state. Then, the response operation to the Bluetooth broadcast request will be determined according to the Bluetooth broadcast state.

[0124] S503. If the current Bluetooth broadcast state is idle, the Bluetooth monitor sends a call request of the Bluetooth broadcast start interface to the Bluetooth.

[0125] It is understandable that the call request of the Bluetooth broadcast start interface is used to request to call the broadcast start interface provided by Bluetooth. After receiving the call request, Bluetooth will start the Bluetooth broadcast. In some embodiments, if the current Bluetooth broadcast state is actually in the broadcast state, and the Bluetooth monitor requests to call the Bluetooth broadcast start interface, Bluetooth will feed back feedback information of the call error to the Bluetooth monitor.

[0126] S504: The Bluetooth monitor updates the current Bluetooth broadcast state to a starting state.

[0127] S505. The Bluetooth starts the Bluetooth broadcast in response to the call request of the Bluetooth broadcast start interface.

[0128] There is no limitation on the execution order of S504 and S505.

[0129] S506. After Bluetooth is successfully started, Bluetooth returns first call success information to the Bluetooth monitor.

[0130] The first call success information is used to indicate that the Bluetooth broadcast start interface call is successful.

[0131] S507. After receiving the first call success information, the Bluetooth monitor updates the current Bluetooth broadcast state from the starting state to the broadcasting state.

[0132] S508. The Bluetooth monitor updates the Bluetooth broadcast message in response to the Bluetooth broadcast request, so that Bluetooth starts broadcasting the updated broadcast message.

[0133] S509. When the Bluetooth broadcast corresponding to the Bluetooth broadcast request is completed, the Bluetooth monitor sends a call request of the Bluetooth broadcast stop interface to the Bluetooth.

[0134] It should be understood that the call request of the Bluetooth broadcast stop interface is used to call the Bluetooth broadcast stop interface. Bluetooth will stop Bluetooth broadcast in response to the call request of the Bluetooth broadcast stop interface. In certain embodiments, if the current Bluetooth broadcast state is actually in a closed state, and the Bluetooth monitor requests to call the Bluetooth broadcast stop interface, Bluetooth can feed back feedback information of successful calling to the Bluetooth monitor.

[0135] S510. The Bluetooth monitor updates the current Bluetooth broadcast state from the broadcasting state to the stopped state.

[0136] There is no limitation on the execution order of S509 and S510.

[0137] S511. The Bluetooth stops the Bluetooth broadcast in response to the call request of the Bluetooth broadcast stop interface.

[0138] S512. After Bluetooth is successfully stopped, Bluetooth sends a second call success message to the Bluetooth monitor.

[0139] The second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

[0140] S513. After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state.

[0141] It should be understood that after S513, the Bluetooth broadcast state returns to the idle state. At this time, if the Bluetooth monitor receives a new Bluetooth broadcast request, the above S501-S513 can be executed in sequence.

[0142] The following will describe in detail the method for processing a Bluetooth broadcast request provided by the present application in conjunction with the accompanying drawings and embodiments. In the following embodiments, the electronic device is a mobile phone as an example. Fig. 6A FIG. 1 is a flow chart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application. The method includes S601-S607, wherein:

[0143] S601. The Bluetooth monitor receives a first Bluetooth broadcast request.

[0144] The first Bluetooth broadcast request is used to request to send a message via Bluetooth broadcast.

[0145] In some embodiments, the broadcast content corresponding to the Bluetooth broadcast request may specifically include data files (such as pictures, documents) sent via Bluetooth, and the current mobile phone status information of the mobile phone broadcast via Bluetooth (such as whether the WiFi switch is turned on, the network name of the WiFi connection, etc.).

[0146] In other embodiments, the Bluetooth broadcast request can also be used to instruct the Bluetooth monitor to restart the Bluetooth broadcast. In this embodiment, when the Bluetooth monitor receives this type of Bluetooth broadcast request, if the current Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor needs to call the Bluetooth broadcast stop interface in response to the Bluetooth broadcast request, and after the Bluetooth broadcast stops successfully, call the Bluetooth broadcast start interface to restart the Bluetooth broadcast.

[0147] S602. The Bluetooth monitor obtains the current Bluetooth broadcast status saved in the Bluetooth monitor.

[0148] It can be seen from the above description that in the embodiment of the present application, the Bluetooth broadcast state is stored in the Bluetooth monitor, and the Bluetooth broadcast state is updated by the Bluetooth monitor.

[0149] S603. The Bluetooth monitor determines whether the current Bluetooth broadcast state is the first Bluetooth broadcast state.

[0150] The first Bluetooth broadcast state includes a starting state or a stopping state. Figure 5B As can be seen from the process shown, the current Bluetooth broadcast state is in the starting state or the stopping state, which specifically indicates that the current Bluetooth monitor has received other Bluetooth broadcast requests (such as the second Bluetooth broadcast request) before the first Bluetooth broadcast request. And in response to the second Bluetooth broadcast request, the Bluetooth monitor is performing the corresponding Bluetooth broadcast operation.

[0151] After S603, if the Bluetooth monitor determines that the current Bluetooth broadcast state is the first Bluetooth broadcast state, it means that the current Bluetooth broadcast is unavailable, and the corresponding Bluetooth broadcast operation cannot be immediately executed for the first Bluetooth broadcast request. Under normal circumstances, in the process of executing the Bluetooth broadcast operation in response to the second Bluetooth broadcast request, the Bluetooth broadcast state will be continuously updated. Therefore, for the first Bluetooth broadcast request, you can wait for a period of time, wait for the Bluetooth broadcast state to be updated to the available state, and then execute the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request.

[0152] For example, if the judgment result of S603 is yes, the specific corresponding expression is Figure 5B In the process shown, a first Bluetooth broadcast request is received between S504 and S507 or between S507 and S513.

[0153] Further, taking the case where the Bluetooth monitor determines that the current Bluetooth broadcast state is in the startup state in S603 as an example, if the Bluetooth and the communication between the Bluetooth monitor and the Bluetooth are normal, then the current moment may specifically be when the Bluetooth monitor calls the Bluetooth broadcast startup interface in response to the second Bluetooth broadcast request (the broadcast request received previously), but has not yet received the successful call information fed back by the Bluetooth. Among them, the normal communication between the Bluetooth monitor and the Bluetooth means that the Bluetooth can normally receive the call request from the Bluetooth monitor, and the Bluetooth monitor can also normally receive the call feedback information fed back by the Bluetooth.

[0154] Taking S603 as an example, in which the Bluetooth monitor determines that the current Bluetooth broadcast state is in the stopping state, if Bluetooth and the communication between the Bluetooth monitor and Bluetooth are normal, then the stopping state corresponds to the time period after the Bluetooth broadcast corresponding to the second Bluetooth broadcast request is completed, the Bluetooth monitor calls the Bluetooth broadcast stop interface, and does not receive the call success information fed back by Bluetooth.

[0155] In other embodiments, if the judgment result of S603 is no, it means that the current Bluetooth broadcast state is idle or broadcasting. The specific implementation of the current Bluetooth broadcast state being idle or broadcasting will be described in detail in the following embodiments and will not be repeated here.

[0156] S604. The Bluetooth monitor enters a first waiting state.

[0157] It should be understood that the above S604 specifically represents that the Bluetooth monitor waits for a period of time for the first Bluetooth broadcast request. In the first waiting state, the Bluetooth monitor will continue to perform the corresponding Bluetooth broadcast operation for the Bluetooth broadcast request (such as the second Bluetooth broadcast request) received before by the Bluetooth monitor.

[0158] S605. In the first waiting state, the Bluetooth monitor monitors the calling information sent by Bluetooth.

[0159] In combination with the description of the above embodiment, it can be known that in the first waiting state, the Bluetooth broadcast state currently saved in the Bluetooth monitor is in the starting state or the stopping state. Generally, the Bluetooth broadcast state in the starting state indicates that the Bluetooth monitor has called the Bluetooth broadcast starting interface in response to the previous Bluetooth broadcast request, but has not yet received the call success information fed back by Bluetooth. Similarly, the Bluetooth broadcast state in the stopping state indicates that the Bluetooth monitor has called the Bluetooth broadcast stopping interface based on the previous Bluetooth broadcast request, but has not yet received the call success information fed back by Bluetooth. Moreover, the time from the Bluetooth monitor calling the Bluetooth interface to receiving the call success information sent by Bluetooth is usually short. That is to say, for the above-mentioned first Bluetooth broadcast request, it only takes a short time to wait until the Bluetooth broadcast state is updated to an available state, such as the broadcasting state or the idle state.

[0160] That is to say, usually in the above S605, in the first waiting state, the Bluetooth monitor only needs to wait for a short time to receive the call information sent by Bluetooth. If the call success information indicating the Bluetooth broadcast start interface / Bluetooth broadcast stop interface is received, the Bluetooth monitor can update the Bluetooth broadcast state to an available state. If the Bluetooth monitor waits for a long time in the first waiting state and does not receive the call information sent by Bluetooth, it is possible that Bluetooth has a fault, or the communication between the Bluetooth monitor and Bluetooth has a fault.

[0161] In order to avoid the Bluetooth monitor from waiting for a long time for the first Bluetooth broadcast request under such a fault condition, the residence time of the Bluetooth broadcast state in the first Bluetooth broadcast state can be timed. Once it is detected that the residence time of the Bluetooth broadcast state in the first Bluetooth broadcast state exceeds a certain time, it is determined that a fault problem may have occurred and corresponding operations need to be performed.

[0162] In some embodiments, after the Bluetooth monitor enters the first waiting state, the above method also includes: in the first waiting state, the Bluetooth monitor obtains the first stay time of Bluetooth in the first Bluetooth broadcast state; if the first stay time does not exceed the first preset time, the Bluetooth monitor maintains the first waiting state.

[0163] The dwell time of Bluetooth in the first Bluetooth broadcast state can specifically be represented by: the time from the time point when the Bluetooth broadcast state is updated from the previous state to the current state to the current moment. Exemplarily, the current Bluetooth broadcast state is the starting state, and the dwell time of Bluetooth in the starting state includes: the time from the time when the Bluetooth broadcast state is updated from the idle state to the starting state to the current moment. The current Bluetooth broadcast state is the stopping state, and the dwell time of Bluetooth in the stopping state includes: the time from the time when the Bluetooth broadcast state is updated from the broadcasting state to the stopping state to the current moment.

[0164] In some embodiments, the timing can be started at the time point when the previous Bluetooth broadcast state is updated to the current Bluetooth broadcast state, and the timing time is used to indicate the stay time of Bluetooth in the current Bluetooth broadcast state. Exemplarily, when the current Bluetooth broadcast state is in the starting state, the timing starts when the Bluetooth monitor updates the Bluetooth broadcast state from the idle state to the starting state. When the current Bluetooth broadcast state is in the stopping state, the timing can be started when the Bluetooth monitor updates the Bluetooth broadcast state from the broadcasting state to the stopping state.

[0165] In other embodiments, the time point when the previous Bluetooth broadcast state is updated to the current Bluetooth broadcast state can also be directly recorded, such as the time point when the idle state is updated to the starting state can be recorded as the starting time, and the time point when the broadcasting state is updated to the stopping state can be recorded as the stopping time. Afterwards, in the starting state, the stay time of the Bluetooth broadcast state in the starting state can be determined based on the time difference between the current time and the starting time. Similarly, in the stopping state, the stay time of the Bluetooth broadcast state in the stopping state can be determined based on the time difference between the current time and the stopping time.

[0166] The first preset time can be set according to actual conditions. For example, after calling the Bluetooth broadcast start interface or the Bluetooth broadcast stop interface, the Bluetooth monitor can usually receive the call success information fed back by Bluetooth within a few milliseconds. Therefore, in some embodiments, the above-mentioned first preset time can be set to be greater than the time required from calling the interface to receiving the information to be fed back; for example, the above-mentioned first preset time can be set to 50ms, 100ms, etc. In the first waiting state, if the Bluetooth monitor detects that the stay time of Bluetooth in the first Bluetooth broadcast state does not exceed the first preset time, the first waiting state can be maintained.

[0167] It is understandable that if the Bluetooth monitor detects that the Bluetooth stays in the first Bluetooth broadcast state for a time exceeding the first preset time in the first waiting state, it is determined that a fault may have occurred. In some embodiments, after the Bluetooth monitor calls the Bluetooth broadcast start interface or the Bluetooth broadcast stop interface, if no call information (call success information or call error information) fed back by Bluetooth is received, it is possible that Bluetooth has failed and the Bluetooth interface cannot be called normally. Alternatively, it is also possible that the call success information fed back by Bluetooth has not been transmitted to the Bluetooth monitor.

[0168] In some embodiments, after entering the first waiting state, if it is detected that the Bluetooth stays in the first Bluetooth broadcast state for longer than a first preset time, the Bluetooth monitor can directly call the Bluetooth broadcast start interface or the Bluetooth broadcast stop interface of Bluetooth to update the Bluetooth broadcast state.

[0169] In some embodiments, after entering the first waiting state, if the current Bluetooth stay time in the startup state exceeds a first preset time, the Bluetooth monitor directly calls the Bluetooth broadcast stop interface.

[0170] It can be seen from the above description that the Bluetooth stays in the first Bluetooth broadcast state for more than a certain period of time. This may be because the successful call information fed back by Bluetooth has not been passed to the Bluetooth monitor, or Bluetooth fails and the Bluetooth broadcast start interface cannot be called normally. For the first case, if the Bluetooth monitor calls the Bluetooth broadcast start interface, the Bluetooth broadcast is successfully started, but the successful call information is not passed to the Bluetooth monitor. Then at this time, Bluetooth is actually in the started state, but the Bluetooth monitor did not update the Bluetooth broadcast state in time because it did not receive the call feedback information. At this time, the Bluetooth monitor calls the Bluetooth broadcast stop interface, and Bluetooth can stop the Bluetooth broadcast according to the call request, and after the Bluetooth broadcast stops successfully, it returns feedback information to the Bluetooth monitor indicating that the call to the Bluetooth broadcast stop interface is successful.

[0171] Further, if the Bluetooth does not fail, after the current Bluetooth stays in the startup state for a time exceeding the first preset time, the Bluetooth monitor calls the Bluetooth broadcast stop interface, and the Bluetooth can stop the Bluetooth broadcast in response to the call request to the Bluetooth broadcast stop interface, and feed back information indicating that the Bluetooth broadcast stop interface call is successful to the Bluetooth monitor. That is, the Bluetooth monitor will receive information indicating that the Bluetooth broadcast stop interface call is successful. In this embodiment, after calling the Bluetooth broadcast stop interface, the Bluetooth monitor can update the current Bluetooth broadcast state to the stopped state. Afterwards, if the Bluetooth monitor receives the call success information indicating that the Bluetooth broadcast stop interface is called, the current Bluetooth broadcast state can be updated to the idle state. In this way, it is possible to avoid the problem that the Bluetooth broadcast state is not updated in time because the Bluetooth monitor does not receive the call success information fed back by Bluetooth, which causes the newly received Bluetooth broadcast request (such as the first Bluetooth broadcast request) to be unable to broadcast for a long time.

[0172] For the second case, if the reason why the Bluetooth stays in the startup state for longer than the first preset time is that the Bluetooth broadcast startup interface fails, then the Bluetooth is not actually started successfully and is still in the shutdown state. At this time, if the Bluetooth monitor calls the Bluetooth broadcast stop interface, it cannot receive the call success information fed back by Bluetooth.

[0173] Further, in this embodiment, after the current Bluetooth stays in the startup state for a time period exceeding the first preset time, the Bluetooth monitor calls the Bluetooth broadcast stop interface, and if the Bluetooth monitor does not receive the call feedback information of the Bluetooth broadcast stop interface within a certain period of time, it can be determined that the current Bluetooth fails. In some embodiments, after determining that the Bluetooth fails, a reminder message can be generated to remind the user that the Bluetooth fails. In this way, the user can be reminded when the Bluetooth may fail, and take corresponding measures as soon as possible.

[0174] Similar to the first Bluetooth broadcast state being the starting state, if the first Bluetooth broadcast state is the stopping state, after entering the first waiting state, the current Bluetooth stay time in the stopping state exceeds the first preset time, then the Bluetooth monitor directly calls the Bluetooth broadcast start interface. Similarly, there are two possible situations when the Bluetooth stay time in the stopping state exceeds the first preset time, that is, the call success information fed back by the Bluetooth is not transmitted to the Bluetooth monitor, or the Bluetooth fails and the Bluetooth broadcast start interface cannot be called normally.

[0175] For the first case, since the Bluetooth does not fail, in fact, the Bluetooth has already stopped the Bluetooth broadcast in response to the previous call request of the Bluetooth broadcast stop interface, that is, the Bluetooth broadcast is currently in a closed state. It is just that the Bluetooth monitor has not received the feedback information for indicating that the Bluetooth broadcast stop interface is successfully called, so that the Bluetooth broadcast state is not updated in time. That is to say, if the Bluetooth monitor calls the Bluetooth broadcast start interface at this time, the Bluetooth can start the Bluetooth broadcast in response to the call request, and then the information for indicating that the Bluetooth broadcast start interface is successfully called can be fed back to the Bluetooth monitor. In this embodiment, after calling the Bluetooth broadcast start interface, the Bluetooth monitor can update the current Bluetooth broadcast state to the start-up state. Afterwards, if the Bluetooth monitor receives the call success information for indicating that the Bluetooth broadcast stops the interface, the current Bluetooth broadcast state can be updated to the broadcast state. In this way, it can be avoided that the Bluetooth broadcast state is not updated in time because the Bluetooth monitor does not receive the call success information fed back by Bluetooth, which causes the newly received Bluetooth broadcast request (such as the first Bluetooth broadcast request) to be unable to broadcast for a long time.

[0176] For the second situation described above, if the reason why the current Bluetooth stays in the stopped state for longer than the first preset time is that the Bluetooth fails, then at this time the Bluetooth is actually still in the broadcasting state. At this time, if the Bluetooth monitor requests to call the Bluetooth broadcast start interface, since the Bluetooth is actually in the broadcasting state, if the Bluetooth receives a call request for the corresponding Bluetooth broadcast start interface at this time, a call error message will be generated. In this embodiment, after the Bluetooth monitor calls the Bluetooth broadcast start interface in the first waiting state, if the call error message fed back by the Bluetooth is received, the Bluetooth monitor determines that the Bluetooth fails. At this time, the Bluetooth monitor can generate a reminder message to remind the user that the Bluetooth may fail. In this way, the user can be reminded when the Bluetooth may fail and take corresponding measures as soon as possible.

[0177] Combination Figure 5B It can be seen from the process shown that when the current Bluetooth broadcast state is in the starting state, it means that the Bluetooth monitor has sent a call request of the Bluetooth broadcast start interface to the Bluetooth in response to the previous Bluetooth broadcast request (such as the second Bluetooth broadcast request). In this embodiment, the above method also includes: in the first waiting state, when the Bluetooth monitor receives the first call success information fed back by the Bluetooth, the current Bluetooth broadcast state is updated to the broadcasting state. The first call success information is used to indicate that the Bluetooth broadcast start interface call is successful.

[0178] Similarly, when the current Bluetooth broadcast state is in the stopping state, it indicates that the Bluetooth monitor has sent a call request of the Bluetooth broadcast stop interface to the Bluetooth. In this embodiment, the above method further includes: in the first waiting state, when the Bluetooth monitor receives the second call success information fed back by the Bluetooth, updating the current Bluetooth broadcast state to the idle state. The second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

[0179] S606. After receiving the call success information sent by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state to the second Bluetooth broadcast state.

[0180] The second Bluetooth broadcast state includes an idle state or a broadcasting state.

[0181] If the Bluetooth monitor receives the successful call information of the Bluetooth feedback in the first waiting state, the Bluetooth broadcast state saved in the Bluetooth monitor can be updated to the second Bluetooth broadcast state. At this time, it means that the current Bluetooth broadcast is updated to the available state. After that, the corresponding Bluetooth broadcast operation can be performed for the first Bluetooth broadcast request.

[0182] S607: The Bluetooth monitor executes a Bluetooth broadcast operation in response to the first Bluetooth broadcast request.

[0183] Under normal circumstances, the Bluetooth broadcast status is as follows Figure 2 That is, if the Bluetooth broadcast state is determined to be in the starting state in S603, then in S607, the Bluetooth monitor receives the successful call information fed back by the Bluetooth, and the Bluetooth monitor can update the Bluetooth broadcast state stored in the Bluetooth monitor to the broadcasting state. If the Bluetooth broadcast state is determined to be in the stopping state in S603, the Bluetooth monitor receives the successful call information fed back in S607, and the Bluetooth monitor can update the Bluetooth broadcast state stored in the Bluetooth monitor to the idle state.

[0184] Combination Figure 5B As can be seen from the process shown, when the current Bluetooth state is in the broadcasting state, the Bluetooth monitor can update the Bluetooth broadcast message in response to the Bluetooth broadcast request. Figure 6B As shown, the above S606 may specifically include:

[0185] S606a. After receiving the first call success information sent by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state to the broadcasting state.

[0186] Further, in this embodiment, please continue to refer to Figure 6B The above S607 may specifically include S607a:

[0187] S607a. The Bluetooth monitor updates the Bluetooth broadcast message in response to the first Bluetooth broadcast request.

[0188] The updated Bluetooth broadcast message is used for Bluetooth broadcast. After S607a, Bluetooth will broadcast the updated broadcast message, that is, the broadcast content corresponding to the first Bluetooth broadcast request.

[0189] When the current Bluetooth broadcast state is an idle state, the Bluetooth monitor may call the Bluetooth broadcast start interface in response to the Bluetooth broadcast request. Figure 6C As shown, the above S606 may specifically include S606b:

[0190] S606b. After receiving the second call success information sent by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state to an idle state.

[0191] Furthermore, the above S607 may specifically include S607b:

[0192] S607b. The Bluetooth monitor sends a call request of a Bluetooth broadcast start interface to the Bluetooth in response to the first Bluetooth broadcast request.

[0193] In the technical solution provided by the embodiment of the present application, if a first Bluetooth broadcast request is received in the Bluetooth broadcast unavailable state (first Bluetooth broadcast state), a period of time will be waited for the first Bluetooth broadcast request. After the Bluetooth broadcast state is updated to the available state (second Bluetooth broadcast state), the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request is executed. In this way, the Bluetooth broadcast request can be prevented from being discarded due to the current Bluetooth broadcast being unavailable, and the loss of Bluetooth broadcast messages can be reduced.

[0194] In the above embodiment, when the Bluetooth monitor receives the first Bluetooth broadcast request, the Bluetooth broadcast state obtained is the first Bluetooth broadcast state, that is, the starting state or the stopping state. At this time, Bluetooth broadcast is not available, and the Bluetooth monitor needs to enter a waiting state for the first Bluetooth broadcast request. In other embodiments, if the Bluetooth monitor obtains that the current Bluetooth broadcast state is not in the first Bluetooth broadcast state when the first Bluetooth broadcast request is received, that is, after the above S603, the Bluetooth monitor determines that the Bluetooth broadcast state is not the first Bluetooth broadcast state. Furthermore, if the current Bluetooth broadcast state is an idle state or a broadcasting state, it means that the current Bluetooth can be used directly.

[0195] Take the current Bluetooth broadcast state as an example, which is the idle state. Figure 7 As shown, if the judgment result of the above S603 is no, the above method further includes S701-S707. It should be noted that in Figure 7In the flowchart shown, the process (S604-S607) executed when the judgment result of S603 is yes is not shown.

[0196] S701. The Bluetooth monitor determines whether the Bluetooth broadcast state is idle.

[0197] In some embodiments, when it is determined that the current Bluetooth broadcast state is an idle state, S702 may be executed. Figure 7 In the process shown, if the current Bluetooth broadcast state is neither the first Bluetooth broadcast state nor the idle state, then the current Bluetooth broadcast state may be the broadcasting state. When the judgment result of S701 is no, that is, the implementation method of the current Bluetooth broadcast state obtained in S602 being the broadcasting state will be described in detail in the following embodiments and will not be repeated here.

[0198] S702: In response to the first Bluetooth broadcast request, the Bluetooth monitor sends a request to call a Bluetooth broadcast start interface to the Bluetooth.

[0199] Combination Figure 5B It can be seen from the process shown that if the Bluetooth does not fail and the communication between the Bluetooth and the Bluetooth monitor is normal, the Bluetooth can start the Bluetooth broadcast in response to the call request, such as S703.

[0200] S703. The Bluetooth monitor updates the current Bluetooth broadcast state from the idle state to the starting state.

[0201] S704: The Bluetooth starts the Bluetooth broadcast in response to the call request of the Bluetooth broadcast start interface.

[0202] It should be understood that the execution order of the above S703 and S704 is not limited in the embodiment of the present application.

[0203] S705. After Bluetooth is successfully started, Bluetooth returns first call success information to the Bluetooth monitor.

[0204] The first call success information is used to indicate that the Bluetooth broadcast start interface call is successful.

[0205] S706. When receiving the first call success information, the Bluetooth monitor updates the current Bluetooth broadcast state from the starting state to the broadcasting state.

[0206] S707: The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request.

[0207] The updated broadcast message is used for Bluetooth broadcasting. The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, which may specifically include: the Bluetooth monitor obtains the broadcast message corresponding to the first Bluetooth broadcast request, and updates the Bluetooth broadcast message to the broadcast message corresponding to the first Bluetooth broadcast request. The specific implementation method of Bluetooth updating the broadcast message can refer to the description in the relevant technology, which will not be repeated in the embodiments of the present application.

[0208] In the technical solution provided in the embodiment of the present application, when the first Bluetooth broadcast request is received, if the current Bluetooth broadcast state is idle, it means that the current Bluetooth is in an available state. At this time, the Bluetooth monitor can directly respond to the first Bluetooth broadcast request, call the Bluetooth broadcast start interface, and quickly respond to the first Bluetooth broadcast request.

[0209] In the above embodiment, if the Bluetooth broadcast state is in the idle state, it is considered that the current Bluetooth is available. However, in actual situations, some Bluetooth broadcasts may still be in an unusable state for a short period of time after the Bluetooth broadcast state is just updated from the stopped state to the idle state. Therefore, when the Bluetooth broadcast state is detected to be the idle state upon receiving the first Bluetooth broadcast request, the Bluetooth monitor can obtain the stay time of the Bluetooth in the idle state. When the stay time in the idle state does not reach the second preset time, it is also necessary to wait for a period of time for the first Bluetooth broadcast request.

[0210] In some embodiments, after the judgment result of the above S701 is yes, before S702, the above method further includes: the Bluetooth monitor obtains the second dwell time of the Bluetooth in the idle state. In this embodiment, the above S702 may specifically include: when the Bluetooth monitor determines that the second dwell time exceeds the second preset time, sending a call request of the Bluetooth broadcast start interface to the Bluetooth.

[0211] When the Bluetooth broadcast state is in the idle state, the time point when the Bluetooth broadcast state is updated from the stopping state to the idle state can be recorded as the stop success time. The timing starts from the stop success time, and the timing time starting from the stop success time is used to indicate the stay time of the Bluetooth broadcast state in the idle state.

[0212] The second preset time can be set according to actual conditions. For example, the second preset time can be set to 50ms, 60ms, 70ms, 100ms, etc.

[0213] In the technical solution provided in the embodiment of the present application, in the case where the first Bluetooth broadcast request is received when the Bluetooth broadcast state has just been updated from the stopped state to the idle state, a period of time can be waited for the first Bluetooth broadcast request, and then the Bluetooth broadcast start interface is called in response to the first Bluetooth broadcast request. In this way, the problem that the Bluetooth cannot be used for a short period of time when the Bluetooth broadcast state has just been updated from the stopped state to the idle state, thereby causing the failure of calling the Bluetooth broadcast start interface, can be avoided.

[0214] Combination Figure 5B As can be seen from the process shown, after S508, the Bluetooth monitor updates the Bluetooth broadcast message based on the Bluetooth broadcast request, so that the Bluetooth broadcasts the broadcast content of the Bluetooth broadcast request. When the Bluetooth broadcast corresponding to the Bluetooth broadcast request is completed in S509, the Bluetooth monitor can call the Bluetooth broadcast stop interface to stop the Bluetooth broadcast. In some embodiments, it can be determined whether the Bluetooth broadcast corresponding to the Bluetooth broadcast request is completed by setting a timer.

[0215] In some embodiments, Figure 8 As shown, after the above S702, the above method further includes S801:

[0216] S801. The Bluetooth monitor sets a first timer based on the pending broadcast duration corresponding to the first Bluetooth broadcast request, and the first timer starts timing.

[0217] The waiting broadcast duration corresponding to the first Bluetooth broadcast request indicates the broadcast duration of the content to be broadcasted corresponding to the first Bluetooth broadcast request. It is understandable that the broadcast durations required for the Bluetooth broadcast content requested by different Bluetooth broadcast requests may be different.

[0218] In some embodiments, the first timer can be a countdown timer. In this embodiment, the timing time of the first timer represents the remaining broadcast duration of Bluetooth. It should be understood that when the remaining broadcast duration of Bluetooth becomes 0, it means that the current Bluetooth broadcast is completed. The above S801 can specifically include: after the Bluetooth monitor determines the broadcast duration corresponding to the first Bluetooth broadcast request according to the first Bluetooth broadcast request, the broadcast duration is set to the countdown duration of the countdown timer. It can be understood that the countdown duration is used to indicate the remaining broadcast duration of the Bluetooth broadcast for the broadcast content corresponding to the first Bluetooth broadcast request. When the countdown duration of the countdown timer becomes 0, it means that the broadcast duration for the first Bluetooth broadcast request has reached the broadcast duration corresponding to the first Bluetooth broadcast request. In other words, the Bluetooth broadcast corresponding to the first Bluetooth broadcast request is completed. At this time, the Bluetooth monitor can call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast.

[0219] In other embodiments, the first timer may also be a forward timer. In this embodiment, the timing time of the first timer represents the broadcast duration of Bluetooth. In combination with the to-be-broadcast duration corresponding to the first Bluetooth broadcast request and the timing time of the first timer, the remaining broadcast duration corresponding to the first Bluetooth broadcast request can be determined. The above S801 may specifically include: after the Bluetooth monitor determines the to-be-broadcast duration corresponding to the first Bluetooth broadcast request, the first timer starts timing from 0. If it is detected that the timing time reaches the to-be-broadcast duration, it means that the Bluetooth broadcast corresponding to the first Bluetooth broadcast request is completed. At this time, the Bluetooth monitor may be triggered to call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast. It should be understood that in this embodiment, the timing time of the first timer is used to indicate the broadcast duration of the Bluetooth broadcast for the broadcast content corresponding to the first Bluetooth broadcast request.

[0220] In some embodiments, the first timer in the above S801 may specifically start timing immediately after S702, or may start timing after the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request in S707.

[0221] Further, in some embodiments, after the above S707, the above method further includes S802-S806, wherein:

[0222] S802: When it is determined according to the timing time of the first timer that the remaining broadcast duration of the current Bluetooth is 0, the Bluetooth monitor sends a request to call the Bluetooth broadcast stop interface to the Bluetooth.

[0223] It can be seen from the description of the above embodiment that the timing time of the first timer can be used to determine the remaining broadcasting time of Bluetooth.

[0224] When it is determined that the remaining Bluetooth broadcast duration becomes 0, it means that the Bluetooth broadcast corresponding to the first Bluetooth broadcast request has been completed. At this time, the Bluetooth monitor can call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast, thereby reducing unnecessary power consumption.

[0225] S803. The Bluetooth monitor updates the current Bluetooth broadcast state to a stopped state.

[0226] S804. The Bluetooth stops the Bluetooth broadcast in response to the call request of the Bluetooth broadcast stop interface.

[0227] S805. When the Bluetooth broadcast stops successfully, the Bluetooth sends a second call success message to the Bluetooth monitor.

[0228] The second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

[0229] S806. Upon receiving the second call success information fed back by the Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state.

[0230] In the technical solution provided in the embodiment of the present application, after the Bluetooth broadcast is started in response to the first Bluetooth broadcast request, a first timer is set, and whether the current Bluetooth broadcast is completed is judged according to the timed time. In this way, it is convenient for the Bluetooth monitor to call the Bluetooth broadcast stop interface in time after the Bluetooth broadcast corresponding to the first Bluetooth broadcast request is completed to turn off the Bluetooth broadcast. Thereby, unnecessary power consumption caused by turning on the Bluetooth broadcast when there is no broadcast can be reduced.

[0231] In some embodiments, the first timer used to determine whether the Bluetooth broadcast is completed may fail to work. In this case, after the Bluetooth broadcast corresponding to the first Bluetooth broadcast request is completed, the Bluetooth monitor may not call the Bluetooth broadcast stop interface, resulting in the Bluetooth broadcast remaining in the broadcasting state for a long time, but there is no content that requires Bluetooth broadcast. In order to avoid this situation, a maximum broadcast duration can be set when sending a call request for the Bluetooth broadcast start interface to Bluetooth. If the Bluetooth monitor does not call the Bluetooth broadcast stop interface after the Bluetooth broadcast is completed. Bluetooth can actively stop the Bluetooth broadcast (i.e., turn off the Bluetooth broadcast) when the cumulative time after the Bluetooth broadcast is started reaches the above-mentioned maximum broadcast duration.

[0232] In some embodiments, the calling request of the Bluetooth broadcast start interface sent by the Bluetooth monitor to the Bluetooth in S702 carries a third preset time, which is used to instruct the Bluetooth to stop the Bluetooth broadcast at a time point corresponding to the third preset time starting from the current time.

[0233] Further, in this embodiment, after the Bluetooth starts the Bluetooth broadcast in the above S704, the Bluetooth starts to count the accumulated Bluetooth broadcast duration. After the above S704, when the Bluetooth detects that the timing duration reaches the third preset time and the Bluetooth still does not receive the call request of the Bluetooth broadcast stop interface sent by the Bluetooth monitor, the Bluetooth can actively stop the Bluetooth broadcast. Thereby avoiding unnecessary power consumption. The third preset time can be set according to actual conditions, for example, the third preset time can be set to 30 seconds (s), 40s, 45s, etc.

[0234] In the technical solution provided by the embodiment of the present application, when the timer fails or other circumstances occur, resulting in the Bluetooth monitor failing to call the Bluetooth broadcast stop interface in time to close the Bluetooth broadcast after the Bluetooth broadcast is completed, the Bluetooth controller can actively stop the Bluetooth broadcast after a period of time. In this way, unnecessary power consumption can be avoided.

[0235] Above Figure 7-Figure 8The process shown introduces the corresponding execution steps when the judgment result of S603 is no and the current Bluetooth broadcast state is idle. When the judgment result of S603 is no, the current Bluetooth broadcast state may also be in the broadcasting state, that is, the Bluetooth monitor has called the Bluetooth broadcast start interface in response to the previous second Bluetooth broadcast request and the Bluetooth broadcast is successfully started. In this embodiment, when the current Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor can directly respond to the first Bluetooth broadcast request to update the Bluetooth broadcast message, so that Bluetooth starts broadcasting the broadcast content corresponding to the first Bluetooth broadcast request.

[0236] In some embodiments, Fig. 9 As shown, if the judgment result of the above S603 is no, the above method further includes S900 and S902. It should be noted that in Fig. 9 In the process shown, the process (S604-S607) for which the judgment result of S603 is yes is not shown, wherein:

[0237] S900. The Bluetooth monitor determines whether the Bluetooth broadcast state is in the broadcasting state.

[0238] If the Bluetooth broadcast state is not in the starting state, the stopping state or the idle state, then the Bluetooth broadcast state may be in the broadcasting state. After determining that the current Bluetooth broadcast state is in the broadcasting state, S902 may be executed:

[0239] S902. The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request.

[0240] The updated broadcast message is used for Bluetooth broadcasting. In some embodiments, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, which may specifically include: the Bluetooth monitor parses the first Bluetooth broadcast request to obtain the corresponding message to be broadcast; the Bluetooth monitor updates the Bluetooth broadcast message to the above-mentioned message to be broadcast. The specific implementation method of the Bluetooth monitor updating the Bluetooth broadcast message can refer to the description in the relevant technology, which will not be repeated in the embodiments of the present application.

[0241] It should be noted that the technical solutions corresponding to the above S900 and S902 can also be used with Figure 7The processes of S701-S707 exist in parallel. In this embodiment, the three judgment steps of S603, S701 and S900 can be judged successively. If the judgment result of S603 is yes, it means that the Bluetooth broadcast state when the first Bluetooth broadcast request is received is in the starting state or the stopping state, and the steps of S604-S607 can be executed at this time. If the judgment result of S603 is no, S701 can be directly executed. If the judgment result of S701 is yes, it means that the Bluetooth broadcast state when the first Bluetooth broadcast request is received is in the idle state, and S702-S707 can be executed at this time. If the judgment result of S701 is no, S900 can be executed. If the judgment result of S900 is yes, S902 can be executed at this time.

[0242] Alternatively, after receiving the first Bluetooth broadcast request, the Bluetooth monitor may also first execute S603 to determine whether the current Bluetooth broadcast state is in the starting state or the stopping state. Then, when the judgment result of S603 is no, first determine whether the Bluetooth broadcast state is in the broadcasting state (S900), and if not, then determine whether it is in the idle state (S701). Alternatively, after receiving the first Bluetooth broadcast request, the Bluetooth monitor may also first determine whether the current Bluetooth broadcast state is in the idle state (S701), and if not, then determine whether it is in the broadcasting state (S900), and finally determine whether it is in the starting state or the stopping state (S603). That is, in the embodiment of the present application, the order of determining the Bluetooth broadcast state when the first Bluetooth broadcast request is received is not limited.

[0243] In the technical solution provided in the embodiment of the present application, when the Bluetooth broadcast state is in the broadcasting state when the first Bluetooth broadcast request is received, it means that the current Bluetooth can directly broadcast. Therefore, the Bluetooth monitor can directly respond to the first Bluetooth broadcast request and update the Bluetooth broadcast message, so that the Bluetooth starts broadcasting the broadcast content corresponding to the first Bluetooth broadcast request. In this way, the Bluetooth broadcast request can be responded to quickly.

[0244] As can be seen from the description of the above embodiment, the first Bluetooth broadcast request may be used to instruct the Bluetooth monitor to restart the Bluetooth broadcast. In this embodiment, if the first Bluetooth broadcast request is received when the Bluetooth broadcast state is in the broadcasting state, since the current Bluetooth broadcast is available and the Bluetooth broadcast is in the broadcasting state, at this time, the Bluetooth monitor needs to restart the Bluetooth broadcast.

[0245] In some embodiments, after S900 and before S902, please refer to Fig. 10A The above method further includes S901:

[0246] S901. The Bluetooth monitor determines whether the broadcast content corresponding to the first Bluetooth broadcast request is a preset periodic broadcast.

[0247] In some embodiments, the above S902 may be specifically executed when the judgment result of the above S901 is no.

[0248] The preset periodic broadcast is used to instruct the Bluetooth monitor to restart the Bluetooth broadcast. In some embodiments, the preset periodic broadcast is to trigger a Bluetooth broadcast request every preset time interval. If the Bluetooth monitor receives a Bluetooth broadcast request for the preset periodic broadcast when the Bluetooth broadcast state is in the broadcasting state, it is necessary to restart the Bluetooth broadcast. It should be understood that in other embodiments, the preset periodic broadcast can also be named by other names, such as heartbeat broadcast.

[0249] Among them, the preset time interval can be set according to actual conditions. For example, the preset time interval can be set to 20s, 30s, 40s, etc. In some embodiments, the preset time interval of the preset periodic broadcast can be set according to the current screen state of the mobile phone. Exemplarily, when the screen state of the mobile phone is in the bright screen state, it means that the current user may be using the mobile phone. At this time, the preset time interval can be set to a smaller value, such as 30s. When the screen state of the mobile phone is in the off screen state, it means that the current user may not be using the mobile phone. At this time, the preset time interval can be set to a larger value, such as 5 minutes (min). It should be understood that the above preset time intervals are examples. In other embodiments, the preset time intervals of the preset periodic broadcasts can also be set to other values.

[0250] In combination with the description of the above embodiments, it can be known that in some embodiments, when calling the Bluetooth broadcast start interface, the Bluetooth monitor sets a maximum broadcast duration, which is used to instruct Bluetooth to actively turn off the Bluetooth broadcast when the Bluetooth broadcast duration reaches the maximum broadcast duration. In some embodiments, the preset time interval of the above preset periodic broadcast can be set to be less than the above maximum broadcast duration. Fig. 10B FIG. 1 is a schematic diagram of restarting Bluetooth broadcast according to a preset periodic broadcast (heartbeat broadcast) provided in an embodiment of the present application. In some embodiments, Fig. 10B During the broadcasting process of the service broadcast D shown in , when a Bluetooth broadcast request of a preset periodic broadcast is received, the unbroadcasted part of the service broadcast D will no longer continue to be broadcast, but the Bluetooth broadcast will be directly restarted.

[0251] In some embodiments, the Bluetooth monitor may set a timer in response to the Bluetooth broadcast request, and the timing time of the timer may be used to determine the remaining broadcast duration of the Bluetooth broadcast. When the remaining broadcast duration is determined to be 0 according to the timing time, the Bluetooth monitor calls the Bluetooth broadcast stop interface to shut down the Bluetooth broadcast. Therefore, if the first Bluetooth broadcast request is received in the broadcasting state, it is necessary to determine whether it is appropriate to directly broadcast the broadcast content corresponding to the first Bluetooth broadcast request in the broadcasting state in combination with the remaining broadcast duration of the current broadcasting state.

[0252] Specifically, when the current Bluetooth broadcast state is detected to be in the broadcasting state upon receiving the first Bluetooth broadcast request, it means that the Bluetooth monitor has previously started the Bluetooth broadcast in response to the second Bluetooth broadcast request received previously. At this time, the Bluetooth broadcast may be broadcasting the broadcast content corresponding to the second Bluetooth broadcast request, and the remaining broadcast duration of the current Bluetooth can be determined according to the timer, that is, the remaining broadcast duration corresponding to the second Bluetooth broadcast request. If the remaining duration corresponding to the second Bluetooth broadcast request is less than a certain value, it means that the broadcast content corresponding to the second Bluetooth broadcast request may not be fully played in the broadcasting state. At this time, if the broadcast content corresponding to the first Bluetooth broadcast request is to be broadcast in the broadcasting state, it is possible that the broadcast content of the first Bluetooth broadcast request cannot be received by other electronic devices, thereby causing the message to be lost.

[0253] In order to avoid this situation, a minimum broadcast duration can be set. When the first Bluetooth broadcast request is received in the broadcasting state, the Bluetooth monitor first determines whether the remaining broadcast duration of the current Bluetooth is greater than the minimum broadcast duration according to the timing time of the second timer. If so, the broadcast operation corresponding to the first Bluetooth broadcast request can be performed in the broadcasting state. Otherwise, the broadcast operation corresponding to the first Bluetooth broadcast request will not be performed in the broadcasting state.

[0254] In some embodiments, please refer to Fig. 10A After the judgment result of S901 is no and before S902, the method further includes S1001:

[0255] S1001. The Bluetooth monitor obtains the timing time of the second Bluetooth timer.

[0256] The timing time of the second timer is used to indicate the remaining broadcasting time of Bluetooth.

[0257] Furthermore, in this embodiment, the above S902 may specifically include S902a:

[0258] S902a. When the Bluetooth monitor determines, based on the timing time of the second timer, that the remaining broadcast duration of the current Bluetooth exceeds a fourth preset time, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request.

[0259] The fourth preset time is used to indicate the minimum broadcast duration required for Bluetooth broadcasting, which indicates the minimum duration required for a broadcast. If the duration is less than the minimum duration, the Bluetooth broadcast may not be received by other electronic devices. It should be noted that the fourth preset time can be set according to actual conditions, for example, it can be set to 400ms, 500ms, etc.

[0260] In the technical solution provided in the embodiment of the present application, when the first Bluetooth broadcast request is received when the Bluetooth broadcast state is in the broadcasting state, it is first determined whether the remaining broadcast duration of the current Bluetooth is greater than a certain value based on the timing time of the second timer. Only when it is determined that the remaining broadcast duration is greater than the certain value will the broadcast operation corresponding to the first Bluetooth broadcast request be executed in the broadcasting state. In this way, it can be ensured that in the current broadcasting state, the broadcast content corresponding to the first Bluetooth broadcast request can be broadcast smoothly. It can be avoided that after the broadcast content corresponding to the first Bluetooth broadcast request starts the Bluetooth broadcast in the current broadcasting state, the Bluetooth monitor responds to the previous second Bluetooth broadcast request to turn off the Bluetooth broadcast, resulting in the broadcast content corresponding to the first Bluetooth broadcast request cannot be received by other electronic devices.

[0261] In other embodiments, if a first Bluetooth broadcast request is received in the broadcasting state, but the remaining broadcast duration of the current Bluetooth is less than the minimum broadcast duration, then for the first Bluetooth broadcast request, the broadcast operation corresponding to the first Bluetooth broadcast request can be executed after the current Bluetooth broadcast is completed and the Bluetooth broadcast state returns to the idle state.

[0262] In some embodiments, after S1001, the method further includes: when it is determined according to the timing time of the second timer that the remaining broadcast duration of the current Bluetooth does not exceed the fourth preset time, the Bluetooth monitor enters a second waiting state. In the second waiting state, the Bluetooth monitor monitors the call information fed back by the Bluetooth. After receiving the call success information fed back by the Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state to an idle state, and the Bluetooth monitor performs a Bluetooth broadcast operation in response to the first Bluetooth broadcast request.

[0263] Among them, the Bluetooth monitor enters the second waiting state, which specifically means that the Bluetooth monitor enters the second waiting state for the second Bluetooth broadcast request. In the second waiting state, the Bluetooth monitor listens to the call information of Bluetooth feedback. If the Bluetooth monitor receives the call success information of Bluetooth feedback, the Bluetooth broadcast state saved in the Bluetooth monitor can be updated to the idle state. And, since the current Bluetooth broadcast state has been updated to the idle state, the Bluetooth monitor can now execute the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request. It should be understood that after receiving the call success information of Bluetooth feedback in the second waiting state, the Bluetooth monitor updates the Bluetooth broadcast state saved in the Bluetooth monitor to the idle state, and the process of the Bluetooth monitor executing the Bluetooth broadcast operation in response to the first Bluetooth broadcast request can refer to the above. Figure 5B The process shown will not be described in detail here.

[0264] It should be noted that the first timer and the second timer may be the same timer or different timers.

[0265] In the technical solution provided in the embodiment of the present application, if the current Bluetooth broadcast state is in the broadcasting state, but the current remaining broadcast duration is not enough to meet the minimum duration required for Bluetooth broadcast (minimum broadcast duration), then for the first Bluetooth broadcast request, it is necessary to wait for the current Bluetooth broadcast to be completed, and after the Bluetooth broadcast state is updated to the idle state, the Bluetooth broadcast operation corresponding to the first Bluetooth broadcast request is executed. In this way, the broadcast content corresponding to the first Bluetooth broadcast request is more likely to be received by other electronic devices, thereby improving the broadcast effect.

[0266] In other embodiments, if a first Bluetooth broadcast request is received when the Bluetooth broadcast state is in the broadcasting state, in order to avoid the problem that the current remaining Bluetooth broadcast time is insufficient to broadcast the broadcast content of the first Bluetooth broadcast request, the timer can also be updated to increase the remaining Bluetooth broadcast time, thereby ensuring that the broadcast content corresponding to the first Bluetooth broadcast request can be broadcast normally in the broadcasting state.

[0267] In some embodiments, Fig. 10C As shown, after S902, the method further includes S1002:

[0268] S1002. The Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request, and the third timer restarts timing.

[0269] The timing time of the third timer is used to indicate the remaining broadcasting time of the current Bluetooth.

[0270] When the first Bluetooth broadcast request is received, if the Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request after updating the Bluetooth broadcast message based on the first Bluetooth broadcast request.

[0271] In some embodiments, the third timer may be a countdown timer, and the countdown time of the countdown timer is used to indicate the remaining broadcast duration of the current Bluetooth. In this embodiment, the above 1002 may specifically include: the Bluetooth monitor obtains the pending broadcast duration corresponding to the first Bluetooth broadcast request; the Bluetooth monitor compares the countdown time with the pending broadcast duration. When the pending broadcast duration is greater than the countdown time, the Bluetooth monitor updates the countdown time of the current countdown timer to the pending broadcast duration corresponding to the first Bluetooth broadcast request. When the countdown time is greater than the pending broadcast duration, the Bluetooth monitor maintains the countdown time of the countdown timer unchanged.

[0272] The pending broadcast duration corresponding to the first Bluetooth broadcast request indicates the duration required to broadcast the broadcast content corresponding to the first Bluetooth broadcast request. If the remaining broadcast duration of the current Bluetooth is less than the pending broadcast duration corresponding to the first Bluetooth broadcast request, then the timing time of the countdown timer is updated to the pending broadcast duration. On the contrary, if the remaining broadcast duration of the current Bluetooth is greater than the pending broadcast duration corresponding to the first Bluetooth broadcast request, then the timing time of the countdown timer is not updated. In this way, regardless of whether the current remaining broadcast duration is greater than the pending broadcast duration corresponding to the first Bluetooth broadcast request, it can be ensured that the timing time of the countdown timer after the update can fully broadcast the broadcast content corresponding to the first Bluetooth broadcast request.

[0273] Further, after S1002 above, please continue to refer to Fig. 10C , the above method further includes S1003-S1007, wherein:

[0274] S1003. When it is determined according to the timing time of the third timer that the remaining broadcast duration of the current Bluetooth is 0, the Bluetooth monitor sends a call request of the Bluetooth broadcast stop interface to the Bluetooth.

[0275] S1004. The Bluetooth monitor updates the current Bluetooth broadcast state to a stopped state.

[0276] S1005. The Bluetooth stops the Bluetooth broadcast in response to the call request of the Bluetooth broadcast stop interface.

[0277] S1006. After the Bluetooth broadcast stops successfully, the Bluetooth sends a second call success message to the Bluetooth monitor.

[0278] The second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

[0279] S1007. When receiving the second call success information fed back by the Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state.

[0280] The specific implementation process of the above S1003-S1007 can refer to the description in the above embodiment and will not be repeated here.

[0281] In the technical solution provided in the embodiment of the present application, when the first Bluetooth broadcast request is received when the Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor will execute the broadcast operation corresponding to the first Bluetooth broadcast request in the broadcasting state and update the timing time of the third timer. In this way, it can be ensured that the broadcast content corresponding to the first Bluetooth broadcast request can be fully broadcast in the broadcasting state, reducing the possibility of Bluetooth broadcast messages being lost.

[0282] In addition, in some embodiments, the third timer may fail. In the case of the failure of the third timer, after the Bluetooth broadcast of the currently executed Bluetooth broadcast request is completed, the Bluetooth monitor will not call the Bluetooth broadcast stop interface, resulting in the Bluetooth broadcast being in the broadcasting state. In order to avoid this situation, the timing can be set after the Bluetooth broadcast corresponding to the current Bluetooth broadcast request is determined to be completed. If the Bluetooth monitor does not call the Bluetooth broadcast stop interface according to the timing time of the third timer within a period of time after the Bluetooth broadcast corresponding to the Bluetooth broadcast request is completed, the Bluetooth monitor can force the Bluetooth broadcast to stop.

[0283] In some embodiments, after S902, the method further includes: when the third timer expires, the Bluetooth monitor calls the Bluetooth broadcast stop interface of Bluetooth and updates the current Bluetooth broadcast state to the stopped state. When receiving the second call success information fed back by Bluetooth, the Bluetooth monitor updates the current Bluetooth broadcast state from the stopped state to the idle state.

[0284] In some embodiments, the failure of the third timer may specifically include that the countdown time of the countdown timer is inaccurate. Exemplarily, the inaccurate countdown time of the countdown timer may include: the countdown time of the third timer stops unchanged, the countdown speed of the countdown time of the third timer is inaccurate, etc. In this embodiment, once the Bluetooth monitor detects that the third timer fails, it can immediately call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast.

[0285] In other embodiments, taking the third timer as a countdown timer as an example, the failure of the third timer may also be that the Bluetooth monitor does not trigger to call the Bluetooth broadcast stop interface after the countdown timer becomes 0, etc. In this embodiment, the Bluetooth monitor may start timing from when the countdown timer becomes 0. If it is monitored that the duration after the countdown timer becomes 0 reaches a fifth preset time, it is determined that the third timer is invalid. At this time, the Bluetooth monitor may immediately call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast.

[0286] It should be noted that the third timer may be the same timer as the first timer and the second timer, or may be different timers.

[0287] In the technical solution provided by the embodiment of the present application, in the case where the Bluetooth monitor cannot turn off the Bluetooth broadcast when the Bluetooth broadcast is completed, the Bluetooth monitor can immediately call the Bluetooth broadcast stop interface to turn off the Bluetooth broadcast when it is determined that the third timer has expired. In this way, the problem of unnecessary power consumption caused by the Bluetooth broadcast still being in the broadcasting state for a long time after the current Bluetooth broadcast is completed can be avoided, thereby saving power.

[0288] In other embodiments, when the determination result of the above S901 is yes, the Bluetooth monitor needs to restart the Bluetooth broadcast, such as Fig.11 As shown, the above method also includes S1101-S1105. It should be noted that, in Fig.11 In the process shown, the execution process when the judgment result of S901 is no is not shown, wherein:

[0289] S1101. In response to the first Bluetooth broadcast request, the Bluetooth monitor sends a request to call a Bluetooth broadcast stop interface to the Bluetooth.

[0290] S1102. The Bluetooth monitor updates the Bluetooth broadcast state from the broadcasting state to the stopped state.

[0291] S1103. The Bluetooth stops the Bluetooth broadcast in response to the call request of the Bluetooth broadcast stop interface.

[0292] S1104. After the Bluetooth broadcast stops successfully, the Bluetooth sends a second call success message to the Bluetooth monitor.

[0293] The second call success information is used to indicate that the call of the Bluetooth broadcast stop interface is successful.

[0294] S1105. After receiving the second call success information, the Bluetooth monitor updates the Bluetooth broadcast state from the stopped state to the idle state.

[0295] In the technical solution provided in the embodiment of the present application, a preset periodic broadcast is set to indicate the restart of the Bluetooth broadcast, that is, the Bluetooth broadcast is restarted at regular intervals to avoid possible problems with Bluetooth caused by long-term continuous broadcasting of the Bluetooth broadcast, such as unnecessary power consumption, etc.

[0296] In addition, the preset periodic broadcast may also correspond to actual broadcast content. In some embodiments, the preset periodic broadcast is also used to broadcast the current device status information of the mobile phone. The device status information is used to indicate the current status of the mobile phone; in some embodiments, the device status information of the mobile phone may specifically include whether the WiFi switch of the mobile phone is turned on, the name of the network to which the WiFi is connected, and the quality of the WiFi network, etc.

[0297] In this embodiment, after S1105, the method further includes: the Bluetooth monitor executes a broadcast operation corresponding to a preset periodic broadcast by calling a Bluetooth interface to broadcast the current device status information of the electronic device.

[0298] In some embodiments, the Bluetooth monitor performs a broadcast operation corresponding to a preset periodic broadcast by calling a Bluetooth interface to broadcast the current device status information of the electronic device. Since the current Bluetooth broadcast state is an idle state, the process of the Bluetooth monitor performing the broadcast operation corresponding to the preset periodic broadcast can refer to Figure 5B The process shown is executed. That is, the Bluetooth monitor calls the Bluetooth broadcast start interface, and then after the Bluetooth broadcast is successfully started, the Bluetooth broadcast message is updated to the broadcast message corresponding to the preset periodic broadcast. Thus, the broadcast message content corresponding to the preset periodic broadcast of the Bluetooth broadcast is the current device status information of the mobile phone.

[0299] In the technical solution provided in the embodiment of the present application, a preset periodic broadcast is set to broadcast the latest device status information of the mobile phone at preset time intervals, so that the connection between the mobile phone and other electronic devices can be maintained.

[0300] In some embodiments, Fig.12 , which is a complete flow chart of a method for processing a Bluetooth broadcast request provided in an embodiment of the present application. In this example, the first preset time and the second preset time are both set to 100ms, the fourth preset time is set to 500ms, and the fifth preset time is set to 100ms.

[0301] Exemplarily, the Bluetooth monitor receives a second Bluetooth broadcast request in an idle state, and the second Bluetooth broadcast request is a broadcast request for a preset periodic broadcast. The Bluetooth monitor then receives a first Bluetooth broadcast request, and the first Bluetooth broadcast request is a broadcast request for disconnecting the WiFi switch (WiFi offline) triggered by the user. In addition, the waiting broadcast time corresponding to the preset periodic broadcast is 5s. The following is an example of the scenario of the processing method of the above Bluetooth broadcast request.

[0302] The Bluetooth monitor is executing a broadcast operation corresponding to a preset periodic broadcast in response to the second Bluetooth broadcast request. Under normal circumstances, in response to the second Bluetooth broadcast request, the Bluetooth broadcast state is updated from the idle state to the starting state, the broadcasting state, and the stopped state in sequence, and then updated from the stopped state to the idle state.

[0303] If the Bluetooth monitor receives the first Bluetooth broadcast request when the current Bluetooth broadcast state is in the starting state, then since the current Bluetooth broadcast state is in the unavailable state, the first waiting state needs to be entered for the first Bluetooth broadcast request. After the Bluetooth monitor updates the current Bluetooth broadcast state to the broadcasting state based on the second Bluetooth broadcast request, the Bluetooth monitor updates the Bluetooth message for the first Bluetooth broadcast request to broadcast the message that the WiFi switch is disconnected.

[0304] If the current Bluetooth broadcast state is in the broadcasting state, the Bluetooth monitor receives the first Bluetooth broadcast request. At this time, since the current Bluetooth broadcast state is in the broadcasting state, if it is detected that the remaining broadcast duration of the preset periodic broadcast is 3s (2s have been broadcasted), since 3s is greater than 500ms, it is determined that the current remaining broadcast duration is sufficient to broadcast the broadcast content corresponding to the first Bluetooth broadcast request. Therefore, at this time, the Bluetooth monitor can directly update the Bluetooth broadcast message based on the first Bluetooth broadcast request to broadcast the broadcast content corresponding to the first Bluetooth broadcast request.

[0305] If the Bluetooth monitor receives the first Bluetooth broadcast request when the current Bluetooth broadcast state is in the stopped state, then the first waiting state needs to be entered for the first Bluetooth broadcast request because the current Bluetooth broadcast state is in an unavailable state. After the Bluetooth monitor updates the current Bluetooth broadcast state to the idle state based on the second Bluetooth broadcast request, the Bluetooth monitor calls the Bluetooth broadcast start interface to start Bluetooth for the first Bluetooth broadcast request, and broadcasts the broadcast content corresponding to the first Bluetooth broadcast request through Bluetooth.

[0306] Some other embodiments of the present application provide a computer device, which may be the above-mentioned electronic device (such as a mobile phone). The computer device may include: a memory and one or more processors. The memory is coupled to the processor. The memory is also used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the computer device may execute the various functions or steps executed by the mobile phone in the above-mentioned method embodiment. When the computer device is an electronic device, its structure can refer to Figure 3 The structure of the electronic device 100 is shown.

[0307] The present application also provides a chip system, such as Fig.13 As shown, the chip system 130 includes at least one processor 1301 and at least one interface circuit 1302. The processor 1301 and the interface circuit 1302 can be interconnected through lines. For example, the interface circuit 1302 can be used to receive signals from other devices (such as the memory of a computer device). For another example, the interface circuit 1302 can be used to send signals to other devices (such as the processor 1301). Exemplarily, the interface circuit 1302 can read the instructions stored in the memory and send the instructions to the processor 1301. When the instruction is executed by the processor 1301, the computer device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0308] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as a mobile phone), the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.

[0309] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment. The computer may be an electronic device, such as a mobile phone.

[0310] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0311] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0312] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0313] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0314] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0315] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for processing a Bluetooth broadcast request, It is characterized in that The method is applied to an electronic device, and the method comprises: In response to the first Bluetooth broadcast request, the Bluetooth monitor of the electronic device acquires the current Bluetooth status; When the current Bluetooth state is in the starting state or the stopping state, the Bluetooth monitor enters a first waiting state; After the Bluetooth is successfully started or the Bluetooth is successfully stopped, the Bluetooth monitor responds to the first Bluetooth broadcast request and performs a Bluetooth broadcast operation.

2. The method according to claim 1, It is characterized in that The Bluetooth startup success includes: the Bluetooth monitor receives first call success information, and the first call success information is used to indicate that the Bluetooth broadcast startup interface call is successful; The Bluetooth stop success includes: the Bluetooth monitor receives second call success information, and the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

3. The method according to claim 1 or 2, It is characterized in that The method further comprises: If the current Bluetooth state is the starting state, then after the Bluetooth is successfully started, the Bluetooth monitor updates the current Bluetooth state to the broadcasting state; If the current Bluetooth state is the stopping state, then after the Bluetooth stops successfully, the Bluetooth monitor updates the current Bluetooth state to the idle state.

4. The method according to any one of claims 1 to 3, It is characterized in that The current Bluetooth status is stored in the Bluetooth monitor.

5. The method according to any one of claims 1 to 4, It is characterized in that After the Bluetooth monitor enters the first waiting state, the method further includes: In the first waiting state, the Bluetooth monitor acquires a first stay time in the starting state or the stopping state; If the first stay time does not exceed the first preset time, the Bluetooth monitor maintains the first waiting state.

6. The method according to any one of claims 1 to 5, It is characterized in that After the Bluetooth monitor enters the first waiting state, the method further includes: In the first waiting state, the Bluetooth monitor acquires a first stay time in the starting state or the stopping state; In the case where the current Bluetooth state is in the starting state, if the first stay time exceeds a first preset time, the Bluetooth monitor calls a Bluetooth broadcast stop interface; When the current Bluetooth state is a stopped state, if the first stay time exceeds a first preset time, the Bluetooth monitor calls a Bluetooth broadcast start interface.

7. The method according to any one of claims 1 to 6, It is characterized in that After the Bluetooth monitor of the electronic device acquires the current Bluetooth state in response to the first Bluetooth broadcast request, the method further includes: When the current Bluetooth state is an idle state, the Bluetooth monitor responds to the first Bluetooth broadcast request and calls a Bluetooth broadcast start interface; The Bluetooth monitor updates the current Bluetooth state from the idle state to the starting state; After receiving the first call success information, the Bluetooth monitor updates the current Bluetooth state from the startup state to the broadcast state; the first call success information is used to indicate that the Bluetooth broadcast startup interface call is successful; The Bluetooth monitor updates the broadcast message based on the first Bluetooth broadcast request; the updated broadcast message is used for the Bluetooth broadcast.

8. The method according to claim 7, It is characterized in that After the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface, the method further includes: The Bluetooth monitor sets a first timer based on the broadcast duration corresponding to the first Bluetooth broadcast request, and the first timer starts timing; Wherein, after the Bluetooth monitor updates the broadcast message based on the first Bluetooth broadcast request, the method further includes: When it is determined according to the timing time of the first timer that the current remaining broadcast duration is 0, the Bluetooth monitor calls a Bluetooth broadcast stop interface and updates the current Bluetooth state to a stopped state; After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth state from the stopping state to the idle state; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

9. The method according to claim 7, It is characterized in that Before the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface, the method further includes: When the current Bluetooth state is an idle state, the Bluetooth monitor acquires a second stay time in the idle state; The Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface, including: When the second stay time exceeds a second preset time, the Bluetooth monitor responds to the first Bluetooth broadcast request and calls the Bluetooth broadcast start interface.

10. The method according to any one of claims 7 to 9, It is characterized in that The Bluetooth monitor responds to the first Bluetooth broadcast request and calls a Bluetooth broadcast start interface, including: The Bluetooth monitor sends a call request of a Bluetooth broadcast start interface to the Bluetooth; the call request includes a third preset time, and the third preset time is used to instruct the Bluetooth to turn off the Bluetooth broadcast at a time point corresponding to the third preset time starting from the current time.

11. The method according to any one of claims 1 to 10, It is characterized in that After the Bluetooth monitor of the electronic device acquires the current Bluetooth state in response to the first Bluetooth broadcast request, the method further includes: When the current Bluetooth state is in the broadcasting state, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request; the updated broadcast message is used for the Bluetooth broadcasting.

12. The method according to claim 10, It is characterized in that Before the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the method further includes: The Bluetooth monitor determines whether the broadcast content corresponding to the first Bluetooth broadcast request is a preset periodic broadcast; the preset periodic broadcast is used to instruct the Bluetooth monitor to restart the Bluetooth broadcast; The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, including: When determining that the broadcast content corresponding to the first Bluetooth broadcast request is not the preset periodic broadcast, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request.

13. The method according to claim 11 or 12, It is characterized in that Before the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the method further includes: The Bluetooth monitor obtains the timing time of the second timer; the timing time of the second timer is used to indicate the remaining broadcasting time of the Bluetooth; The Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, including: When it is determined according to the timing time of the second timer that the current remaining broadcast duration exceeds a fourth preset time, the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request; the fourth preset time is used to indicate the minimum broadcast duration required for the Bluetooth broadcast.

14. The method according to claim 13, It is characterized in that After the Bluetooth monitor obtains the timing time of the second timer, the method further includes: When it is determined according to the timing time of the second timer that the current remaining broadcasting duration does not exceed the fourth preset time, the Bluetooth monitor enters a second waiting state; In the second waiting state, the Bluetooth monitor monitors the calling information; After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth state to an idle state, and the Bluetooth monitor performs a Bluetooth broadcast operation in response to the first Bluetooth broadcast request; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

15. The method according to claim 11, It is characterized in that After the Bluetooth monitor acquires the current Bluetooth status in response to the first Bluetooth broadcast request, the method further includes: In the case that the current Bluetooth state is in the broadcasting state, the Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request, and the third timer restarts timing; the timing time of the third timer is used to indicate the remaining broadcasting time of the Bluetooth; Wherein, after the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the method further includes: When it is determined according to the timing time of the third timer that the remaining broadcasting duration of the Bluetooth is 0, the Bluetooth monitor calls a Bluetooth broadcast stop interface and updates the current Bluetooth state to a stopped state; After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth state from the stopping state to the idle state; the second call success information is used to indicate that the Bluetooth broadcast stop interface call is successful.

16. The method according to claim 15, It is characterized in that The third timer is a countdown timer, and the countdown time of the countdown timer is used to indicate the remaining broadcasting time of the Bluetooth; The Bluetooth monitor updates the timing time of the third timer based on the first Bluetooth broadcast request, including: The Bluetooth monitor obtains the waiting broadcast time corresponding to the first Bluetooth broadcast request; The Bluetooth monitor compares the countdown time with the duration of the broadcast; If the waiting broadcast time is longer than the countdown time, the Bluetooth monitor updates the current countdown time of the countdown timer to the waiting broadcast time corresponding to the first Bluetooth broadcast request; If the countdown time is greater than or equal to the waiting broadcast time, the countdown time of the countdown timer is maintained unchanged by the Bluetooth monitor.

17. The method according to claim 15, It is characterized in that After the Bluetooth monitor updates the Bluetooth broadcast message based on the first Bluetooth broadcast request, the method further includes: When the third timer expires, the Bluetooth monitor calls the Bluetooth broadcast stop interface and updates the current Bluetooth state to a stopped state; After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth state from the stopping state to the idle state.

18. The method according to any one of claims 12 to 17, It is characterized in that The method further comprises: When the Bluetooth monitor determines that the broadcast content corresponding to the first Bluetooth broadcast request is the preset periodic broadcast, it calls the Bluetooth broadcast stop interface and updates the current Bluetooth state from the broadcasting state to the stopped state; After receiving the second call success information, the Bluetooth monitor updates the current Bluetooth state from the stopping state to the idle state.

19. The method according to claim 18, It is characterized in that The preset periodic broadcast is also used to broadcast the current device status information of the electronic device; After the Bluetooth monitor updates the current Bluetooth state from the stopped state to the idle state, the method further includes: The Bluetooth monitor executes the broadcast operation corresponding to the preset periodic broadcast by calling the Bluetooth interface to broadcast the current device status information of the electronic device.

20. An electronic device, It is characterized in that The electronic device comprises: a processor and a memory; the memory stores a computer program code, the computer program code comprises computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-19.

21. A computer-readable storage medium, It is characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 19.