CN110177357B - Bluetooth management method, mobile terminal and computer storage medium - Google Patents

Bluetooth management method, mobile terminal and computer storage medium Download PDF

Info

Publication number
CN110177357B
CN110177357B CN201910413498.7A CN201910413498A CN110177357B CN 110177357 B CN110177357 B CN 110177357B CN 201910413498 A CN201910413498 A CN 201910413498A CN 110177357 B CN110177357 B CN 110177357B
Authority
CN
China
Prior art keywords
target
peripheral device
mobile terminal
bluetooth
application protocol
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.)
Active
Application number
CN201910413498.7A
Other languages
Chinese (zh)
Other versions
CN110177357A (en
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910413498.7A priority Critical patent/CN110177357B/en
Publication of CN110177357A publication Critical patent/CN110177357A/en
Application granted granted Critical
Publication of CN110177357B publication Critical patent/CN110177357B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/50Service provisioning or reconfiguring
    • 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. TPC [Transmission Power Control], power saving 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
    • 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)
  • Telephone Function (AREA)

Abstract

The application discloses a Bluetooth management method, a mobile terminal and a computer storage medium, wherein the Bluetooth management method comprises the following steps: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol. Through the mode, the power consumption and the memory occupation of the Bluetooth application program can be reduced.

Description

