[go: up one dir, main page]

CN119155663A - Communication mode switching method, device, medium and equipment based on Bluetooth connection - Google Patents

Communication mode switching method, device, medium and equipment based on Bluetooth connection Download PDF

Info

Publication number
CN119155663A
CN119155663A CN202411519802.3A CN202411519802A CN119155663A CN 119155663 A CN119155663 A CN 119155663A CN 202411519802 A CN202411519802 A CN 202411519802A CN 119155663 A CN119155663 A CN 119155663A
Authority
CN
China
Prior art keywords
mode switching
request
feedback information
communication mode
switching request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411519802.3A
Other languages
Chinese (zh)
Inventor
张瀚坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202411519802.3A priority Critical patent/CN119155663A/en
Publication of CN119155663A publication Critical patent/CN119155663A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. Transmission Power Control [TPC] or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0225Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
    • H04W52/0229Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal where the received signal is a wanted signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请实施例提供一种基于蓝牙连接的通信模式切换方法、装置、介质及设备,该方法包括:在检测到开启呼吸模式的触发条件时,向第二设备发起模式切换请求,并冻结第一设备的指令下发权限;记录模式切换请求的发起时间,并获取当前的目标参数值,通过目标参数值预测超时等待时间;监测模式切换请求的执行结果;若超过超时等待时间未收到请求反馈信息,则解除第一设备的指令下发权限;重新向第二设备发起模式切换请求。本申请能够提升通信模式切换的成功率,和避免第一设备因缺少指令下发权限导致无法正常控制第二设备。

The embodiment of the present application provides a communication mode switching method, device, medium and equipment based on Bluetooth connection, the method comprising: when a trigger condition for turning on the breathing mode is detected, a mode switching request is initiated to the second device, and the instruction issuing authority of the first device is frozen; the initiation time of the mode switching request is recorded, and the current target parameter value is obtained, and the timeout waiting time is predicted by the target parameter value; the execution result of the mode switching request is monitored; if the request feedback information is not received after the timeout waiting time, the instruction issuing authority of the first device is released; and the mode switching request is initiated again to the second device. The present application can improve the success rate of communication mode switching, and avoid the first device being unable to control the second device normally due to the lack of instruction issuing authority.

Description

