CN111935694B - Bluetooth device connection method and device, electronic device and readable storage medium - Google Patents

Bluetooth device connection method and device, electronic device and readable storage medium Download PDF

Info

Publication number
CN111935694B
CN111935694B CN202011099908.4A CN202011099908A CN111935694B CN 111935694 B CN111935694 B CN 111935694B CN 202011099908 A CN202011099908 A CN 202011099908A CN 111935694 B CN111935694 B CN 111935694B
Authority
CN
China
Prior art keywords
bluetooth
equipment
application program
connection
list
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
CN202011099908.4A
Other languages
Chinese (zh)
Other versions
CN111935694A (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN202011099908.4A priority Critical patent/CN111935694B/en
Publication of CN111935694A publication Critical patent/CN111935694A/en
Application granted granted Critical
Publication of CN111935694B publication Critical patent/CN111935694B/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/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
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/005Discovery of network devices, e.g. terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Telephone Function (AREA)

Abstract

The present application relates to the field of information security technologies, and in particular, to a bluetooth device connection method, apparatus, electronic device, and readable storage medium. The method comprises the following steps: the application program calls a first system function carrying a page life cycle callback object to determine the current running state of the first system function on the terminal equipment; when the current running state is determined to be running in the background, the Bluetooth equipment information in a pre-configured equipment list is obtained; selecting any Bluetooth device in the device list according to the Bluetooth device information; calling a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment; after determining that a bluetooth connection has been established with the selected bluetooth device, a process of determining its current operating state on the terminal device is performed. In the application, the application program realizes the judgment of the foreground and background states through callback processing of the system function, and realizes automatic Bluetooth connection with Bluetooth equipment in the equipment list when the application program runs in the background.

Description

Bluetooth device connection method and device, electronic device and readable storage medium
Technical Field
The present application relates to the field of information security technologies, and in particular, to a bluetooth device connection method, apparatus, electronic device, and readable storage medium.
Background
In the prior art, for a terminal device with a bluetooth function, an application program thereon can perform bluetooth connection with the bluetooth device through the bluetooth function, thereby implementing data communication with the bluetooth device. For the bluetooth connection between the application program and the bluetooth device, when the application program runs in the background, it usually only maintains the standby state when the application program is placed in the background, and does not care about the connection state of each bluetooth device in the device list, and further does not perform corresponding automatic connection processing on the unconnected or disconnected bluetooth device in the device list. Therefore, when the application program runs in the background, how to realize automatic bluetooth connection with the bluetooth devices in the device list is an urgent technical problem to be solved at present.
Disclosure of Invention
The application provides a Bluetooth device connection method, a Bluetooth device connection device, an electronic device and a readable storage medium, so that automatic Bluetooth connection with Bluetooth devices in a device list is realized when an application program runs in a background.
In a first aspect, a bluetooth device connection method is provided, which is applied to a terminal device installed with an application program, and includes:
the application program calls a first system function carrying a page life cycle callback object to determine the current running state of the first system function on the terminal equipment;
when the current running state is determined to be running in the background, the application program acquires Bluetooth equipment information in a pre-configured equipment list;
the application program selects any one Bluetooth device in the device list according to the Bluetooth device information;
the application program calls a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment;
if the connection state is not connected, the application program sends a Bluetooth connection establishment request to the selected Bluetooth equipment, receives a Bluetooth connection establishment response returned by the Bluetooth equipment, and obtains a corresponding establishment result of the Bluetooth connection established with the selected Bluetooth equipment according to the Bluetooth connection establishment response; if the connection state is connected, the application program determines that Bluetooth connection is established with the selected Bluetooth equipment;
after the application program determines that the Bluetooth connection is established with the selected Bluetooth device, the application program executes processing for determining the current running state of the application program on the terminal device.
In a possible implementation manner, the determining, by the application program, a current running state of the first system function on the terminal device by calling the first system function carrying the page lifecycle callback object includes:
the application program calls the first system function to send the page life cycle callback object to the terminal equipment;
when the terminal device monitors that the page changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries page state information in a notification message to call back the page state information to the application program.
In one possible implementation of the method of the invention,
when the current running state is determined to be running in the foreground, the application program carries out Bluetooth equipment scanning processing and determines whether the scanned Bluetooth equipment is in the pre-configured equipment list or not; if the scanned Bluetooth equipment is in the equipment list, performing Bluetooth connection with the scanned Bluetooth equipment; otherwise, continuing to execute the scanning processing of the Bluetooth equipment;
and when the current running state is determined to be running in the background, the application program determines the connection state of the residual Bluetooth equipment in the equipment list, and determines whether Bluetooth connection is established with the residual Bluetooth equipment according to the connection state.
In one possible implementation, the application performs a bluetooth device scanning process, including:
the application program performs Bluetooth equipment scanning processing within preset time;
when the preset time is not reached, the application program executes the processing of determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not on the scanned Bluetooth equipment;
and when the preset time is up, the application program closes the scanning processing of the Bluetooth equipment.
In one possible implementation, after the application turns off the bluetooth device scanning process, the method further includes:
and the application program restarts the scanning processing of the Bluetooth equipment after a specific time, and then executes the operation of scanning the Bluetooth equipment within the preset time.
In one possible implementation, the application performing, on the scanned bluetooth device, a determination of whether the scanned bluetooth device is in the preconfigured device list includes:
the application program acquires the identity identification information of the scanned Bluetooth equipment;
the application program inquires a pre-configured equipment list according to the identity identification information and determines whether the identity identification information corresponding to each Bluetooth equipment in the equipment list is matched with the identity identification information of the scanned Bluetooth equipment; if the Bluetooth devices are matched with the devices, the application program determines that the scanned Bluetooth devices are in the device list; otherwise, the application program determines that the scanned bluetooth device is not in the device list.
In one possible implementation manner, the bluetooth device information includes stored connection state information, and the determining, by the application program, the connection state of the selected bluetooth device by calling the second system function carrying the bluetooth callback object includes:
the application program calls the second system function to send the Bluetooth callback object to the terminal equipment;
the terminal equipment performs callback processing on a Bluetooth callback object according to a second system function called by the application program, and carries the connection state information of the Bluetooth equipment in a notification message to call back to the application program;
when the terminal equipment judges that the terminal equipment is in a connected state with the Bluetooth equipment, the connection state information in the notification message received by the application program through the callback interface is a message of successful connection;
and when the terminal equipment judges that the terminal equipment is in an unconnected state with the Bluetooth equipment, the connection state information in the notification message received by the application program through the callback interface is a message of connection failure.
In a second aspect, a bluetooth device connection apparatus is provided, which is applied to a terminal device installed with an application program, and includes:
the first processing module is used for calling a first system function carrying a page life cycle callback object to determine the current running state of the application program on the terminal equipment;
the acquisition module is used for acquiring the Bluetooth equipment information in a pre-configured equipment list when the current running state of the application program is determined to be running in the background;
the selecting module is used for selecting any one Bluetooth device in the device list according to the Bluetooth device information;
the second processing module is used for calling a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment;
the second processing module is used for sending a Bluetooth connection establishment request to the selected Bluetooth equipment if the connection state is not connected, receiving a Bluetooth connection establishment response returned by the Bluetooth equipment, and obtaining a corresponding establishment result of the Bluetooth connection established with the selected Bluetooth equipment according to the Bluetooth connection establishment response; if the connection state is connected, determining that Bluetooth connection is established with the selected Bluetooth equipment;
the first processing module is further configured to execute processing for determining a current operating state of the selected bluetooth device on the terminal device after determining that a bluetooth connection has been established with the selected bluetooth device.
In a possible implementation manner, the first processing module is configured to call the first system function to send the page lifecycle callback object to the terminal device; when the terminal device monitors that the page changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries page state information in a notification message to call back the page state information to the application program.
In one possible implementation of the method of the invention,
the first processing module is used for scanning the Bluetooth equipment and determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not when the current running state is determined to be running in the foreground; if the scanned Bluetooth equipment is in the equipment list, performing Bluetooth connection with the scanned Bluetooth equipment; otherwise, continuing to execute the scanning processing of the Bluetooth equipment;
the first processing module is configured to determine a connection state of the remaining bluetooth devices in the device list when it is determined that the current operation state is in the background, and determine whether to establish bluetooth connection with the remaining bluetooth devices according to the connection state.
In one possible implementation manner, the first processing module is configured to perform a bluetooth device scanning process within a preset time; when the preset time is not reached, executing the processing of determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not on the scanned Bluetooth equipment; and when the preset time is up, the scanning processing of the Bluetooth equipment is closed.
In one possible implementation manner, the first processing module is further configured to restart the bluetooth device scanning process after a certain time, and then perform the above operation of performing the bluetooth device scanning process within a preset time.
In one possible implementation manner, the first processing module is specifically configured to acquire identity information of the scanned bluetooth device; inquiring a pre-configured equipment list according to the identity identification information, and determining whether the identity identification information corresponding to each Bluetooth equipment in the equipment list is matched with the identity identification information of the scanned Bluetooth equipment; if the Bluetooth devices are matched with the devices, the application program determines that the scanned Bluetooth devices are in the device list; otherwise, the application program determines that the scanned bluetooth device is not in the device list.
In one possible implementation manner, the second processing module is configured to call the second system function to send a bluetooth callback object to the terminal device;
the terminal equipment performs callback processing on a Bluetooth callback object according to a second system function called by the application program, and carries the connection state information of the Bluetooth equipment in a notification message to call back to the application program;
the second processing module is used for receiving the connection state information in the notification message through the callback interface as a successful connection message when the terminal equipment judges that the terminal equipment is in a connected state with the Bluetooth equipment;
and the second processing module is used for receiving the connection state information in the notification message as a connection failure message through the callback interface when the terminal equipment judges that the terminal equipment is not connected with the Bluetooth equipment.
In a third aspect, an electronic device is provided, including: a processor and a memory;
the memory for storing a computer program;
the processor is used for executing the Bluetooth device connection method by calling the computer program.
In a fourth aspect, there is provided a computer-readable storage medium for storing a computer program which, when run on a computer, makes the computer perform the bluetooth device connection method described above.
By means of the technical scheme, the technical scheme provided by the application at least has the following advantages:
in the application, the application program realizes the judgment of the foreground and background states through callback processing of the system function, and realizes automatic Bluetooth connection with Bluetooth equipment in the equipment list when the application program runs in the background.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the embodiments of the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart of a bluetooth device connection method provided in the present application;
fig. 2 is a schematic processing flow diagram of a possible implementation manner of the bluetooth device connection method provided in the present application;
fig. 3 is a schematic structural diagram of a bluetooth device connection apparatus provided in the present application;
fig. 4 is a schematic structural diagram of an electronic device in a bluetooth device connection method provided in the present application.
Detailed Description
The present application provides a bluetooth device connection method, an apparatus, an electronic device, and a readable storage medium, and the following detailed description is provided with reference to the accompanying drawings.
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those within the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
As shown in fig. 1, a schematic flowchart of a bluetooth device connection method provided in the present application is applied to a terminal device installed with an application program, and the method includes the following steps:
s101, an application program calls a first system function carrying a page life cycle callback object to determine the current running state of the first system function on terminal equipment;
when the current running state of the application program is determined to be running in the background, the step S102 is carried out;
step S102, the application program obtains the Bluetooth device information in the pre-configured device list;
step S103, the application program selects any Bluetooth device in the device list according to the Bluetooth device information;
step S104, the application program calls a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment;
if the connection status is not connected, go to step S105; if the connection status is connected, go to step S106;
step S105, the application program sends a Bluetooth connection establishment request to the selected Bluetooth equipment, receives a Bluetooth connection establishment response returned by the Bluetooth equipment, and obtains a corresponding establishment result of the Bluetooth connection established with the selected Bluetooth equipment according to the Bluetooth connection establishment response;
step S106, the application program determines that Bluetooth connection is established with the selected Bluetooth equipment;
in step S105 and step S106, after the application program determines that the bluetooth connection has been established with the selected bluetooth device, the process goes to step S101 to continue the process of determining the current operating state of the terminal device.
In the application, the application program realizes the judgment of the foreground and background states through callback processing of the system function, and realizes automatic Bluetooth connection with Bluetooth equipment in the equipment list when the application program runs in the background.
Based on the above technical solution provided by the present application, the following explains the technical solution in detail, as shown in fig. 2, which is a specific processing flowchart of one possible implementation manner of the bluetooth device connection method provided by the present application.
In one possible implementation, after the user opens the application, the user may perform pre-configuration of the device list in the application; for example, the identification information (which may be unique identification information representing the bluetooth device, such as a mac address) of the required bluetooth device is input into the application program for pre-storing, so that the device list of the application program stores the corresponding information of the input bluetooth device, so that when the subsequent application program scans the bluetooth device in which the identification information is pre-stored, the bluetooth device can be directly connected with the bluetooth device according to the pre-stored identification information.
For the present application, in one possible implementation, the aforementioned processing of step S101 specifically includes the processing of step S201 described below.
In step S201, the application determines its current operating state on the terminal device.
In a possible implementation manner, the application program determines the current running state according to the page state information in the notification message recalled by the terminal device, so as to determine the foreground or the background currently running on the terminal device, and perform corresponding processing according to the current running state running on the foreground or the background. If the device runs in the background, turning to step S202 to query the device list; if the operation is in the foreground, go to step S207.
In one possible implementation, the application may determine from the stored page status information when determining its current running state on the terminal device. When the page of the application program changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries the page state information in a notification message to call back to the application program; the page change may include page display and page hiding;
further, the determining, by the application program, the current running state of the application program on the terminal device by using the first system function carrying the page lifecycle callback object includes:
when the variable value of the state information corresponding to the page state information is determined to be larger than a preset threshold value, determining that the current running state is running in the foreground; and when the variable value of the state information is not larger than the preset threshold value, determining that the current running state is running in the background. In a specific embodiment, for the preset threshold, the value may be 0, that is, when the value of the state information variable is greater than 0, it is determined that the current operating state is operating in the foreground; and when the variable value of the state information is not larger than 0, namely is less than or equal to 0, determining that the current running state is running in the background.
Furthermore, when the page of the display page of the application program changes, the terminal device performs callback processing on the page life cycle callback object according to the first system function called by the application program, and carries the page state information in the notification message to call back to the application program, including:
when the terminal equipment monitors that the page is displayed, the application program receives callback processing of the page callback interface by the terminal equipment, and the application program adds 1 to the variable value of the state information according to the callback processing of the page callback interface;
when the terminal device monitors that the page is hidden, the application program receives callback processing of the page callback interface by the terminal device, and the application program subtracts 1 from the state information variable value according to the callback processing of the page hidden callback interface.
The variable value of the state information stored in the application program is notified to the application program by the terminal device, namely when the display page of the application program is displayed on the terminal device, the terminal device sends a notification message to the application program through the page display callback interface to notify the application program that the display page is currently in a page display state, and the application program adds 1 to the variable value of the state information according to the notification message; once the display page is not displayed on the terminal device, that is, when the display page is page-hidden, the terminal device sends a notification message to the application program through the page-hidden callback interface to tell the application program that the display page is currently in a page-hidden state, and the application program subtracts 1 from the state information variable value.
In one possible implementation, for an application in an open state, a user may perform pre-configuration of a device list in the application; for example, the identification information (which may be unique identification information representing the bluetooth device, such as a mac address) of the bluetooth device is input into an application program to be prestored, so that the device list of the application program stores the input corresponding information of the bluetooth device, and when the subsequent application program scans the bluetooth device prestored with the identification information, the bluetooth device is directly connected with the bluetooth device according to the identification information.
In a specific embodiment, an application program creates a Myapplication class, and configures the name of application in a Manifest.xml application configuration file as Myapplication; the Myapplication class is an application inlet, and the life cycle of a display page can receive a callback in the class; namely, whether the application program is in the foreground or the background is judged through the life cycle of the page. The application program creates a page life cycle callback object in the Myapplication class, and calls a register ActivityLifecycleCallbackks in an onCreate method to register the life cycle callback object, and the change of the page life cycle is displayed to be received in the callback. The page life cycle comprises onactive started and onactive stopped; onactitystarted is a system call by the terminal device when the page comes to the foreground, and onactitystopped is a system call by the terminal device when the page comes to the background.
Wherein, an application program may contain many display pages, and when one display page is displayed in the foreground, the application program is in the foreground; when all the display pages are in the background, the application program is in the background, and a variable activityCount is created in the class to record the number of foreground pages. When the aforementioned onactitystarted is called by the system, activtycount is added with 1, and if activity is equal to 1, the application is switched to the foreground; when onactive stopped is called by the system, activityCount is decremented by 1, and if activity is equal to 0, the application switches to the background.
For the present application, in one possible implementation, the aforementioned processing of step S102 specifically includes the processing of step S202 described below.
In step S202, the application queries the device list.
In one possible implementation, the application queries a pre-configured device list while the application is currently running in the background.
For the present application, in one possible implementation, the aforementioned processing of step S103 specifically includes the processing of step S203 described below.
In step S203, the application program selects a bluetooth device to be processed.
In one possible implementation, the application obtains bluetooth device information for each corresponding bluetooth device by querying the device list. The bluetooth device information may include an identity of the bluetooth device and a current connection status thereof; finding the Bluetooth equipment information of at least 1 Bluetooth equipment in the equipment list by inquiring the equipment list, and selecting 1 Bluetooth equipment from the Bluetooth equipment information of at least 1 Bluetooth equipment for subsequent processing; wherein, if the number of the Bluetooth devices is 1, the Bluetooth device is directly selected; however, if there are at least 2 bluetooth devices, the process of selecting 1 bluetooth device from the at least 2 bluetooth devices may be to arbitrarily select 1 bluetooth device, or may be to select 1 bluetooth device according to a specific sequence, for example, sequentially selecting the bluetooth device ranked first according to the ranking sequence of the at least 2 bluetooth devices in the device list for processing, and of course, the bluetooth device selection process when there are at least 2 bluetooth devices in the device list may be selected in any other manner as long as it is ensured that one of the bluetooth devices is selected for processing.
For the present application, in one possible implementation, the aforementioned processing of step S104 specifically includes the processing of step S204 described below.
In step S204, the application program determines the connection state of the selected bluetooth device.
In one possible implementation, after the application program selects a bluetooth device to be processed from the device list, the connection status of the bluetooth device is obtained according to the connection status information stored in the bluetooth device information of the bluetooth device. If the connection status is not connected, go to step S205; otherwise, go to step S206.
In a possible implementation manner, the connection state information is information obtained by judging the connection state information in a notification message sent by the terminal device received by the application program through a registered connection state callback interface;
when the terminal equipment judges that the terminal equipment is in a connected state with the Bluetooth equipment, the application program receives the connection state information in the notification message through the connection state callback interface as a message of successful connection;
and when the terminal equipment judges that the terminal equipment is in the unconnected state with the Bluetooth equipment, the connection state information in the notification message received by the application program through the connection state callback interface is a message of connection failure.
In a possible implementation manner, the application program calls the terminal device to acquire the bluetooth device object according to the mac address of the bluetooth device in the device list, and then calls the bluetooth device connection interface to register the connection state callback interface through the bluetooth device object, wherein the notification message received in the connection state callback interface includes the bluetooth connection success and the bluetooth connection failure, and the application program can determine the connection state with the bluetooth device according to the notification message; the notification message is sent to the application program through the connection state callback interface after the terminal device judges the connection state with the Bluetooth device.
For the present application, in one possible implementation manner, the processing of the foregoing steps S105 to S106 specifically includes the processing of the following steps S205 to S206.
Step S205, the application program establishes a bluetooth connection with the bluetooth device.
In one possible implementation manner, when the application program determines that the application program is not connected with the bluetooth device, the application program sends a bluetooth connection establishment request to the bluetooth device, and the bluetooth device establishes the bluetooth connection according to the bluetooth connection establishment request sent by the application program; after the bluetooth connection is successfully established, the message that the bluetooth connection is successfully established is carried in the bluetooth connection establishment response and returned to the application program, so that the application program can obtain a corresponding establishment result that the bluetooth connection is established with the selected bluetooth device according to the bluetooth connection establishment response returned by the bluetooth device, and then the process goes to step S201.
In step S206, the application program determines that a connection has been established with the bluetooth device.
In one possible implementation, the application program determines that a corresponding bluetooth connection has been established with the selected bluetooth device when determining that the current connection status is connected, and then goes to step S201.
In one possible implementation, after the above steps S205 and S206, going to step S201, the application program continues to perform the process of determining its current operating state on the terminal device.
In a possible implementation manner, after determining the connection state of the bluetooth device, the application program needs to determine its current running state, so as to determine whether the application program is currently running in the foreground or the background of the terminal device, so as to perform corresponding processing according to the running state currently running in the foreground or the background. If the operation is in the foreground, go to step S207; if the bluetooth device is running in the background, go to step S202, continue to select one bluetooth device from the remaining bluetooth devices in the device list, and determine the connection status of the selected bluetooth device; if the selected Bluetooth device is the last Bluetooth device, other Bluetooth devices which do not establish Bluetooth connection in the device list continue to be subjected to polling processing. Of course, the bluetooth connection processing in the background may be performed all the time when the application runs in the background, or may be preset for a time, and the bluetooth connection processing is stopped as long as the preset time is reached.
In one possible implementation, when the application is currently running in the foreground, the following processing is included:
in step S207, the application performs bluetooth device scanning processing.
In one possible implementation, after determining that the application program is currently running in the foreground, the application program performs a scanning operation of the bluetooth device within a scanning range of the bluetooth device of the terminal device. The scanning range of the bluetooth device may be a scanning range of the default bluetooth device, and may also be adjusted according to the scanning range required by the user, so that only the bluetooth device within the scanning range required by the user is scanned.
In one possible implementation, the application may set a preset time during which the bluetooth device scan is performed when the bluetooth device scan is performed. In the preset time (that is, the preset time is not reached), as long as the bluetooth device is scanned, no matter 1 bluetooth device or a plurality of bluetooth devices, the process goes to step S208, and the application program determines whether the scanned bluetooth device is in a preconfigured device list; when the preset time is reached, the process goes to step S211.
In step S208, the application program obtains the identity information of the scanned bluetooth device.
In one possible implementation, after scanning the bluetooth device, the application program obtains the corresponding identification information, such as the mac address, of the bluetooth device.
In step S209, the application program determines whether the scanned bluetooth device is in a preconfigured device list according to the identification information.
In a possible implementation manner, after acquiring the identification information of the bluetooth device, the application program queries a pre-configured device list according to the acquired identification information, and determines whether the identification information corresponding to each bluetooth device in the device list is matched with the identification information corresponding to the scanned bluetooth device; if the Bluetooth devices are matched, the scanned Bluetooth devices are determined to be in the device list, and the step S210 is carried out; otherwise, it is determined that the scanned bluetooth device is not in the device list, and the process goes to step S207 to continue to execute the bluetooth device scanning process.
Step S210, the application program performs bluetooth connection with the scanned bluetooth device.
In one possible implementation, after determining that the scanned bluetooth device is in the device list, the application program directly performs bluetooth connection with the scanned bluetooth device, and then continues to perform the scanning process of the bluetooth device until the preset time is reached and stops.
In step S211, the application closes the process of scanning the bluetooth device.
In one possible implementation, the application turns off the current scanning bluetooth device processing operations when a preset time is reached. After the application closes the current bluetooth device scanning process, the bluetooth device scanning process is restarted after a certain preset time, and then the process goes to step S207 to continue to execute the bluetooth device scanning process. That is, after the preset time is reached, the application closes the current scanning process no matter whether the application scans the bluetooth device or not, and after the current scanning process is closed, the process of scanning the bluetooth device is started again after the application waits for a specific time, so that the process of scanning the bluetooth device within the preset time is executed again.
In the method, no matter the application program is in the foreground or the background, the automatic Bluetooth connection between the application program and the Bluetooth equipment is realized; when the application program is in the foreground, automatic Bluetooth connection can be realized only by the Bluetooth equipment in the equipment list, manual Bluetooth connection of a user is avoided, and connection efficiency is improved; when the application program runs in the background, the Bluetooth connection aging is guaranteed through continuous background Bluetooth connection processing, the defect that the user cannot realize Bluetooth connection after the application program is switched to the background is avoided, and connection processing of the application program to a plurality of Bluetooth devices in a device list is realized through sequential Bluetooth connection processing, so that the use experience of the user is improved.
Based on the above technical solution of the bluetooth device connection method provided by the present application, the present application correspondingly provides a schematic structural diagram of a bluetooth device connection apparatus, as shown in fig. 3, the bluetooth device connection apparatus 30 of the present application may include:
the first processing module 31 is configured to call a first system function carrying a page life cycle callback object to determine a current running state of an application program on a terminal device;
the obtaining module 32 is configured to obtain bluetooth device information in a pre-configured device list when it is determined that the current running state of the application program is running in the background;
a selecting module 33, configured to select any one bluetooth device in the device list according to the bluetooth device information;
the second processing module 34 is configured to call a second system function carrying a bluetooth callback object to determine a connection state of the selected bluetooth device;
the second processing module 34 is configured to send a bluetooth connection establishment request to the selected bluetooth device if the connection status is unconnected, receive a bluetooth connection establishment response returned by the bluetooth device, and obtain a corresponding establishment result of the bluetooth connection established with the selected bluetooth device according to the bluetooth connection establishment response; if the connection state is connected, determining that Bluetooth connection is established with the selected Bluetooth equipment;
the first processing module 31 is further configured to execute a process of determining a current operating state of the selected bluetooth device on the terminal device after determining that the bluetooth connection has been established with the selected bluetooth device.
In a possible implementation manner, the first processing module 31 is configured to call a first system function to send the page life cycle callback object to the terminal device; when the terminal device monitors that the page changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries page state information in a notification message to call back the page state information to the application program.
In one possible implementation of the method of the invention,
a first processing module 31, configured to perform bluetooth device scanning processing when it is determined that the current operating state is operating in the foreground, and determine whether the scanned bluetooth device is in a preconfigured device list; if the scanned Bluetooth equipment is in the equipment list, performing Bluetooth connection with the scanned Bluetooth equipment; otherwise, continuing to execute the scanning processing of the Bluetooth equipment;
the first processing module 31 is configured to determine connection states of the remaining bluetooth devices in the device list when it is determined that the current operation state is operating in the background, and determine whether to establish bluetooth connection with the remaining bluetooth devices according to the connection states.
In one possible implementation, the first processing module 31 is configured to perform a bluetooth device scanning process within a preset time; when the preset time is not reached, executing the processing of determining whether the scanned Bluetooth equipment is in a pre-configured equipment list or not on the scanned Bluetooth equipment; and when the preset time is up, the scanning processing of the Bluetooth equipment is closed.
In one possible implementation, the first processing module 31 is further configured to restart the bluetooth device scanning process after a certain time, and then perform the above-mentioned operation of performing the bluetooth device scanning process within a preset time.
In one possible implementation, the first processing module 31 is specifically configured to acquire identity information of a scanned bluetooth device; inquiring a pre-configured equipment list according to the identity identification information, and determining whether the identity identification information corresponding to each Bluetooth equipment in the equipment list is matched with the identity identification information of the scanned Bluetooth equipment; if the Bluetooth devices are matched with the devices, the application program determines that the scanned Bluetooth devices are in a device list; otherwise, the application determines that the scanned bluetooth device is not in the device list.
In one possible implementation, the second processing module 34 is configured to call a second system function to send the bluetooth callback object to the terminal device;
the terminal equipment carries out callback processing on the Bluetooth callback object according to a second system function called by the application program, and carries the connection state information of the Bluetooth equipment in the notification message to call back the Bluetooth callback object to the application program;
the second processing module 34 is configured to, when the terminal device determines that the terminal device is in a connected state with the bluetooth device, determine that connection state information in the notification message received through the callback interface is a successful connection message;
and the second processing module 34 is configured to, when the terminal device determines that the terminal device is in an unconnected state with the bluetooth device, determine that connection state information in the notification message received through the callback interface is a connection failure message.
In the method, the Bluetooth connection between the application program and the Bluetooth equipment is realized no matter the application program is in the foreground or the background; when the application program is in the foreground, automatic Bluetooth connection can be realized only by the Bluetooth equipment in the equipment list, manual Bluetooth connection of a user is avoided, and connection efficiency is improved; when the application program runs in the background, the Bluetooth connection aging is guaranteed through continuous background Bluetooth connection processing, the defect that the user cannot realize Bluetooth connection after the application program is switched to the background is avoided, and connection processing of the application program to a plurality of Bluetooth devices in a device list is realized through sequential Bluetooth connection processing, so that the use experience of the user is improved.
Referring now to fig. 4, a block diagram of an electronic device (e.g., the terminal device of fig. 1) 400 suitable for implementing embodiments of the present application is shown. The terminal device in the embodiments of the present application may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program, when executed by the processing device 401, performs the above-described functions defined in the methods of the embodiments of the present application.
It should be noted that the computer readable medium mentioned above in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the disclosure. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.
The electronic device provided by the present application is applicable to any of the embodiments of the bluetooth device connection method described above, and is not described herein again.
In the method, the Bluetooth connection between the application program and the Bluetooth equipment is realized no matter the application program is in the foreground or the background; when the application program is in the foreground, automatic Bluetooth connection can be realized only by the Bluetooth equipment in the equipment list, manual Bluetooth connection of a user is avoided, and connection efficiency is improved; when the application program runs in the background, the Bluetooth connection aging is guaranteed through continuous background Bluetooth connection processing, the defect that the user cannot realize Bluetooth connection after the application program is switched to the background is avoided, and connection processing of the application program to a plurality of Bluetooth devices in a device list is realized through sequential Bluetooth connection processing, so that the use experience of the user is improved.
The present application provides a computer-readable storage medium storing a computer program that causes a computer to execute the bluetooth device connection method shown in the above-described embodiments.
The computer-readable storage medium provided in the present application is applicable to any embodiment of the bluetooth device connection method, and is not described herein again.
In the method, the Bluetooth connection between the application program and the Bluetooth equipment is realized no matter the application program is in the foreground or the background; when the application program is in the foreground, automatic Bluetooth connection can be realized only by the Bluetooth equipment in the equipment list, manual Bluetooth connection of a user is avoided, and connection efficiency is improved; when the application program runs in the background, the Bluetooth connection aging is guaranteed through continuous background Bluetooth connection processing, the defect that the user cannot realize Bluetooth connection after the application program is switched to the background is avoided, and connection processing of the application program to a plurality of Bluetooth devices in a device list is realized through sequential Bluetooth connection processing, so that the use experience of the user is improved.
It will be understood by those within the art that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. Those skilled in the art will appreciate that the computer program instructions may be implemented by a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the aspects specified in the block or blocks of the block diagrams and/or flowchart illustrations disclosed herein.
The modules of the device can be integrated into a whole or can be separately deployed. The modules can be combined into one module, and can also be further split into a plurality of sub-modules.
Those skilled in the art will appreciate that the drawings are merely schematic representations of one preferred embodiment and that the blocks or flow diagrams in the drawings are not necessarily required to practice the present application.
Those skilled in the art will appreciate that the modules in the devices in the embodiments may be distributed in the devices in the embodiments according to the description of the embodiments, and may be correspondingly changed in one or more devices different from the embodiments. The modules of the above embodiments may be combined into one module, or further split into multiple sub-modules.
The above application serial numbers are for descriptive purposes only and do not represent the merits of the embodiments.
The disclosure of the present application is only a few specific embodiments, but the present application is not limited to these, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (16)

1. A Bluetooth device connection method is applied to a terminal device installed with an application program, and is characterized by comprising the following steps:
the application program calls a first system function carrying a page life cycle callback object to determine the current running state of the first system function on the terminal equipment;
when the current running state is determined to be running in the background, the application program acquires Bluetooth equipment information in a pre-configured equipment list;
the application program selects any one Bluetooth device in the device list according to the Bluetooth device information;
the application program calls a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment;
if the connection state is not connected, the application program sends a Bluetooth connection establishment request to the selected Bluetooth equipment, receives a Bluetooth connection establishment response returned by the Bluetooth equipment, and obtains a corresponding establishment result of the Bluetooth connection established with the selected Bluetooth equipment according to the Bluetooth connection establishment response; if the connection state is connected, the application program determines that Bluetooth connection is established with the selected Bluetooth equipment;
after the application program determines that the Bluetooth connection is established with the selected Bluetooth equipment, executing the processing of determining the current running state of the application program on the terminal equipment;
further comprising:
and when the current running state is determined to be running in the background, the application program determines the connection state of the residual Bluetooth equipment in the equipment list, and determines whether Bluetooth connection is established with the residual Bluetooth equipment according to the connection state.
2. The method of claim 1, wherein said application invoking a first system function carrying a page lifecycle callback object to determine its current running state on said terminal device comprises:
the application program calls the first system function to send the page life cycle callback object to the terminal equipment;
when the terminal device monitors that the page changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries page state information in a notification message to call back the page state information to the application program.
3. The method of claim 1,
when the current running state is determined to be running in the foreground, the application program carries out Bluetooth equipment scanning processing and determines whether the scanned Bluetooth equipment is in the pre-configured equipment list or not; if the scanned Bluetooth equipment is in the equipment list, performing Bluetooth connection with the scanned Bluetooth equipment; otherwise, the bluetooth device scanning process is continuously executed.
4. The method of claim 3, wherein the application performs a Bluetooth device scanning process comprising:
the application program performs Bluetooth equipment scanning processing within preset time;
when the preset time is not reached, the application program executes the processing of determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not on the scanned Bluetooth equipment;
and when the preset time is up, the application program closes the scanning processing of the Bluetooth equipment.
5. The method of claim 4, wherein after the application turns off the Bluetooth device scanning process, further comprising:
and the application program restarts the scanning processing of the Bluetooth equipment after a specific time, and then executes the operation of scanning the Bluetooth equipment within the preset time.
6. The method of claim 4, wherein the application performing the determination of whether the scanned Bluetooth device is in the preconfigured device list for the scanned Bluetooth device comprises:
the application program acquires the identity identification information of the scanned Bluetooth equipment;
the application program inquires a pre-configured equipment list according to the identity identification information and determines whether the identity identification information corresponding to each Bluetooth equipment in the equipment list is matched with the identity identification information of the scanned Bluetooth equipment; if the Bluetooth devices are matched with the devices, the application program determines that the scanned Bluetooth devices are in the device list; otherwise, the application program determines that the scanned bluetooth device is not in the device list.
7. The method of claim 1, wherein the bluetooth device information includes stored connection status information, and the application calls a second system function carrying a bluetooth callback object to determine the connection status of the selected bluetooth device, comprising:
the application program calls the second system function to send the Bluetooth callback object to the terminal equipment;
the terminal equipment performs callback processing on a Bluetooth callback object according to a second system function called by the application program, and carries the connection state information of the Bluetooth equipment in a notification message to call back to the application program;
when the terminal equipment judges that the terminal equipment is in a connected state with the Bluetooth equipment, the connection state information in the notification message received by the application program through the callback interface is a message of successful connection;
and when the terminal equipment judges that the terminal equipment is in an unconnected state with the Bluetooth equipment, the connection state information in the notification message received by the application program through the callback interface is a message of connection failure.
8. The utility model provides a bluetooth equipment connecting device, is applied to and installs on the terminal equipment of application, its characterized in that includes:
the first processing module is used for calling a first system function carrying a page life cycle callback object to determine the current running state of the application program on the terminal equipment;
the acquisition module is used for acquiring the Bluetooth equipment information in a pre-configured equipment list when the current running state of the application program is determined to be running in the background;
the selecting module is used for selecting any one Bluetooth device in the device list according to the Bluetooth device information;
the second processing module is used for calling a second system function carrying a Bluetooth callback object to determine the connection state of the selected Bluetooth equipment;
the second processing module is used for sending a Bluetooth connection establishment request to the selected Bluetooth equipment if the connection state is not connected, receiving a Bluetooth connection establishment response returned by the Bluetooth equipment, and obtaining a corresponding establishment result of the Bluetooth connection established with the selected Bluetooth equipment according to the Bluetooth connection establishment response; if the connection state is connected, determining that Bluetooth connection is established with the selected Bluetooth equipment;
the first processing module is further configured to execute processing for determining a current operating state of the selected bluetooth device on the terminal device after determining that a bluetooth connection has been established with the selected bluetooth device;
the first processing module is configured to determine a connection state of the remaining bluetooth devices in the device list when it is determined that the current operation state is in the background, and determine whether to establish bluetooth connection with the remaining bluetooth devices according to the connection state.
9. The apparatus of claim 8, wherein said first processing module is configured to invoke said first system function to send said page lifecycle callback object to said terminal device; when the terminal device monitors that the page changes, the terminal device performs callback processing on a page life cycle callback object according to a first system function called by the application program, and carries page state information in a notification message to call back the page state information to the application program.
10. The apparatus of claim 8,
the first processing module is used for scanning the Bluetooth equipment and determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not when the current running state is determined to be running in the foreground; if the scanned Bluetooth equipment is in the equipment list, performing Bluetooth connection with the scanned Bluetooth equipment; otherwise, the bluetooth device scanning process is continuously executed.
11. The apparatus of claim 10, wherein the first processing module is configured to perform a bluetooth device scanning process within a preset time; when the preset time is not reached, executing the processing of determining whether the scanned Bluetooth equipment is in the pre-configured equipment list or not on the scanned Bluetooth equipment; and when the preset time is up, the scanning processing of the Bluetooth equipment is closed.
12. The apparatus of claim 11, wherein the first processing module is further configured to restart the bluetooth device scanning process after a specific time, and then perform the bluetooth device scanning process within a preset time.
13. The apparatus according to claim 11, wherein the first processing module is specifically configured to acquire identification information of the scanned bluetooth device; inquiring a pre-configured equipment list according to the identity identification information, and determining whether the identity identification information corresponding to each Bluetooth equipment in the equipment list is matched with the identity identification information of the scanned Bluetooth equipment; if the Bluetooth devices are matched with the devices, the application program determines that the scanned Bluetooth devices are in the device list; otherwise, the application program determines that the scanned bluetooth device is not in the device list.
14. The apparatus of claim 8, wherein the second processing module is configured to invoke the second system function to send a bluetooth callback object to the terminal device;
the terminal equipment performs callback processing on a Bluetooth callback object according to a second system function called by the application program, and carries the connection state information of the Bluetooth equipment in a notification message to call back to the application program;
the second processing module is used for receiving the connection state information in the notification message through the callback interface as a successful connection message when the terminal equipment judges that the terminal equipment is in a connected state with the Bluetooth equipment;
and the second processing module is used for receiving the connection state information in the notification message as a connection failure message through the callback interface when the terminal equipment judges that the terminal equipment is not connected with the Bluetooth equipment.
15. An electronic device, comprising: a processor and a memory;
the memory for storing a computer program;
the processor is configured to execute the bluetooth device connection method according to any one of the above claims 1 to 7 by calling the computer program.
16. A computer-readable storage medium for storing a computer program which, when run on a computer, causes the computer to perform the bluetooth device connection method of any one of the above claims 1 to 7.
CN202011099908.4A 2020-10-15 2020-10-15 Bluetooth device connection method and device, electronic device and readable storage medium Active CN111935694B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011099908.4A CN111935694B (en) 2020-10-15 2020-10-15 Bluetooth device connection method and device, electronic device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011099908.4A CN111935694B (en) 2020-10-15 2020-10-15 Bluetooth device connection method and device, electronic device and readable storage medium

Publications (2)

Publication Number Publication Date
CN111935694A CN111935694A (en) 2020-11-13
CN111935694B true CN111935694B (en) 2021-03-16

Family

ID=73334799

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011099908.4A Active CN111935694B (en) 2020-10-15 2020-10-15 Bluetooth device connection method and device, electronic device and readable storage medium

Country Status (1)

Country Link
CN (1) CN111935694B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416617A (en) * 2020-11-19 2021-02-26 青岛海尔科技有限公司 Control method and device of Bluetooth equipment, storage medium and electronic device
CN113543102A (en) * 2021-07-12 2021-10-22 三诺生物传感股份有限公司 Bluetooth connection method
CN113573291B (en) * 2021-08-04 2024-07-30 杭州涂鸦信息技术有限公司 Bluetooth connection method, device, computer equipment and computer readable storage medium
CN116264677A (en) * 2021-12-13 2023-06-16 美的集团股份有限公司 Data transmission method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103237069A (en) * 2013-04-17 2013-08-07 浙江大学 Intelligent wireless household appliance controlling system and intelligent wireless household appliance controlling method
CN105430603A (en) * 2015-12-03 2016-03-23 北京握奇智能科技有限公司 Secure connection method and system for Bluetooth equipment
CN107770762A (en) * 2017-11-20 2018-03-06 飞天诚信科技股份有限公司 A kind of method and device for establishing bluetooth connection

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9924298B2 (en) * 2014-10-31 2018-03-20 Welch Allyn, Inc. Wireless ambulatory care network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103237069A (en) * 2013-04-17 2013-08-07 浙江大学 Intelligent wireless household appliance controlling system and intelligent wireless household appliance controlling method
CN105430603A (en) * 2015-12-03 2016-03-23 北京握奇智能科技有限公司 Secure connection method and system for Bluetooth equipment
CN107770762A (en) * 2017-11-20 2018-03-06 飞天诚信科技股份有限公司 A kind of method and device for establishing bluetooth connection

Also Published As

Publication number Publication date
CN111935694A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
CN111935694B (en) Bluetooth device connection method and device, electronic device and readable storage medium
US7957775B2 (en) Low battery notification service for wireless device users
US11354019B2 (en) Electronic device and method for controlling snooze notification
US11012926B2 (en) Methods and apparatus for acquiring wireless access points information
CN111212421B (en) Card automatic connection method, electronic device and computer readable storage medium
RU2554099C2 (en) User selected operational environments for mobile communication devices
EP2784661B1 (en) Computer program product, information processing method, and information processing apparatus
CN109510881A (en) Method, apparatus, electronic equipment and the readable storage medium storing program for executing of sharing files
CN111813625B (en) Health checking method and device for distributed server cluster
CN112256371A (en) Method and device for displaying information and electronic equipment
CN112257478A (en) Code scanning method, device, terminal and storage medium
CN110933772A (en) Connection method of wireless device, mobile terminal and computer readable storage medium
CN106789832B (en) Data processing method, device and system in call process
CN112732365B (en) Preassembled application program starting method and device, electronic equipment and storage medium
EP1777926A1 (en) Method and mobile terminal for performing multiple tasks without conflict
CN115396824B (en) Bluetooth-based network configuration method, device, computer equipment and medium
CN114827060B (en) Interaction method and device and electronic equipment
CN108650716B (en) Terminal device control method, terminal device and storage medium
CN112437192A (en) Installation method and running method of application software, electronic equipment and computer readable medium
CN114006880B (en) Method and device for acquiring message receipt, electronic equipment and storage medium
CN112187863B (en) Method and device for expanding organization roles, storage medium and electronic equipment
JP7100740B2 (en) Mobile terminal
CN111200861B (en) Method and device for searching wireless communication network in terminal
CN111352672A (en) Page synchronization method and device, electronic equipment and computer readable storage medium
CN106658448B (en) Voice communication method and device

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