Bluetooth management method, mobile terminal and computer storage medium
Technical Field
The present application relates to the field of bluetooth technologies, and in particular, to a bluetooth management method, a mobile terminal, and a computer storage medium.
Background
Bluetooth is a widely used short-range communication technology. Based on bluetooth technology, a number of different functions may be implemented, such as handsfree phone, audio streaming, file transfer, etc., which are called bluetooth profiles (application protocol), for example, HFP (hands free protocol), A2DP (audio transfer protocol), OPP (push to target protocol), respectively, for the three mentioned functions. Although all profiles are implemented based on bluetooth L2CAP (logical link control adaptation protocol, which is the underlying protocol of bluetooth), each profile has a completely different logic.
Disclosure of Invention
The technical scheme adopted by the application is as follows: there is provided a bluetooth management method, the method comprising: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol.
Another technical scheme adopted by the application is as follows: the mobile terminal comprises a processor, a Bluetooth module and a memory, wherein the Bluetooth module and the memory are connected with the processor; the Bluetooth module is used for carrying out Bluetooth communication with peripheral equipment in a pairing mode, the memory is used for storing program data, and the processor is used for executing the program data to achieve the following method: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol.
Another technical scheme adopted by the application is as follows: there is provided a computer storage medium having program data stored therein, the program data when executed by a processor to implement a method comprising: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol.
The Bluetooth management method provided by the application comprises the following steps: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol. By the mode, according to the application protocol supported by the paired peripheral equipment, the Service class corresponding to the profile in the Bluetooth application program is dynamically switched on and off, the problems of high power consumption and high memory occupation under the condition that all the Service classes are started are avoided, and the power consumption and the memory occupation of the Bluetooth application program can be reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
fig. 1 is a first flowchart of a bluetooth management method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a process for determining a target application protocol according to an embodiment of the present application;
fig. 3 is a second flowchart of a bluetooth management method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating pairing of a mobile terminal and a peripheral device according to an embodiment of the present application;
fig. 5 is a third flowchart of a bluetooth management method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a mobile terminal provided in an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computer storage medium provided in an embodiment of the present application.
Detailed Description
Referring to fig. 1, fig. 1 is a first flowchart of a bluetooth management method according to an embodiment of the present application, where the method includes:
step 101: and when the mobile terminal starts the Bluetooth, starting the service classes corresponding to all the application protocols.
Bluetooth (Bluetooth) is a wireless technology standard that enables short-range data exchange (using UHF radio waves in the ISM band of 2.4-2.485 GHz) between fixed devices, mobile devices and building personal area networks.
The L2CAP (Logical Link Control and Adaptation Protocol) Protocol in bluetooth is also called a Logical Link Control and Adaptation Protocol, which is a core Protocol in the bluetooth system and is responsible for adapting an upper layer Protocol in a baseband.
The upper layer application protocol for bluetooth is enumerated by the following table:
HFP hands-free protocol Hands Free Protocol
A2DP Audio transmission protocol Advanced Audio Distribution Profile
OPP Targeted push protocol Object Push Protocol
AVRCP Audio and video remote control protocol Audio Video Remote Control Protocol
GATT Generic attribute protocol Generic Attribute
PAN Personal area network protocol Personal Area Network
PBAP Phonebook access protocol Phone Book Access Protocol
HID Human body input device protocol Human Input Device
In the Android system, bluetooth functionality is integrated into a bluetooth application (bluetooth. app), and the logic of each profile is implemented in bluetooth. app via a Service class (Service classes) that are inherited from the Android.
When the Bluetooth function is started, the Bluetooth profile currently supported by the current mobile phone is obtained by analyzing a configuration file in the Bluetooth. The correspondence between the commonly used bluetooth profile and its corresponding Service class in bluetooth.
Figure BDA0002063578360000031
Figure BDA0002063578360000041
When the Service classes corresponding to the profiles are started, each profile is in an available state. When the bluetooth function is turned off, the Service is turned off.
Step 102: determining a target application protocol supported by a target peripheral device; the target peripheral device is one or more peripheral devices which are in Bluetooth communication with the mobile terminal.
In some embodiments, the peripheral device may be a bluetooth functional device such as a bluetooth headset, a bluetooth speaker, a bluetooth interphone, or other mobile terminals, such as a mobile phone, a tablet computer, a wearable device, or the like.
In some embodiments, the mobile terminal may default to support all application protocols, and then the mobile terminal may be considered to support as long as the application protocols are supported by the peripheral device. Therefore, the application protocol supported by the target peripheral device can be directly acquired as the target application protocol.
It is understood that if a certain application protocol mobile terminal supported by the target peripheral device does not support, then the mobile terminal and the peripheral device have no meaning of establishing a bluetooth connection.
In other embodiments, as shown in fig. 2, fig. 2 is a schematic flowchart of determining a target application protocol provided in this embodiment, and step 101 may specifically include:
step 1021: the method includes determining a first application protocol supported by the mobile terminal and determining a second application protocol supported by the target peripheral device.
The first application protocol supported by the mobile terminal itself may be easily obtained, and details are not described here, and it is determined that the second application protocol supported by the target peripheral device may specifically adopt the following method: and acquiring a second application Protocol supported by the target peripheral equipment by adopting a Service Discovery Protocol (SDP).
The SDP protocol lets the mobile terminal discover the services offered by the paired peripheral devices and the attributes of those services. SDP provides only a mechanism to discover services and does not provide a way to use these services. Each bluetooth device requires an SDP protocol. Each Service in the SDP protocol is represented by a ServiceRecord (Handle with a unique 32 bit), each ServiceRecord consisting of several serviceattributes, which are two parts, Attribute ID and Attribute value. These records can be accessed through the SDP request to obtain service information of the peripheral device, and thus the application protocol supported by the peripheral device.
Step 1022: an intersection of the first application protocol and the second application protocol is determined as a target application protocol.
Generally, the number of first application protocols supported by the mobile terminal is much larger than the number of second application protocols supported by the peripheral device.
For example, the first application protocol supported by the mobile terminal includes HFP protocol, A2DP protocol, OPP protocol, avrcp (controller) protocol, GATT protocol, PAN protocol, PBAP protocol, and HID protocol, and assuming that the peripheral device is a bluetooth headset and the second application protocol supported by the peripheral device includes HFP protocol and A2DP protocol, the target application protocol at the intersection of the first application protocol and the second application protocol includes HFP protocol and A2DP protocol.
Step 103: and closing the service classes corresponding to the application protocols except the target application protocol.
In some embodiments, when the target peripheral device cancels bluetooth pairing with the mobile terminal, querying the status of a second service class corresponding to an application protocol other than the target application protocol; if the second service class is in the open state, closing the second service class; if the second service class is the off state, the off state is maintained.
To illustrate by way of example, the first application protocol includes HFP protocol, A2DP protocol, OPP protocol, avrcp (controller) protocol, GATT protocol, PAN protocol, PBAP protocol, and HID protocol, and assuming that the peripheral device is a bluetooth headset and the second application protocol supported by the peripheral device includes HFP protocol and A2DP protocol, the target application protocol at the intersection of the first application protocol and the second application protocol includes HFP protocol and A2DP protocol. Then, the server that is started is the server class corresponding to HFP protocol and A2DP protocol, and the service class that is closed is the service class corresponding to OPP protocol, avrcp (controller) protocol, GATT protocol, PAN protocol, PBAP protocol, and HID protocol.
In addition, after step 103, the method may further include: and opening the service class corresponding to the target application protocol.
It can be understood that, in a general case, after the bluetooth is turned on, the mobile terminal may default to turn on all the server classes corresponding to the supported application protocols, but in the bluetooth application process based on this embodiment, some service classes may be turned off according to the condition of the target peripheral device that establishes the bluetooth connection, so in some application scenarios, the turned-off service classes may also be turned on.
In some embodiments, when a new peripheral device establishes bluetooth pairing with the mobile terminal, the target application protocol supported by the target peripheral device is redetermined; or when the target peripheral equipment which is paired with the mobile terminal is cancelled with the mobile terminal, the target application protocol supported by the target peripheral equipment is determined again.
For example, the service class corresponding to the HFP application protocol supported by the target peripheral device is a HeadsetService service class. When the mobile terminal initially turns on the bluetooth, all service classes (including the HeadsetService service class) are turned on, then the HeadsetService class corresponding to the HFP application protocol supported by the target peripheral device is acquired, and other service classes except the HeadsetService class are turned off. If the target peripheral equipment cancels the Bluetooth connection with the mobile terminal, the Headset service class is closed, and if the target peripheral equipment establishes the Bluetooth connection with the mobile terminal again, the Headset service class is opened.
The bluetooth management method provided by the embodiment comprises the following steps: when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol. By the mode, according to the application protocol supported by the paired peripheral equipment, the Service classes corresponding to the profiles in the Bluetooth.apk are dynamically switched on and off, the problems of high power consumption and high memory occupation under the condition that all the Service classes are opened are solved, and the power consumption and the memory occupation of the Bluetooth.apk can be reduced.
In some embodiments, during the bluetooth usage, a new peripheral device may establish a bluetooth connection with the mobile terminal, and a peripheral device that has already established a bluetooth connection with the mobile terminal may cancel the bluetooth connection with the mobile terminal. In the specific application process, if the target application protocol supported by the mobile terminal and the target peripheral device is detected each time, the detection is relatively complicated. It will be appreciated that, among the plurality of peripheral devices establishing a connection with the mobile terminal, there may be two devices of the same model, the application protocols supported by the two devices being the same. In this embodiment, whether to re-determine the target application protocol commonly supported by the mobile terminal and the target peripheral device may be determined by determining whether there are devices of the same model.
Specifically, when a first peripheral device establishes Bluetooth pairing with the mobile terminal, the model of the first peripheral device is obtained; and if the second peripheral equipment exists in the one or more first peripheral equipment and the model of each peripheral equipment in the second peripheral equipment and the target peripheral equipment is different, re-determining the target application protocol supported by the target peripheral equipment.
For example, after a bluetooth connection is established between a first peripheral device and the mobile terminal, if the device a exists in the first peripheral device and the model of each device in the target peripheral device is different, the target application protocol supported by the target peripheral device is determined again. If all the devices in the first peripheral device have a device with the same model as the target device, the target application protocol supported by the target peripheral device does not need to be determined again.
Specifically, when a third peripheral device which is paired with the mobile terminal in the target peripheral device cancels Bluetooth pairing with the mobile terminal, the model of the third peripheral device is obtained; and if the fourth peripheral equipment exists in the one or more third peripheral equipment, and the model of each peripheral equipment which keeps the Bluetooth pairing in the fourth peripheral equipment and the target peripheral equipment is different, re-determining the target application protocol supported by the target peripheral equipment.
For example, when the third peripheral device paired with the mobile terminal in the target peripheral device cancels bluetooth pairing with the mobile terminal, if the device B exists in one or more third peripheral devices and the model of each peripheral device paired with the target peripheral device with bluetooth is different, the target application protocol supported by the target peripheral device is determined again. If all the devices in the third peripheral device have a device with the same model as the target device, the target application protocol supported by the target peripheral device does not need to be determined again.
Referring to fig. 3, fig. 3 is a second flowchart of a bluetooth management method according to an embodiment of the present application, where the method includes:
step 301: and when the mobile terminal starts the Bluetooth, starting the service classes corresponding to all the application protocols.
Step 302: a corresponding counter is established for each application protocol.
Wherein the value of the counter identifies the number of peripheral devices that have been paired with the mobile terminal and that support the corresponding application protocol, and the initial value of the counter is 0.
It is understood that the mobile terminal may generally form a bluetooth pairing with a plurality of peripheral devices, as shown in fig. 4, fig. 4 is a schematic diagram of the pairing of the mobile terminal and the peripheral devices provided in the embodiment of the present application, wherein the mobile terminal 41 forms a pairing with the first peripheral device 42, the second peripheral device 43, and the third peripheral device 44, respectively.
Referring to the following table, the application protocols supported by the mobile terminal 41 and the first, second and third peripherals 42, 43, 44, respectively, and the corresponding counter values are shown in the following table.
Mobile terminal First peripheral device Second peripheral device Third peripheral device Counter with a memory
HFP HFP 1
A2DP A2DP A2DP A2DP 3
OPP OPP OPP 2
AVRCP AVRCP 1
GATT 0
PAN 0
PBAP PBAP 1
HID HID 1
Step 303: a target application protocol supported by the target peripheral device is determined.
Step 304: and adding 1 to a counter corresponding to the target application protocol.
It can be understood that, for the newly paired peripheral device, the SDP protocol may be used to obtain the application protocol supported by the newly paired peripheral device, and then the value of the counter in the table is increased, and meanwhile, if the peripheral device and the mobile terminal disconnect the bluetooth pairing, the value of the counter in the table is decreased.
After step 304, step 305 and step 308 are performed, respectively.
Step 305: and inquiring the state of the first service class corresponding to the application protocol except the target application protocol.
Step 306: and if the first service class is in the opening state and the value of the counter corresponding to the target application protocol is 0, closing the first service class.
If the target application protocol does not include the PAN protocol, detecting whether the Service class corresponding to the PAN protocol is in an open state or not according to the value of the counter displayed in the table being 0, and if the Service class corresponding to the PAN protocol is in the open state, closing the Service class corresponding to the PAN protocol.
If the target application protocol does not include the PAN protocol, detecting whether the Service class corresponding to the PAN protocol is in an open state or not according to the value of the counter displayed in the table being 0, and if so, keeping the closed state.
Step 307: if the first service class is in the off state, the off state is maintained.
Step 308: and querying the state of the second service class corresponding to the target application protocol.
Step 309: if the second service class is in the open state, the open state is maintained.
If the target application protocol comprises the A2DP protocol, adding 1 on the basis of 3 according to the value of the counter shown in the table, and simultaneously detecting whether the Service class corresponding to the A2DP protocol is in an open state, if so, keeping the open state.
Step 310: and if the second service class is in the closed state, opening the second service class.
And if the target application protocol comprises the GATT protocol, adding 1 on the basis of 0 according to the value of the counter displayed in the table as 0, and simultaneously detecting whether the Service class corresponding to the GATT protocol is in an opening state, and if the Service class corresponding to the GATT protocol is in a closing state, opening the Service class corresponding to the GATT protocol.
Referring to fig. 5, fig. 5 is a third flowchart of a bluetooth management method for a mobile terminal according to an embodiment of the present application, where the method includes:
step 501: and when the mobile terminal starts the Bluetooth, starting the service classes corresponding to all the application protocols.
Step 502: a corresponding counter is established for each application protocol.
Wherein, the value of the counter identifies the number of peripheral devices which are paired with the mobile terminal and support the corresponding application protocol, and the initial value of the counter is 0.
Step 503: a target application protocol supported by the target peripheral device is determined.
Step 504: and adding 1 to a counter corresponding to the target application protocol.
Step 505: and if the Bluetooth pairing with the target peripheral equipment is released, acquiring a second application protocol supported by the target peripheral equipment.
Step 506: and subtracting 1 from the value of the counter corresponding to the second application protocol.
With continuing reference to the following table, the application protocols supported by the mobile terminal and the first, second, and third peripherals, respectively, and the corresponding counter values are represented in the following table.
Figure BDA0002063578360000091
Figure BDA0002063578360000101
If the mobile terminal releases the bluetooth pairing with the third peripheral device, subtracting 1 from the value of the counter corresponding to the A2DP protocol and the HID protocol, specifically as follows:
mobile terminal First peripheral device Second peripheral device Counter with a memory
HFP HFP 1
A2DP A2DP A2DP 3-1=2
OPP OPP OPP 2
AVRCP AVRCP 1
GATT 0
PAN 0
PBAP PBAP 1
HID 1-1=0
Step 507: and detecting whether the value of the counter corresponding to the second application protocol is 0.
Whether the counter value corresponding to the A2DP protocol and the HID protocol is 0 is detected.
Step 508: and closing the service class corresponding to the second application protocol.
And if the counter value corresponding to the HID protocol is detected to be 0, closing the Service class corresponding to the HID protocol.
In addition, in the above embodiment, if the mobile terminal turns off the bluetooth, all the service classes are turned off at the same time, and the values of the counters corresponding to all the service classes are cleared.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a mobile terminal according to an embodiment of the present disclosure, where the mobile terminal 60 includes a processor 61, and a bluetooth module 62 and a memory 63 connected to the processor 61.
The bluetooth module 62 is also called a bluetooth module, and generally includes a chip, a printed Circuit board (pcb), and peripheral devices.
It is understood that the mobile terminal 60 may be a mobile phone, a tablet, a wearable device, and a smart device.
Wherein the memory 63 is used for storing program data and the processor 61 is used for executing the program data to realize the following method:
when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: a target application protocol supported by the target peripheral device is determined using a service discovery protocol.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: when a new peripheral device establishes Bluetooth pairing with the mobile terminal, re-determining a target application protocol supported by the target peripheral device; or when the target peripheral equipment which is paired with the mobile terminal is cancelled with the mobile terminal, the target application protocol supported by the target peripheral equipment is determined again.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: when a first peripheral device and a mobile terminal establish Bluetooth pairing, acquiring the model of the first peripheral device; if a second peripheral device exists in the one or more first peripheral devices and the model of each peripheral device in the second peripheral device is different from that of each peripheral device in the target peripheral device, re-determining the target application protocol supported by the target peripheral device
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: when the Bluetooth pairing between the third peripheral equipment which is paired with the mobile terminal in the target peripheral equipment and the mobile terminal is cancelled, the model of the third peripheral equipment is obtained; and if the fourth peripheral equipment exists in the one or more third peripheral equipment, and the model of each peripheral equipment which keeps the Bluetooth pairing in the fourth peripheral equipment and the target peripheral equipment is different, re-determining the target application protocol supported by the target peripheral equipment.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: when the target peripheral equipment and the mobile terminal cancel Bluetooth pairing, inquiring the state of a first service class corresponding to an application protocol except a target application protocol; if the first service class is in an open state, closing the first service class; if the first service class is in the off state, the off state is maintained.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: when a new peripheral device establishes Bluetooth pairing with the mobile terminal, inquiring the state of a second service class corresponding to the target application protocol; if the second service class is in the opening state, the opening state is kept; and if the second service class is in the closed state, opening the second service class.
In some embodiments, processor 61 is further configured to execute the sequence data to implement the following method: and after the set time period of starting the Bluetooth, if no peripheral equipment performs Bluetooth communication with the mobile terminal, closing the service classes corresponding to all the application protocols.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a computer storage medium provided in an embodiment of the present application, where the computer storage medium 70 stores program data 71, and when executed by a processor, the program data 71 is used to implement the following method:
when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols; determining a target application protocol supported by a target peripheral device; the target peripheral equipment is peripheral equipment which carries out Bluetooth communication with the mobile terminal; and closing the service classes corresponding to the application protocols except the target application protocol.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: a target application protocol supported by the target peripheral device is determined using a service discovery protocol.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: when a new peripheral device establishes Bluetooth pairing with the mobile terminal, re-determining a target application protocol supported by the target peripheral device; or when the target peripheral equipment which is paired with the mobile terminal is cancelled with the mobile terminal, the target application protocol supported by the target peripheral equipment is determined again.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: when a first peripheral device and a mobile terminal establish Bluetooth pairing, acquiring the model of the first peripheral device; and if the second peripheral equipment exists in the one or more first peripheral equipment and the model of each peripheral equipment in the second peripheral equipment and the target peripheral equipment is different, re-determining the target application protocol supported by the target peripheral equipment.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: when the Bluetooth pairing between the third peripheral equipment which is paired with the mobile terminal in the target peripheral equipment and the mobile terminal is cancelled, acquiring the model of the third peripheral equipment; and if the fourth peripheral equipment exists in the one or more third peripheral equipment, and the model of each peripheral equipment which keeps the Bluetooth pairing in the fourth peripheral equipment and the target peripheral equipment is different, re-determining the target application protocol supported by the target peripheral equipment.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: when the target peripheral equipment and the mobile terminal cancel Bluetooth pairing, inquiring the state of a first service class corresponding to an application protocol except a target application protocol; if the first service class is in an open state, closing the first service class; if the first service class is in the off state, the off state is maintained.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: when a new peripheral device establishes Bluetooth pairing with the mobile terminal, inquiring the state of a second service class corresponding to the target application protocol; if the second service class is in the open state, keeping the open state; and if the second service class is in the closed state, opening the second service class.
In some embodiments, program data 71, when executed by a processor, is further configured to implement a method comprising: and after the set time period of starting the Bluetooth, if no peripheral equipment performs Bluetooth communication with the mobile terminal, closing the service classes corresponding to all the application protocols.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated units in the other embodiments described above may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (6)

1. A bluetooth management method, comprising:
when the mobile terminal starts the Bluetooth, starting service classes corresponding to all application protocols;
establishing a corresponding counter for each application protocol;
determining a first application protocol supported by the mobile terminal, and determining a second application protocol supported by a target peripheral device by adopting a service discovery protocol; the target peripheral equipment is one or more peripheral equipment which carries out Bluetooth communication with the mobile terminal;
determining an intersection of the first application protocol and the second application protocol as a target application protocol; when a new peripheral device establishes Bluetooth pairing with the mobile terminal, re-determining a target application protocol supported by the target peripheral device; or when the target peripheral equipment which is paired with the mobile terminal is cancelled with the mobile terminal, the target application protocol supported by the target peripheral equipment is determined again;
adding 1 to a counter corresponding to the target application protocol;
inquiring the state of a first service class corresponding to the application protocol except the target application protocol;
if the first service class is in an open state and the value of a counter corresponding to the target application protocol is a preset threshold value, closing the first service class, and if the first service class is in a closed state, keeping the closed state;
querying the state of a second service class corresponding to the target application protocol;
if the second service class is in an open state, the second service class is kept in the open state, and if the second service class is in a closed state, the second service class is opened;
if the Bluetooth pairing with the target peripheral equipment is released, acquiring a second application protocol supported by the target peripheral equipment and subtracting 1 from the value of a counter corresponding to the second application protocol;
and when the value of the counter corresponding to the second application protocol is a preset threshold value, closing the service class corresponding to the second application protocol.
2. The method of claim 1,
the step of re-determining the target application protocol supported by the target peripheral device when the new peripheral device establishes bluetooth pairing with the mobile terminal includes:
when a first peripheral device establishes Bluetooth pairing with the mobile terminal, acquiring the model of the first peripheral device;
and if a second peripheral device exists in one or more first peripheral devices, and the model of each peripheral device in the second peripheral device is different from that of each peripheral device in the target peripheral device, re-determining the target application protocol supported by the target peripheral device.
3. The method of claim 1,
the step of re-determining the target application protocol supported by the target peripheral device when the target peripheral device paired with the mobile terminal cancels bluetooth pairing with the mobile terminal comprises:
when the Bluetooth pairing between a third peripheral device which is paired with the mobile terminal in the target peripheral device and the mobile terminal is cancelled, acquiring the model of the third peripheral device;
and if a fourth peripheral device exists in one or more third peripheral devices, and the model of each peripheral device which is paired with the target peripheral device by the Bluetooth is different from that of each peripheral device which is paired with the target peripheral device, re-determining the target application protocol supported by the target peripheral device.
4. The method of claim 1,
when the mobile terminal starts the bluetooth, after the step of starting the service classes corresponding to all the application protocols, the method further comprises the following steps:
and after the first preset time of starting the Bluetooth, if no peripheral equipment performs Bluetooth communication with the mobile terminal, closing the service classes corresponding to all application protocols.
5. A mobile terminal is characterized by comprising a processor, a Bluetooth module and a memory, wherein the Bluetooth module and the memory are connected with the processor;
wherein the bluetooth module is for bluetooth communication with a peripheral device pair, the memory is for storing program data, and the processor is for executing the program data to implement the method of any one of claims 1-4.
6. A computer storage medium, characterized in that program data are stored in the computer storage medium, which program data, when being executed by a processor, are adapted to carry out the method of any one of claims 1-4.
CN201910413498.7A 2019-05-17 2019-05-17 Bluetooth management method, mobile terminal and computer storage medium Active CN110177357B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910413498.7A CN110177357B (en) 2019-05-17 2019-05-17 Bluetooth management method, mobile terminal and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910413498.7A CN110177357B (en) 2019-05-17 2019-05-17 Bluetooth management method, mobile terminal and computer storage medium