Communication mode switching method, device, medium and equipment based on Bluetooth connection
Technical Field
The present application relates to the field of communications technologies, and in particular, to a communication mode switching technology field based on bluetooth connection, and in particular, to a communication mode switching method, device, medium, and apparatus based on bluetooth connection.
Background
The bluetooth core specification defines a number of modes for classical bluetooth connection states including, for example, active mode, sniff mode and Hold mode. The active mode and the breathing mode, the active mode and the holding mode may be switched to each other. In the active mode, the master device can try to use available resources to communicate, in the breathing mode, the master device and the slave device need to agree on a breathing interval, the master device and the slave device communicate at the agreed interval, the slave device sleeps during the interval, and in the holding mode, the slave device can sleep until the agreed holding mode time is up, and the slave device can not wake up.
The master device may enter an intermediate state (mode) during initiation of the breathing mode to the slave device, in which the master device is not allowed to issue data to the bluetooth chip of the master device. If the bluetooth chip of the master device fails to upload a success event or a failure event sent by the slave device to the master device in a scheduled time due to the device itself or environmental interference, the connection state between the master device and the bluetooth chip of the master device is caused to stay in an intermediate state all the time, so that the subsequent master device cannot issue any instruction to the bluetooth chip of the master device. The most direct effect is that the related Bluetooth remote control command cannot be issued to the slave device through the master device, so that the master device fails to control the slave device.
Disclosure of Invention
The embodiment of the application provides a communication mode switching method, device, medium and equipment based on Bluetooth connection. The communication mode switching method based on Bluetooth connection provided by the embodiment of the application solves the problem that the host chip fails to upload a success event or a failure event sent by the slave device to the host device within a stipulated time, so that the connection state between the host device and the Bluetooth chip of the host device stays in an intermediate state all the time, and the subsequent host device cannot send any instruction to the Bluetooth chip of the host device.
In one aspect, an embodiment of the present application provides a method for switching communication modes based on bluetooth connection, which is applied to a first device, and includes:
when a triggering condition for starting a breathing mode is detected, a mode switching request is initiated to second equipment, and the instruction issuing authority of the first equipment is frozen;
recording the initiation time of the mode switching request, acquiring a target parameter value corresponding to a preset parameter which is currently used for influencing the communication quality, inputting the target parameter value into a pre-trained time determination model for performing time prediction operation, and obtaining predicted overtime waiting time;
Monitoring an execution result of the mode switching request;
If the execution result is that the request feedback information is not received after the timeout waiting time is exceeded, releasing the instruction issuing authority of the first equipment;
And re-initiating a mode switching request to the second equipment.
In the method for switching communication modes based on bluetooth connection according to the embodiment of the present application, before the mode switching request is initiated to the second device, the method further includes:
acquiring a preset parameter value generated during each link management protocol interaction in the process of establishing Bluetooth connection between the first equipment and the second equipment;
and training the initial time determination model by taking each preset parameter value as a model training sample, and adjusting model parameters of the initial time determination model by using a random gradient descent algorithm until the loss function value of the initial time determination model exceeds a preset threshold value, and completing model training to obtain a pre-trained time determination model.
In the method for switching communication modes based on bluetooth connection according to the embodiment of the present application, after the monitoring of the execution result of the mode switching request, the method further includes:
If the execution result is that the allowable switching feedback information returned by the second equipment is received within the timeout waiting time, switching the current communication mode between the first equipment and the second equipment to a breathing mode;
if the execution result is that the refused switching feedback information returned by the second equipment is received within the timeout waiting time, the current communication mode between the first equipment and the second equipment is not changed and/or
And generating prompt information containing the refused switching feedback information to prompt a user.
In the method for switching communication modes based on bluetooth connection according to the embodiment of the present application, before the mode switching request is reinitiated to the second device, the method further includes:
acquiring the repeated initiation times of the current mode switching request;
and if the repeated starting times exceeds the preset times, stopping starting the mode switching request to the second equipment, and generating an equipment abnormality message to prompt a user.
In the method for switching communication modes based on bluetooth connection according to the embodiment of the present application, before the mode switching request is initiated to the second device, the method further includes:
checking the role state of the first device in the current Bluetooth local area network, wherein the role state comprises a central device or a peripheral device;
if the role state of the first device is the central device, increasing the initial polling interval between the first device and the second device on the premise of not exceeding the preset maximum polling interval.
In the method for switching communication modes based on bluetooth connection according to the embodiment of the present application, after the role state of the first device in the current bluetooth local area network is checked, the method further includes:
if the role state of the first device is peripheral device, initiating a role exchange request to a central device in the current Bluetooth local area network so as to modify the role state of the first device into the central device, so that the first device has modification authority for modifying the polling interval between the first device and the second device;
and on the basis of the modification authority, increasing the initial polling interval between the first equipment and the second equipment on the premise of not exceeding the preset maximum polling interval.
Correspondingly, another aspect of the embodiment of the present application further provides a communication mode switching method based on bluetooth connection, which is applied to a second device, and includes:
receiving a mode switching request initiated by first equipment;
generating corresponding request feedback information according to the mode switching request, and sending the request feedback information to the first equipment;
If the feedback information request is feedback information allowing switching, switching the current communication mode between the first equipment and the second equipment to a breathing mode;
and if the request feedback information is refused to switch the feedback information, not changing the current communication mode between the first equipment and the second equipment.
Correspondingly, another aspect of the embodiment of the present application further provides a communication mode switching device based on bluetooth connection, which is applied to a first device, where the communication mode switching device based on bluetooth connection includes:
The detection module is used for initiating a mode switching request to the second equipment when detecting a triggering condition for starting a breathing mode, and freezing the instruction issuing authority of the first equipment;
The prediction module is used for recording the initiation time of the mode switching request, acquiring a target parameter value corresponding to a preset parameter which is currently used for influencing the communication quality, inputting the target parameter value into a pre-trained time determination model for performing time prediction operation, and obtaining predicted overtime waiting time;
The monitoring module is used for monitoring the execution result of the mode switching request;
the release module is used for releasing the instruction issuing authority of the first equipment if the execution result is that the request feedback information is not received beyond the timeout waiting time;
and the retry module is used for reinitiating a mode switching request to the second equipment.
Accordingly, another aspect of the embodiments of the present application provides a storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the communication mode switching method based on bluetooth connection as described above.
Accordingly, another aspect of the embodiments of the present application provides an electronic device, including a processor and a memory, where the memory stores a plurality of instructions, and the processor loads the instructions to perform the communication mode switching method based on bluetooth connection as described above.
The embodiment of the application provides a communication mode switching method, a device, a medium and equipment based on Bluetooth connection, wherein the method initiates a mode switching request to second equipment and freezes the instruction issuing authority of first equipment when detecting the triggering condition of starting a breathing mode; recording the initiation time of a mode switching request, acquiring a target parameter value corresponding to a preset parameter which is used for influencing the communication quality currently, inputting the target parameter value into a time determination model for time prediction operation to obtain predicted overtime waiting time, monitoring the execution result of the mode switching request, releasing the instruction issuing authority of the first equipment if the execution result is that the request feedback information is not received after the overtime waiting time is exceeded, and initiating the mode switching request to the second equipment again. By setting a reasonable overtime waiting time, if the first equipment does not receive the request feedback information sent by the second equipment within the overtime waiting time, the instruction issuing authority of the first equipment is released, and the mode switching request is initiated to the second equipment again, so that the success rate of the communication mode switching is improved, and the situation that the second equipment cannot be controlled normally due to the lack of the instruction issuing authority of the first equipment is avoided. And the timeout waiting time is dynamically generated according to the current use scene, so that the method can be more in line with the current use scene, and the problem that the first device fails to normally receive the request feedback information due to the fact that the mode switching request is re-initiated to the second device in advance or delayed is avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the description of the embodiments will be briefly described below. It is evident that the drawings in the following description are only some embodiments of the application and that other drawings may be obtained from these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a communication mode switching method based on bluetooth connection according to an embodiment of the present application.
Fig. 2 is another flow chart of a communication mode switching method based on bluetooth connection according to an embodiment of the present application.
Fig. 3 is another flow chart of a communication mode switching method based on bluetooth connection according to an embodiment of the present application.
Fig. 4 is another flow chart of a communication mode switching method based on bluetooth connection according to an embodiment of the present application.
Fig. 5 is another flow chart of a communication mode switching method based on bluetooth connection according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a communication mode switching device based on bluetooth connection according to an embodiment of the present application.
Fig. 7 is a schematic diagram of another structure of a communication mode switching device based on bluetooth connection according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by a person skilled in the art without any inventive effort, are intended to be within the scope of the present application based on the embodiments of the present application.
The embodiment of the application provides a communication mode switching method based on Bluetooth connection, which is utilized to set a reasonable overtime waiting time, if a first device does not receive request feedback information sent by a second device within the overtime waiting time, the instruction issuing authority of the first device is released, and a mode switching request is initiated to the second device again, so that the success rate of communication mode switching is improved, and the situation that the second device cannot be controlled normally due to the lack of the instruction issuing authority of the first device is avoided. And the timeout waiting time is dynamically generated according to the current use scene, so that the method can be more in line with the current use scene, and the problem that the first device fails to normally receive the request feedback information due to the fact that the mode switching request is re-initiated to the second device in advance or delayed is avoided.
The term "and/or" appearing in the present application may be an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B, and may indicate that a exists alone, while a and B exist together, and B exists alone. In the present application, the character "/" generally indicates that the front and rear related objects are an or relationship.
The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to only those steps or modules that are expressly listed or inherent to such process, method, article, or apparatus. The naming or numbering of the steps in the present application does not mean that the steps in the method flow must be executed according to the time/logic sequence indicated by the naming or numbering, and the execution sequence of the steps in the flow that are named or numbered may be changed according to the technical purpose to be achieved, so long as the same or similar technical effects can be achieved. The division of the modules in the present application is a logical division, and may be implemented in another manner in practical applications, for example, a plurality of modules may be combined or integrated in another system, or some features may be omitted or not implemented, and further, coupling or direct coupling or communication connection between the modules shown or discussed may be through some interfaces, and indirect coupling or communication connection between the modules may be electrical or other similar manners, which are not limited in the present application. The modules or sub-modules described as separate components may be physically separated or not, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present application.
The communication mode switching method based on Bluetooth connection, which is related to the embodiment of the application, is mainly applied to electronic equipment, and the electronic equipment can be a smart phone, a tablet personal computer, a notebook computer, a desktop computer, an intelligent household appliance, a server and the like, and is not limited herein. Alternatively, the server may be an independent physical server, or a server cluster or a distributed system formed by a plurality of physical servers, or an IoT cloud (internet of things cloud) that provides an ability to store, process, and manage data generated by the internet of things device, or a cloud server that provides a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network, a content delivery network), and a basic cloud computing service such as a big data and an artificial intelligence platform, which are not limited herein.
For easy understanding, a specific flow in the embodiments of the present application is described below, and referring to fig. 1, fig. 1 is a schematic flow diagram of an embodiment of a communication mode switching method based on bluetooth connection according to the embodiments of the present application.
In the embodiment shown in fig. 1, the method applied to the first device may include the steps of:
S101, when a triggering condition for starting a breathing mode is detected, a mode switching request is initiated to second equipment, and the instruction issuing authority of the first equipment is frozen.
It should be explained that the sniff mode is one of the classical bluetooth connection states for turning on when the bluetooth device does not need continuous communication to function to reduce power consumption. In the breathing mode, the Bluetooth device periodically disconnects and reestablishes the connection with the paired device, thereby achieving the effect of reducing energy consumption.
The breathing mode is typically not actively initiated by the device, but rather is automatically switched to the breathing mode when a trigger condition is detected to turn on the breathing mode when the device is in a hold mode or sleep mode. For example, when the first device is in the hold mode and it is detected that no data exchange occurs within the timeout waiting time, the first device may be considered to satisfy a trigger condition for starting the breathing mode, and the first device may automatically initiate a mode switching request to a second device connected to the first device via bluetooth, so as to request to switch the current communication mode to the breathing mode, so as to reduce power consumption of the device.
It should be noted that, in this scheme, the first device actually includes a master device control chip and a master device bluetooth chip, when the first device initiates a mode switching request to the second device to switch the current communication mode to the breathing mode, the master device control chip firstly sends a mode switching application to the master device bluetooth chip, after the master device control chip receives the application success information fed back by the master device bluetooth chip, the master device control chip automatically enters an intermediate state (mode), and the master device control chip is not allowed to issue data to the master device bluetooth chip in the intermediate state. The main reasons include the following:
1. Avoiding collisions, the second device may need to perform some specific operations to adapt to the new communication mode during the mode switch. If the first device sends other instructions at this time, it may collide with the requirement of the second device during the mode switching, so that the second device cannot respond correctly or perform the wrong operation.
2. Ensuring stability, mode switching is a sensitive process that requires the second device to centralize the resources to complete. The prohibition instruction issuing can reduce the data quantity which needs to be processed during the mode switching period of the second equipment, and ensure the stability and success rate of the mode switching process.
3. Preventing erroneous operation, the second device may not support certain device instructions or may not respond correctly to such instructions during the mode switch. Disabling instruction issue may prevent the second device from being subject to errors or malfunctions due to attempts to perform improper operations.
4. Resource management, the second device may need to reconfigure its bluetooth stack and hardware resources when switching modes. In this process, the second device may not be able to process the new instruction, so disabling instruction issue is to avoid wasting resources and possible resulting problems.
S102, recording the initiation time of the mode switching request, acquiring a target parameter value corresponding to a preset parameter which is currently used for influencing the communication quality, inputting the target parameter value into a pre-trained time determination model for performing time prediction operation, and obtaining predicted timeout waiting time.
It should be explained that, because the bluetooth chip of the second device or the master device of the first device may be affected by network quality or system resources, there is a certain time delay when the request feedback information is sent to the master device control chip of the first device, if the influence possibly caused by the time delay is ignored, the request feedback information may be mistakenly considered to be sent abnormally, so that the master device control chip card of the first device is directly in an intermediate state, and cannot continuously control the second device.
For example, when the second device receives the mode switching request, or the bluetooth chip of the master device of the first device forwards the request feedback information to the control chip of the master device of the first device, the current network quality of the second device or the bluetooth chip of the master device is poor, which causes that the bluetooth chip of the second device or the bluetooth chip of the master device cannot timely send data to the corresponding receiving end, and in fact, the bluetooth chip of the second device or the bluetooth chip of the master device may be able to send the data in the next second. When the timeout waiting time is fixed, the above listed situation is determined to be timeout transmission, and meanwhile, the master device of the first device may directly cause the chip card to be controlled in an intermediate state, and the second device cannot be controlled continuously.
For another example, when the second device receives the mode switching request, or the master bluetooth chip of the first device forwards the request feedback information to the master control chip of the first device, the current network quality of the second device or the master bluetooth chip is better, and under normal conditions, the second device or the master bluetooth chip can shorten the time of transmitting the data to the corresponding receiving end. When the timeout waiting time is fixed, even if the current network quality can meet the requirement of rapid data transmission, the current network quality needs to wait until the preset timeout waiting time is exceeded, and the current network quality is possibly judged to be in timeout transmission.
In summary, because the timeout waiting time is set to be too long or too short to bring adverse effects, in this embodiment, when a mode switching request is initiated to the second device, a target parameter value corresponding to a preset parameter currently used to affect the communication quality is acquired, the target parameter value is input into a pre-trained time determination model to perform a time prediction operation, so as to obtain a predicted timeout waiting time, and the timeout waiting time is a dynamic adjustment result.
S103, monitoring an execution result of the mode switching request.
It should be noted that, if the bluetooth chip of the master device of the first device fails to upload a success event or a failure event sent by the second device to the control chip of the master device within a stipulated time due to the self-cause or environmental interference of the device, the connection state between the control chip of the master device and the bluetooth chip of the master device will stay in an intermediate state all the time, so that the control chip of the subsequent device cannot issue any instruction to the bluetooth chip of the master device. The most direct effect is that the related Bluetooth remote control command cannot be issued to the second device through the first device, so that the first device fails to control the second device. Therefore, in this embodiment, it is necessary to monitor the execution result of the mode switching request and execute a corresponding operation according to the execution result.
And S104, if the execution result is that the request feedback information is not received after the timeout waiting time is exceeded, releasing the instruction issuing authority of the first equipment.
When the execution result is that the request feedback information returned by the second device is not received after the timeout waiting time is exceeded, in order to avoid that the connection state between the master device control chip and the master device Bluetooth chip stays in the intermediate state all the time, the subsequent device control chip cannot send any instruction to the master device Bluetooth chip. In this embodiment, conditions are created for the first device to initiate the mode switching request to the second device again by releasing the instruction issuing authority of the control chip of the master device in the first device.
S105, re-initiating a mode switching request to the second equipment.
In this embodiment, by re-initiating the mode switching request to the second device, the success rate of mode switching is improved, so that the first device is prevented from staying in the intermediate state for a long time, and the first device cannot continuously control the second device.
Meanwhile, in the scheme, when the request feedback information is not received after the timeout waiting time is detected to be exceeded, the target parameter value corresponding to the current preset parameter is acquired, and the timeout waiting time is redetermined, so that the timeout waiting time can be set to a smaller value when the timeout waiting time meets the requirement of down regulation, the first equipment can timely reinitiate the mode switching request to the second equipment, and the second equipment can rapidly respond to the mode switching request.
In some embodiments, as shown in fig. 2, before said S101, the method further comprises the steps of:
And acquiring a preset parameter value generated during each link management protocol interaction in the process of establishing Bluetooth connection between the first equipment and the second equipment.
In this embodiment, the preset parameters refer to various parameters capable of affecting the communication quality, and may include, but are not limited to, the following parameters:
The device type of the second device, such as a television, a mobile phone, a sound box, an earphone, a computer, etc.
The delay value, i.e. the last five times the first device had sent the link management protocol from the downlink to the second device, and then to the time average of the feedback information received from the second device (preferably the time corresponding to the last five downlink management protocols was averaged).
Signal Strength (RSSI) values.
The number of retransmissions, i.e. the average of the number of retransmissions required by the first five times from the downlink management protocol to the hit of the second device (preferably the average of the number of times corresponding to the last five downlink management protocols).
And training the initial time determination model by taking each preset parameter value as a model training sample, and adjusting model parameters of the initial time determination model by using a random gradient descent algorithm until the loss function value of the initial time determination model exceeds a preset threshold value, and completing model training to obtain a pre-trained time determination model.
In this embodiment, a random gradient descent (SGD) algorithm is used to train the model and change the parameters of the model. During training, the random gradient descent algorithm optimizes the performance of the model by iteratively adjusting the parameters of the model to minimize the loss function. Specifically, the stochastic gradient descent algorithm calculates the gradient of the loss function with respect to the model parameters for each iteration and updates the parameters of the model based on these gradients and the learning rate. This process continues until the loss function value of the model reaches a preset threshold or the performance of the model is no longer significantly improved.
In some embodiments, as shown in fig. 2, after said S103, the method further comprises the steps of:
And S1031, if the execution result is that the switching permission feedback information returned by the second equipment is received within the timeout waiting time, switching the current communication mode between the first equipment and the second equipment to a breathing mode.
In this embodiment, when it is detected that the first device receives the feedback information that allows switching and is returned by the second device, and the feedback information is received within the timeout waiting time, and indicates that the engagement of the breathing mode has been completed between the first device and the second device, the current communication mode between the first device and the second device may be switched to the breathing mode. It should be noted that, the switching feedback information is specifically allowed to be uploaded to the master device bluetooth chip of the first device first, and then uploaded to the master device control chip of the first device by the master device bluetooth chip.
S1032, if the execution result is that the refused switching feedback information returned by the second equipment is received within the timeout waiting time, the current communication mode between the first equipment and the second equipment is not changed, and/or prompt information containing the refused switching feedback information is generated to prompt the user.
In this embodiment, when it is detected that the first device receives the feedback information of allowing switching returned by the second device, and the feedback information is received within the timeout waiting time, it indicates that the second device refuses the mode switching request initiated by the first device, and at this time, the current communication mode between the first device and the second device is continuously maintained. It should be noted that, the refused switching feedback information is specifically uploaded to the master device bluetooth chip of the first device, and then uploaded to the master device control chip of the first device by the master device bluetooth chip.
In other embodiments, a prompt may also be generated to prompt the user containing refusal to switch feedback information, such as "the second device is temporarily unable to switch to respiratory mode because there are important files to transmit".
In some embodiments, as shown in fig. 3, before said S105, the method further comprises the steps of:
S1041, obtaining the repeated initiation times of the current mode switching request;
in this embodiment, since the first device repeatedly initiates the mode switching request multiple times, the feedback information of the request cannot be received within the timeout waiting time, possibly because the first device or the second device has an abnormal device or other unknown reasons, if the mode switching request is still repeatedly initiated to the second device without limitation at this time, the user cannot be prompted timely, so as to take intervention measures to solve the problem that the second device cannot be normally controlled at present, and waste of system resources is caused.
S1042, judging whether the repeated starting times exceeds the preset times.
S1043, if the repeated initiation times exceeds the preset times, stopping initiating a mode switching request to the second equipment, and generating an equipment abnormality message to prompt a user.
In this embodiment, the number of repeated initiation may be set, for example, three times, and when the request feedback information cannot be received within the timeout waiting time for more than three times, the initiation of the mode switching request to the second device is stopped, and the device exception message is generated to prompt the user, where the user may attempt to repair by restarting the device or disconnecting the reconnection bluetooth.
In some embodiments, as shown in fig. 4, before said S101, the method further comprises the steps of:
S1011, checking the role state of the first device in the current Bluetooth local area network, wherein the role state comprises a central device or a peripheral device.
It should be explained that in bluetooth technology, devices in bluetooth local area networks are generally classified into two roles, central device (Central) and Peripheral device (Peripheral), which are the basis of Bluetooth Low Energy (BLE) communication mode.
Central device (Central) the Central device is responsible for discovery and connection of peripheral devices. In bluetooth local area networks, the central device typically plays the role of a client, which can actively search for and establish a connection with peripheral devices. Once the connection is established, the central device may read or write the services and features of the peripheral device.
Peripheral devices (Peripheral) provide services and features that can be discovered and connected by the central device. In bluetooth local area networks, a peripheral device typically plays the role of a server, broadcasting its own presence and available services so that a central device can discover and interact with it.
And S1012, if the role state of the first device is central equipment, increasing the initial polling interval between the first device and the second device on the premise of not exceeding the preset maximum polling interval.
In this embodiment, when the first device initiates a mode switching request to the second device, it needs to ensure that the first device is a central device in the current bluetooth local area network, so that the first device has the authority to modify the polling interval, where the polling interval refers to how often the first device sends a polling command to query the state or data of the second device, so as to ensure that the first device and the second device can maintain a connection state.
The first device with the right of modifying the polling interval increases the initial polling interval on the premise of not exceeding the maximum polling interval, so that the first device and the second device can not only keep a connection state, but also occupy excessive system resources due to frequent polling operation, and the influence of the first device in the process of initiating a mode switching request to the second device is reduced, thereby improving the successful hit rate of mode switching.
In some embodiments, as shown in fig. 4, after said S1011, the method further comprises the steps of:
And S1013, if the role state of the first device is a peripheral device, initiating a role exchange request to a central device in the current Bluetooth local area network so as to modify the role state of the first device into the central device, so that the first device has modification authority for modifying the polling interval between the first device and the second device.
In this embodiment, since the first device needs to ensure that the first device is a central device in the bluetooth local area network when initiating the mode switching request, when confirming that the first device is not the central device, a role exchange request is initiated to the central device in the current bluetooth local area network, that is, a master-slave role exchange request is initiated, so that the first device has the authority to modify the polling interval.
S1014, based on the modification authority, increasing an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
In this embodiment, the first device having the right to modify the polling interval increases the initial polling interval on the premise that the maximum polling interval is not exceeded, so that the first device and the second device can not only maintain a connection state, but also occupy too many system resources due to frequent polling operation, and the influence of the first device in the process of initiating a mode switching request to the second device is reduced, thereby improving the successful hit rate of mode switching.
It can be seen that, according to the communication mode switching method based on bluetooth connection provided by the embodiment of the application, when the triggering condition of starting the breathing mode is detected, a mode switching request is initiated to a second device, the instruction issuing authority of the first device is frozen, the initiation time of the mode switching request is recorded, a target parameter value corresponding to a preset parameter which is currently used for influencing the communication quality is obtained, the target parameter value is input into a pre-trained time determination model to perform time prediction operation, a predicted timeout waiting time is obtained, the execution result of the mode switching request is monitored, if the execution result exceeds the timeout waiting time, the instruction issuing authority of the first device is released, and the mode switching request is initiated to the second device again. By setting a reasonable overtime waiting time, if the first device does not receive the request feedback information sent by the second device within the overtime waiting time, the instruction issuing authority of the first device is released, and the mode switching request is initiated to the second device again, so that the success rate of the communication mode switching is improved, and the situation that the second device cannot be controlled normally due to the lack of the instruction issuing authority of the first device is avoided. And the timeout waiting time is dynamically generated according to the current use scene, so that the method can be more in line with the current use scene, and the problem that the first device fails to normally receive the request feedback information due to the fact that the mode switching request is re-initiated to the second device in advance or delayed is avoided.
In some embodiments, in the embodiment shown in fig. 5, the method may also be applied to a second device, comprising the steps of:
s201, a mode switching request initiated by the first equipment is received.
This step can be understood by referring to the content of step S101 in fig. 1, and will not be described here.
S202, corresponding request feedback information is generated according to the mode switching request, and the request feedback information is sent to the first device.
In this embodiment, the corresponding request feedback information is given according to the mode switching request initiated by the first device, and the request feedback information is sent to the first device, so that the first device can execute the corresponding operation according to the request feedback information.
And S203, if the request feedback information is the feedback information allowing switching, switching the current communication mode between the first equipment and the second equipment to a breathing mode.
This step can be understood by referring to the content of step S1031 in fig. 2, and will not be described here.
S204, if the request feedback information is refusal to switch feedback information, the current communication mode between the first equipment and the second equipment is not changed.
This step can be understood by referring to the content of step S1032 in fig. 2, and will not be described here.
Any combination of the above optional solutions may be adopted to form an optional embodiment of the present application, which is not described herein.
In particular, the application is not limited by the order of execution of the steps described, as some of the steps may be performed in other orders or concurrently without conflict.
It can be seen that the communication mode switching method based on bluetooth connection provided by the embodiment of the application is characterized by receiving a mode switching request initiated by a first device, generating corresponding request feedback information according to the mode switching request, sending the request feedback information to the first device, switching the current communication mode between the first device and a second device to a breathing mode if the request feedback information is feedback information allowing switching, and not changing the current communication mode between the first device and the second device if the request feedback information is feedback information refusing switching. By using the communication mode switching method based on Bluetooth connection provided by the embodiment of the application, corresponding request feedback information can be given according to the mode switching request initiated by the first equipment, and corresponding operation can be executed.
The embodiment of the application also provides a communication mode switching device based on the Bluetooth connection, which can be integrated in the electronic equipment.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a communication mode switching device based on bluetooth connection according to an embodiment of the present application. The communication mode switching device 30 based on bluetooth connection may include:
The detection module 31 is configured to initiate a mode switching request to a second device and freeze an instruction issuing authority of the first device when a triggering condition for opening a breathing mode is detected;
The prediction module 32 is configured to record an initiation time of the mode switching request, obtain a target parameter value corresponding to a preset parameter currently used for affecting communication quality, input the target parameter value into a pre-trained time determination model, and perform a time prediction operation, so as to obtain a predicted timeout waiting time;
a monitoring module 33, configured to monitor an execution result of the mode switching request;
A releasing module 34, configured to release the instruction issuing authority of the first device if the execution result is that the request feedback information is not received beyond the timeout waiting time;
a retry module 35, configured to reinitiate a mode switch request to the second device.
In some embodiments, the apparatus further includes a training module, configured to obtain preset parameter values generated during each link management protocol interaction in a process of establishing a bluetooth connection between the first device and the second device, train an initial time determination model by using each preset parameter value as a model training sample, and adjust model parameters of the initial time determination model by using a random gradient descent algorithm until a loss function value of the initial time determination model exceeds a preset threshold, complete model training, and obtain a pre-trained time determination model.
In some embodiments, the apparatus further includes an execution module, configured to switch a current communication mode between the first device and the second device to a breathing mode if the execution result is that the switching permission feedback information returned by the second device is received within a timeout waiting time, and/or generate a prompt message containing the switching refusal feedback information to prompt a user without changing the current communication mode between the first device and the second device if the execution result is that the switching refusal feedback information returned by the second device is received within the timeout waiting time.
In some embodiments, the apparatus further includes an obtaining module, configured to obtain a number of repeated initiation times of the current mode switching request, and if the number of repeated initiation times exceeds a preset number of times, stop initiating the mode switching request to the second device, and generate a device exception message to prompt a user.
In some embodiments, the apparatus further includes a checking module configured to check a role state of the first device in the current bluetooth local area network, where the role state includes a central device or a peripheral device, and if the role state of the first device is the central device, increase an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
In some embodiments, the apparatus further includes a modification module, configured to initiate a role exchange request to a central device in the current bluetooth local area network if the role state of the first device is a peripheral device, so as to modify the role state of the first device into the central device, so that the first device has a modification authority for modifying a polling interval with the second device, and increase an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded based on the modification authority.
In specific implementation, each module may be implemented as a separate entity, or may be combined arbitrarily and implemented as the same entity or several entities.
As can be seen from the foregoing, the communication mode switching device 30 based on bluetooth connection provided in the embodiments of the present application is configured to, when detecting a triggering condition for starting a breathing mode, initiate a mode switching request to a second device and freeze an instruction issuing authority of the first device, predict a module 32 configured to record an initiation time of the mode switching request, obtain a target parameter value corresponding to a preset parameter currently used for affecting communication quality, input the target parameter value into a pre-trained time determination model for performing a time prediction operation, obtain a predicted timeout waiting time, monitor a result of the mode switching request, and release a module 34 configured to release the instruction issuing authority of the first device if the execution result is that the request feedback information is not received beyond the timeout waiting time, and retry a module 35 configured to initiate the mode switching request to the second device again.
Referring to fig. 7, fig. 7 is a schematic diagram of another structure of a communication mode switching device based on bluetooth connection according to an embodiment of the application, the communication mode switching device 30 based on bluetooth connection includes a memory 120, one or more processors 180, and one or more application programs, wherein the one or more application programs are stored in the memory 120 and configured to be executed by the processor 180, and the processor 180 may include a detection module 31, a prediction module 32, a monitoring module 33, a release module 34, and a retry module 35. For example, the structures and connection relationships of the above respective components may be as follows:
Memory 120 may be used to store applications and data. The memory 120 stores application programs including executable code. Applications may constitute various functional modules. The processor 180 executes various functional applications and data processing by running application programs stored in the memory 120. In addition, memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 120 may also include a memory controller to provide access to the memory 120 by the processor 180.
The processor 180 is a control center of the device, connects the various parts of the entire terminal using various interfaces and lines, and performs various functions of the device and processes data by running or executing application programs stored in the memory 120, and calling data stored in the memory 120, thereby performing overall monitoring of the device. Optionally, the processor 180 may include one or more processing cores, and preferably, the processor 180 may integrate an application processor and a modem processor, wherein the application processor primarily processes operating systems, user interfaces, application programs, and the like.
In particular, in this embodiment, the processor 180 loads executable codes corresponding to the processes of one or more application programs into the memory 120 according to the following instructions, and the processor 180 executes the application programs stored in the memory 120, so as to implement various functions:
The detection instruction is used for initiating a mode switching request to the second equipment when detecting a triggering condition for starting a breathing mode, and freezing the instruction issuing authority of the first equipment;
a prediction instruction, configured to record an initiation time of the mode switching request, obtain a target parameter value corresponding to a preset parameter currently used for affecting communication quality, input the target parameter value into a pre-trained time determination model, and perform a time prediction operation, so as to obtain a predicted timeout waiting time;
a monitoring instruction, configured to monitor an execution result of the mode switching request;
A release instruction, configured to release the instruction issuing authority of the first device if the execution result is that the request feedback information is not received beyond the timeout waiting time;
and the retry instruction is used for reinitiating a mode switching request to the second equipment.
In some embodiments, the program further includes training instructions for obtaining preset parameter values generated during each link management protocol interaction in the process of establishing the bluetooth connection between the first device and the second device, training an initial time determination model by using each preset parameter value as a model training sample, and adjusting model parameters of the initial time determination model by using a random gradient descent algorithm until a loss function value of the initial time determination model exceeds a preset threshold value, completing model training, and obtaining a pre-trained time determination model.
In some embodiments, the program further includes an execution instruction, configured to switch a current communication mode between the first device and the second device to a breathing mode if the execution result is that the switching permission feedback information returned by the second device is received within a timeout waiting time, and if the execution result is that the switching rejection feedback information returned by the second device is received within the timeout waiting time, the current communication mode between the first device and the second device is not changed, and/or generate a prompt message containing the switching rejection feedback information to prompt a user.
In some embodiments, the program further includes an acquisition instruction, configured to acquire a number of repeated initiation times of the current mode switching request, and if the number of repeated initiation times exceeds a preset number of times, stop initiating the mode switching request to the second device, and generate a device exception message to prompt a user.
In some embodiments, the program further includes a check instruction configured to check a role state of the first device in the current bluetooth local area network, where the role state includes a central device or a peripheral device, and if the role state of the first device is the central device, increasing an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
In some embodiments, the program further includes a modification instruction, configured to initiate a role exchange request to a central device in the current bluetooth local area network if the role state of the first device is a peripheral device, so as to modify the role state of the first device into the central device, so that the first device has a modification authority for modifying a polling interval with the second device, and based on the modification authority, increase an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
The embodiment of the application also provides electronic equipment. Referring to fig. 8, fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application, which may be used to implement the communication mode switching method based on bluetooth connection provided in the above embodiment. The electronic device 1200 may be a gateway or a smart phone or tablet.
As shown in fig. 8, the electronic device 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer readable storage media (only one is shown), an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more processing cores (only one is shown), and a power supply 190. Those skilled in the art will appreciate that the configuration of the electronic device 1200 shown in fig. 8 is not limiting of the electronic device 1200 and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
The RF circuit 110 is configured to receive and transmit electromagnetic waves, and to perform mutual conversion between the electromagnetic waves and the electrical signals, so as to communicate with a communication network or other devices. RF circuitry 110 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and the like. The RF circuitry 110 may communicate with various networks such as the internet, intranets, wireless networks, or other devices via wireless networks.
The memory 120 may be used to store software programs and modules, such as program instructions/modules corresponding to the communication mode switching method based on bluetooth connection in the above embodiments, and the processor 180 executes various function applications and data processing by running the software programs and modules stored in the memory 120, so that the communication mode switching based on bluetooth connection can be automatically selected according to the current scene where the electronic device is located, thereby not only ensuring that the scenes such as a meeting are not disturbed, but also ensuring that the user can perceive an incoming call, and improving the intelligence of the electronic device. Memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 120 may further include memory remotely located relative to the processor 180, which may be connected to the electronic device 1200 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input unit 130 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may comprise a touch sensitive surface 131 and other input devices 132. The touch sensitive surface 131, also referred to as a touch display screen or touch pad, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the touch sensitive surface 131 or thereabout by any suitable object or accessory such as a finger, stylus, etc.), and actuate the corresponding connection means according to a pre-set program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection device and a touch controller. The touch control controller receives touch control information from the touch control detection device, converts the touch control information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch-sensitive surface 131 may be implemented in various types of resistive, capacitive, infrared, surface acoustic wave, and the like. In addition to the touch-sensitive surface 131, the input unit 130 may also comprise other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
The display unit 140 may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of the electronic device 1200, which may be composed of graphics, text, icons, video, and any combination thereof. The display unit 140 may include a display panel 141, and alternatively, the display panel 141 may be configured in the form of an LCD (Liquid CRYSTAL DISPLAY), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and after the touch-sensitive surface 131 detects a touch operation thereon or thereabout, the touch-sensitive surface is transferred to the processor 180 to determine a type of touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of touch event. Although in fig. 8 the touch-sensitive surface 131 and the display panel 141 are implemented as two separate components for input and output functions, in some embodiments the touch-sensitive surface 131 may be integrated with the display panel 141 to implement the input and output functions.
The electronic device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or the backlight when the electronic device 1200 moves to the ear. As one of the motion sensors, the gravitational acceleration sensor may detect the acceleration in each direction (generally, three axes), and may detect the gravity and direction when stationary, and may be used for applications of recognizing the gesture of the mobile phone (such as horizontal/vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer, and knocking), and other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which may be further configured in the electronic device 1200, will not be described herein.
Audio circuitry 160, speaker 161, microphone 162 may provide an audio interface between a user and electronic device 1200. The audio circuit 160 may transmit the received electrical signal converted from audio data to the speaker 161 for conversion into sound signals for output by the speaker 161, while the microphone 162 may convert the collected sound signals into electrical signals for reception by the audio circuit 160 for conversion into audio data, for processing by the audio data output processor 180, for transmission to another terminal, for example, via the RF circuit 110, or for outputting the audio data to the memory 120 for further processing. The audio circuit 160 may also include an ear bud jack to provide communication of the peripheral headphones with the electronic device 1200.
The electronic device 1200 may facilitate user email, web browsing, streaming media access, etc. via the transmission module 170 (e.g., wi-Fi module), which provides wireless broadband internet access to the user. Although fig. 8 shows the transmission module 170, it is understood that it does not belong to the essential constitution of the electronic device 1200, and can be omitted entirely as required within the scope not changing the essence of the invention.
The processor 180 is a control center of the electronic device 1200, connects various parts of the entire handset using various interfaces and lines, and performs various functions of the electronic device 1200 and processes data by running or executing software programs and/or modules stored in the memory 120, and invoking data stored in the memory 120, thereby performing overall monitoring of the handset. Optionally, the processor 180 may include one or more processing cores, and in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor primarily processes operating systems, user interfaces, application programs, and the like, and the modem processor primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
The electronic device 1200 also includes a power supply 190 that provides power to the various components, and in some embodiments, may be logically connected to the processor 180 via a power management system to perform functions such as managing discharge, and managing power consumption via the power management system. The power supply 190 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the electronic device 1200 may also include a camera (e.g., front camera, rear camera), a bluetooth module, etc., which are not described in detail herein. In particular, in the present embodiment, the display unit 140 of the electronic device 1200 is a touch screen display, the electronic device 1200 further includes a memory 120, and one or more programs, wherein the one or more programs are stored in the memory 120 and configured to be executed by the one or more processors 180, the one or more programs include instructions for:
The detection instruction is used for initiating a mode switching request to the second equipment when detecting a triggering condition for starting a breathing mode, and freezing the instruction issuing authority of the first equipment;
a prediction instruction, configured to record an initiation time of the mode switching request, obtain a target parameter value corresponding to a preset parameter currently used for affecting communication quality, input the target parameter value into a pre-trained time determination model, and perform a time prediction operation, so as to obtain a predicted timeout waiting time;
a monitoring instruction, configured to monitor an execution result of the mode switching request;
A release instruction, configured to release the instruction issuing authority of the first device if the execution result is that the request feedback information is not received beyond the timeout waiting time;
and the retry instruction is used for reinitiating a mode switching request to the second equipment.
In some embodiments, the program further includes training instructions for obtaining preset parameter values generated during each link management protocol interaction in the process of establishing the bluetooth connection between the first device and the second device, training an initial time determination model by using each preset parameter value as a model training sample, and adjusting model parameters of the initial time determination model by using a random gradient descent algorithm until a loss function value of the initial time determination model exceeds a preset threshold value, completing model training, and obtaining a pre-trained time determination model.
In some embodiments, the program further includes an execution instruction, configured to switch a current communication mode between the first device and the second device to a breathing mode if the execution result is that the switching permission feedback information returned by the second device is received within a timeout waiting time, and if the execution result is that the switching rejection feedback information returned by the second device is received within the timeout waiting time, the current communication mode between the first device and the second device is not changed, and/or generate a prompt message containing the switching rejection feedback information to prompt a user.
In some embodiments, the program further includes an acquisition instruction, configured to acquire a number of repeated initiation times of the current mode switching request, and if the number of repeated initiation times exceeds a preset number of times, stop initiating the mode switching request to the second device, and generate a device exception message to prompt a user.
In some embodiments, the program further includes a check instruction configured to check a role state of the first device in the current bluetooth local area network, where the role state includes a central device or a peripheral device, and if the role state of the first device is the central device, increasing an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
In some embodiments, the program further includes a modification instruction, configured to initiate a role exchange request to a central device in the current bluetooth local area network if the role state of the first device is a peripheral device, so as to modify the role state of the first device into the central device, so that the first device has a modification authority for modifying a polling interval with the second device, and based on the modification authority, increase an initial polling interval between the first device and the second device on the premise that a preset maximum polling interval is not exceeded.
The embodiment of the application also provides electronic equipment. The electronic equipment can be a smart phone, a computer and other equipment.
As can be seen from the above, the embodiment of the present application provides an electronic device 1200, wherein the electronic device 1200 performs the following steps:
when a triggering condition for starting a breathing mode is detected, a mode switching request is initiated to second equipment, and the instruction issuing authority of the first equipment is frozen;
recording the initiation time of the mode switching request, acquiring a target parameter value corresponding to a preset parameter which is currently used for influencing the communication quality, inputting the target parameter value into a pre-trained time determination model for performing time prediction operation, and obtaining predicted overtime waiting time;
Monitoring an execution result of the mode switching request;
If the execution result is that the request feedback information is not received after the timeout waiting time is exceeded, releasing the instruction issuing authority of the first equipment;
And re-initiating a mode switching request to the second equipment.
In some embodiments, the electronic device 1200 further performs the steps of:
receiving a mode switching request initiated by first equipment;
generating corresponding request feedback information according to the mode switching request, and sending the request feedback information to the first equipment;
If the feedback information request is feedback information allowing switching, switching the current communication mode between the first equipment and the second equipment to a breathing mode;
and if the request feedback information is refused to switch the feedback information, not changing the current communication mode between the first equipment and the second equipment.
The embodiment of the application also provides a storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer executes the communication mode switching method based on the Bluetooth connection according to any one of the embodiments.
It should be noted that, for the method for switching a communication mode based on a bluetooth connection according to the present application, it will be understood by those skilled in the art that all or part of the flow of implementing the method for switching a communication mode based on a bluetooth connection according to the embodiments of the present application may be implemented by controlling related hardware through a computer program, where the computer program may be stored in a computer readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and the execution process may include the flow of the embodiment of the method for switching a communication mode based on a bluetooth connection. The storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a random access Memory (RAM, random Access Memory), or the like.
For the communication mode switching device based on bluetooth connection in the embodiment of the present application, each functional module may be integrated in one processing chip, or each module may exist physically separately, or two or more modules may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated module, if implemented as a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium such as read-only memory, magnetic or optical disk, etc.
The method, the device, the medium and the equipment for switching the communication modes based on the Bluetooth connection provided by the embodiment of the application are described in detail. While the principles and embodiments of the present application have been described in detail in this application, the foregoing embodiments are provided to facilitate understanding of the principles and concepts underlying the application, and variations in terms of specific embodiments and applications are apparent to those skilled in the art in light of the teachings herein, and in light of these teachings, this disclosure should not be construed to limit the application.

