Connection control method of a handwriting pen and electronic device

By automatically connecting and controlling the stylus wirelessly with electronic devices, the problem of cumbersome stylus operation is solved, and the user experience is improved.

CN115407885BActive Publication Date: 2026-06-23HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2021-05-26
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, users need to manually manage the connection and disconnection of the stylus with multiple electronic devices, which makes the operation process cumbersome and reduces the user experience.

Method used

Electronic devices automatically respond to screen mirroring requests or disconnect commands, enabling wireless connection and disconnection with the stylus, reducing manual operation by the user.

Benefits of technology

The automated wireless connection control simplifies the user operation process and improves the user experience of using the stylus.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115407885B_ABST
    Figure CN115407885B_ABST
Patent Text Reader

Abstract

A connection control method of a handwriting pen and an electronic device are provided. The method is applied to a first electronic device, and a handwriting pen establishes a first wireless connection with a second electronic device, and the first wireless connection is used to implement general service data transmission. The method comprises: the first electronic device receiving a screen projection request sent by the second electronic device; the first electronic device displaying a screen projection interface of the second electronic device in response to the screen projection request; and the first electronic device automatically establishing the first wireless connection with the handwriting pen. The technical solution provided in the present application does not require the user to manually manage the connection between the first electronic device and the handwriting pen, reduces the operation process when the user uses the handwriting pen, and thus improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This invention relates to the field of terminal technology, and more specifically to a method for controlling the connection of a stylus and an electronic device. [Background Technology]

[0002] With the development of touch technology, more and more electronic devices are realizing human-computer interaction functions through touch. In addition to using their fingers to operate electronic devices, users can also use styluses. Typically, a user has only one stylus but owns multiple electronic devices with touchscreens, such as mobile phones and tablets. A single stylus can connect to one electronic device or connect to multiple electronic devices simultaneously.

[0003] When a stylus is first used with an electronic device, it must be paired. Only after successful pairing can the user use the stylus normally on the electronic device. Currently, users must manually pair the stylus with the electronic device. If the stylus is used in various screen mirroring scenarios, users need to manually manage the connection and disconnection of the stylus, making the operation cumbersome and increasing the user's operating process, thus reducing the user experience. [Summary of the Invention]

[0004] In view of this, the present invention provides a method for controlling the connection of a stylus and an electronic device, which reduces the user's operation process when using a stylus and improves the user experience.

[0005] A first aspect provides a connection control method for a stylus, the method being applied to a first electronic device, wherein the stylus establishes a first wireless connection with a second electronic device, the first wireless connection being used to realize general business data transmission; the method includes: the first electronic device receiving a screen projection request sent by the second electronic device; the first electronic device responding to the screen projection request by displaying the screen projection interface of the second electronic device; and the first electronic device automatically establishing the first wireless connection with the stylus.

[0006] In one possible implementation, before the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes:

[0007] If the first electronic device is not paired with the stylus, the first electronic device first performs pairing with the stylus, and then performs the establishment of the first wireless connection with the stylus; and / or, if the first electronic device is paired with the stylus, it directly performs the establishment of the first wireless connection between the first electronic device and the stylus.

[0008] In one possible implementation, after the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: the first electronic device recording wireless connection establishment information, wherein the wireless connection establishment information is used to indicate that the first wireless connection between itself and the stylus was established by being triggered by a screen projection operation.

[0009] In one possible implementation, the first electronic device automatically establishes the first wireless connection with the stylus, including: the first electronic device establishing the first wireless connection with the stylus based on the physical address of the stylus obtained from the second electronic device during the screen projection operation.

[0010] In one possible implementation, the screen projection request includes the physical address of the stylus.

[0011] In one possible implementation, after the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: the first electronic device receiving a screen mirroring disconnect command sent by the second electronic device; the first electronic device responding to the screen mirroring disconnect command stopping the display of the screen mirroring interface of the second electronic device; and the first electronic device automatically disconnecting the first wireless connection with the stylus after determining that its first wireless connection with the stylus was established by triggering the screen mirroring operation.

[0012] In one possible implementation, the step of determining that the first wireless connection between the electronic device and the stylus was established by triggering a screen projection operation includes: the first electronic device determining, based on recorded wireless connection establishment information, that the first wireless connection between the electronic device and the stylus was established by triggering a screen projection operation.

[0013] In one possible implementation, automatically disconnecting the first wireless connection from the stylus includes: the first electronic device automatically disconnecting the first wireless connection from the stylus based on the physical address of the stylus obtained from the second electronic device during the screen mirroring disconnection process.

[0014] In one possible implementation, the screen mirroring disconnect instruction includes the physical address of the stylus.

[0015] In one possible implementation, the stylus establishes a second wireless connection with the second electronic device, the second wireless connection being used to realize human-computer interaction business data transmission;

[0016] After the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: after the stylus disconnects from the second electronic device, the first electronic device automatically establishes the second wireless connection with the stylus.

[0017] In one possible implementation, the first wireless connection is a GATT (General Attribute Protocol) connection.

[0018] In one possible implementation, the second wireless connection is a GATT-based Human-Machine Interface Protocol (HOGP) connection.

[0019] A second aspect provides a connection control method for a stylus, the method being applied to a first electronic device, wherein the stylus establishes a first wireless connection with a second electronic device, the first wireless connection being used to realize general business data transmission; the method includes: the first electronic device sending a screen projection request to the second electronic device to display its own screen projection interface on the second electronic device; the first electronic device receiving a screen projection success message returned by the second electronic device; and the first electronic device automatically establishing the first wireless connection with the stylus.

[0020] In one possible implementation, before the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: if the first electronic device is not paired with the stylus, the first electronic device first performs pairing with the stylus, and then performs the establishment of the first wireless connection with the stylus; and / or, if the first electronic device is already paired with the stylus, it directly performs the establishment of the first wireless connection between the first electronic device and the stylus.

[0021] In one possible implementation, after the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: the first electronic device recording wireless connection establishment information, wherein the wireless connection establishment information is used to indicate that the first wireless connection between itself and the stylus was established by being triggered by a screen projection operation.

[0022] In one possible implementation, the first electronic device automatically establishes the first wireless connection with the stylus, including: the first electronic device automatically establishes the first wireless connection with the stylus based on the physical address of the stylus obtained from the second electronic device during the screen projection operation.

[0023] In one possible implementation, the screen mirroring success message includes the physical address of the stylus.

[0024] In one possible implementation, after the first electronic device automatically establishes the first wireless connection with the stylus, the method further includes: the first electronic device sending a screen mirroring disconnect command to the second electronic device to stop its own screen mirroring interface from being displayed on the second electronic device; the first electronic device receiving a screen mirroring disconnect success message returned by the second electronic device; and the first electronic device determining that its first wireless connection with the stylus was established by triggering the screen mirroring operation, and automatically disconnecting the first wireless connection with the stylus.

[0025] In one possible implementation, the query to establish the first wireless connection between the stylus and itself is triggered by a screen projection operation, including:

[0026] The first electronic device determines, based on the recorded wireless connection establishment information, that its first wireless connection with the stylus was established by the screen projection operation.

[0027] In one possible implementation, automatically disconnecting the first wireless connection from the stylus includes: the first electronic device automatically disconnecting the first wireless connection from the stylus based on the physical address of the stylus obtained from the second electronic device during the screen mirroring disconnection process.

[0028] In one possible implementation, the screen mirroring disconnection success message includes the physical address of the stylus.

[0029] In one possible implementation, the stylus establishes a second wireless connection with the second electronic device, the second wireless connection being used to realize human-computer interaction business data transmission;

[0030] After the first electronic device establishes the first wireless connection with the stylus, the method further includes: after the stylus disconnects from the second electronic device, the first electronic device automatically establishes the second wireless connection with the stylus.

[0031] In one possible implementation, the first wireless connection is a GATT connection.

[0032] In one possible implementation, the second wireless connection is an HOGP connection.

[0033] The third aspect provides a first electronic device in which a stylus establishes a first wireless connection with a second electronic device, the first wireless connection being used to realize general business data transmission;

[0034] The first electronic device includes: a display screen; one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the first electronic device, cause the first electronic device to perform the stylus connection control method in the first aspect or any possible implementation of the first aspect.

[0035] The fourth aspect provides a first electronic device in which a stylus establishes a first wireless connection with a second electronic device, the first wireless connection being used to realize general business data transmission;

[0036] The first electronic device includes: a display screen; one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the first electronic device, cause the first electronic device to perform the stylus connection control method in the second aspect or any possible implementation of the second aspect.

[0037] The fifth aspect provides a computer-readable storage medium comprising a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform a stylus connection control method in the first aspect or any possible implementation thereof, or when the program is executed, it controls the device on which the computer-readable storage medium is located to perform a stylus connection control method in the second aspect or any possible implementation thereof.

[0038] The sixth aspect provides a computer program product containing instructions that, when the computer program product is run on a computer or any at least one processor, cause the computer to execute the stylus connection control method of the first aspect or any possible implementation thereof, or cause the computer to execute the stylus connection control method of the second aspect or any possible implementation thereof.

[0039] In the technical solution provided by the embodiments of the present invention, the stylus establishes a first wireless connection with the second electronic device. In response to the screen projection request sent by the second electronic device, the first electronic device displays the screen projection interface of the second electronic device. Then, the first electronic device automatically establishes a first wireless connection with the stylus, eliminating the need for the user to manually manage the connection between the first electronic device and the stylus, thereby reducing the user's operation process when using the stylus and improving the user experience. [Attached Image Description]