Publications (2)

Publication Number Publication Date
CN110177357A CN110177357A (en) 2019-08-27
CN110177357B true CN110177357B (en) 2022-06-07

Family

ID=67691506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910413498.7A Active CN110177357B (en) 2019-05-17 2019-05-17 Bluetooth management method, mobile terminal and computer storage medium

Country Status (1)

Country Link
CN (1) CN110177357B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111954039B (en) * 2020-07-02 2022-07-01 深圳市华曦达科技股份有限公司 Set top box Bluetooth configuration method and device, electronic equipment and storage medium
CN112948007B (en) * 2021-02-02 2023-06-16 歌尔科技有限公司 Initialization method and device of Bluetooth sound box and Bluetooth sound box
CN113676851B (en) * 2021-08-17 2022-06-28 深圳市芯中芯科技有限公司 Communication method and system of Bluetooth device and wireless interphone

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102378400A (en) * 2010-08-23 2012-03-14 中兴通讯股份有限公司 Management method and device of Bluetooth services
CN105487887A (en) * 2015-11-24 2016-04-13 惠州Tcl移动通信有限公司 Bluetooth starting method and Bluetooth device
CN106028268A (en) * 2016-06-27 2016-10-12 广东欧珀移动通信有限公司 Method and apparatus for lowering device power consumption
CN109089247A (en) * 2018-07-24 2018-12-25 深圳Tcl新技术有限公司 Using starting method, system, terminal device and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6242051B2 (en) * 2013-01-23 2017-12-06 キヤノン株式会社 COMMUNICATION DEVICE, COMMUNICATION DEVICE CONTROL METHOD, PROGRAM

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102378400A (en) * 2010-08-23 2012-03-14 中兴通讯股份有限公司 Management method and device of Bluetooth services
CN105487887A (en) * 2015-11-24 2016-04-13 惠州Tcl移动通信有限公司 Bluetooth starting method and Bluetooth device
CN106028268A (en) * 2016-06-27 2016-10-12 广东欧珀移动通信有限公司 Method and apparatus for lowering device power consumption
CN109089247A (en) * 2018-07-24 2018-12-25 深圳Tcl新技术有限公司 Using starting method, system, terminal device and computer readable storage medium

Also Published As

Publication number Publication date
CN110177357A (en) 2019-08-27

Similar Documents

Publication Publication Date Title
CN110177357B (en) Bluetooth management method, mobile terminal and computer storage medium
EP2701313A1 (en) Method for pairing bluetooth accessory with bluetooth device, and bluetooth accessory
CN109379498B (en) Electromagnetic interference control method and related device
CN107027114A (en) A kind of SIM card switching method, equipment and computer-readable recording medium
CN108600951A (en) Access network discovery and selection
CN107147419A (en) Reduce method, storage medium and the terminal of signal interference
US20150282059A1 (en) Wireless System Selection Factoring RF Resource Availability in Dual Access Phones
CN111818667B (en) Device connection method, device and readable storage medium
WO2013184418A1 (en) Supplemental audio signal processing for a bluetooth audio link
WO2020259446A1 (en) Communication control method and apparatus, and electronic device
WO2020164351A1 (en) Link connection method and related apparatus
CN104184499A (en) Bluetooth device control method, device and system
CN111741456A (en) Bluetooth device, Bluetooth preemption method and device thereof, and computer-readable storage medium
WO2020224418A1 (en) Method for solving wifi channel interference and related product
JP2021521737A (en) Access control method, message broadcasting method and related equipment
CN108513196A (en) A kind of wireless headset and its matching method
WO2021239032A1 (en) Bluetooth protocol connection method and apparatus, storage medium, and related device
EP3258617B1 (en) Antenna configuration method and terminal
CN111491278B (en) Method and terminal for playing audio through Bluetooth device
CN112867115A (en) Wireless device and wireless communication method
CN114339618B (en) Broadcast control method, bluetooth audio system and Bluetooth audio equipment
CN109739641B (en) Self-adaptive CPU frequency modulation acceleration method and device, mobile terminal and storage medium
CN108307447A (en) Wireless network transmissions control method, device, storage medium and terminal device
CN111918250B (en) Bluetooth communicator and Bluetooth communication method
CN109739642B (en) CPU frequency modulation method and device, mobile terminal and computer readable storage medium

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
GR01 Patent grant
GR01 Patent grant