Claims (10)

1.一种基于蓝牙连接的通信模式切换方法,应用于第一设备,其特征在于,包括:1. A communication mode switching method based on Bluetooth connection, applied to a first device, characterized by comprising: 在检测到开启呼吸模式的触发条件时,向第二设备发起模式切换请求,并冻结所述第一设备的指令下发权限;When a trigger condition for starting the breathing mode is detected, a mode switching request is initiated to the second device, and the instruction issuing authority of the first device is frozen; 记录所述模式切换请求的发起时间,并获取与当前用于影响通信质量的预设参数对应的目标参数值,将所述目标参数值输入预训练的时间确定模型中进行时间预测操作,得到预测的超时等待时间;Recording the initiation time of the mode switching request, and obtaining a target parameter value corresponding to a preset parameter currently used to affect communication quality, inputting the target parameter value into a pre-trained time determination model to perform a time prediction operation, and obtaining a predicted timeout waiting time; 监测所述模式切换请求的执行结果;monitoring the execution result of the mode switching request; 若所述执行结果为超过所述超时等待时间未收到请求反馈信息,则解除所述第一设备的指令下发权限;If the execution result is that no request feedback information is received within the timeout waiting time, the instruction issuing authority of the first device is released; 重新向所述第二设备发起模式切换请求。Re-initiate a mode switching request to the second device. 2.如权利要求1所述的通信模式切换方法,其特征在于,在所述向第二设备发起模式切换请求之前,所述方法还包括:2. The communication mode switching method according to claim 1, characterized in that before initiating the mode switching request to the second device, the method further comprises: 在所述第一设备与第二设备建立蓝牙连接过程中,获取每次链路管理协议交互时产生的预设的参数值;During the process of establishing a Bluetooth connection between the first device and the second device, obtaining a preset parameter value generated during each link management protocol interaction; 将各所述预设参数值作为模型训练样本,对初始时间确定模型进行训练,并利用随机梯度下降算法调整所述初始时间确定模型的模型参数,直至所述初始时间确定模型的损失函数值超过预设阈值,完成模型训练,得到预训练的时间确定模型。The initial time determination model is trained by using each of the preset parameter values as a model training sample, and the model parameters of the initial time determination model are adjusted using a stochastic gradient descent algorithm until the loss function value of the initial time determination model exceeds a preset threshold, completing the model training and obtaining a pre-trained time determination model. 3.如权利要求1所述的通信模式切换方法,其特征在于,在所述监测所述模式切换请求的执行结果之后,所述方法还包括:3. The communication mode switching method according to claim 1, characterized in that after monitoring the execution result of the mode switching request, the method further comprises: 若所述执行结果为,在超时等待时间内接收到所述第二设备返回的允许切换反馈信息,则将所述第一设备与第二设备之间的当前通信模式切换至呼吸模式;If the execution result is that the switching permission feedback information returned by the second device is received within the timeout waiting time, the current communication mode between the first device and the second device is switched to the breathing mode; 若所述执行结果为,在超时等待时间内接收到所述第二设备返回的拒绝切换反馈信息,则不改变所述第一设备与第二设备之间的当前通信模式;及/或生成包含所述拒绝切换反馈信息的提示信息提示用户。If the execution result is that the rejection switching feedback information returned by the second device is received within the timeout waiting period, the current communication mode between the first device and the second device is not changed; and/or a prompt message containing the rejection switching feedback information is generated to prompt the user. 4.如权利要求1所述的通信模式切换方法,其特征在于,在所述重新向所述第二设备发起模式切换请求之前,所述方法还包括:4. The communication mode switching method according to claim 1, characterized in that before re-initiating the mode switching request to the second device, the method further comprises: 获取当前所述模式切换请求的重复发起次数;Obtain the number of repetitions of the current mode switching request; 若所述重复发起次数超过预设次数,则停止向所述第二设备发起模式切换请求,并生成设备异常消息提示用户。If the number of repeated initiations exceeds a preset number, the mode switching request to the second device is stopped, and a device abnormality message is generated to prompt the user. 5.如权利要求1所述的通信模式切换方法,其特征在于,在所述向第二设备发起模式切换请求之前,所述方法还包括:5. The communication mode switching method according to claim 1, characterized in that before initiating the mode switching request to the second device, the method further comprises: 查看所述第一设备在当前的蓝牙局域网中的角色状态,所述角色状态包括中央设备或外围设备;Checking the role status of the first device in the current Bluetooth local area network, where the role status includes a central device or a peripheral device; 若所述第一设备的角色状态为中央设备,则在不超过预设的最大轮询间隔的前提下,增加所述第一设备与第二设备之间的初始轮询间隔。If the role status of the first device is a central device, the initial polling interval between the first device and the second device is increased without exceeding a preset maximum polling interval. 6.如权利要求5所述的通信模式切换方法,其特征在于,在所述查看所述第一设备在当前的蓝牙局域网中的角色状态之后,所述方法还包括:6. The communication mode switching method according to claim 5, characterized in that after checking the role status of the first device in the current Bluetooth local area network, the method further comprises: 若所述第一设备的角色状态为外围设备,则向当前的蓝牙局域网中的中央设备发起角色互换请求,以将所述第一设备的角色状态修改为中央设备,使所述第一设备具有修改与第二设备之间的轮询间隔的修改权限;If the role status of the first device is a peripheral device, a role exchange request is initiated to a central device in the current Bluetooth local area network to change the role status of the first device to a central device, so that the first device has the modification authority to modify the polling interval between the first device and the second device; 基于所述修改权限,在不超过预设的最大轮询间隔的前提下,增加所述第一设备与第二设备之间的初始轮询间隔。Based on the modification authority, an initial polling interval between the first device and the second device is increased without exceeding a preset maximum polling interval. 7.一种基于蓝牙连接的通信模式切换方法,应用于第二设备,其特征在于,包括:7. A method for switching a communication mode based on a Bluetooth connection, applied to a second device, comprising: 接收第一设备发起的模式切换请求;receiving a mode switching request initiated by a first device; 根据所述模式切换请求生成对应的请求反馈信息,将所述请求反馈信息发送至所述第一设备;Generate corresponding request feedback information according to the mode switching request, and send the request feedback information to the first device; 若所述请求反馈信息为允许切换反馈信息,则将所述第一设备与第二设备之间的当前通信模式切换至呼吸模式;If the request feedback information is switching permission feedback information, switching the current communication mode between the first device and the second device to a breathing mode; 若所述请求反馈信息为拒绝切换反馈信息,则不改变所述第一设备与第二设备之间的当前通信模式。If the request feedback information is switching rejection feedback information, the current communication mode between the first device and the second device is not changed. 8.一种基于蓝牙连接的通信模式切换装置,应用于第一设备,其特征在于,所述基于蓝牙连接的通信模式切换装置包括:8. A communication mode switching device based on Bluetooth connection, applied to a first device, characterized in that the communication mode switching device based on Bluetooth connection comprises: 检测模块,用于在检测到开启呼吸模式的触发条件时,向第二设备发起模式切换请求,并冻结所述第一设备的指令下发权限;A detection module, configured to initiate a mode switching request to the second device and freeze the instruction issuing authority of the first device when a trigger condition for starting the breathing mode is detected; 预测模块,用于记录所述模式切换请求的发起时间,并获取与当前用于影响通信质量的预设参数对应的目标参数值,将所述目标参数值输入预训练的时间确定模型中进行时间预测操作,得到预测的超时等待时间;A prediction module, used to record the initiation time of the mode switching request, and obtain a target parameter value corresponding to a preset parameter currently used to affect the communication quality, and input the target parameter value into a pre-trained time determination model to perform a time prediction operation to obtain a predicted timeout waiting time; 监测模块,用于监测所述模式切换请求的执行结果;A monitoring module, used for monitoring the execution result of the mode switching request; 解除模块,用于若所述执行结果为超过所述超时等待时间未收到请求反馈信息,则解除所述第一设备的指令下发权限;a release module, configured to release the instruction issuing authority of the first device if the execution result is that no request feedback information is received within the timeout waiting time; 重试模块,用于重新向所述第二设备发起模式切换请求。A retry module is used to re-initiate a mode switching request to the second device. 9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有多条指令,所述指令适于处理器进行加载,以执行权利要求1至7任一项所述的基于蓝牙连接的通信模式切换方法。9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the communication mode switching method based on Bluetooth connection according to any one of claims 1 to 7. 10.一种电子设备,其特征在于,包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述指令以执行权利要求1至7任一项所述的基于蓝牙连接的通信模式切换方法。10. An electronic device, characterized in that it comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the communication mode switching method based on Bluetooth connection according to any one of claims 1 to 7.
CN202411519802.3A 2024-10-28 2024-10-28 Communication mode switching method, device, medium and equipment based on Bluetooth connection Pending CN119155663A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411519802.3A CN119155663A (en) 2024-10-28 2024-10-28 Communication mode switching method, device, medium and equipment based on Bluetooth connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411519802.3A CN119155663A (en) 2024-10-28 2024-10-28 Communication mode switching method, device, medium and equipment based on Bluetooth connection

