CN114340021A - Request processing method and device - Google Patents
Request processing method and device Download PDFInfo
- Publication number
- CN114340021A CN114340021A CN202210203279.8A CN202210203279A CN114340021A CN 114340021 A CN114340021 A CN 114340021A CN 202210203279 A CN202210203279 A CN 202210203279A CN 114340021 A CN114340021 A CN 114340021A
- Authority
- CN
- China
- Prior art keywords
- application
- electronic device
- connection
- smart watch
- priority
- 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.)
- Granted
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Telephone Function (AREA)
Abstract
The application provides a request processing method and device, relates to the technical field of Bluetooth communication, and the method can be applied to first electronic equipment which supports at least two applications to control the first electronic equipment, such as a first application and a second application. The first electronic equipment and other electronic equipment can be prevented from switching back and forth among a plurality of applications to establish connection, and the problem of disordered data distribution or error of the first electronic equipment is solved. After an ACL link is established between first electronic equipment and second electronic equipment, a first SPP connection is established between the first electronic equipment and the second electronic equipment based on a first application, and priority information of the first application is acquired and stored, wherein the priority information of the first application is used for indicating the first application to control the priority of the first electronic equipment; the first electronic equipment receives a connection request sent by the second electronic equipment based on the second application; the first electronic device determines whether to establish a second SPP connection with the second electronic device based on the second application in response to the connection request according to the priority information of the first application.
Description
Technical Field
The present application relates to the field of bluetooth communication technologies, and in particular, to a request processing method and device.
Background
With the development of technology, more and more kinds of intelligent wearing equipment can be used by the user. Wherein, partial intelligent wearing equipment need be connected with electronic equipment (like the cell-phone) between to carry out data communication with corresponding Application (APP) among the electronic equipment.
The mode that adopts the bluetooth to be connected between intelligence wearing equipment and the electronic equipment at present usually. Specifically, the electronic device may communicate with the intelligent wearable device through an application program (APP, application for short) installed in the electronic device based on a Serial Port Profile (SPP) protocol in the bluetooth technology. The SPP protocol is characterized in that: the corresponding relation between the server (server) and the client (client) is 1:1, which means that when the electronic device communicates with the intelligent wearable device based on the SPP protocol through the application, only one application is supported to use the SPP protocol channel. And present many intelligent wearing equipment all support this intelligent wearing equipment of two at least applications control. In this case, a problem that at least two applications preempt the SPP protocol channel to connect with the smart wearable device may occur. Specifically, the smart wearable device may switch the connection between the at least two applications back and forth, thereby causing a problem that data distribution in the smart wearable device is prone to confusion or errors.
Disclosure of Invention
The embodiment of the application provides a request processing method and device, and aims to solve the problem that data distribution in intelligent wearable equipment is prone to confusion or errors due to the fact that the intelligent wearable equipment in the related technology switches connection between at least two applications back and forth.
The technical scheme is as follows:
in a first aspect, the present application provides a request processing method, which may be applied to a first electronic device. The first electronic device supports at least two applications to control the first electronic device, the at least two applications including a first application and a second application. The method can comprise the following steps: after the ACL link is established between the first electronic device and the second electronic device, the first electronic device establishes a first SPP connection with the second electronic device based on a first application in the second electronic device, and the first electronic device acquires and stores priority information of the first application. The priority information of the first application is used for indicating the priority of the first application for controlling the first electronic equipment. When receiving a connection request sent by a second electronic device based on a second application, the first electronic device determines whether to respond to the connection request according to priority information of the first application, and establishes a second SPP connection with the second electronic device based on the second application.
By adopting the technical scheme, the priority information is respectively set for the plurality of applications supported by the first electronic device, and after the first electronic device successfully establishes the SPP connection with other electronic devices, the first electronic device stores the priority information of the application currently establishing the SPP connection. When the first electronic device receives a connection request sent by other applications again, the first electronic device determines whether to respond to the connection request received later or not by combining the priority information of the currently stored application. Therefore, the problem that the first electronic device switches back and forth among the plurality of applications to establish connection when connection requests initiated by other electronic devices based on different applications are received successively can be solved, and the problem of disordered data distribution or errors in the first electronic device is reduced.
In one possible implementation, the method may further include: the determining, by the first electronic device, whether to establish the second SPP connection with the second electronic device based on the second application in response to the connection request according to the priority information of the first application may include: if the priority of the first application is the highest priority of the at least two applications, the first electronic device ignores the connection request; if the priority of the first application is not the highest priority of the at least two applications, the first electronic device will establish a second SPP connection with the second electronic device based on the second application in response to the connection request. By the technical scheme, under the precondition that the first electronic equipment is controlled by a plurality of applications, the situation that the connection is switched back and forth between different applications cannot be easily caused when the first electronic equipment receives connection requests initiated by other electronic equipment based on different applications in sequence is ensured. Specifically, if the application currently establishing the SPP connection is the application with the highest priority among all supported applications, the application is not switched to other applications to establish the SPP connection, so that the condition of data distribution confusion or errors in the first electronic device is reduced.
In one possible implementation, the method may further include: the first electronic device establishing a second SPP connection with the second electronic device based on the second application in response to the connection request may include: the first electronic device disconnects the first SPP connection, and in response to the connection request, establishes a second SPP connection with the second electronic device based on the second application. Before the first electronic device and the second electronic device establish the second SPP connection based on the second application, the first SPP connection established based on the first application and the second electronic device is disconnected, namely only one SPP connection is kept between the first electronic device and the second electronic device at the same time, and data in the first electronic device is transmitted through the unique SPP connection, so that the condition of disordered data distribution or errors is avoided.
In one possible implementation, the method may further include: the acquiring and saving of the priority information of the first application by the first electronic device may include: the first electronic device acquires the connection parameters of the first SPP connection, and acquires and stores the priority information of the first application according to the connection parameters of the first SPP connection.
In one possible implementation, the method may further include: the first electronic device obtaining the connection parameters of the first SPP may include: the first electronic device obtains a first service channel number corresponding to the first SPP connection. The obtaining and saving, by the first electronic device, priority information of the first application based on the connection parameters of the first SPP connection may include: the first electronic device acquires a handle corresponding to the first application based on the first service channel number, and stores the handle corresponding to the first application as priority information of the first application. Since the handle is a parameter that must be configured in advance in the first electronic device before the second electronic device establishes the SPP connection with the first electronic device, in the request processing method, it is not necessary to add other parameters as the priority of the application. For the second electronic device, the process of establishing a connection with the first electronic device is consistent with the process of conventional connection and does not need to be improved. The application installed in the second electronic device may also be a developed application, thereby widening the application range of the request processing method described above.
In one possible implementation, the method may further include: and after the first electronic equipment successfully establishes the second SPP connection, acquiring a second service channel number corresponding to the second SPP connection. And the first electronic equipment acquires the handle corresponding to the second application based on the second service channel number, and replaces the stored handle corresponding to the first application by adopting the handle corresponding to the second application as the priority information of the second application. And after the first electronic device establishes a second SPP connection with the second electronic device based on the second application, replacing the priority information of the currently saved application with a handle corresponding to the second application. Only the priority information of the application of the currently established SPP connection is stored, and when the first electronic device receives the connection request, the priority of the application corresponding to the currently established SPP connection can be quickly judged, and whether the newly received connection request is responded or not is judged, so that the request processing efficiency is improved.
In one possible implementation, the method may further include: the first electronic device displays a priority setting interface for setting priority information of at least two applications. The first electronic equipment receives the priority information set by the user on the priority setting interface and stores the set priority information. The first electronic equipment provides a priority setting interface for a user, and the user can conveniently perform custom setting on the priority of the application supporting control of the first electronic equipment.
In a second aspect, the present application provides an electronic device, which may be a first electronic device supporting at least two applications to control the first electronic device, and the first electronic device may include: a memory, a bluetooth module, one or more processors; the memory, the Bluetooth module and the processor are coupled; wherein the bluetooth module is configured to communicate with a second electronic device, the memory is configured to store priority information of an application controlling the first electronic device, and the memory stores computer program code comprising computer instructions that, when executed by the processor, cause the first electronic device to perform the request processing method according to the first aspect or any of the possible implementations of the first aspect.
In one possible implementation, the electronic device is a smart wearable device.
In a third aspect, the present application provides a computer-readable storage medium having stored therein instructions that, when executed in a computer, enable the computer to perform the request processing method as described in the first aspect or any of the possible implementations of the first aspect.
It is understood that the electronic device according to the second aspect and the computer-readable storage medium according to the third aspect are both configured to perform the corresponding methods provided above, and therefore, the beneficial effects achieved by the electronic device according to the second aspect and the computer-readable storage medium according to the third aspect can be referred to the beneficial effects of the corresponding methods provided above, and are not described herein again.
Drawings
Fig. 1 is a schematic structural diagram of a communication system according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a communication system according to another embodiment of the present application;
fig. 3 is a schematic diagram of a mobile phone interface provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a smart watch according to an embodiment of the present application;
fig. 5 is a protocol architecture diagram related to creating an SPP connection between a mobile phone and a smart watch according to an embodiment of the present application;
fig. 6 is a system framework diagram related to establishment of an SPP connection between a mobile phone and a smart watch based on different applications according to an embodiment of the present application;
fig. 7 is a schematic flowchart of a request processing method according to an embodiment of the present application;
fig. 8 is a flowchart illustrating a request processing method according to another embodiment of the present application;
fig. 9 is a flowchart illustrating a request processing method according to another embodiment of the present application;
FIG. 10 is a schematic diagram of a priority setting interface provided by an embodiment of the present application;
fig. 11 is a schematic structural diagram of a chip system according to an embodiment of the present disclosure.
Detailed Description
The embodiment of the application provides a request processing method, which can be used for other electronic equipment (such as a second electronic equipment and/or a third electronic equipment) to control a first electronic equipment through a plurality of applications (such as a first application and a second application).
For example, the first electronic device may be a smart home device, such as a smart speaker, a smart bulb, a smart camera, a smart switch, a smart socket, a smart window curtain, a smart tv, a smart refrigerator, and so on. Alternatively, the first electronic device may also be a smart wearable device. For example, the first electronic device may be the smart watch 101 shown in fig. 1 or fig. 2. Also for example, the first electronic device may be smart glasses, smart headphones, smart bracelets, and so on.
The first electronic device may support at least two applications (e.g., a first application and a second application) to control the first electronic device. The at least two applications may be a plurality of different application programs developed by a vendor of the first electronic device for the first electronic device. Alternatively, the at least two applications may be a plurality of different application programs respectively developed for the first electronic device by a manufacturer and other developers of the first electronic device.
In the application scenario (1), the second electronic device and the third electronic device may be the same electronic device, and at least two applications capable of controlling the first electronic device may be installed in the electronic device. For example, the second electronic device and the third electronic device may be the cell phone 102 shown in fig. 1. The mobile phone 102 has a first application and a second application installed therein. The cell phone 102 shown in fig. 1 may control not only the smart watch 101 through the first application but also the smart watch 101 through the second application.
In the application scenario (2), the second electronic device and the third electronic device may be two different electronic devices. An application capable of controlling the first electronic device is respectively installed in the two electronic devices; and, applications installed in the two electronic devices for controlling the first electronic device are different. For example, the second electronic device may be the cell phone 102 shown in fig. 2, and the third electronic device may be the tablet computer 103 shown in fig. 2. The first application is installed in the cell phone 102 shown in fig. 2, and the cell phone 102 can control the smart watch 101 through the first application. The tablet computer 103 shown in fig. 2 has a second application installed therein, and the tablet computer 103 can control the smart watch 101 through the second application.
In other embodiments, the second electronic device and/or the third electronic device may be other types of electronic devices, for example, the second electronic device and/or the third electronic device may also be a desktop, a laptop, a handheld computer, a notebook, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a Personal Digital Assistant (PDA), an Augmented Reality (AR) device, a media player, a television, and the like.
Further, as shown in fig. 3, a schematic diagram of a main interface of the mobile phone 102 in the application scenario (1) is shown. A plurality of applications may be installed in the cell phone 102, and the plurality of applications may include the first application and the second application described above. As shown in fig. 3, the home interface 110 in the handset 102 includes: application icons for applications such as "email," settings, "" camera, "" smart watch, "and" sports health. Wherein the first application may be a "smart watch" as shown in fig. 3 and the second application may be an "athletic health" as shown in fig. 3. It is to be appreciated that, in the present embodiment, the cell phone 102 may control the smart watch 101 through "smart watch" or "sports health".
The cell phone 102 may receive a user's click operation on an application icon of "smart watch" in the main interface 110 shown in fig. 3. In response to a user clicking on the application icon of the "smartwatch," the cell phone 102 may launch the "smartwatch" application and enter the control interface 120 of the "smartwatch" as shown in fig. 3.
The cell phone 102 can also receive a user click operation on the "sports health" application icon in the main interface 110 shown in fig. 3. In response to a user clicking on the "sports health" application icon, the handset 102 may initiate "sports health" and enter the control interface 130 shown in FIG. 3.
Here, "smart watch 1" shown in the control interface 120 or the control interface 130 represents a smart watch searched by the cell phone 102 or a smart watch to which the cell phone 102 has been connected. In other embodiments, information for multiple smartwatches or other electronic devices may be displayed in control interface 120 or control interface 130. In this scenario, the cell phone 102 may receive an operation of a user to trigger a connection for one of the electronic devices in the control interface 120 or the control interface 130, and establish a connection with the corresponding electronic device. It should be understood that the control interface of the second electronic device (e.g., the cell phone 102) includes, but is not limited to, the control interface 120 or the control interface 130 shown in fig. 3, and the control interface 120 or the control interface 130 is only one example of a control interface.
For example, the structure of the smart watch 101 in the above application scenarios (1) and (2) is as shown in the smart watch 200 shown in fig. 4. It should be understood that the illustrated smart watch 200 is merely an example, that the smart watch configuration shown in fig. 4 does not constitute a limitation of the smart watch, and that the smart watch 200 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different configuration of components. The various components shown in fig. 4 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
As shown in fig. 4, the smart watch 200 includes: a watch body and a wrist band, wherein the watch body may include a front case (not shown in fig. 4), a touch screen 201 (also called a touch panel), a display 202, a bottom case (not shown in fig. 4), a processor 203, a Micro Control Unit (MCU) 204, a memory 205, a Microphone (MIC) 206, a thin film actuator 207, a bluetooth module 208, an air pressure sensor 209, a heart rate detection sensor 210, a gravity acceleration sensor 211, a power supply 212, a power supply management system 213, and the like. Although not shown, the smart watch may also include an antenna, a WiFi module, a GPS module, a speaker, a gyroscope, and the like. The following describes each functional component of the smart watch 200:
the touch screen 201, also referred to as a touch pad, may collect touch operations of a watch user thereon (e.g., operations of the user on or near the touch panel using any suitable object or accessory such as a finger, a stylus, etc.) and drive a responsive connection device according to a preset program. Alternatively, the touch screen 201 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and sends the touch point coordinates to the processor 203, and can receive and execute commands sent by the processor 203. In addition, the touch panel may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch screen 201, the smart watch may include other input devices, which may include, but are not limited to, function keys (such as volume control keys, switch keys, etc.).
The processor 203 is used for system scheduling, controlling the display screen, touch screen, support processing microphone 206, one or more membrane actuators 207, bluetooth module 208, etc.
The membrane actuator 207 is used to apply an input pressure (e.g., pressurized gas, fluid, etc.) to the cavity of the actuator to cause the membrane to move. When applied to a smart watch surface, membrane actuator 207 may generate a haptic effect on the surface of the smart watch upon receiving an input pressure.
The bluetooth module 208 and the smart watch may interact information with other electronic devices (e.g., the mobile phone 102 shown in fig. 1 and the tablet computer 103 shown in fig. 2) through the bluetooth module 208, and may be connected to a network through the electronic devices, connected to a server, and configured to process functions such as voice recognition.
The micro control unit 204 is used for controlling the sensor, performing calculations on sensor data, communicating with the processor 203, and the like.
The sensor may be a barometric pressure sensor 209, a heart rate detection sensor 210, a gravitational acceleration sensor 211, a light sensor, a motion sensor, or other sensor. In particular, the light sensor may include an ambient light sensor and a proximity sensor. As for the other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are also configurable to the watch, detailed description is omitted here.
The memory 205 is used for storing software programs and data, and the processor 203 executes various functional applications and data processing of the watch by running the software programs and data stored in the memory. The memory 205 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system and application programs (such as a sound playing function and an image playing function) required by at least one function; the stored data area may store data created from use of the watch (e.g., audio data, a phonebook, etc.). Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as a magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The smart watch 200 further includes a power source 212 (e.g., a battery) for supplying power to various components, and optionally, the power source 212 may be logically connected to the processor 203 through a power management system 213, so as to implement functions of managing charging, discharging, and power consumption through the power management system 213.
In the application scenarios (1) and (2) described above, the smart watch 101 may be controlled by both the first application and the second application in the second electronic device and/or the third electronic device. Typically, upon receiving a connection request initiated by another electronic device based on a first application, smart watch 101 will accept the connection request and establish a connection with the corresponding electronic device based on the first application. And when a connection request based on the second application is received again on the basis, the smart watch receives a new connection request, establishes connection with the corresponding electronic equipment based on the second application, and replaces the connection established based on the first application. In the application scenario (1), the mobile phone 102 is connected to the smart watch 101 through the first application and the second application in sequence. Or, in the application scenario (2), after the mobile phone 102 is connected to the smart watch 101 through the first application, the tablet pc 103 is connected to the smart watch 101 through the second application. The above scenario may cause a problem that a first electronic device (e.g., smart watch 101) switches a connection back and forth between a first application and a second application, resulting in a data distribution in the first electronic device that is prone to confusion or errors.
In the request processing method provided by the embodiment of the application, after the first electronic device establishes SPP connection with other electronic devices based on an application, priority information of the application may be stored. In this way, if the first electronic device receives a connection request based on another application again, it may be determined whether to respond to the connection request of another application according to the priority information of the application corresponding to the established SPP connection. That is, the first electronic device may determine whether to respond to a connection request for the second application to establish the SPP connection according to priority information of the first application that has currently established the SPP connection.
Through the technical scheme provided by the application, the problem that the first electronic equipment switches the connection back and forth between the at least two applications due to the fact that the at least two applications occupy the SPP protocol channel to be connected with the first electronic equipment can be avoided, and the problem that data distribution of the first electronic equipment is disordered or wrong can be further avoided.
In an embodiment of the present application, the communication between the second electronic device and/or the third electronic device (e.g., the cell phone 102) and the first electronic device (e.g., the smart watch 101) is accomplished based on the SPP protocol. For the convenience of understanding the present solution, the following explains technical terms that may be involved in the embodiments of the present application, by taking the above application scenario (1) as an example:
the SPP protocol defines the protocols and procedures that should be used by devices using bluetooth for RS232 (or similar) serial cable emulation. Specifically, the SPP Protocol requires a Service Discovery Protocol (SDP) and a serial linear emulation Protocol (RFCOMM Protocol) as supports, and is respectively responsible for Service Discovery and data transmission.
The device that initiates the SPP connection request is generally referred to as a client, and the device that accepts the SPP connection request is generally referred to as a server. For example, taking the application scenario (1) as an example, the mobile phone 102 shown in fig. 1 may serve as a client, and the smart watch 101 may serve as a server. The cell phone 102 shown in fig. 1 may initiate an SPP connection request to the smart watch 101, and the smart watch 101 accepts the SPP connection request of the cell phone 102.
Specifically, bluetooth devices discover each other's Service (Service) through the SDP protocol. The role of the SDP protocol is to discover all the services of the peer bluetooth device and which functions the service provides. The client can only obtain the device information, the service information and the service characteristics of the server through the SDP protocol, and can establish mutual connection on the basis. Taking the application scenario (1) as an example, the mobile phone 102 shown in fig. 1 discovers all services provided by the smart watch 101 and functions provided by the services based on the SDP protocol.
Each Service represents a capability of the bluetooth device, such as a power information Service, a system information Service, and the like. Each Service is represented by a Service Record (Service Record), i.e., a handle (handle) with a unique 32-bit (bit), each Service Record being composed of several Service attributes (Service attributes). Each Service is an instance of a Service Class (Service Class), i.e., a Service Record is an instance of a Service Class.
Each Service Class has a Service Class ID, which is called a Universal Unique Identifier (UUID). The client operates the Service Attribute in the server by searching the UUID to obtain a corresponding handle, and then operating the Service Attribute by the handle.
The RFCOMM Protocol provides a serial (9-pin RS 232) emulation based on the Logical Link Control and Adaptation Protocol (L2 CAP). A communication connection between two bluetooth devices while maintaining up to 60 lanes may be supported. The purpose of RFCOMM is to guarantee a complete communication path between applications on two different devices.
The L2CAP protocol is located above the baseband, and can provide connection-oriented and connectionless-oriented data services for a high layer, and complete functions such as protocol multiplexing, segmentation and reassembly, quality of service (QoS) transmission, and group abstraction.
The Host Communication Interface (HCI) is located between the bluetooth high-level protocol and the bluetooth low-level protocol, provides commands to the baseband controller and the link manager and a unified interface for accessing the bluetooth hardware, that is, a specific format is defined, the bluetooth chip is controlled by the bluetooth protocol stack to perform corresponding actions, and the bluetooth chip responds to the status of the bluetooth protocol stack and event messages.
Based on the technical words, the bluetooth connection process possibly involved in the embodiment of the present application is explained:
taking the application scenario (1) as an example, a physical connection needs to be established first for communication between the mobile phone 102 and the smart watch 101. One of the bluetooth physical connections is an Asynchronous Connection-Oriented Link (ACL) type.
In the embodiment of the present application, a process of establishing an ACL link between a mobile phone 102 and an intelligent watch 101 is described by taking the mobile phone 102 as a client (client) to actively connect to the intelligent watch 101 (i.e., a server). After the bluetooth function is turned on for both the cell phone 102 and the smart watch 101, the cell phone 102 may start paging the smart watch 101 in a frequency hopping manner. Smart watch 101 may scan for external pages at regular intervals. The smart watch 101 responds to an external page from the handset 102 when it scans for the page. In this way, an ACL link can be established between the cell phone 102 and the smart watch 101. The mobile phone 102 may start paging the smart watch 101 after the user triggers the ACL connection request, or may start paging the smart watch 101 automatically after the mobile phone 102 starts the bluetooth function. Further, in some possible embodiments, after the ACL link is first established between the cell phone 102 and the smart watch 101, the two electronic devices may automatically connect when both are within a certain range and bluetooth is enabled.
Further, after the ACL link is established between the cell phone 102 and the smart watch 101, a virtual serial port profile SPP connection may be created between the cell phone 102 and the smart watch 101 for communication. As shown in fig. 5, a protocol architecture diagram related to SPP connection is created for the handset 102 as a client (client) and the smart watch 101 as a server (server). As shown in fig. 5, the protocol architecture includes: HCI layer, L2CAP layer, SDP layer, RFCOMM layer, SPP layer. The bluetooth modules of the mobile phone 102 and the smart watch 101 mainly transmit data and information through the HCI layer. In some possible embodiments, after establishing the ACL link between the handset 102 and the smart watch 101, the procedure for the handset 102 to discover services of the smart watch 101 based on the SDP protocol and establish the SPP connection between the handset 102 and the smart watch 101 includes the steps of:
1) handset 102 sends an SDP request to smart watch 101 to look up connection parameters in smart watch 101. The connection parameters may include, among other things, the RFCOMM service channel number, the service class identification, and the handle. In the connection parameters, the RFCOMM service channel number, the service class identification and the handle have unique association relationship. In this embodiment of the present application, the handset 102 sends an SDP request to the smart watch 101 to search for connection parameters corresponding to at least two applications that support controlling the smart watch 101.
2) The cell phone 102 sends an authentication request to the smart watch 101. The smart watch 101 optionally performs device authentication and encryption with the cell phone 102 after receiving an authentication request from the cell phone.
3) Handset 102 sends a new L2CAP channel connection request to the RFCOMM entity of smartwatch 101 to request a new L2CAP channel. After receiving the L2CAP channel connection request, smart watch 101 establishes a new L2CAP channel.
4) Handset 102 sends an RFCOMM connection request to smartwatch 101 over an L2CAP channel. After receiving the RDCOMM connection request, the smartwatch 101 opens an RFCOMM session.
5) The handset 102 sends a data connection request to the smart watch 101 based on a connection parameter corresponding to an application on the RFCOMM session, and starts a new SPP connection. Wherein the application is one of at least two applications.
After the connection is established, smart watch 101 registers a service record for the established virtual serial port connection with a local SDP database.
Fig. 6 is a system framework diagram related to the establishment of SPP connections between the cell phone 102 and the smart watch 101 based on different applications. The SDP record (SDP records) in the Bluetooth kernel (BT kernel) of the smart watch 101 is configured with connection parameters corresponding to applications that support controlling the smart watch 101 in advance, and the applications shown in fig. 6 include a first application and a second application. The connection parameters may include service class identification, handle, service channel number, and the like. Applications that support controlling smart watch 101 are defined in an application core (APP core) of smart watch 101.
The Bluetooth Socket Manager (Bluetooth Socket Manager) of the cell phone 102 receives a connection request sent by a Bluetooth Socket corresponding to the first application through the connection service SDK, and sends a request to the smart watch 101 to establish an SPP connection based on the first application by the above connection establishment method. The bluetooth socket manager of the cell phone 102 receives a connection request sent by the bluetooth socket corresponding to the second application through the connection service SDK, and sends a request to the smart watch 101 to establish SPP connection based on the second application through the above connection establishment method.
The Bluetooth SDK of the smart watch 101 receives the connection request sent by the cell phone 102 through a Bluetooth Controller (BTC), and the SPP server of the smart watch 101 responds to the connection request to establish the SPP connection with the cell phone 102.
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, it being understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the present disclosure described herein may be practiced in sequences other than those illustrated or described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 7 is a flowchart illustrating a request processing method according to an embodiment of the present application. The present embodiment introduces the request processing method provided in the present embodiment with reference to the application scenario (1). Specifically, the description will be given taking, as an example, that the first electronic device is the smart watch 101 in the application scenario (1), and the second electronic device and the third electronic device are the mobile phone 102 in the application scenario (1). Where smart watch 101 supports at least two applications (e.g., a first application and a second application) controlling smart watch 101. The cell phone 102 installs the at least two applications (e.g., the first application and the second application) that may control the smart watch 101.
The smart watch 101 and the mobile phone 102 may establish a bluetooth connection for communication. Data transmission can be performed between the smart watch 101 and the mobile phone 102 based on the bluetooth connection. For example, the mobile phone 102 may transmit an upgrade data packet to the smart watch 101 through the bluetooth connection, so that the smart watch 101 is upgraded based on the upgrade data packet. For another example, the first cell phone 102 may send a control instruction to the smart watch 101 through the bluetooth connection, so that the smart watch 101 executes a corresponding operation based on the control instruction. For another example, the smart watch 101 may transmit monitoring data to the mobile phone 102 through the bluetooth connection, where the monitoring data may be acquired by the smart watch 101 for the monitored object.
The bluetooth protocol stack may be initialized after the smart watch 101 is powered on. Then, the smart watch 101 may establish a bluetooth connection with other electronic devices to receive control of applications in the other electronic devices. Specifically, as shown in fig. 7, the request processing method provided in the embodiment of the present application may include the following steps:
s401, the mobile phone 102 and the intelligent watch 101 establish an ACL link.
The process of establishing the ACL link between the mobile phone 102 and the smart watch 101 may refer to the description of the bluetooth connection process, which is not described herein again.
Taking the control interface 120 corresponding to the "smart watch" application shown in fig. 3 or the control interface 130 corresponding to the "sports health" application shown in fig. 3 as an example, the cell phone 102 may receive a trigger operation of the user on the "connect" control in the control interface 120 or the control interface 130. In response to a triggering operation of the "connect" control, the handset 102 begins initiating a page to establish an ACL link with the smart watch 101.
S402, the mobile phone 102 establishes a first SPP connection with the smart watch 101 through an ACL link based on a first application.
After the ACL link is established between the cell phone 102 and the smart watch 101, a service discovery SDP request may be sent to the smart watch 101 through the ACL link. The SDP request may be used to obtain connection parameters from smart watch 101 that correspond to support at least two applications that control smart watch 101. The connection parameters may include the channel number of the RFCOMM service corresponding to the application, the service class identifier, the handle, and the like. The at least two applications include the first application described above. Handset 102 may also initiate authentication and encryption requests to smart watch 101, performing authentication and key negotiations with smart watch 101 (this step is optional). Handset 102 may then request an L2CAP channel from the RFCOMM entity of smart watch 101. The handset 102 initiates an RFCOMM connection request to the smart watch 101 in an L2CAP channel, and establishes an RFCOMM session.
In the RFCOMM session, the cell phone 102 may initiate an SPP connection request to the smart watch 101 based on the connection parameter corresponding to the first application, and request to establish an SPP connection based on the first application (i.e., the first SPP connection in this embodiment of the present application) with the smart watch 101.
And S403, after the first SPP connection is established between the intelligent watch 101 and the mobile phone 102, acquiring and storing priority information of the first application.
Wherein the priority information of the first application is used to indicate a priority of the first application to control the smart watch 101, the first application being one of the at least two applications.
In some embodiments, corresponding priority identifiers may be preset for the at least two applications, respectively, and used for storing priority information of the applications. In the application scenario (1) described above, after establishing the first SPP connection with the cell phone 102, the smartwatch 101 may obtain and store the priority identifier of the first application, where the priority identifier of the first application is used as the priority information of the first application. Where the priority identification of the application may be stored in smart watch 101.
Further, in some embodiments, the priority identification may be set in conjunction with the number of applications that support controlling smart watch 101. For example, smart watch 101 supports two applications controlling smart watch 101, and may set the priority flag of one application a to 1 and the priority flag of the other application B to 2. Wherein, the order of the priority can be set as: priority identity =1 lower than priority identity = 2. Also for example, if smart watch 101 supports three applications to control smart watch 101, one of the applications C may have priority flag set to 1, application D may have priority flag set to 2, and application E may have priority flag set to 3. Wherein, the order of the priority can be set as: priority identity =1 lower than priority identity =2, priority identity =2 lower than priority identity = 3.
In the technical solution provided in the embodiment of the present application, the smart watch 101 supports more than two applications to control the smart watch 101. When the mobile phone 102 establishes a connection with the smart watch 101, different applications correspond to different connection parameters. In some embodiments, the connection parameter information corresponding to the application may also be used as the priority information of the application. The smart watch 101 obtains and saves priority information of the first application, including: the smart watch 101 acquires and stores connection parameter information corresponding to the first application, where the connection parameter information corresponding to the first application is used as priority information of the first application. The service class identifier, handle, or service channel number corresponding to the application may be set as the priority information of the application.
Specifically, the first SPP connection is established based on the first application, and the connection parameter of the first SPP connection is the connection parameter corresponding to the first application, so that the smart watch 101 may obtain the connection parameter corresponding to the first application according to the first SPP connection.
For example, in one particular embodiment, smart watch 101 supports two applications controlling smart watch 101, such as application a and application B. The application identifier corresponding to the application a is X1 and the handle is 1, and the application identifier corresponding to the application B is X2 and the handle is 2. In this embodiment, priority information (application priority for short) of an application may be set according to an application identifier, and specifically, a priority order may be set in advance according to the application identifier as follows: the application priority corresponding to the application identifier X1 is higher than the application priority corresponding to the application identifier X2. Or the application priority can be set as follows according to the handle: an application priority corresponding to an application with a handle of 1 is higher than an application priority corresponding to an application with a handle of 2. The priority order of the application of the two modes is as follows: application a has a higher priority than application B.
In other embodiments, for the application a and the application B, the application priority may also be set according to the application identifier as follows: the application priority corresponding to the application identifier X1 is lower than the application priority corresponding to the application identifier X2. The application priority may also be set according to the handle as: the application priority corresponding to the handle of 1 is lower than the application priority corresponding to the handle of 2. The priority order of the application of the two modes is as follows: application a has a lower priority than application B.
As another example, in another particular embodiment, smart watch 101 supports three applications controlling smart watch 101, such as application C, application D, and application E. Wherein, the application identifier corresponding to the application C is Y1, and the handle is 3; the application identifier corresponding to the application D is Y2, and the handle is 4; the application identifier Y3 and handle 5 correspond to application E. In this embodiment, the priority order may be set according to the application identifier as follows: (application priority of application identity Y1) < (application priority of application identity Y2) < (application priority of application identity Y3). Or the priority order can be set as follows according to the handle: (application priority of handle 3) < (application priority of handle 4) < (application priority of handle 5). The priority order of the application of the two modes is as follows: application C < application D < application E.
In other embodiments, for the applications C, D and E supporting three applications to control the smart watch 101, the priority order may also be set according to the application identifier: (application priority of application identification Y1) > (application priority of application identification Y2) > (application priority of application identification Y3). Or, the priority order is set as follows according to the handle: (application priority of application identification Y1) > (application priority of application identification Y2) > (application priority of application identification Y3). The priority order of the application of the two modes is as follows: application C > application D > application E.
It is understood that in other embodiments, the priority of the applications may be set to other orders according to the service class identifier of the application, the handle corresponding to the application, or the service channel number corresponding to the application.
In some embodiments, the cell phone 102 carries a service channel number corresponding to an application in a connection request sent to the smart watch 101 based on the application.
Further, in some embodiments, smart watch 101 obtains and saves priority information for the first application, including: the smart watch 101 analyzes the connection request based on the first application to obtain priority information of the first application, and stores the priority information obtained by the first application. Wherein the first application based connection request is for requesting control of smart watch 101 based on the first application.
If the information carried in the connection request based on the first application from the cell phone 102 includes the priority information of the first application, the smart watch 101 may directly analyze the connection request to obtain the priority information of the first application, and store the priority information of the first application. In a specific embodiment, the service channel number corresponding to the first application is used as the priority information of the first application, and since the connection request sent by the mobile phone 102 carries the service channel number corresponding to the first application, the priority information of the first application can be obtained by analyzing the connection request.
According to the technical scheme provided by the embodiment of the disclosure, the service channel number corresponding to the application supporting control of the first electronic device is used as the priority information of the application. Since the service channel number is a necessary connection parameter in the process of establishing the SPP connection between the second electronic device and the first electronic device, in the request processing method, it is not necessary to add other parameters as the priority of the application. The process of establishing the connection between the second electronic device and the first electronic device is consistent with the process of conventional connection, and the application installed in the second electronic device can also be a developed application without improvement, so that the application range of the request processing method is wider.
In other embodiments, if the connection request from the cell phone 102 does not include the priority information of the first application, the smartwatch 101 may obtain the connection parameter information of the first SPP connection, and then obtain and store the priority information of the first application according to the connection parameter information of the first SPP connection.
In some embodiments, taking the handle corresponding to the first application as the priority information of the first application as an example, since the connection request does not include the handle corresponding to the first application, the smart watch 101 needs to first obtain the connection parameter information corresponding to the first application. On this basis, the smart watch 101 may obtain and store a handle corresponding to the first application based on the connection parameter information corresponding to the first application, where the handle corresponding to the first application is used as priority information of the first application. Since the first SPP connection is established based on the first application, after establishing the first SPP connection with the cell phone 102, the smartwatch 101 may acquire the connection parameters of the first SPP connection through the first SPP connection, that is, the connection parameters corresponding to the first application.
As can be seen from the above embodiments, the smart watch 101 obtains the priority information of the first application through the connection parameters of the first SPP connection. Therefore, after the smart watch 101 successfully establishes the first SPP connection with the cell phone 102, the connection parameter corresponding to the first application is specifically obtained according to the first SPP connection, and the handle corresponding to the first application is obtained according to the connection parameter corresponding to the first application.
Further, after the smart watch 101 establishes the first SPP connection with the cell phone 102, the first service channel number corresponding to the first SPP connection may be acquired according to the first SPP connection, and the handle corresponding to the first application may be acquired based on the first service channel number. It should be understood that the first SPP connection is based on the SPP connection established by the first application, and therefore the service channel number corresponding to the first SPP connection is the service channel number corresponding to the first application. Alternatively, the smart watch 101 may also obtain the first service channel number corresponding to the first SPP connection by analyzing the connection request based on the first application, and then obtain the handle corresponding to the first application based on the first service channel number.
In some embodiments, the connection parameter information corresponding to the application may be pre-configured in the protocol stack of smart watch 101. In this embodiment, the smart watch 101 obtains the handle corresponding to the first application based on the service channel number corresponding to the first application, and specifically may be: the smart watch 101 acquires a handle corresponding to the first application from a protocol stack of the smart watch 101 based on the service channel number corresponding to the first application, where the handle corresponding to the first application is used as priority information of the first application. In this embodiment, the handle corresponding to the first application may be obtained according to the service channel number corresponding to the first application, because the service channel number, the service class identifier, and the handle corresponding to the first application are all stored in a one-to-one correspondence.
According to the technical scheme, the handle corresponding to the application supporting control of the first electronic device is used as the priority information of the application. Since the handle is a parameter that must be configured in advance in the first electronic device before the second electronic device establishes the SPP connection with the first electronic device, in the request processing method, it is not necessary to add other parameters as the priority of the application. For the second electronic device, the process of establishing a connection with the first electronic device is consistent with the process of conventional connection and does not need to be improved. The application installed in the second electronic device may also be a developed application, thereby widening the application range of the request processing method described above.
In other embodiments, taking the priority identifier according to the first application as the priority information of the first application as an example, because the connection request does not include the priority identifier of the first application, the smart watch 101 needs to first obtain the connection parameter information of the first SPP connection, and then obtain and store the priority identifier of the first application based on the connection parameter information of the first SPP connection, where the priority identifier of the first application is used as the priority information of the first application.
When the priority identifier of an application is used as the priority information of the application, the priority identifier of the application may be stored in the protocol stack of the smart watch 101. Therefore, the smart watch 101 obtains and stores the priority identifier of the first application based on the connection parameter information of the first SPP connection, which may specifically be: the smart watch 101 obtains and stores the priority identifier of the first application from the protocol stack of the smart watch 101 based on the connection parameter information of the first SPP connection.
According to the technical scheme provided by the embodiment of the disclosure, the corresponding priority identification is set for the application as the priority information of the application. The priority identification is stored in the protocol stack of smart watch 101. In the request processing method, for the second electronic device, the process of establishing connection with the first electronic device is consistent with the process of conventional connection, and no improvement is needed. The application installed in the second electronic device may also be a developed application, thereby widening the application range of the request processing method described above.
S404, the smartwatch 101 interacts with the cell phone based on the first application in the cell phone 102 through the first SPP connection.
In some possible embodiments, the smart watch 101 interacting with the cell phone 102 based on the first application comprises: data transmission is performed between the smart watch 101 and the mobile phone 102 through the first SPP connection. For example, when a user wears smart watch 101, smart watch 101 may monitor the user's body-related data (e.g., heart rate data, sleep data, exercise data, etc.). In this scenario, the smart watch 101 may upload the monitored data to the cell phone 102 through the first SPP connection. After receiving the data, the mobile phone 102 may display the data in the interface of the first application. For another example, when the smart watch 101 needs to perform firmware upgrade, the cell phone 102 may transmit upgrade packet data to the smart watch 101 through the first SPP connection. The smart watch 101 may perform firmware upgrade according to upgrade packet data when receiving the upgrade packet data from the cell phone 102.
In further embodiments, the smart watch 101 interacting with the cell phone 102 based on the first application may further include: the cell phone 102 controls the smart watch 101 based on the first application. Specifically, the cell phone 102 receives a control instruction triggered by the user through the interface of the first application, and forwards the control instruction to the smart watch 101 through the first SPP connection. When receiving the control instruction, the smart watch 101 executes a corresponding control event according to the control instruction. For example, in a scenario where the user wishes to set an alarm clock reminder in the smart watch 101, the cell phone 102 receives alarm clock information (such as alarm clock time, alarm clock repetition number, and the like) set by the user in the first application interface, and forwards the set alarm clock information to the smart watch 101 through the first SPP connection. When receiving the alarm clock information, the smart watch 101 executes a corresponding alarm clock setting event in the smart watch 101.
In other embodiments, the interaction between the smart watch 101 and the cell phone 102 may also be an interaction in other scenarios, which are not limited in the embodiments of the present application.
After the smart watch 101 establishes the first SPP connection with the cell phone 102 based on the first application, the user may also start a second application in the cell phone 102 and control the smart watch 101 through the second application. Specifically, the cell phone 102 receives the user's "sports health" by clicking on the home interface 110 as shown in FIG. 3. In response to the click operation, the cell phone 102 launches the second application. After the phone 102 initiates "sports fitness," the control interface 130 shown in fig. 3 may be entered.
S405, the mobile phone 102 receives a control operation of the user on the second application, where the control operation is used to trigger the mobile phone 102 to request to control the smart watch 101 through the second application.
Taking the control interface 130 shown in fig. 3 as an example, the cell phone 102 receives a click operation of a "connect" control of the "smart watch 1" in the control interface 130 by the user. In response to the click operation, the handset 102 may perform S406.
S406, the cell phone 102 sends a connection request to the smart watch 101. The connection request is for requesting control of the smart watch 101 by a second application in the handset 102.
Wherein the second application is one of the at least two applications. After receiving the control operation of the second application by the user, the cell phone 102 transmits a connection request to the smart watch 101 based on the second application. In particular the connection request is an SPP connection request.
In this embodiment, since the ACL link is already established between the cell phone 102 and the smart watch 101 before the user starts the second application, when the cell phone 102 receives the control operation of the user on the second application, the SPP connection request can be directly sent to the smart watch 101 through the already established ACL link according to the control operation.
S407, the smartwatch 101 receives a connection request from the cell phone 102.
Generally, after establishing the first SPP connection with the cell phone 102, when the smart watch 101 receives a connection request sent by another application (e.g., the second application), a new connection is established with the corresponding electronic device (e.g., the cell phone 102) in place of the first SPP connection in response to the connection request of the application.
However, if the smart watch 101 repeatedly receives connection requests sent based on different applications, the smart watch 101 may switch the connection back and forth between the different applications, which may cause a problem that data distribution is confusing or error occurs easily when data transmission is performed between the smart watch 101 and other electronic devices. In this embodiment of the application, after the smart watch 101 has established a connection with another electronic device, when receiving a connection request sent by another application, the smart watch does not directly accept a new connection request, but needs to determine whether to respond to the new connection request in combination with the application that has currently established the connection, and establishes a new connection based on the new connection request.
S408, the smartwatch 101 determines whether to establish a second SPP connection with the cell phone 102 based on the second application in response to the connection request according to the priority information of the first application.
As shown in FIG. 8, S408 may include S408a-S408 c:
s408a. the smart watch 101 determines whether the priority of the first application is the highest priority among the priorities of the at least two applications.
Specifically, after S408a, if the priority of the first application is the highest priority among the priorities of the at least two applications, it indicates that the priorities of the other applications (including the second application) are lower than the priority of the first application, and the other applications cannot preempt the first SPP connection that has been currently established between the first application and the handset 102 based on the first application. In this case, smart watch 101 may perform S408b ignoring the connection request described in S406-S407.
If the priority of the first application is not the highest priority among the priorities of the at least two applications, it indicates that the priorities of the other applications (including the second application) may be higher than the priority of the first application. In this case, smart watch 101 may then respond to the connection request described in S406-S407. Specifically, smart watch 101 may perform S408c.
S408b. the smart watch 101 ignores the connection request.
S408c. the smartwatch 101 responds to the connection request, and establishes a second SPP connection with the cell phone 102 based on the second application.
Specifically, S408c may further include: the smart watch 101 disconnects the first SPP connection, responds to the connection request, and establishes a second SPP connection with the cell phone 102 based on the second application.
In the above embodiment, when the smart watch 101 receives the connection request sent by the cell phone 102 based on the second application, since the smart watch 101 has already established the first SPP connection with the cell phone 102 based on the first application, it needs to determine whether to respond to the connection request, that is, whether to establish the SPP connection with the cell phone 102 based on the second application corresponding to the connection request. Further, in this embodiment, for a first application that has currently established an SPP connection, priority information of the first application is acquired, and in combination with the priority information of the first application, it is determined whether to respond to the connection request.
According to the technical scheme provided by the embodiment of the disclosure, for the case that the priority of the first application is not the highest priority of the at least two applications, the smart watch 101 responds to the connection request based on the second application, and establishes the second SPP connection with the cell phone 102 based on the second application. For the case where the priority of the first application is the highest priority of the at least two applications, smart watch 101 may ignore the connection request received later and maintain the first SPP connection. By the technical scheme, under the precondition that the first electronic equipment is controlled by a plurality of applications, the situation that the connection is switched back and forth between different applications cannot be easily caused when the first electronic equipment receives connection requests initiated by other electronic equipment based on different applications in sequence is ensured. Specifically, if the application currently establishing the SPP connection is one of all the supported applications with the highest priority, the SPP connection is not established by switching to another application, so that the situation of data distribution confusion or errors when the first electronic device and the second electronic device perform data communication is reduced.
The request processing method provided by the above embodiment is applied to the first electronic device, and the first electronic device supports more than two applications to control the first electronic device. By adopting the technical scheme, the priority information is respectively set for the plurality of applications supported by the first electronic device, and after the first electronic device successfully establishes the SPP connection with other electronic devices, the first electronic device stores the priority information of the application currently establishing the SPP connection. When the first electronic device receives a connection request sent by other applications again, the first electronic device determines whether to respond to the connection request received later or not by combining the priority information of the currently stored application. Therefore, the problem that the first electronic device switches back and forth among the plurality of applications to establish connection when connection requests initiated by other electronic devices based on different applications are received successively can be solved, and the problem of disordered data distribution or errors in the first electronic device is reduced.
In some embodiments, as shown in fig. 9, after S408c, the method further includes: and S409, the smart watch 101 acquires and stores the priority information of the second application.
Similarly to the priority information of the first application, the smart watch 101 may use connection parameter information corresponding to the second application as the priority information of the second application, or may use a priority identifier pre-configured in a protocol stack of the smart watch 101 as the priority information of the second application.
In some embodiments, obtaining priority information for the second application by smart watch 101 includes: the smart watch 101 obtains second connection parameter information corresponding to the second application, and obtains priority information of the second application based on the second connection parameter information.
Specifically, the smart watch 101 may obtain a second service channel number corresponding to the second SPP connection, and obtain priority information of the second application based on the second service channel number. Further, smart watch 101 may obtain priority information for the second application from a protocol stack of smart watch 101 based on the second service channel number.
As can be seen from the foregoing embodiments, the handle corresponding to the second application may be used as the priority information of the second application. Therefore, the smart watch 101 may obtain the priority information of the second application based on the second service channel number, specifically: the smart watch 101 acquires a handle corresponding to the second application based on the second service channel number, where the handle corresponding to the second application is used as priority information of the second application.
In other embodiments, the service class identifier or the service channel number corresponding to an application may also be used as the priority information of the application. Therefore, the obtaining, by the smart watch 101, the priority information of the second application based on the second service channel number may further be: the smart watch 101 stores the second service channel number as priority information of the second application, or the smart watch 101 obtains a service class identifier corresponding to the second application based on the second service channel number, and the service class identifier corresponding to the second application is used as the priority information of the second application.
Further, after the second SPP connection is successfully established between the smart watch 101 and the cell phone 102, the obtaining and saving of the priority information of the second application by the smart watch 101 may include S409 a: smart watch 101 replaces the priority information of the first application that was saved in smart watch 101 with the priority information of the second application. That is, smart watch 101 may delete the priority information of the first application. It is understood that smart watch 101 may only be able to maintain priority information for applications currently establishing SPP connections at the same time.
From the above embodiment, it can be seen that: the handle corresponding to an application is used as the priority information of the application. Therefore, the replacing, by the smart watch 101, the priority information of the first application stored in the smart watch 101 with the priority information of the second application may specifically be: and the smart watch 101 replaces the saved handle corresponding to the first application with the handle corresponding to the second application.
It should be noted that the process of obtaining the second service channel number corresponding to the second SPP connection and obtaining the handle corresponding to the second application based on the second service channel number by the smart watch 101 is similar to the process of obtaining the first service channel number corresponding to the first SPP connection and obtaining the handle corresponding to the first application based on the first service channel number, and is not described herein again.
According to the technical scheme provided by the embodiment of the disclosure, after the first electronic device establishes the second SPP connection with the second electronic device based on the second application, the first electronic device replaces the stored priority of the first application with the priority of the second application. According to the stored priority information of the second application, the current first electronic device is based on the connection established by the second application and the second electronic device. When the first electronic device receives the other connection request, it may be determined whether to respond to the other connection request in combination with the saved priority information of the second application. Only the priority information of the application of the currently established SPP connection is stored, and when the first electronic device receives the connection request, the priority of the application corresponding to the currently established SPP connection can be quickly judged, and whether the newly received connection request is responded or not is judged, so that the request processing efficiency is improved.
In other embodiments, smart watch 101 may not delete the priority information of the first application, but may directly save the priority information of the second application. In this embodiment, when the smart watch 101 and the cell phone 102 have established the second SPP connection, after receiving the SPP connection request based on another application (e.g., the first application), it may determine whether to respond to the SPP connection request according to the priority information corresponding to the application (i.e., the second application) corresponding to the second SPP connection.
In other embodiments, the request processing method provided in the embodiment of the present application is described in conjunction with the application scenario (2). Specifically, the description will be given by taking an example in which the first electronic device is the smart watch 101 in the application scenario (2), the second electronic device is the mobile phone 102 in the application scenario (2), and the third electronic device is the tablet computer 103 in the application scenario (2). Where smart watch 101 supports at least two applications (e.g., a first application and a second application) controlling smart watch 101. The mobile phone 102 installs one of the at least two applications (e.g., a first application), and the tablet computer 103 installs one of the at least two applications (e.g., a second application).
The smart watch 101, the mobile phone 102 and the tablet computer 103 may be connected to each other via bluetooth for communication. Data transmission can be performed between the smart watch 101 and the mobile phone 102 or the tablet computer 103 based on the bluetooth connection, or the mobile phone 102 or the tablet computer 103 can control the smart watch 101 based on the bluetooth connection.
After the smart watch 101 is powered on, the bluetooth protocol stack may be initialized. Then, the smart watch 101 may establish a bluetooth connection with other electronic devices to receive control of applications in the other electronic devices. Specifically, the request processing method provided in the embodiment of the present application may include steps 1 to 10, where:
step 1, the mobile phone 102 establishes an ACL link with the smart watch 101.
And 2, establishing a first SPP connection with the intelligent watch 101 by the mobile phone 102 through the ACL link based on the first application.
And step 3, after the first SPP connection is established between the intelligent watch 101 and the mobile phone 102, acquiring and storing the priority information of the first application.
And 4, the smart watch 101 interacts with the mobile phone based on the first application in the mobile phone 102 through the first SPP connection.
After the smart watch 101 establishes the first SPP connection with the cell phone 102 based on the first application, the user may also start a second application in the tablet computer 103 and control the smart watch 101 via the tablet computer 103 based on the second application.
And 5, establishing an ACL link between the tablet computer 103 and the intelligent watch 101.
And 6, the tablet computer 103 receives a control operation of the user on the second application, wherein the control operation is used for triggering the tablet computer 103 to request to control the smart watch 101 through the second application.
And 7, the tablet computer 103 sends a connection request to the smart watch 101. The connection request is for requesting control of smart watch 101 by a second application in tablet computer 103.
Step 8, the smart watch 101 receives a connection request from the tablet computer 103; the connection request is for requesting control of smart watch 101 by a second application in tablet computer 103.
And 9, the smart watch 101 determines whether to respond to the connection request to establish a second SPP connection with the tablet computer 103 based on a second application according to the priority information of the first application.
Specifically, step 9 may include: if the priority of the first application is the highest priority of the at least two applications, smart watch 101 ignores the connection request from tablet computer 103. If the priority of the first application is not the highest priority of the at least two applications, smart watch 101 responds to the connection request from tablet computer 103 to establish a second SPP connection with tablet computer 103 based on the second application. As can be appreciated, after establishing the second SPP connection between smart watch 101 and tablet computer 103, smart watch 101 and tablet computer 103 interact based on the second application.
Further, after establishing the second SPP connection between the smart watch 101 and the tablet computer 103, the smart watch 101 also obtains and saves the priority information of the second application. In some embodiments, smart watch 101 obtains priority information for the second application and replaces the priority information for the first application with the priority information for the second application.
It can be understood that, the processes of establishing the ACL link and the SPP connection between the tablet pc 103 and the smart watch 101, and acquiring the priority information of the second application by the smart watch 101 are similar to the processes of establishing the ACL link and the SPP connection between the mobile phone 102 and the smart watch 101, and acquiring the priority information of the first application by the smart watch 101 in the above embodiment, and are not described herein again.
In this embodiment, when the smart watch 101 receives the connection request from the tablet computer 103, since the smart watch 101 has already established the first SPP connection with the mobile phone 102 based on the first application, it needs to determine whether to respond to the connection request, that is, whether to establish the SPP connection with the tablet computer 103 based on the second application corresponding to the connection request. Further, in this embodiment, for a first application that has currently established an SPP connection, priority information of the first application is obtained, and in combination with the priority information of the first application, it is determined whether to respond to the connection request, and a second SPP connection is established with the tablet computer 103 based on a second application.
According to the technical scheme provided by the embodiment of the disclosure, the second electronic device and the third electronic device are different devices, different applications are respectively installed in the second electronic device and the third electronic device, and the different applications all support control of the first electronic device. After connection is established with the second electronic device based on the first application, the first electronic device acquires and saves priority information of the first application. When the first electronic device receives a connection request based on the second application from the third electronic device, the first electronic device also determines whether to respond to the connection request from the third electronic device and establish the SPP connection with the third electronic device in combination with the priority information of the first application. By storing the application priority corresponding to the currently established SPP connection, the first electronic device is prevented from switching the connection back and forth between different applications, and the possibility of data distribution confusion or errors of the first electronic device is reduced.
In some embodiments, the priority information supporting at least two applications controlling smart watch 101 is pre-set in a protocol stack of smart watch 101. In particular, priority information for at least two applications may be stored in the SPP protocol of the protocol stack of smart watch 101.
In some embodiments, the SPP protocol of smart watch 101 is factory configured, i.e., the priority information for at least two applications is factory configured. When the smart watch 101 establishes a connection with another electronic device, the application priority information in the SPP protocol may be directly obtained and read from a preset storage path of the smart watch 101.
In other embodiments, the priority information of at least two applications may also be customized according to a user instruction after factory shipment. In this embodiment, the smart watch 101 displays a priority setting interface for setting priority information of at least two applications. The smart watch 101 receives the priority information set by the user on the priority setting interface, and stores the set priority information.
The smart watch 101 stores the set priority information in a protocol stack of the smart watch 101. Specifically, smart watch 101 may store the priority information set by the user at the priority setting interface in the SPP protocol of the smart watch protocol stack.
Further, in some embodiments, after storing the priority information set by the user on the priority setting interface to the SPP protocol of the protocol stack, the request processing method further includes: smart watch 101 initializes the SPP protocol. In this embodiment, after modifying the priority information applied in the SPP protocol according to the instruction of the user, the smart watch 101 needs to reinitialize the SPP protocol so as to validate the application of the modified priority information.
In some embodiments, a schematic view of a priority setting interface provided in an embodiment of the present application is shown in fig. 10. The priority of the first application is set low and the priority of the second application is set high in the interface shown in fig. 10. It is to be understood that the priority of the first application is lower than the priority of the second application as the priority setting shown in fig. 10. At this interface, smart watch 101 may also receive an operation by the user, setting the priority of the first application to be higher than the priority of the second application.
According to the technical scheme provided by the embodiment of the disclosure, for at least two applications supporting control of the first electronic device, respective priorities of the applications can be set according to user definition, so that a user can conveniently select the application preferentially connected with the first electronic device. In the case of an established SPP connection, a new connection request based on other applications is received and the first electronic device will determine whether to respond to the new connection request in conjunction with the application priority of the established SPP connection. The first electronic device ignores the new connection request if the application priority of the currently established SPP connection is the highest priority of the at least two applications. And if the application priority of the currently established SPP connection is not the highest priority of the at least two applications, the first electronic equipment responds to the new connection request, disconnects the previously established SPP connection and establishes a new connection. The first electronic equipment is prevented from switching connection back and forth among different applications, and the condition of disordered data distribution or error of the first electronic equipment is reduced.
In some embodiments, the first application and the second application are system applications installed in the mobile phone 102 and/or the tablet computer 103. The system application is usually a built-in application when the electronic device leaves a factory, and a user can also install the system application according to requirements.
Further, in some embodiments, a third party application in the cell phone 102 and/or tablet computer 103 may communicate data with the smart watch 101 through the system application. The third-party application generally refers to an application downloaded and installed after the electronic device leaves a factory; the third party application may also send data to smart watch 101. The process of sending data to the smart watch 101 by the third-party application in the mobile phone 102 and/or the tablet computer 103 includes: after the first electronic device establishes a first SPP connection with the second electronic device based on the first application, the third-party application sends first data to the first application, and the first application forwards the first data to the first electronic device through the first SPP connection. It will be appreciated that the first application referred to in the above process may be replaced by a second application.
Other embodiments of the present application provide an electronic device that is the first electronic device (e.g., smart watch 101) described above, wherein the first electronic device supports at least two applications to control the first electronic device. The first electronic device may include: a memory, a bluetooth module, and one or more processors. The memory, bluetooth module and processor are coupled. The Bluetooth module is used for short-distance communication with other electronic equipment. The memory is used for storing priority information of an application controlling the first electronic equipment; the memory is also used to store computer program code, which includes computer instructions. When the processor executes the computer instructions, the first electronic device may perform the various functions or steps performed by smart watch 101 in the above-described method embodiments. The structure of the first electronic device may refer to the structure of the smart watch 200 shown in fig. 4.
In some embodiments, the first electronic device is a smart wearable device.
The embodiment of the present application further provides a chip system, as shown in fig. 11, the chip system 60 includes at least one processor 601 and at least one interface circuit 602. The processor 601 and the interface circuit 602 may be interconnected by wires. For example, the interface circuit 602 may be used to receive signals from other devices (e.g., a memory of an electronic device). As another example, the interface circuit 602 may be used to send signals to other devices, such as the processor 601. Illustratively, the interface circuit 602 may read instructions stored in the memory and send the instructions to the processor 601. The instructions, when executed by the processor 601, may cause the electronic device to perform the various steps in the embodiments described above. Of course, the chip system may further include other discrete devices, which is not specifically limited in this embodiment of the present application.
Embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium includes computer instructions, and when the computer instructions are executed on the first electronic device (e.g., the smart watch 101), the first electronic device is caused to perform the functions or steps performed by the smart watch 101 in the above method embodiments.
The embodiment of the present application further provides a computer program product, which when running on a computer, causes the computer to execute each function or step performed by the smart watch 101 in the above method embodiments. The computer may be a first electronic device, such as smart watch 101.
Through the description of the above embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are 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 unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A request processing method applied to a first electronic device, wherein the first electronic device supports at least two applications to control the first electronic device, the method comprising:
after the first electronic device and a second electronic device establish an asynchronous connection-oriented ACL link, establishing a first serial port configuration file (SPP) connection based on a first application in the second electronic device and the second electronic device, and acquiring and storing priority information of the first application, wherein the priority information of the first application is used for indicating the first application to control the priority of the first electronic device, and the first application is one of the at least two applications;
the first electronic device receiving a connection request from the second electronic device; wherein the connection request is for requesting control of the first electronic device by a second application in the second electronic device, the second application being one of the at least two applications;
and the first electronic equipment determines whether to respond to the connection request and establish a second SPP connection with the second electronic equipment based on the second application according to the priority information of the first application.
2. The method of claim 1, wherein the first electronic device determining whether to establish a second SPP connection with the second electronic device based on the second application in response to the connection request according to priority information of the first application, comprises:
if the priority of the first application is the highest priority of the priorities of the at least two applications, the first electronic device ignores the connection request;
and if the priority of the first application is not the highest priority of the priorities of the at least two applications, the first electronic equipment responds to the connection request and establishes the second SPP connection with the second electronic equipment based on the second application.
3. The method of claim 2, wherein the first electronic device establishing the second SPP connection with the second electronic device based on the second application in response to the connection request comprises:
and the first electronic equipment disconnects the first SPP connection, responds to the connection request, and establishes the second SPP connection with the second electronic equipment based on the second application.
4. The method according to any one of claims 1-3, wherein the obtaining and saving priority information for the first application comprises:
acquiring connection parameters of the first SPP connection;
and acquiring and storing the priority information of the first application based on the connection parameters of the first SPP connection.
5. The method of claim 4, wherein:
the obtaining of the connection parameter of the first SPP connection includes: acquiring a first service channel number corresponding to the first SPP connection;
the acquiring and storing the priority information of the first application based on the connection parameters of the first SPP connection includes: acquiring and storing a handle corresponding to the first application based on the first service channel number; and the handle corresponding to the first application is used as priority information of the first application.
6. The method of claim 5, further comprising:
after the first electronic device successfully establishes the second SPP connection, acquiring a second service channel number corresponding to the second SPP connection;
acquiring a handle corresponding to the second application based on the second service channel number, and replacing the saved handle corresponding to the first application with the handle corresponding to the second application; and the handle corresponding to the second application is used as the priority information of the second application.
7. The method according to any one of claims 1-3, further comprising:
the first electronic equipment displays a priority setting interface, and the priority setting interface is used for setting priority information of the at least two applications;
and the first electronic equipment receives the priority information set by the user on the priority setting interface and stores the set priority information.
8. An electronic device, wherein the electronic device is a first electronic device that supports at least two applications controlling the first electronic device, the first electronic device comprising: a memory, a bluetooth module, one or more processors; the memory, the Bluetooth module and the processor are coupled;
wherein the bluetooth module is for communicating with a second electronic device, the memory is for holding priority information for an application controlling the first electronic device, the memory has stored therein computer program code comprising computer instructions which, when executed by the processor, cause the first electronic device to perform the method of any of claims 1 to 7.
9. The electronic device of claim 8, wherein the electronic device is a smart wearable device.
10. A computer-readable storage medium having stored therein instructions which, when executed in the computer, cause the computer to perform the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210203279.8A CN114340021B (en) | 2022-03-03 | 2022-03-03 | Request processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210203279.8A CN114340021B (en) | 2022-03-03 | 2022-03-03 | Request processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114340021A true CN114340021A (en) | 2022-04-12 |
CN114340021B CN114340021B (en) | 2022-08-12 |
Family
ID=81031551
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210203279.8A Active CN114340021B (en) | 2022-03-03 | 2022-03-03 | Request processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114340021B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1633787A (en) * | 2002-08-23 | 2005-06-29 | 松下电器产业株式会社 | Wireless communication system |
CN105407225A (en) * | 2015-11-27 | 2016-03-16 | 青岛海信信芯科技有限公司 | Data transmission method and Bluetooth equipment |
US20170017451A1 (en) * | 2015-07-17 | 2017-01-19 | Samsung Electronics Co., Ltd. | Method and system for managing applications running on smart device using a wearable device |
CN111935801A (en) * | 2020-07-16 | 2020-11-13 | 中国联合网络通信集团有限公司 | Voice access method, system, terminal device and computer readable storage medium |
CN112748972A (en) * | 2019-10-31 | 2021-05-04 | 华为技术有限公司 | Multitask interface management method and electronic equipment |
CN113806030A (en) * | 2020-07-24 | 2021-12-17 | 荣耀终端有限公司 | Application scheduling method and electronic equipment |
-
2022
- 2022-03-03 CN CN202210203279.8A patent/CN114340021B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1633787A (en) * | 2002-08-23 | 2005-06-29 | 松下电器产业株式会社 | Wireless communication system |
US20170017451A1 (en) * | 2015-07-17 | 2017-01-19 | Samsung Electronics Co., Ltd. | Method and system for managing applications running on smart device using a wearable device |
CN105407225A (en) * | 2015-11-27 | 2016-03-16 | 青岛海信信芯科技有限公司 | Data transmission method and Bluetooth equipment |
CN112748972A (en) * | 2019-10-31 | 2021-05-04 | 华为技术有限公司 | Multitask interface management method and electronic equipment |
CN111935801A (en) * | 2020-07-16 | 2020-11-13 | 中国联合网络通信集团有限公司 | Voice access method, system, terminal device and computer readable storage medium |
CN113806030A (en) * | 2020-07-24 | 2021-12-17 | 荣耀终端有限公司 | Application scheduling method and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN114340021B (en) | 2022-08-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11307733B2 (en) | Always on display method and electronic device | |
US11985374B2 (en) | Method of controlling the sharing of videos and electronic device adapted thereto | |
KR102092063B1 (en) | Method And Apparatus For Performing Communication Service | |
CN111083684B (en) | Method for controlling electronic equipment and electronic equipment | |
CN109683847A (en) | A kind of volume adjusting method and terminal | |
CN108093307B (en) | Method and system for acquiring playing file | |
JP7403648B2 (en) | Synchronization method and electronic equipment | |
WO2019000411A1 (en) | Method and device for establishing wireless communication connection | |
KR102516019B1 (en) | Electronic apparatus and method for communicating with an external electronic device | |
WO2018120905A1 (en) | Message reminding method for terminal, and terminal | |
CN110832888A (en) | Method for automatically switching SIM (subscriber identity Module) cards and electronic device | |
JP2023503691A (en) | Application sharing method, electronic device and computer readable storage medium | |
KR20150125464A (en) | Method for displaying message and electronic device | |
CN115623257A (en) | Screen projection display method, system, terminal device and storage medium | |
US11323880B2 (en) | Method for wireless connection and electronic device therefor | |
KR20160052105A (en) | Method for transmitting and receiving data and Electronic device using the same | |
CN113238868A (en) | Task processing method, device, server, equipment, system and storage medium | |
KR102308289B1 (en) | Device for connecting external device and updating data | |
CN107770449B (en) | Continuous shooting method, electronic device and storage medium | |
CN109658926B (en) | Voice instruction updating method and mobile terminal | |
JP2022522658A (en) | Systems, methods, computer programs, mobile devices, and kits for operating low-computational devices | |
CN114340021B (en) | Request processing method and device | |
CN111327756A (en) | Operation guiding method of terminal and terminal | |
US10397390B2 (en) | Communication event transfer method and apparatus, communication event processing method and apparatus, and terminal | |
CN111726848A (en) | Equipment binding method, target starting device, fixed terminal and 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 |