[0040] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 These are schematic diagrams of the stylus communication system in some embodiments;

[0042] Figure 2 These are schematic diagrams of the hardware structure of electronic devices in some embodiments;

[0043] Figure 3 These are software structure block diagrams of a stylus and an electronic device in some embodiments;

[0044] Figure 4 These are schematic diagrams of screen projection in some embodiments;

[0045] Figures 5a to 5d These are schematic diagrams illustrating the establishment of a first wireless connection and a second wireless connection between a stylus and an electronic device in some embodiments;

[0046] Figure 5e These are schematic diagrams illustrating the disconnection of the stylus from the electronic device in some embodiments;

[0047] Figure 6a These are flowcharts of handwriting pen connection control methods in some embodiments;

[0048] Figure 6b This is a flowchart of a method for pairing a first electronic device with a stylus and establishing a first wireless connection in some embodiments;

[0049] Figure 6c This is a flowchart of a stylus connection control method in some other embodiments;

[0050] Figure 6d These are schematic diagrams illustrating the method for establishing a HOGP connection between a stylus and an electronic device in some embodiments;

[0051] Figure 7a This is a flowchart of a stylus connection control method in some other embodiments;

[0052] Figure 7b This is a flowchart of a stylus connection control method in some other embodiments;

[0053] Figures 8a to 8d This is a schematic diagram of establishing a first wireless connection and a second wireless connection between the stylus and the electronic device in some other embodiments;

[0054] Figure 8eThis is a schematic diagram of the stylus disconnecting from the electronic device in some other embodiments;

[0055] Figure 9a This is a flowchart of a stylus connection control method in some other embodiments;

[0056] Figure 9b This is a flowchart of a stylus connection control method in some other embodiments;

[0057] Figure 10a This is a flowchart of a stylus connection control method in some other embodiments;

[0058] Figure 10b This is a flowchart of a stylus connection control method in some other embodiments.

Detailed Implementation Methods

[0059] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0060] It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0061] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0062] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0063] Figure 1 These are schematic diagrams of the stylus communication system in some embodiments, such as... Figure 1 As shown, the system includes a stylus 200 and at least two electronic devices. The stylus 200 can be paired with each electronic device, and the stylus 200 can maintain a primary wireless connection with multiple electronic devices simultaneously. In some embodiments, the stylus 200 and the electronic devices can be paired via Bluetooth (BT), Near Field Communication (NFC), or a USB-C interface.

[0064] For example, Figure 1 The text uses four electronic devices as an example for description: mobile phone 100a, laptop 100b, tablet computer 100c, and mobile phone 100d. Figure 1 This demonstrates an application scenario for "one stylus connecting to multiple devices." This technology refers to the ability of a single stylus 200 to maintain a connection with multiple electronic devices simultaneously and freely switch between them. The stylus 200 and the electronic devices can adhere to any appropriate standard, such as the Huawei Pen Protocol (HPP) 3.x. HPP 3.x is a converged protocol that includes compatibility solutions with HPP 2.x.

[0065] The electronic device is a device equipped with a touch screen. In some embodiments, the electronic device includes, but is not limited to, devices equipped with... Or devices with other operating systems. Electronic devices include, but are not limited to, mobile phones, tablets, laptops, desktop computers, smart screens, etc. Figure 1 As shown, the stylus 200 maintains a primary wireless connection with mobile phone 100a, laptop 100b, tablet 100c, and mobile phone 100d simultaneously, and can freely switch between these devices.

[0066] The stylus may include an active stylus or a passive stylus. In this embodiment of the invention, the stylus 200 may be an active stylus. In some embodiments, the active stylus is an active capacitive stylus, which can emit a voltage driving signal to change the electric field at the touch point of the touch screen, thereby changing the electrode capacitance at the touch point. The control chip of the touch screen can determine the position of the touch point by detecting the change in electrode capacitance. In other embodiments, the active stylus may also be an active electromagnetic stylus, which can emit an electromagnetic driving signal to change the magnetic flux at the touch point of the touch screen. The control chip of the touch screen can determine the position of the touch point by the change in magnetic flux. In addition, to achieve a natural writing effect, an active stylus typically incorporates a pressure sensor at the tip, which allows for different pen strokes under different pressures to simulate real human handwriting.

[0067] For example, such as Figure 2 As shown, a method is provided. Figure 1 A schematic diagram of the hardware structure of an electronic device. Figure 1 The mobile phone 100a, laptop 100b, tablet 100c, and mobile phone 100d can all adopt this technology. Figure 2 The hardware structure of electronic devices in China. For example... Figure 2 As shown, electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on electronic device 100. In other embodiments of the present invention, electronic device 100 may include more or fewer components than illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0068] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). Different processing units may be independent devices or integrated into one or more processors. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. Processor 110 may also include memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that processor 110 has just used or that is used repeatedly. If processor 110 needs to reuse an instruction or data, it can directly retrieve it from the memory. This avoids repeated access, reduces the waiting time of processor 110, and thus improves system efficiency.

[0069] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include inter-integrated circuit (I2C) interfaces, inter-integrated circuit sound (I2S) interfaces, pulse code modulation (PCM) interfaces, universal asynchronous receiver / transmitter (UART) interfaces, mobile industry processor interfaces (MIPI), general-purpose input / output (GPIO) interfaces, subscriber identity module (SIM) interfaces, and / or universal serial bus (USB) interfaces, etc. It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation of the electronic device 100. In other embodiments of the present invention, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0070] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.

[0071] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0072] The wireless communication function of electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0073] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G / 6G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device. The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0074] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0075] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), 5G and subsequent evolution standards, BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0076] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU performs mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute instructions to generate or modify display information. Electronic device 101 implements shooting functions through an ISP, one or more cameras 193, a video codec, a GPU, one or more displays 194, and an application processor.

[0077] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0078] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.

[0079] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0080] The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc. The touch sensor 180K is also referred to as a "touch device." The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 constitute a touchscreen, also referred to as a "touch screen." The touch sensor 180K is used to detect touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100, in a different location than the display screen 194.

[0081] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0082] For example, such as Figure 3 The diagram shows a software architecture block diagram of a stylus 200 and an electronic device 100. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces.

[0083] In some embodiments, the electronic device 100 system is divided into three layers, from top to bottom: the application layer, the service layer, and the driver layer. For example... Figure 3 As shown, the application layer can include a series of application packages, including collaborative office applications and screen mirroring applications; the service layer can include stylus management services, screen mirroring management services, and near-field communication (NFC) management services; the driver layer can include touch panel (TP) drivers, human interface device (HID) drivers, and NFC drivers. For example, NFC management services can include Bluetooth management services, NFC management services, and Wi-Fi management services; NFC drivers can include Bluetooth drivers, NFC drivers, and Wi-Fi drivers.

[0084] In some embodiments, the stylus 200 system is divided into three layers, from top to bottom: the application layer, the service layer, and the driver layer. For example... Figure 3 As shown, the application layer may include a series of application packages, and the application layer may include a host-side communication agent; the service layer may include touch management and connection management; and the driver layer may include pen driver.

[0085] In some embodiments, the stylus 200 includes, but is not limited to, a device equipped with Or devices with other operating systems. For example, the stylus 200 is equipped with... For example, the HarmonyOS lightweight system is used in 100 electronic devices.

[0086] Currently, when a user owns multiple electronic devices 100, in addition to using a stylus 200 to perform touch operations on the multiple electronic devices 100, screen mirroring can also be performed between the multiple electronic devices 100. In some embodiments, the source device can mirror the screen interface to the sink device via wired or wireless means, wherein the source device is the central device for screen mirroring, and the sink device is the device whose screen is being mirrored.

[0087] In some embodiments, the source device is a first electronic device and the destination device is a second electronic device, in which case the first electronic device projects its screen to the second electronic device. In other embodiments, the source device is a second electronic device and the destination device is a first electronic device, in which case the second electronic device projects its screen to the first electronic device. Both the first electronic device and the second electronic device can employ the methods described above. Figure 2 The hardware structure of the electronic device 100 shown herein, and both the first electronic device and the second electronic device can adopt the above-described hardware structure. Figure 3 The software structure of the electronic device 100 shown will not be described in detail here.

[0088] For example, when the first electronic device is a mobile phone and the second electronic device is a tablet computer, or when the second electronic device is a mobile phone and the first electronic device is a tablet computer, the mobile phone projects its screen onto the tablet computer to display the content displayed on the mobile phone's screen. Alternatively, when the first electronic device is a mobile phone and the second electronic device is a laptop computer, or when the second electronic device is a mobile phone and the first electronic device is a laptop computer, the mobile phone projects its screen onto the laptop computer to display the content displayed on the mobile phone's screen; or when the first electronic device is a tablet computer and the second electronic device is a laptop computer, or when the second electronic device is a tablet computer and the first electronic device is a laptop computer, the tablet computer projects its screen onto the laptop computer to display the content displayed on the tablet computer's screen.

[0089] In this embodiment of the invention, the first electronic device and the second electronic device can project their screens using either a same-source projection technology or a different-source projection technology. If the first and second electronic devices use the same-source projection technology, they display the projected content synchronously. If the first and second electronic devices use a different-source projection technology, they can display the projected content asynchronously.

[0090] In some embodiments, taking the example of a first electronic device projecting its screen to a second electronic device using a shared projection technology, the projection interface of the first electronic device displayed on the second electronic device is the same as the display interface of the first electronic device. For example, if the display interface of the first electronic device is the display interface of a video application, then the collaborative window of the second electronic device also displays the display interface of that video application; if the first electronic device exits the video application and displays its main interface, then the collaborative window of the second electronic device also displays the main interface of the first electronic device.

[0091] In other embodiments, taking the example of a first electronic device projecting its screen to a second electronic device via heterogeneous projection technology, the first electronic device currently displays the interface of a video application. The first electronic device projects the video application's interface to the second electronic device, causing the second electronic device's collaborative window to display the video application's interface. At this time, the projected interface of the first electronic device is the video application's interface. Subsequently, the first electronic device switches the video application to the background, displaying the main interface or the interface of another application in the foreground, while the second electronic device's collaborative window can still display the video application's interface. In other words, the first and second electronic devices are not displayed synchronously.

[0092] For example, such as Figure 4 The diagram shown illustrates a screen mirroring method. Figure 4 This illustrates an application scenario where a second electronic device 300 projects its screen onto a first electronic device 400. For example, the second electronic device 300 is a mobile phone, and the first electronic device 400 is a tablet computer.

[0093] like Figure 4 As shown, exemplarily, the projection interface of the second electronic device 300 includes a status bar 301 and a menu bar 302. The status bar 301 includes signal status, network status, battery level, current location, current time, and local weather. The signal status is full bars, indicating a strong signal; the network status includes Wi-Fi and Bluetooth networks; the black portion of the battery level indicates the remaining battery power; the current location is Tianjin; the current time is Saturday, April 17th, the sixth day of the third lunar month in the Xin Chou year, 08:08; the weather in Tianjin is cloudy with a temperature of 8℃. Additionally, a camera is located in the upper left corner of the status bar 301, to the left of the signal status indicator. The menu bar 302 includes icons for at least one application, for example, located in the top row... The app includes a gallery, and below it are phone, messages, settings, and camera. The positions of the app icons and their names can be adjusted according to user preferences; this embodiment of the invention does not impose limitations on this.

[0094] like Figure 4As shown, exemplarily, the screen projection interface of the first electronic device 400 includes icons for at least one application, such as settings, camera, and gallery. The positions of the application icons and their corresponding names can be adjusted according to user preferences, and this embodiment of the invention does not limit this.

[0095] like Figure 4 As shown, a wireless connection is established between the second electronic device 300 and the first electronic device 400. For example, the second electronic device 300 and the first electronic device 400 can establish a wireless connection through Huawei Share OneHop technology. The second electronic device 300 projects its screen onto the first electronic device 400. The first electronic device 400 displays a collaborative window 500 generated on the first electronic device 400, which includes the screen projection interface of the second electronic device 300, thereby realizing the "multi-screen collaboration" function. The content of the collaborative window 500 changes accordingly with the user's operation on the second electronic device 300. For example, as... Figure 4 As shown, the projection interface of the second electronic device 300 in the collaboration window 500 also has a top title bar, which includes the device name of the second electronic device 300, "HUAWEI Mate 40Pro", and several function buttons, such as a minimize button, a maximize button, and a close button. The projection interface of the second electronic device 300 in the collaboration window 500 also has a bottom function bar, which includes a back button, a home button, and a menu button. The back button is used to return to the previous level, the home button is used to return to the home desktop, and the menu button is used to display multiple background applications.

[0096] In this embodiment of the invention, as another optional solution, the electronic device acting as the source device can simultaneously project its screen onto multiple other electronic devices acting as destination devices. This scenario is not specifically illustrated.

[0097] In related technologies, when a user projects the screen of a first electronic device onto a second electronic device or vice versa, if they need to use a stylus on the first or second electronic device, they need to manually pair the stylus with each device. Furthermore, they need to manually manage the connection and disconnection of the stylus during use, which makes the process cumbersome, increases the user's stylus usage process, and reduces the user experience.

[0098] To address the issues of increased user interaction with the stylus and reduced user experience in the aforementioned related technologies, embodiments of the present invention provide a stylus connection control method and an electronic device. In some embodiments, the stylus establishes a first wireless connection with a second electronic device. Upon receiving a screen mirroring request from the second electronic device, the first electronic device displays its screen mirroring interface. The first electronic device automatically establishes the first wireless connection with the stylus, eliminating the need for manual user management of the connection between the first electronic device and the stylus, thereby reducing the user's interaction with the stylus and improving the user experience. In other embodiments, upon receiving a screen mirroring disconnection command from the second electronic device, the first electronic device stops displaying the screen mirroring interface. The first electronic device then determines that its first wireless connection with the stylus was established due to a screen mirroring operation and automatically disconnects the first wireless connection with the stylus. This also eliminates the need for manual user management of the disconnection, further reducing the user's interaction with the stylus and improving the user experience.

[0099] For example, Figures 5a to 5d A schematic diagram is provided showing how a stylus establishes a first wireless connection and a second wireless connection with an electronic device. Figures 5a to 5d The illustration shows a stylus 200, a second electronic device 300, and a first electronic device 400, for example, the second electronic device 300 is a mobile phone and the first electronic device 400 is a tablet computer.

[0100] In this embodiment of the invention, the first wireless connection is used to realize general business data transmission. For example, general business data may include business data such as stylus attributes and screen parameters; the second wireless connection is used to realize human-computer interaction business data transmission. For example, human-computer interaction business data may include business data such as stylus attributes, screen parameters, and stylus pressure data.

[0101] like Figure 5a As shown, if a user uses the stylus 200 to perform touch operations on the second electronic device 300, a first wireless connection needs to be established between the stylus 200 and the second electronic device 300. The second electronic device 300 and the stylus 200 can establish this first wireless connection via near-field communication (NFC) technology, which may include, but is not limited to, Bluetooth, Wi-Fi, or NFC. For example, the second electronic device 300 and the stylus 200 can establish the first wireless connection via Bluetooth. In this case, the established first wireless connection can be a Generic Attribute Profile (GATT) connection. GATT is a general specification for sending and receiving short data segments over a Bluetooth connection. It should be noted that in this embodiment of the invention, a GATT connection is used as an example for description.

[0102] If a user uses the stylus 200 on the second electronic device 300 for the first time, the second electronic device 300 needs to pair with the stylus 200 before establishing a GATT connection. Specifically, the second electronic device 300 and the stylus 200 can pair via Bluetooth, NFC, or a USB-C interface. Then, the second electronic device 300 establishes a GATT connection with the stylus 200. After the second electronic device 300 and the stylus 200 are paired and a GATT connection is established, the stylus 200 can establish a second wireless connection with the second electronic device 300. The user can then use the stylus 200 to perform touch operations on the second electronic device 300. For example, the second wireless connection is a GATT-based Human Interface Device Protocol (HIDOver GATT Protocol, or HOGP) connection. It should be noted that in this embodiment of the invention, the second wireless connection is described using an HOGP connection as an example. Specifically, when the tip of the stylus 200 touches the screen of the second electronic device 300 for the first time, an HOGP connection is established between the two devices. Figure 5a As shown, exemplarily, the second electronic device 300 displays a handwriting interface, on which a user can use a stylus 200 to perform writing operations, such as writing the word "Huawei". The GATT connection supports the transmission of business data such as stylus attributes and screen parameters, but does not support the transmission of stylus pressure data; the HOGP connection supports the transmission of business data such as stylus attributes, screen parameters, and stylus pressure data.

[0103] like Figure 5b As shown, the first electronic device 400 and the second electronic device 300 perform a screen mirroring operation, and the screen mirroring operation is successful. Specifically, the second electronic device 300 mirrors its interface to the first electronic device 400. The first electronic device 400 displays a collaborative window 500 generated on the first electronic device 400 by the mirrored interface of the second electronic device 300, thus realizing the "multi-screen collaboration" function. Figure 5b As shown, exemplarily, the projection interface is the main interface of the second electronic device 300. The content of the collaboration window 500 changes accordingly with the user's operation on the second electronic device 300; for example, the content displayed on the second electronic device 300 changes from the main interface to... Figure 5a The handwriting interface in the middle, Figure 5b The content displayed in the Collaboration Window 500 also changed Figure 5a The handwriting interface in the text is not specifically shown in this case.

[0104] like Figure 5cAs shown, the first electronic device 400 displays the screen mirroring interface of the second electronic device 300, indicating a successful screen mirroring operation. The first electronic device 400 then automatically establishes a first wireless connection with the stylus 200. The first electronic device 400 and the stylus 200 can automatically establish this first wireless connection via near-field communication (NFC) technology, which may include, but is not limited to, Bluetooth, Wi-Fi, or NFC. For example, the first electronic device 400 and the stylus 200 can automatically establish a first wireless connection via Bluetooth. In this case, the established first wireless connection can be a GATT connection. Before establishing a GATT connection, the first electronic device 400 checks whether a GATT connection has already been established with the stylus 200. If a GATT connection has been established, it indicates that the first electronic device 400 has already established a GATT connection with the stylus 200 before screen mirroring; if no GATT connection has been established, the establishment of a GATT connection with the stylus 200 can be performed directly. Additionally, if a user uses the stylus 200 on the first electronic device 400 for the first time, the first electronic device 400 needs to perform pairing with the stylus 200 before establishing a GATT connection. For example, the first electronic device 400 can perform pairing with the stylus 200 via Bluetooth or NFC, thereby achieving automatic pairing between the first electronic device 100 and the stylus 200 without manual operation by the user, improving the user experience. Figure 5c As shown, during the process of establishing a GATT connection between the first electronic device 400 and the stylus 200, the first electronic device 400 pops up a prompt box. The user clicks the "Connect" button in the prompt box to indicate agreement to establish a GATT connection, and then the first electronic device 400 and the stylus 200 establish a GATT connection. Figure 5c As shown, if the user clicks "Cancel" in the prompt box, it means that they do not agree to establish a GATT connection, and the first electronic device 400 and the stylus 200 fail to establish a GATT connection.

[0105] like Figure 5d As shown, after the first electronic device 400 and the stylus 200 have paired and established a GATT connection, the first electronic device 400 can automatically establish a second wireless connection with the stylus 200. The user can then use the stylus 200 to perform touch operations on the first electronic device 400; for example, the second wireless connection is a HOGP connection. Specifically, when the tip of the stylus 200 first touches the screen of the first electronic device 400, the stylus 200 disconnects the HOGP connection established with the second electronic device 300 and automatically establishes an HOGP connection with the first electronic device 400, thereby enabling the user to perform touch operations on the first electronic device 400 using the stylus 200. Figure 5dAs shown, for example, the first electronic device 400 displays a handwriting interface, on which a user can use a stylus 200 to perform writing operations, such as writing the word "Huawei" on the handwriting interface.

[0106] For example, Figure 5e A schematic diagram is provided showing the stylus disconnecting from the electronic device via a first wireless connection. After execution... Figures 5a to 5d After the process shown illustrates the establishment of a first wireless connection between the stylus and the electronic device, the first electronic device 400 and the second electronic device 300 have established a screen mirroring connection, and both the second electronic device 300 and the first electronic device 400 have established a GATT connection with the stylus 200. For example... Figure 5e As shown, the first electronic device 400 and the second electronic device 300 disconnect the screen mirroring, and the screen mirroring disconnection is successful. Specifically, the second electronic device 300 sends a screen mirroring disconnection command to the first electronic device 400, causing the first electronic device 400 to stop displaying the screen mirroring interface of the second electronic device 300. At this time, the collaboration window 500 is no longer displayed on the first electronic device 400, and the communication channel established by the first electronic device 400 and the second electronic device 300 during screen mirroring is disconnected. Since the GATT connection between the first electronic device 400 and the stylus 200 is established by being triggered by the screen mirroring operation, when the screen mirroring between the first electronic device 400 and the second electronic device 300 is disconnected, the first electronic device 400 automatically disconnects the GATT connection with the stylus 200. However, since the GATT connection between the second electronic device 300 and the stylus 200 is not established by being triggered by the screen mirroring operation, the GATT connection between the second electronic device 300 and the stylus 200 is not affected by the screen mirroring disconnection, and the second electronic device 300 and the stylus 200 still maintain a GATT connection. Because the GATT connection between the first electronic device 400 and the stylus 200 is broken, the HOGP connection between the first electronic device 400 and the stylus 200 is also broken, preventing the user from using the stylus 200 for touch operations on the first electronic device 400. The stylus 200 can establish an HOGP connection with the second electronic device 300, allowing the user to use the stylus 200 for touch operations on the second electronic device 300, for example... Figure 5e As shown, the user uses the stylus 200 to click the gallery icon on the second electronic device 300. In another scenario, if the GATT connection between the first electronic device 400 and the stylus 200 is not established in response to a screen mirroring operation, the GATT connection between the first electronic device 400 and the stylus 200 is unaffected by the screen mirroring disconnection. The first electronic device 400 and the stylus 200 maintain the GATT connection, and the user can continue to use the stylus 200 for touch operations on the first electronic device 400. This scenario is not specifically depicted.

[0107] In summary, if the GATT connection between the first electronic device 400 and the stylus 200 is established upon triggering a screen mirroring operation, then the connection lifecycle between the stylus 200 and the first electronic device 400 is consistent with the screen mirroring cycle. That is, during screen mirroring, the stylus 200 maintains a GATT connection with both the first electronic device 400 and the second electronic device 300, allowing the stylus 200 to freely switch between touch operations on both devices. When screen mirroring is disconnected, the GATT connection between the stylus 200 and the first electronic device 400 is lost, preventing touch operations on the first electronic device 400. However, since the GATT connection between the stylus 200 and the second electronic device 300 is not triggered by a screen mirroring operation, the GATT connection is unaffected by the screen mirroring disconnection. Therefore, the stylus 200 can continue to maintain a GATT connection with the second electronic device 300, and touch operations can still be performed on the second electronic device 300. This achieves management of the connection lifecycle between the stylus and the electronic device.

[0108] It should be noted that, Figure 4 , Figures 5a to 5e The schematic diagram of the electronic device interface shown is an exemplary demonstration of an embodiment of the present invention. The schematic diagram of the electronic device interface may also be of other styles, and the present invention does not limit them.

[0109] The following specific embodiment illustrates the workflow of the stylus connection control method. Figure 6a These are flowcharts of the stylus connection control methods in some embodiments. Figure 6a The workflow shown can be used to achieve Figures 5a to 5c The connection control method of the stylus shown is as follows: Figure 6a As shown, the method includes:

[0110] Step 102: The second electronic device establishes a first wireless connection with the stylus.

[0111] For example, such as Figure 5a As shown, the second electronic device 300 establishes a first wireless connection with the stylus 200 via Bluetooth, Wi-Fi, or NFC. For example, this first wireless connection is a GATT connection.

[0112] If the user is using the stylus 200 on the second electronic device 300 for the first time, the process may include the following steps before step 102: Step 100, where the second electronic device 300 performs pairing with the stylus 200. Then, the second electronic device 300 performs the establishment of a first wireless connection with the stylus 200, i.e., step 102.

[0113] If the user needs to use the stylus 200 to perform touch operations on the second electronic device 300, then after step 102, the process may further include: the second electronic device 300 and the stylus 200 establishing a second wireless connection, for example, the second wireless connection is a HOGP connection.

[0114] Step 104: The second electronic device establishes a communication channel with the first electronic device.

[0115] After the communication channel is established, the second electronic device and the first electronic device can transmit data during the screen projection process through the communication channel.

[0116] Step 106: The second electronic device sends a screen mirroring request to the first electronic device, which includes the physical address of the stylus.

[0117] The physical address of a stylus is used to uniquely identify a stylus, ensuring its uniqueness. For example, the physical address of a stylus includes its Media Access Control (MAC) address, such as a Bluetooth MAC address.

[0118] During the screen mirroring process between the second electronic device and the first electronic device, the second electronic device sends the physical address of the stylus to the first electronic device via a screen mirroring request. This allows the first electronic device to obtain the physical address of the stylus from the second electronic device during the screen mirroring operation. Alternatively, after establishing a communication channel in step 104, the second electronic device can also send the physical address of the stylus to the first electronic device independently. For example, after sending a screen mirroring request to the first electronic device, the second electronic device sends the physical address of the stylus to the first electronic device.

[0119] The screen mirroring request includes screen mirroring parameters, which may include one or more of the following: screen mirroring resolution, transmission bitrate, encoding compression rate, or keyframe interval time.

[0120] Step 108: The first electronic device responds to the screen mirroring request and displays the screen mirroring interface of the second electronic device.

[0121] Specifically, such as Figure 5b As shown, the first electronic device 400 parses the screen projection parameters, determines that it has the ability to accept screen projection from the second electronic device 300, accepts the screen projection request, displays the screen projection interface of the second electronic device 300, and thus the screen projection is successful.

[0122] Step 110: The first electronic device sends a screen mirroring success message to the second electronic device.

[0123] Step 112: The first electronic device automatically establishes a first wireless connection with the stylus based on the physical address of the stylus.

[0124] When the screen mirroring interface of the second electronic device is displayed on the first electronic device, that is, when the screen mirroring operation of the second electronic device on the first electronic device is successful, the process of automatically establishing a first wireless connection between the first electronic device and the stylus can be triggered. For example, Figure 6b Flowcharts of methods for pairing a first electronic device with a stylus and establishing a first wireless connection are provided in some embodiments, wherein the first electronic device and the stylus can establish a first wireless connection via Bluetooth Low Energy (BLE) technology. Figure 6b As shown, step 112 may specifically include:

[0125] Step 1122: The first electronic device receives the broadcast packet (Adv) broadcast by the stylus.

[0126] Step 1124: The first electronic device sends a connection request (PageRequest) to the stylus based on the stylus's physical address.

[0127] Step 1126: The stylus returns a connection response (Page Response) to the first electronic device.

[0128] Step 1128: The stylus sends a Connection Establish message to the first electronic device.

[0129] In some embodiments, before step 112, the method further includes: the first electronic device queries whether it has been paired with the stylus; if it has been paired with the stylus, step 112 is executed directly; if it has not been paired with the stylus, step 111 is executed first, the first electronic device performs pairing with the stylus, and step 112 is executed after successful pairing.

[0130] Specifically, the first electronic device can store paired device information, which may include the name and type of the paired device. For example, the name of the paired device may be "HUAWEI PEN", and the type may be a stylus. In step 112, the first electronic device can query whether the name and type of the stylus are included in the paired device information. If yes, it indicates that the first electronic device and the stylus are paired, and step 112 is executed directly. If no, it indicates that the first electronic device and the stylus are not paired, and step 111 is executed first. After successful pairing, step 112 is executed.

[0131] For example, such as Figure 6b As shown, step 111 may specifically include:

[0132] Step 1112: The first electronic device sends a pairing request to the stylus based on the stylus's physical address.

[0133] Step 1114: The stylus returns a pairing response to the first electronic device.

[0134] Step 1116: The stylus sends a pairing message based on the Secure Manager Protocol (SMP) to the first electronic device.

[0135] Among them, the pairing message based on SMP is the "Paring Over SMP" message.

[0136] The embodiments of the present invention enable automatic pairing between the first electronic device and the stylus, eliminating the need for manual operation by the user and improving the user experience.

[0137] In some embodiments, if the first electronic device finds that it has been paired with the stylus, it may continue to perform the following steps: the first electronic device checks whether a first wireless connection has been established with the stylus; if it finds that a first wireless connection has not been established with the stylus, it directly performs step 112; if it finds that a first wireless connection has been established with the stylus, it does not need to continue to perform step 112.

[0138] Specifically, the first electronic device can store connected device information, which may include the name and type of the connected device. For example, the name of the connected device may be "HUAWEI PEN", and the type may be a stylus. The first electronic device can then query whether the connected device information includes the name and type of the stylus. If not, it indicates that the first electronic device and the stylus have not established a first wireless connection, and step 112 is executed directly. If yes, it indicates that the first electronic device and the stylus have established a first wireless connection, and step 112 does not need to be executed again.

[0139] Step 114: The first electronic device records wireless connection establishment information, which indicates that the first wireless connection between the first electronic device and the stylus was established by the screen projection operation.

[0140] In some embodiments, wireless connection establishment information can be used to indicate whether the first wireless connection between the first electronic device and the stylus was established by being triggered by a screen mirroring operation.

[0141] In step 112, the first electronic device automatically establishes a first wireless connection with the stylus. In step 114, the wireless connection establishment information recorded by the first electronic device is used to indicate that the first wireless connection between the first electronic device and the stylus was established by the screen projection operation.

[0142] If the first wireless connection between the first electronic device and the stylus was not established upon triggering a screen mirroring operation—for example, if the first wireless connection between the first electronic device and the stylus had already been established before the screen mirroring operation—the wireless connection establishment information is used to indicate that the first wireless connection between the first electronic device and the stylus was not established upon triggering a screen mirroring operation. In some embodiments, for Figure 3 The illustrated software structure diagram of the stylus and electronic device shows that the stylus may include a connection management unit, the first electronic device may include a screen projection management service unit and a stylus management service unit, and the second electronic device may include a screen projection management service unit and a stylus management service unit. For example, Figure 6c Flowcharts of stylus connection control methods in other embodiments are provided. Figure 6c The workflow shown can be used to achieve Figures 5a to 5c The connection control method of the stylus shown is as follows: Figure 6c As shown, the method includes:

[0143] Step 202: The stylus management service unit of the second electronic device establishes a first wireless connection with the stylus connection management unit.

[0144] If the user is using the stylus for the first time on the second electronic device, the process may include the following steps before step 202: Step 200, where the stylus management service unit of the second electronic device and the connection management unit of the stylus perform pairing. Then, the stylus management service unit of the second electronic device establishes a first wireless connection with the connection management unit of the stylus, i.e., step 202.

[0145] If the user needs to use a stylus to perform touch operations on the second electronic device, then after step 202, the method may further include: the stylus management service unit of the second electronic device establishing a HOGP connection with the stylus connection management unit.

[0146] Step 204: The screen projection management service unit of the second electronic device establishes a communication channel with the screen projection management service unit of the first electronic device.

[0147] Step 206: The screen mirroring management service unit of the second electronic device sends a screen mirroring request to the screen mirroring management service unit of the first electronic device. The screen mirroring request includes the physical address of the stylus.

[0148] Step 208: The screen mirroring management service unit of the first electronic device responds to the screen mirroring request and displays the screen mirroring interface of the second electronic device.

[0149] Step 210: The screen mirroring management service unit of the first electronic device returns a screen mirroring success message to the screen mirroring management service unit of the second electronic device.

[0150] Step 212: The screen mirroring management service unit of the first electronic device sends a stylus connection establishment notification to the stylus management service unit of the first electronic device. The stylus connection establishment notification includes the physical address of the stylus.

[0151] Step 214: The stylus management service unit of the first electronic device automatically establishes a first wireless connection with the stylus connection management unit based on the physical address of the stylus.

[0152] In some embodiments, before step 214, the method further includes: the stylus management service unit of the first electronic device queries whether it is paired with the stylus; if it is paired with the stylus, step 214 is executed directly; if it is not paired with the stylus, the following steps are executed first: the stylus management service unit of the first electronic device and the connection management unit of the stylus perform pairing; after successful pairing, step 214 is executed.

[0153] In some embodiments, if the stylus management service unit of the first electronic device finds that it has been paired with the stylus, it may continue to perform the following steps: the stylus management service unit of the first electronic device checks whether a first wireless connection has been established with the stylus. If it finds that a first wireless connection has not been established with the stylus, it directly performs step 214; if it finds that a first wireless connection has been established with the stylus, it does not need to perform step 214.

[0154] Step 216: The stylus management service unit of the first electronic device records the wireless connection establishment information, which is used to indicate that the first wireless connection between the first electronic device and the stylus is established by the screen projection operation.

[0155] Thus, this embodiment has achieved the following: Figure 5c A first wireless connection is established between the first electronic device 400 and the stylus 200. At this time, both the first electronic device 400 and the second electronic device 300 establish the first wireless connection with the stylus 200. If the stylus 200 needs to perform touch operations on the electronic device, it needs to establish a second wireless connection with that electronic device, for example, a HOGP connection. Furthermore, the stylus 200 can freely switch between the first electronic device 400 and the second electronic device 300 by establishing the HOGP connection. For example, Figure 6d This is a schematic flowchart illustrating the method for establishing a HOGP connection between a stylus and an electronic device in some embodiments. The description takes the establishment of a HOGP connection between the stylus 200 and the first electronic device 400 as an example. Figure 6d As shown, the method includes:

[0156] Step 302: The stylus and the first electronic device execute the GATT connection establishment process. If the GATT connection is established successfully, proceed to step 304; if the GATT connection fails to be established, the process ends.

[0157] Step 304: Use a stylus to touch the screen of the first electronic device to read the screen parameters of the first electronic device.

[0158] When the stylus tip touches the screen for the first time, it reads the screen parameters of the first electronic device. These screen parameters may include the screen type and / or the frequency of the marking. For example, the screen type may include in-cell or on-cell, and the frequency of the marking is used to indicate that frequency hopping is required when there is interference.

[0159] Step 306: The stylus determines the first working mode based on the screen parameters of the first electronic device. The first working mode is the working mode of the stylus and the first electronic device.

[0160] For example, the stylus determines the first working mode as HPP 3.x mode based on the screen type and the frequency of the coding. That is, the first working mode is HPP 3.x mode, meaning the stylus is connected to the first electronic device in HPP 3.x mode.

[0161] Step 308: Check if the stylus has established an HOGP connection with other electronic devices. If yes, proceed to step 310; otherwise, proceed to step 318.

[0162] In this embodiment of the invention, other electronic devices may be second electronic devices, or other electronic devices may be electronic devices other than the first electronic device and the second electronic device.

[0163] Step 310: Disconnect the stylus from other electronic devices via HOGP.

[0164] For example, if the stylus finds that it has established an HOGP connection with the second electronic device, then step 310 is executed, and the stylus disconnects the HOGP connection with the second electronic device.

[0165] Step 312: Establish HOGP connection between the stylus and the first electronic device.

[0166] Step 314: The stylus determines whether the first working mode and the second working mode are the same. The second working mode is the working mode of the stylus and other electronic devices. If yes, the process ends; otherwise, proceed to step 316.

[0167] For example, when the second operating mode is HPP 3.x mode, the stylus is connected to the other electronic device in HPP 3.x mode; or, when the second operating mode is HPP 2.x mode, the stylus is connected to the other electronic device in HPP 2.x mode. It should be noted that a stylus cannot be connected to the first electronic device in HPP 3.x mode and simultaneously connected to another electronic device in HPP 2.x mode. Therefore, for the same stylus, if the first and second operating modes are different—for example, the first operating mode is HPP 3.x mode and the second operating mode is HPP 2.x mode—if the stylus is connected to the first electronic device in HPP 3.x mode, it cannot be connected to other electronic devices in HPP 2.x mode.

[0168] For example, if the first working mode is HPP 3.x mode and the second working mode is HPP 3.x mode, it means that the stylus is connected to the first electronic device in HPP 3.x mode, and can also be connected to other electronic devices in HPP 3.x mode. In this case, there is no need to disconnect the GATT connection between the stylus and other electronic devices, and the stylus maintains the GATT connection with other electronic devices.

[0169] For example, if the first working mode is HPP 3.x mode and the second working mode is HPP 2.x mode, it means that the stylus is connected to the first electronic device in HPP 3.x mode, but cannot be connected to other electronic devices in HPP 2.x mode at the same time. In this case, the stylus disconnects from other electronic devices via GATT.

[0170] Step 316: Disconnect the stylus from other electronic devices via GATT. The process ends.

[0171] Step 318: The stylus establishes an HOGP connection with the first electronic device, and the process ends.

[0172] Once the stylus establishes an HOGP connection with the first electronic device, it can perform touch operations on the first electronic device.

[0173] The workflow of the stylus connection control method is illustrated below through another specific embodiment. Figure 7a This is a flowchart of a stylus connection control method in some other embodiments. Figure 7a The workflow shown can be used to achieve Figure 5e The connection control method of the stylus shown is as follows: Figure 7a As shown, the method includes:

[0174] Step 402: The first electronic device receives a screen mirroring disconnect command sent by the second electronic device. The screen mirroring disconnect command includes the physical address of the stylus.

[0175] For example, the physical address of the stylus includes the stylus's MAC address, such as the Bluetooth MAC address.

[0176] The second electronic device sends the physical address of the stylus to the first electronic device via a screen mirroring disconnect command, thereby enabling the first electronic device to obtain the physical address of the stylus from the second electronic device during the screen mirroring disconnection process.

[0177] Step 404: In response to the screen mirroring disconnect command, the first electronic device stops displaying the screen mirroring interface of the second electronic device.

[0178] Specifically, such as Figure 5e As shown, the first electronic device 400 no longer displays the projection interface of the second electronic device 300.

[0179] Step 406: The first electronic device sends a message to the second electronic device that the screen mirroring was successfully disconnected.

[0180] Step 408: The first electronic device finds that its first wireless connection with the stylus was established by the screen projection operation.

[0181] Step 410: The first electronic device automatically disconnects the first wireless connection from the stylus based on the physical address of the stylus.

[0182] In step 408, the first electronic device queries whether the first wireless connection between itself and the stylus was established by the screen projection operation. If it is found that the first wireless connection between itself and the stylus was established by the screen projection operation, then step 410 is executed. If it is found that the first wireless connection between itself and the stylus was not established by the screen projection operation, then step 410 is not executed, and the first electronic device maintains the first wireless connection with the stylus.

[0183] Specifically, the first electronic device queries whether its first wireless connection with the stylus was established by the screen projection operation based on the recorded wireless connection establishment information.

[0184] Before checking whether the first wireless connection between the electronic device and the stylus was established by the screen projection operation in step 408, the process further includes: the first electronic device checking whether it is in a state where the first wireless connection with the stylus has been established. If yes, then step 408 is executed; if no, it indicates that the first electronic device has disconnected the first wireless connection with the stylus, and then steps 408 and 410 are no longer executed.

[0185] Thus, this embodiment has achieved the following: Figure 5e The first wireless connection between the first electronic device 400 and the stylus 200 is disconnected.

[0186] In some embodiments, for Figure 3 The illustrated software structure diagram of the stylus and electronic device shows that the stylus may include a connection management unit, the first electronic device may include a screen projection management service unit and a stylus management service unit, and the second electronic device may include a screen projection management service unit and a stylus management service unit. For example, Figure 7b Flowcharts of stylus connection control methods in other embodiments are provided. Figure 7b The workflow shown can be used to achieve Figure 5e The connection control method of the stylus shown is as follows: Figure 7b As shown, the method includes:

[0187] Step 502: The screen mirroring management service unit of the first electronic device receives a screen mirroring disconnection command sent by the screen mirroring management service unit of the second electronic device. The screen mirroring disconnection command includes the physical address of the stylus.

[0188] Step 504: The screen mirroring management service unit of the first electronic device responds to the screen mirroring disconnect command and stops displaying the screen mirroring interface of the second electronic device.

[0189] Step 506: The screen mirroring management service unit of the first electronic device returns a screen mirroring disconnection success message to the screen mirroring management service unit of the second electronic device.

[0190] Step 508: The screen projection management service unit of the first electronic device sends a stylus disconnection notification to the stylus management service unit of the first electronic device. The stylus disconnection notification includes the physical address of the stylus.

[0191] Step 510: The stylus management service unit of the first electronic device finds that the first wireless connection between itself and the stylus was established by the screen projection operation.

[0192] In some embodiments, before step 510, the method further includes: the stylus management service unit of the first electronic device queries whether it is in a state where a first wireless connection has been established with the stylus; if yes, then step 510 is executed directly; if no, it indicates that the first electronic device has disconnected the first wireless connection with the stylus, and then steps 510 and 512 are no longer executed.

[0193] Step 512: The stylus management service unit of the first electronic device automatically disconnects the first wireless connection from the stylus connection management unit based on the physical address of the stylus.

[0194] The above Figures 5a to 5eThe solution shown provides a scenario: the stylus establishes a first wireless connection with a second electronic device, which is the source device; when the second electronic device successfully projects its screen onto the first electronic device, which is the destination device, the first electronic device is triggered to actively establish a first wireless connection with the stylus; when the second electronic device successfully disconnects from the first electronic device, the first electronic device is triggered to actively disconnect from the stylus.

[0195] In other embodiments, another scenario is provided: the stylus establishes a first wireless connection with a second electronic device, which is the destination device; when the first electronic device, which is the source device, successfully projects its screen onto the second electronic device, it triggers the first electronic device to actively establish a first wireless connection with the stylus; when the second electronic device successfully disconnects from the first electronic device, it triggers the first electronic device to actively disconnect the first wireless connection with the stylus. For example, Figures 8a to 8d Another schematic diagram is provided showing how a stylus can establish a first wireless connection and a second wireless connection with an electronic device. Figures 8a to 8d The illustration shows a stylus 200, a first electronic device 600, and a second electronic device 700, for example, the first electronic device 600 is a mobile phone and the second electronic device 700 is a tablet computer.

[0196] like Figure 8a As shown, if a user uses the stylus 200 to perform touch operations on the second electronic device 700, a first wireless connection needs to be established between the stylus 200 and the second electronic device 700. The second electronic device 700 and the stylus 200 can establish this first wireless connection via near-field communication (NFC) technology, which may include, but is not limited to, Bluetooth, Wi-Fi, or NFC. For example, the second electronic device 700 and the stylus 200 can establish the first wireless connection via Bluetooth; in this case, the established first wireless connection can be a GATT connection.

[0197] If a user uses the stylus 200 on the second electronic device 700 for the first time, the second electronic device 700 needs to pair with the stylus 200 before establishing a GATT connection. Specifically, the second electronic device 700 and the stylus 200 can pair via Bluetooth, NFC, or a USB-C interface. Then, the second electronic device 700 establishes a GATT connection with the stylus 200. After the second electronic device 700 and the stylus 200 are paired and a GATT connection is established, the stylus 200 can establish a second wireless connection with the second electronic device 700. The user can then use the stylus 200 to perform touch operations on the second electronic device 700, for example, a HOGP connection. Specifically, when the tip of the stylus 200 touches the screen of the second electronic device 700 for the first time, a HOGP connection is established between the two devices. Figure 8a As shown, exemplarily, the second electronic device 700 displays a handwriting interface, on which a user can use a stylus 200 to perform writing operations, such as writing the word "Huawei" on the handwriting interface.

[0198] like Figure 8b As shown, the first electronic device 600 and the second electronic device 700 perform a screen mirroring operation, and the screen mirroring operation is successful. Specifically, the first electronic device 600 mirrors its interface to the second electronic device 700, and the second electronic device 700 displays a collaborative window 500 generated on the second electronic device 700, which includes the mirrored interface of the first electronic device 600, to realize the "multi-screen collaboration" function. Figure 8b As shown, exemplarily, the projection interface is the main interface of the first electronic device 600. The content of the collaboration window 500 changes accordingly with the user's operations on the first electronic device 600.

[0199] like Figure 8b As shown, if the second electronic device 700 displays the screen mirroring interface of the first electronic device 600, it indicates that the screen mirroring operation was successful. Then, as shown... Figure 8c As shown, the first electronic device 600 automatically establishes a first wireless connection with the stylus 200. This first wireless connection can be established automatically via near-field communication (NFC) technology, which may include, but is not limited to, Bluetooth, Wi-Fi, or NFC. For example, the first electronic device 600 and the stylus 200 can automatically establish a first wireless connection via Bluetooth. In this case, the established first wireless connection can be a GATT connection. Before establishing a GATT connection, the first electronic device 600 checks whether a GATT connection has already been established with the stylus 200. If a GATT connection is found to be established, it indicates that the first electronic device 600 has already established a GATT connection with the stylus 200 before screen projection; if no GATT connection is found, the establishment of a GATT connection with the stylus 200 can be performed directly. Additionally, if a user uses the stylus 200 on the first electronic device 600 for the first time, the first electronic device 600 needs to perform pairing with the stylus 200 before establishing a GATT connection. For example, the first electronic device 600 can perform pairing with the stylus 200 via Bluetooth or NFC, thus achieving automatic pairing between the first electronic device 600 and the stylus 200 without manual operation by the user, improving the user experience. Figure 8c As shown, during the process of establishing a GATT connection between the first electronic device 600 and the stylus 200, the first electronic device 600 pops up a prompt box. The user clicks the "Connect" button in the prompt box to indicate agreement to establish a GATT connection, and then the first electronic device 600 and the stylus 200 establish a GATT connection. Figure 8c As shown, if the user clicks "Cancel" in the prompt box, it means that they do not agree to establish a GATT connection, and the first electronic device 600 and the stylus 200 fail to establish a GATT connection.

[0200] like Figure 8d As shown, after the first electronic device 600 and the stylus 200 have paired and established a GATT connection, the first electronic device 600 can automatically establish a second wireless connection with the stylus 200. The user can then use the stylus 200 to perform touch operations on the first electronic device 600; for example, the second wireless connection is a HOGP connection. Specifically, when the tip of the stylus 200 first touches the screen of the first electronic device 600, the stylus 200 disconnects the HOGP connection established with the second electronic device 700 and automatically establishes an HOGP connection with the first electronic device 600, thereby enabling the user to perform touch operations on the first electronic device 600 using the stylus 200. Figure 8d As shown, for example, the first electronic device 600 displays a handwriting interface, on which a user can use a stylus 200 to perform writing operations, such as writing the word "Huawei" on the handwriting interface.

[0201] For example, Figure 8e Another schematic diagram is provided illustrating the disconnection of the stylus from the electronic device via a first wireless connection. After execution... Figures 8a to 8d After the process shown illustrates the establishment of a first wireless connection between the stylus and the electronic device, the first electronic device 600 and the second electronic device 700 have established a screen mirroring connection, and both the first electronic device 600 and the second electronic device 700 have established a GATT connection with the stylus 200. For example... Figure 8eAs shown, the first electronic device 600 and the second electronic device 700 successfully disconnect the screen mirroring. Specifically, the first electronic device 600 sends a screen mirroring disconnect command to the second electronic device 700, causing the second electronic device 700 to stop displaying the screen mirroring interface of the first electronic device 600. At this time, the collaboration window 500 is no longer displayed on the second electronic device 700, and the communication channel established when the screen mirroring was performed between the first electronic device 600 and the second electronic device 700 is disconnected. Since the GATT connection between the first electronic device 600 and the stylus 200 is established by triggering the screen mirroring operation, when the screen mirroring between the first electronic device 600 and the second electronic device 700 is disconnected, the first electronic device 600 automatically disconnects the GATT connection with the stylus 200. However, since the GATT connection between the second electronic device 700 and the stylus 200 is not established by triggering the screen mirroring operation, the GATT connection between the second electronic device 700 and the stylus 200 is not affected by the screen mirroring disconnection, and the second electronic device 700 and the stylus 200 still maintain a GATT connection. Because the GATT connection between the first electronic device 600 and the stylus 200 is broken, the HOGP connection between the first electronic device 600 and the stylus 200 is also broken, preventing the user from using the stylus 200 for touch operations on the first electronic device 600. The stylus 200 can establish an HOGP connection with the second electronic device 700, allowing the user to use the stylus 200 for touch operations on the second electronic device 700, for example... Figure 8e As shown, the user uses the stylus 200 to click the gallery icon on the second electronic device 700. In another scenario, if the GATT connection between the first electronic device 600 and the stylus 200 is not established by the screen mirroring operation, then the GATT connection between the first electronic device 600 and the stylus 200 is unaffected by the screen mirroring disconnection. The first electronic device 600 and the stylus 200 maintain the GATT connection, and the user can continue to use the stylus 200 for touch operations on the first electronic device 600. This scenario is not specifically depicted.

[0202] It should be noted that, Figures 8a to 8e The schematic diagram of the electronic device interface shown is an exemplary demonstration of an embodiment of the present invention. The schematic diagram of the electronic device interface may also be of other styles, and the present invention does not limit them.

[0203] The following specific embodiment illustrates the workflow of the stylus connection control method. Figure 9a This is a flowchart of a stylus connection control method in some other embodiments. Figure 9a The workflow shown can be used to achieve Figures 8a to 8c The connection control method of the stylus shown is as follows: Figure 9a As shown, the method includes:

[0204] Step 602: The second electronic device establishes a first wireless connection with the stylus.

[0205] Step 604: The second electronic device establishes a communication channel with the first electronic device.

[0206] Step 606: The first electronic device sends a screen mirroring request to the second electronic device.

[0207] Step 608: The second electronic device responds to the screen mirroring request and displays the screen mirroring interface of the first electronic device.

[0208] Step 610: The second electronic device returns a screen mirroring success message to the first electronic device. The screen mirroring success message includes the physical address of the stylus.

[0209] During the screen mirroring process from the first electronic device to the second electronic device, the second electronic device sends the physical address of the stylus to the first electronic device via a successful screen mirroring message. This allows the first electronic device to obtain the physical address of the stylus from the second electronic device during the screen mirroring operation. Alternatively, after establishing the communication channel in step 604, the second electronic device can also send the physical address of the stylus to the first electronic device separately. For example, before sending the successful screen mirroring message to the first electronic device, the second electronic device can send the physical address of the stylus to the first electronic device.

[0210] Step 612: The first electronic device automatically establishes a first wireless connection with the stylus based on the physical address of the stylus.

[0211] Step 614: The first electronic device records wireless connection establishment information, which indicates that the first wireless connection between the first electronic device and the stylus was established by the screen projection operation.

[0212] In some embodiments, for Figure 3 The illustrated software structure diagram of the stylus and electronic device shows that the stylus may include a connection management unit, the first electronic device may include a screen projection management service unit and a stylus management service unit, and the second electronic device may include a screen projection management service unit and a stylus management service unit. For example, Figure 9b Flowcharts of stylus connection control methods in other embodiments are provided. Figure 9b The workflow shown can be used to achieve Figures 8a to 8c The connection control method of the stylus shown is as follows: Figure 9b As shown, the method includes:

[0213] Step 702: The stylus management service unit of the second electronic device establishes a first wireless connection with the stylus connection management unit.

[0214] Step 704: The screen projection management service unit of the second electronic device establishes a communication channel with the screen projection management service unit of the first electronic device.

[0215] Step 706: The screen mirroring management service unit of the first electronic device sends a screen mirroring request to the screen mirroring management service unit of the second electronic device.

[0216] Step 708: The screen mirroring management service unit of the second electronic device responds to the screen mirroring request and displays the screen mirroring interface of the first electronic device.

[0217] Step 710: The screen mirroring management service unit of the second electronic device returns a screen mirroring success message to the screen mirroring management service unit of the first electronic device. The screen mirroring success message includes the physical address of the stylus.

[0218] Step 712: The screen mirroring management service unit of the first electronic device sends a stylus connection establishment notification to the stylus management service unit of the first electronic device. The stylus connection establishment notification includes the physical address of the stylus.

[0219] Step 714: The stylus management service unit of the first electronic device automatically establishes a first wireless connection with the stylus connection management unit based on the physical address of the stylus.

[0220] In some embodiments, before step 714, the method further includes: the stylus management service unit of the first electronic device queries whether it is paired with the stylus; if it is paired with the stylus, step 714 is executed directly; if it is not paired with the stylus, the following steps are executed: the stylus management service unit of the first electronic device and the connection management unit of the stylus perform pairing; after successful pairing, step 714 is executed.

[0221] In some embodiments, if the stylus management service unit of the first electronic device finds that it has been paired with the stylus, it may continue to perform the following steps: the stylus management service unit of the first electronic device checks whether a first wireless connection has been established with the stylus; if it finds that a first wireless connection has not been established with the stylus, it directly performs step 714; if it finds that a first wireless connection has been established with the stylus, it does not need to perform step 714.

[0222] Step 716: The stylus management service unit of the first electronic device records the wireless connection establishment information, which is used to indicate that the first wireless connection between the first electronic device and the stylus is established by the screen projection operation.

[0223] Thus, this embodiment has achieved the following: Figure 8cA first wireless connection is established between the first electronic device 600 and the stylus 200. At this time, both the first electronic device 600 and the second electronic device 700 establish the first wireless connection with the stylus 200. If the stylus 200 needs to perform touch operations on the electronic device, it needs to establish a second wireless connection with that electronic device; this second wireless connection is a HOGP connection. Furthermore, the stylus 200 can freely switch between the first electronic device 600 and the second electronic device 700 by establishing the HOGP connection. For example, a flowchart illustrating the method for establishing a HOGP connection between the stylus and the first electronic device is shown below. Figure 6d As shown.

[0224] The workflow of the stylus connection control method is illustrated below through another specific embodiment. Figure 10a This is a flowchart of a stylus connection control method in some other embodiments. Figure 10a The workflow shown can be used to achieve Figure 8e The connection control method of the stylus shown is as follows: Figure 10a As shown, the method includes:

[0225] Step 802: The second electronic device receives the screen mirroring disconnect command sent by the first electronic device.

[0226] Step 804: The second electronic device responds to the screen mirroring disconnect command and stops displaying the screen mirroring interface of the first electronic device.

[0227] Step 806: The second electronic device returns a screen mirroring disconnection success message to the second electronic device. The screen mirroring disconnection success message includes the physical address of the stylus.

[0228] The second electronic device sends the physical address of the stylus to the first electronic device via a successful screen mirroring disconnection message, thereby enabling the first electronic device to obtain the physical address of the stylus from the second electronic device during the screen mirroring disconnection process.

[0229] Step 808: The first electronic device finds that its first wireless connection with the stylus was established by the screen projection operation.

[0230] Step 810: The first electronic device automatically disconnects the first wireless connection from the stylus based on the physical address of the stylus.

[0231] In step 808, the first electronic device queries whether the first wireless connection between itself and the stylus was established by triggering a screen projection operation; if it is found that the first wireless connection between itself and the stylus was established by triggering a screen projection operation, then step 810 is executed; if it is found that the first wireless connection between itself and the stylus was not established by triggering a screen projection operation, then step 810 is not executed, and the first electronic device maintains the first wireless connection with the stylus.

[0232] Specifically, the first electronic device queries whether its first wireless connection with the stylus was established by the screen projection operation based on the recorded wireless connection establishment information.

[0233] Before checking whether the first wireless connection between the electronic device and the stylus was established in response to the successful screen projection operation in step 808, the process further includes: the first electronic device checking whether it is in a state where the first wireless connection with the stylus has been established. If yes, then step 808 is executed; if no, it indicates that the first electronic device has disconnected the first wireless connection with the stylus, and then steps 808 and 810 can be skipped.

[0234] Thus, this embodiment has achieved the following: Figure 8e The first wireless connection between the first electronic device 400 and the stylus 200 is disconnected.

[0235] In some embodiments, for Figure 3 The illustrated software structure diagram of the stylus and electronic device shows that the stylus may include a connection management unit, the first electronic device may include a screen projection management service unit and a stylus management service unit, and the second electronic device may include a screen projection management service unit and a stylus management service unit. For example, Figure 10b Flowcharts of stylus connection control methods in other embodiments are provided. Figure 10b The workflow shown can be used to achieve Figure 8e The connection control method of the stylus shown is as follows: Figure 10b As shown, the method includes:

[0236] Step 902: The screen mirroring management service unit of the second electronic device receives the screen mirroring disconnection command sent by the screen mirroring management service unit of the first electronic device.

[0237] Step 904: The screen mirroring management service unit of the second electronic device responds to the screen mirroring disconnect command and stops displaying the screen mirroring interface of the first electronic device.

[0238] Step 906: The screen mirroring management service unit of the second electronic device returns a screen mirroring disconnection success message to the screen mirroring management service unit of the first electronic device. The screen mirroring disconnection success message includes the physical address of the stylus.

[0239] Step 908: The screen mirroring management service unit of the first electronic device sends a stylus disconnection notification to the stylus management service unit of the first electronic device. The stylus disconnection notification includes the physical address of the stylus.

[0240] Step 910: The stylus management service unit of the first electronic device finds that the first wireless connection between itself and the stylus was established by the screen projection operation.

[0241] In some embodiments, before step 910, the method further includes: the stylus management service unit of the first electronic device queries whether it is in a state where a first wireless connection has been established with the stylus; if yes, then step 910 is executed directly; if no, it indicates that the first electronic device has disconnected the first wireless connection with the stylus, and then steps 910 and 912 are no longer executed.

[0242] Step 912: The stylus management service unit of the first electronic device automatically disconnects the first wireless connection from the stylus connection management unit based on the physical address of the stylus.

[0243] In this embodiment of the invention, the stylus establishes a first wireless connection with the second electronic device. In response to the screen projection request sent by the second electronic device, the first electronic device displays the screen projection interface of the second electronic device. Then, the first electronic device automatically establishes a first wireless connection with the stylus, eliminating the need for the user to manually manage the connection between the first electronic device and the stylus, thereby reducing the user's operation process when using the stylus and improving the user experience.

[0244] In this embodiment of the invention, in response to the screen mirroring disconnect command sent by the second electronic device, the first electronic device stops displaying the screen mirroring interface of the second electronic device. The first electronic device then determines that the first wireless connection between itself and the stylus was established by the screen mirroring operation and automatically disconnects the first wireless connection with the stylus. This eliminates the need for the user to manually manage the disconnection between the first electronic device and the stylus, thereby reducing the user's operation process when using the stylus and improving the user experience.

[0245] This invention provides a first electronic device, which can be a terminal device or a circuit device built into the terminal device. The electronic device includes: a display screen; one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, enable the device to perform the various steps in the above-described embodiment of the stylus connection control method.

[0246] This invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the steps described in the above-described embodiment of the handwriting pen connection control method.

[0247] This invention provides a computer program product containing instructions that, when run on a computer or any at least one processor, cause the computer to execute the various steps in the above-described handwriting pen connection control method embodiments.

[0248] In this embodiment of the invention, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0249] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0250] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0251] In the several embodiments provided by this invention, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0252] The above description is merely a specific embodiment of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this invention should be included within the protection scope of this invention. The protection scope of this invention should be determined by the scope of the claims.

Claims

1. A method for controlling the connection of a stylus, characterized in that, The method is applied to a first electronic device, wherein the stylus and a second electronic device establish a first wireless connection when they are paired, and the first wireless connection is used to realize general business data transmission; The method includes: The first electronic device receives the screen mirroring request sent by the second electronic device; The first electronic device responds to the screen mirroring request and displays the screen mirroring interface of the second electronic device; The first electronic device automatically pairs with the stylus when it is not paired with the stylus, based on the physical address of the stylus obtained from the second electronic device during the screen mirroring operation, and then automatically establishes the first wireless connection with the stylus.

2. The method according to claim 1, characterized in that, After the first electronic device automatically establishes the first wireless connection with the stylus, it further includes: The first electronic device records wireless connection establishment information, which indicates that the first wireless connection between itself and the stylus was established by the screen projection operation.

3. The method according to claim 1, characterized in that, The screen mirroring request includes the physical address of the stylus.

4. The method according to any one of claims 1 to 3, characterized in that, After the first electronic device automatically establishes the first wireless connection with the stylus, it further includes: The first electronic device receives a screen mirroring disconnect command sent by the second electronic device; In response to the screen mirroring disconnect command, the first electronic device stops displaying the screen mirroring interface of the second electronic device; The first electronic device detects that its first wireless connection with the stylus was established by the screen projection operation and automatically disconnects the first wireless connection from the stylus.

5. The method according to claim 4, characterized in that, The query to determine that the first wireless connection between itself and the stylus is established upon being triggered by a screen projection operation includes: The first electronic device determines, based on the recorded wireless connection establishment information, that its first wireless connection with the stylus was established by the screen projection operation.

6. The method according to claim 4 or 5, characterized in that, The automatic disconnection from the first wireless connection with the stylus includes: The first electronic device automatically disconnects the first wireless connection with the stylus based on the physical address of the stylus obtained from the second electronic device during the screen mirroring disconnection process.

7. The method according to any one of claims 4 to 6, characterized in that, The screen mirroring disconnect command includes the physical address of the stylus.

8. The method according to any one of claims 1 to 7, characterized in that, The stylus establishes a second wireless connection with the second electronic device, and the second wireless connection is used to realize the data transmission of human-computer interaction business; After the first electronic device automatically establishes the first wireless connection with the stylus, it further includes: After the stylus disconnects from the second electronic device, the first electronic device automatically establishes the second wireless connection with the stylus.

9. The method according to any one of claims 1 to 8, characterized in that, The first wireless connection is a GATT (General Attribute Protocol) connection.

10. The method according to claim 8, characterized in that, The second wireless connection is a HOGP (Human Interface Protocol) connection based on GATT.

11. A method for controlling the connection of a stylus, characterized in that, The method is applied to a first electronic device, wherein the stylus and a second electronic device establish a first wireless connection when they are paired, and the first wireless connection is used to realize general business data transmission; The method includes: The first electronic device sends a screen mirroring request to the second electronic device to display its own screen mirroring interface on the second electronic device; The first electronic device receives a screen mirroring success message returned by the second electronic device; The first electronic device automatically pairs with the stylus when it is not paired with the stylus, based on the physical address of the stylus obtained from the second electronic device during the screen mirroring operation, and then automatically establishes the first wireless connection with the stylus.

12. The method according to claim 11, characterized in that, After the first electronic device automatically establishes the first wireless connection with the stylus, it further includes: The first electronic device records wireless connection establishment information, which indicates that the first wireless connection between itself and the stylus was established by the screen projection operation.

13. The method according to claim 11, characterized in that, The successful screen mirroring message includes the physical address of the stylus.

14. The method according to any one of claims 11 to 13, characterized in that, After the first electronic device automatically establishes the first wireless connection with the stylus, it further includes: The first electronic device sends a screen mirroring disconnect command to the second electronic device, so that its own screen mirroring interface stops being displayed on the second electronic device; The first electronic device receives a screen mirroring disconnect success message returned by the second electronic device; The first electronic device detects that its first wireless connection with the stylus was established by the screen projection operation and automatically disconnects the first wireless connection from the stylus.

15. The method according to claim 14, characterized in that, The query to determine that the first wireless connection between itself and the stylus is established upon being triggered by a screen projection operation includes: The first electronic device determines, based on the recorded wireless connection establishment information, that its first wireless connection with the stylus was established by the screen projection operation.

16. The method according to claim 14 or 15, characterized in that, The automatic disconnection from the first wireless connection with the stylus includes: The first electronic device automatically disconnects the first wireless connection with the stylus based on the physical address of the stylus obtained from the second electronic device during the screen mirroring disconnection process.

17. The method according to any one of claims 14 to 16, characterized in that, The successful screen mirroring disconnection message includes the physical address of the stylus.

18. The method according to any one of claims 11 to 17, characterized in that, The stylus establishes a second wireless connection with the second electronic device, and the second wireless connection is used to realize the data transmission of human-computer interaction business; After the first electronic device establishes the first wireless connection with the stylus, it further includes: After the stylus disconnects from the second electronic device, the first electronic device automatically establishes the second wireless connection with the stylus.

19. The method according to any one of claims 11 to 18, characterized in that, The first wireless connection is a GATT connection.

20. The method according to claim 18, characterized in that, The second wireless connection is an HOGP connection.

21. A first electronic device, characterized in that, include: Display screen; One or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more computer programs including instructions that, when executed by the device, cause the device to perform the stylus connection control method according to any one of claims 1 to 10 or the stylus connection control method according to any one of claims 11 to 20.

22. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the stylus connection control method according to any one of claims 1 to 10 or the stylus connection control method according to any one of claims 11 to 20.

23. A computer program product containing instructions, characterized in that, When the computer program product is run on a computer or any at least one processor, it causes the computer to perform the stylus connection control method as described in any one of claims 1 to 10 or the stylus connection control method as described in any one of claims 11 to 20.