Publications (1)

Publication Number Publication Date
CN119155663A true CN119155663A (en) 2024-12-17

Family

ID=93817117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411519802.3A Pending CN119155663A (en) 2024-10-28 2024-10-28 Communication mode switching method, device, medium and equipment based on Bluetooth connection

Country Status (1)

Country Link
CN (1) CN119155663A (en)

Similar Documents

Publication Publication Date Title
US10732696B2 (en) Method and apparatus for wake-up control of intelligent terminal
US20190215364A1 (en) Data processing method, storage medium, and electronic device
WO2015090248A1 (en) Server overload protection method and device
CN110958710B (en) Channel access method, configuration method, terminal and network side equipment
CN111431882B (en) Data processing method, device and storage medium
CN110113478A (en) The display control method and terminal device of terminal device
WO2016107389A1 (en) Multimedia processing device, multimedia processing server and method therefor
WO2018161788A1 (en) Multimedia data sharing method and device
CN110688051B (en) Screen recording operation method and device, computer readable storage medium and terminal
CN114327332A (en) Internet of things equipment setting method and device, electronic equipment and storage medium
CN113922522A (en) Wireless charging management method, system, electronic device and storage medium
WO2021052128A1 (en) Notification message control method and related apparatus
CN119155663A (en) Communication mode switching method, device, medium and equipment based on Bluetooth connection
TWI482021B (en) Method for sharing peripheral devices in dual operating systems, and electronic device using the same
CN112788772B (en) Beam failure recovery confirmation method, terminal equipment and storage medium
KR20220036136A (en) Edge Computing System and Handover Method of Edge Computing Device
CN113742703B (en) Application program management and control method and device, electronic equipment and storage medium
CN111158929A (en) Application processing method and electronic equipment
CN110913022A (en) Method, device and system for downloading network file of mobile terminal and storage medium
CN114449630B (en) Communication establishment method, device, computer equipment and readable storage medium
CN114222085B (en) Data processing method, device, electronic device and computer readable storage medium
CN116016639B (en) Link management method, device and system
CN114189436B (en) Multi-cluster configuration deployment method and device, electronic equipment and storage medium
WO2022170849A1 (en) Development kit authentication method and related device
CN117858272A (en) Bluetooth connection method, device, medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination