Patent ID: 12216839

DESCRIPTION OF EMBODIMENTS

FIG.1is a schematic diagram of a scenario to which the embodiments of this application are applicable. Referring toFIG.1, the scenario includes a stylus (stylus)100, an electronic device200, and a wireless keyboard300. InFIG.1, an example in which the electronic device200is a tablet (tablet) is used for description. The stylus100and the wireless keyboard300each may provide an input to the electronic device200, and in response to the input, the electronic device200performs an operation based on the input of the stylus100or the wireless keyboard300. A touch area may be disposed on the wireless keyboard300. The stylus100may operate the touch area of the wireless keyboard300to provide an input to the wireless keyboard300, and based on the input of the stylus100, the wireless keyboard300may perform an operation in response to the input. In an embodiment, the stylus100and the electronic device200, the stylus100and the wireless keyboard300, and the electronic device200and the wireless keyboard300may be interconnected through a communication network, to implement interaction between wireless signals. The communication network may be, but is not limited to, a short-range communication network, such as a Wi-Fi hotspot network, a Wi-Fi peer-to-peer (peer-to-peer, P2P) network, a Bluetooth network, a ZigBee network, or a near field communication (near field communication. NFC) network.

The stylus100may be, but is not limited to, an inductive stylus and a capacitive stylus. The electronic device200has a touchscreen201. When the stylus100is an inductive stylus, an electromagnetic induction board needs to be integrated on the touchscreen201of the electronic device200interacting with the stylus100. A coil is distributed on the electromagnetic induction board, and a coil is also integrated in the inductive stylus. According to an electromagnetic induction principle, the inductive stylus can accumulate electric energy with movement of the inductive stylus in a magnetic field range generated by the electromagnetic induction board. The inductive stylus can transmit the accumulated electric energy to the electromagnetic induction board through the coil in the inductive stylus and free oscillation. The electromagnetic induction board may scan the coil on the electromagnetic induction board based on the electric energy from the inductive stylus, and calculate a location of the inductive stylus on the touchscreen201. The touchscreen201of the electronic device200may also be referred to as a touch screen, and the stylus201may be referred to as a stylus.

The capacitive stylus may include a passive capacitive stylus and an active capacitive stylus. The passive capacitive stylus may be referred to as a passive capacitive stylus, and the active capacitive stylus may be referred to as an active capacitive stylus.

One or more electrodes may be disposed in the active capacitive stylus (for example, a stylus tip). The active capacitive stylus may transmit a signal through the electrode. When the stylus100is an active capacitive stylus, an electrode array needs to be integrated on the touchscreen201of the electronic device200interacting with the stylus100. In an embodiment, the electrode array may be a capacitive electrode array. The electronic device200may receive a signal from the active capacitive stylus through the electrode array, and when receiving the signal, identify a location of the active capacitive stylus on the touchscreen and an inclination angle of the active capacitive stylus based on a change in a capacitance value on the touchscreen201.

FIG.2Ais a schematic diagram of a structure of a stylus according to an embodiment of this application. Referring toFIG.2A, the stylus100may include a stylus tip10, a stylus rod20, and a rear cover30. The inside of the stylus rod20is in a hollow structure. The stylus tip10and the rear cover30are respectively located at two ends of the stylus rod20. The rear cover30and the stylus rod20may be connected through plugging or snapping. For a fitting relationship between the stylus tip10and the stylus rod20, refer to descriptions inFIG.2B.

FIG.2Bis a schematic diagram of a partially split structure of a stylus according to an embodiment of this application. Referring toFIG.2B, the stylus100further includes a spindle component50. The spindle component50is located in the stylus rod20, and the spindle component50is slidably disposed in the stylus rod20. The spindle component50has an external screw thread51, and the stylus tip10includes a writing end11and a connecting end12. The connecting end12of the stylus tip10has an internal screw thread (not shown) fitting the external screw thread51.

When the spindle component50is assembled into the stylus rod20, the connecting end12of the stylus tip10extends into the stylus rod20and is threadedly connected to the external screw thread51of the spindle component50. In some other examples, the connecting end12of the stylus tip10may alternatively be connected to the spindle component50in a detachable manner such as snapping. The connecting end12of the stylus tip10is detachably connected to the spindle component50, to implement replacement of the stylus tip10.

To detect pressure applied to the writing end11of the stylus tip10, as shown inFIG.2A, there is a gap10abetween the stylus tip10and the stylus rod20. In this way, it can be ensured that when the writing end11of the stylus tip10is subjected to an external force, the stylus tip10can move toward the stylus rod20, and movement of the stylus tip10drives the spindle component50to move in the stylus rod20. To detect the external force, as shown inFIG.2B, a pressure sensing component60is disposed on the spindle component50. A part of the pressure sensing component60is fixedly connected to a fastener in the stylus rod20, and a part of the pressure sensing component60is fixedly connected to the spindle component50. In this way, when the spindle component50moves with the stylus tip10, because the part of the pressure sensing component60is fixedly connected to the fastener in the stylus rod20, movement of the spindle component50drives deformation of the pressure sensing component60, and the deformation of the pressure sensing component60is transmitted to a circuit board70(for example, the pressure sensing component60and the circuit board70can be electrically connected through a wire or a flexible circuit board). The circuit board70detects the pressure of the writing end11of the stylus tip10based on the deformation of the pressure sensing component60, and therefore controls a line thickness of the writing end11based on the pressure of the writing end11of the stylus tip10.

It should be noted that detection on the pressure of the stylus tip10includes but is not limited to the foregoing method. For example, a pressure sensor may be further disposed at the writing end11of the stylus tip10, and the pressure of the stylus tip10is detected by the pressure sensor.

In this embodiment, as shown inFIG.2B, the stylus100further includes a plurality of electrodes. The plurality of electrodes may be, for example, a first transmitting electrode41, a ground electrode43, and a second transmitting electrode42. The first transmitting electrode41, the ground electrode43, and the second transmitting electrode42are electrically connected to the circuit board70. The first transmitting electrode41may be located in the stylus tip10and close to the writing end11. The circuit board70may be configured to provide a signal control board to each of the first transmitting electrode41and the second transmitting electrode42, and the first transmitting electrode41is configured to transmit a first signal. When the first transmitting electrode41is close to the touchscreen201of the electronic device200, a coupling capacitance may be formed between the first transmitting electrode41and the touchscreen201of the electronic device200, so that the electronic device200can receive the first signal. The second transmitting electrode42is configured to transmit a second signal, and the electronic device200can determine an inclination angle of the stylus100based on the received second signal. In this embodiment of this application, the second transmitting electrode42may be located on an inner wall of the stylus rod20. In an example, the second transmitting electrode42may alternatively be located on the spindle component50.

The ground electrode43may be located between the first transmitting electrode41and the second transmitting electrode42, or the ground electrode43may be located at an outer periphery of the first transmitting electrode41and the second transmitting electrode42, and the ground electrode43is configured to reduce coupling between the first transmitting electrode41and the second transmitting electrode42.

When the electronic device200receives a first signal from the stylus100, a capacitance value at a corresponding location on the touchscreen201changes. Based on this, the electronic device200may determine a location of the stylus100(or the stylus tip of the stylus100) on the touchscreen201based on the change in the capacitance value on the touchscreen201. In addition, the electronic device200may obtain the inclination angle of the stylus100by using a double-tip projection method in an inclination angle detection algorithm. Because locations of the first transmitting electrode41and the second transmitting electrode42in the stylus100are different, when the electronic device200receives the first signal and a second signal from the stylus100, capacitance values at the two locations on the touchscreen201change. The electronic device200may obtain the inclination angle of the stylus100based on a distance between the first transmitting electrode41and the second transmitting electrode42and a distance between the two locations at which the capacitance values on the touchscreen201change. For more detailed descriptions of obtaining the inclination angle of the stylus100, refer to related descriptions of the double-tip projection method in the conventional technology.

In this embodiment of this application, as shown inFIG.2B, the stylus100further includes a battery assembly80, where the battery assembly80is configured to provide power to the circuit board70. The battery assembly80may include a lithium-ion battery, or the battery assembly80may include a nickel-chromium battery, an alkaline battery, a nickel-metal hydride battery, or the like. In an embodiment, the battery included in the battery assembly80may be a rechargeable battery or a disposable battery. When the battery included in the battery assembly80may be the rechargeable battery, the stylus100can charge the battery in the battery assembly80through wireless charging.

When the stylus100is an active capacitive stylus, as shown inFIG.3, after the electronic device200is wirelessly connected to the stylus100, the electronic device200may send an uplink signal to the stylus100through the electrode array integrated on the touchscreen201. The stylus100may receive the uplink signal through a receiving electrode, and the stylus100transmits a downlink signal through a transmitting electrode (for example, the first transmitting electrode41and the second transmitting electrode42). The downlink signal includes the first signal and the second signal. When the stylus tip10of the stylus100is in contact with the touchscreen201, the capacitance value at the corresponding location on the touchscreen201changes, and the electronic device200may determine a location of the stylus tip10of the stylus100on the touchscreen201based on the capacitance value on the touchscreen201. In an embodiment, the uplink signal and the downlink signal may be square wave signals.

In an embodiment, as shown inFIG.4, the wireless keyboard300may include a first portion301and a second portion302. For example, the wireless keyboard300may include a keyboard body and a keyboard cover. The first portion301may be the keyboard cover, and the second portion302is the keyboard body. The first portion301is configured to place the electronic device200, and the second portion302may be provided with a button, a touchpad, or the like for a user operation.

When the wireless keyboard300is used, the first portion301and the second portion302of the wireless keyboard300need to be opened. When the wireless keyboard300is not used, the first portion301and the second portion302of the wireless keyboard300can be closed. In an embodiment, the first portion301and the second portion302of the wireless keyboard300are rotatably connected to each other. For example, the first portion301and the second portion302may be connected through a rotating shaft or a hinge. Alternatively, in some examples, the first portion301and the second portion302are rotatably connected by using a flexible material (for example, a leather material or a cloth material). Alternatively, in some examples, the first portion301and the second portion302may be integrally formed, and a connection part between the first portion301and the second portion302is thinned, so that the connection part between the first portion301and the second portion302can be bent. A manner of the connection between the first portion301and the second portion302may include but is not limited to the foregoing rotational connection manners.

The first portion301may include at least two rotatably connected supports. For example, as shown inFIG.4, the first portion301includes a first support301aand a second support301b. The first support301aand the second support301bare rotatably connected to each other. During use, the first support301aand the second support301bmay be used to jointly support the electronic device200(for details, refer toFIG.1). Alternatively, the first support301asupports the second support301b, and the second support301bsupports the electronic device200. Referring toFIG.4, the second support301band the second portion302are rotatably connected to each other.

As shown inFIG.4, to accommodate the stylus100, the wireless keyboard300may be provided with an accommodating portion303for accommodating the stylus100. As shown inFIG.4, the accommodating portion303is a tubular cavity. During accommodation, the stylus100is inserted into the accommodating cavity along an arrow direction inFIG.4. In this embodiment, as shown inFIG.4, the second portion302and the second support301bare rotatably connected to each other through a connecting portion304, and the accommodating portion303is disposed in the connecting portion304. The connecting portion304may be a rotating shaft.

FIG.5Ais a schematic diagram in which a stylus is accommodated in an accommodating portion of a wireless keyboard according to an embodiment of this application.FIG.5Bis a schematic side view obtained when a stylus is accommodated in an accommodating portion of a wireless keyboard according to an embodiment of this application. Referring toFIG.5B, the accommodating portion303is a circular cavity, and an inner diameter of the accommodating portion303is greater than an outer diameter of the stylus100.

In an embodiment, a magnetic material may be disposed on an inner wall of the accommodating portion303, and a magnetic material may be disposed in the stylus100, to prevent the stylus100from falling out of the accommodating portion303. The stylus100is attached in the accommodating portion303through magnetic adsorption between the magnetic materials. Certainly, in some examples, when the stylus100is fastened to the accommodating portion303, the stylus100is fastened to the accommodating portion303through magnetic adsorption or the like. For example, the stylus100may also be alternatively to the accommodating portion303through snapping.

To facilitate removal of the stylus100from the accommodating portion303, an eject structure may be disposed in the accommodating portion303. For example, one end of the stylus100is pressed, so that the eject mechanism can drive one end of the stylus100to eject from the accommodating portion303.

FIG.6is a schematic diagram of a hardware structure of a stylus according to an embodiment of this application. Referring toFIG.6, the stylus100may have a processor110. The processor110may include storage and processing circuits configured to support operations of the stylus100. The storage and processing circuits may include a storage apparatus (for example, a flash memory or another electrical programmable read-only memory configured as a solid-state drive) such as a non-volatile memory, a volatile memory (for example, a static or dynamic random access memory), and the like. The processing circuit in the processor110may be configured to control an operation of the stylus100. The processing circuit may be based on one or more microprocessors, microcontrollers, digital signal processors, baseband processors, power management units, audio chips, application-specific integrated circuits, and the like.

The stylus100may include one or more sensors. For example, the sensor may include a pressure sensor120. The pressure sensor120may be disposed at the writing end11of the stylus100(as shown inFIG.2B). Certainly, the pressure sensor120may alternatively be disposed in the stylus rod20of the stylus100. In this way, after one end of the stylus tip10of the stylus100is subject to a force, the other end of the stylus tip10moves to apply the force to the pressure sensor120. In an embodiment, the processor110may adjust, based on pressure detected by the pressure sensor120, a writing line thickness of the stylus tip10of the stylus100.

The sensor may also include an inertial sensor130. The inertial sensor130may include a three-axis accelerometer and a three-axis gyroscope, and/or another component configured to measure movement of the stylus100. For example, a three-axis magnetometer may be included in the sensor in a configuration of a nine-axis inertial sensor. The sensor may also include an additional sensor, such as a temperature sensor, an ambient light sensor, an optical proximity sensor, a contact sensor, a magnetic sensor, a pressure sensor, and/or another sensor.

The stylus100may include a status indicator140such as a light-emitting diode and a button150. The status indicator140is configured to prompt a user with a status of the stylus100. The button150may include a mechanical button and a non-mechanical button, and the button150may be configured to collect button press information from the user.

In this embodiment of this application, the stylus100may include one or more electrodes160(for details, refer to the descriptions inFIG.2B), one electrode160may be located at the writing end of the stylus100, and one electrode160may be located in the stylus tip10. For details, refer to the foregoing related descriptions.

The stylus100may include a sensing circuit170. The sensing circuit170may sense capacitive coupling between the electrode160and a drive line on a capacitive touch sensor panel interacting with the stylus100. The sensing circuit170may include an amplifier used to receive capacitive readings from the capacitive touch sensor panel, a clock used to generate a demodulation signal, a phase shifter used to generate a phase-shifted demodulation signal, a mixer used to demodulate capacitive readings by using an in-phase demodulation frequency component, a mixer used to demodulate capacitive readings by using a quadrature demodulation frequency component, and the like. A demodulation result of the mixer may be used to determine an amplitude proportional to a capacitance, so that the stylus100can sense contact with the capacitive touch sensor panel.

It can be understood that the stylus100may include a microphone, a speaker, an audio generator, a vibrator, a camera, a data port, and another device based on an actual requirement. The user may use these devices to provide commands to control operations of the stylus100and the electronic device200interacting with the stylus100, and receive status information and another output.

The processor110may be configured to run software that is on the stylus100and that controls an operation of the stylus100. In an operation process of the stylus100, the software running on the processor110may process a sensor input, a button input, and an input from another apparatus to monitor movement of the stylus100and an input of another user. The software running on the processor110may detect a user command and may communicate with the electronic device200.

To support wireless communication between the stylus100and the electronic device200, the stylus100may include a wireless module. InFIG.6, an example in which the wireless module is a Bluetooth module180is used for description. The wireless module may alternatively be a Wi-Fi hotspot module, a Wi-Fi peer-to-peer module, or the like. The Bluetooth module180) may include a radio frequency transceiver, for example, a transceiver. The Bluetooth module180may also include one or more antennas. The transceiver may transmit and/or receive a wireless signal through the antenna. The wireless signal may be a Bluetooth signal, a wireless local area network signal, a remote signal such as a cellular phone signal, a near field communication signal, or another wireless signal based on a type of the wireless module.

The stylus100may further include a charging module190. The charging module190may support charging of the stylus100to provide power to the stylus100.

It should be understood that the electronic device200in this embodiment of this application may be referred to as user equipment (user equipment, UE), a terminal (terminal), or the like. For example, the electronic device200may be a mobile terminal or a fixed terminal including a touchscreen, for example, a tablet (portable android device, PAD), a personal digital assistant (personal digital assistant. PDA), a handheld device having a wireless communication function, a computing device, a vehicle-mounted device, a wearable device, a virtual reality (virtual reality, VR) terminal device, an augmented reality (augmented reality, AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in self driving (self driving), a wireless terminal in remote medical (remote medical), a wireless terminal in a smart grid (smart grid), a wireless terminal in transportation safety (transportation safety), a wireless terminal in a smart city (smart city), or a wireless terminal in a smart home (smart home). A form of the terminal device is not specifically limited in the embodiments of this application.

FIG.7is a schematic diagram of a hardware structure of an electronic device according to an embodiment of this application. Referring toFIG.7, the electronic device200may include a plurality of subsystems. The subsystems cooperate to perform, coordinate, or monitor one or more operations or functions of the electronic device202. The electronic device200includes a processor210, an input surface220, a coordination engine230, a power subsystem240, a power connector250), a wireless interface260, and a display270.

For example, the coordination engine230may be configured to: communicate with another subsystem of the electronic device200and/or process data; communicate with and/or exchange data with the stylus100; measure and/or obtain one or more outputs of one or more analog or digital sensors (for example, touch sensors); measure and/or obtain one or more outputs of one or more sensor nodes in a sensor node array (for example, a capacitive sensing node array); receive and position a tip signal and a ring signal from the stylus100; position the stylus100based on locations of a tip signal crossing area and a ring signal crossing area, and the like.

The coordination engine230of the electronic device200includes or may be communicatively coupled, in another manner, to a sensor layer located below the input surface220or integrated with the input surface. The coordination engine230uses the sensor layer to position the stylus100on the input surface220, and uses the technology described in this specification to estimate an angular location of the stylus100relative to a plane of the input surface220. In an embodiment, the input surface220may be referred to as a touchscreen201.

For example, the sensor layer of the coordination engine230of the electronic device200is a grid of capacitive sensing nodes arranged in columns and rows. More specifically, a column trace array is set to be perpendicular to a row trace array. The sensor layer may be separated from other layers of the electronic device, or the sensor layer may be disposed directly on another layer. The other layers are, for example but not limited to: a display stack layer, a force sensor layer, a digitizer layer, a polarizer layer, a battery layer, a structural or decorative shell layer, and the like.

The sensor layer can operate in various modes. If the sensor layer operates in mutual capacitance mode, a column trace and a row trace form a single capacitive sensing node (for example, a “vertical” mutual capacitance) at each overlapping point. If the sensor layer operates in self-capacitive mode, a column trace and a row trace form two (vertically aligned) capacitive sensing nodes at each overlapping point. In another implementation solution, if the sensor layer operates in mutual capacitance mode, adjacent column traces and/or adjacent row traces each may form a single capacitive sensing node (for example, a “horizontal” mutual capacitance). As described above, the sensor layer may monitor a change in a capacitance (for example, a mutual capacitance or a self-capacitance) presented at each capacitive sensing node to detect existence of the stylus tip10of the stylus100and/or touch of a finger of the user. In many cases, the coordination engine230may be configured to detect, through capacitive coupling, the tip signal and the ring signal received from the stylus100through the sensor layer.

The tip signal and/or the ring signal may include specific information and/or data that may be used to enable the electronic device200to identify the stylus100. Such information is usually referred to as “stylus identity.” information in this specification. The information and/or the data may be received by the sensor layer, and interpreted, decoded, and/or demodulated by the coordination engine230.

The processor210may use the stylus identity information to receive an input from more than one stylus simultaneously. Specifically, the coordination engine230may be configured to transmit, to the processor210, a location and/or an angular location that are/is of each of several styluses and that are/is detected by the coordination engine230. In another case, the coordination engine230) may further transmit, to the processor210, information about relative locations and/or relative angular locations that are of a plurality of styluses and that are detected by the coordination engine230). For example, the coordination engine220may notify the processor210of a location of the detected first stylus relative to the detected second stylus.

In another case, the tip signal and/or the ring signal may further include specific information and/or data used to enable the electronic device200to identify a specific user. Such information is usually referred to as “user identity” information in this specification.

The coordination engine230may forward the user identity information (if the user identity information can be detected and/or can be restored) to the processor210. If the user identity information cannot be restored from the tip signal and/or the ring signal, the coordination engine230) may optionally indicate to the processor210that the user identity information is unavailable. The processor210can utilize the user identity information (or absence of such information) in any suitable manner, including but not limited to: accepting or denying an input from the specific user, allowing or denying access to a specific function of the electronic device, and the like. The processor210may use the user identity information to simultaneously receive an input from more than one user.

In another case, the tip signal and/or the ring signal may include specific information and/or data that may be used to enable the electronic device200to identify settings or preferences of the user or the stylus100. Such information is usually referred to as “stylus settings” information in this specification.

The coordination engine230may forward the stylus settings information (if the stylus settings information can be detected and/or can be restored) to the processor210. If the stylus settings information cannot be restored from the tip signal and/or the ring signal, the coordination engine230may optionally indicate to the processor210that the stylus settings information is unavailable. The electronic device200can utilize the stylus settings information (or absence of such information) in any suitable manner, including but not limited to: applying settings to the electronic device, applying settings to a program running on the electronic device, changing a line thickness, a color, a pattern presented by a graphics program of the electronic device, changing settings of a video game operated on the electronic device, and the like.

In general, the processor210may be configured to perform, coordinate, and/or manage functions of the electronic device200. Such functions may include, but are not limited to, communicating with and/or exchanging data with other subsystems of the electronic device200; communicating with and/or exchanging data with the stylus100; performing data communication and/or data exchange over a wireless interface; performing data communication and/or data exchange over a wired interface; facilitating exchange of power through a wireless (for example, inductive or resonant) or wired interface; receiving a location and an angular location of one or more styluses; and so on.

The processor210may be implemented as any electronic device capable of processing, receiving, or sending data or instructions. For example, the processor may be a microprocessor, a central processing unit, an application-specific integrated circuit, a field programmable gate array, a digital signal processor, an analog circuit, a digital circuit, or a combination of these devices. The processor may be a single-threaded processor or a multi-threaded processor. The processor may be a single-core processor or a multi-core processor.

During use, the processor210may be configured to access a memory that stores instructions. The instructions may be configured to enable the processor to perform, coordinate, or monitor one or more operations or functions of the electronic device200.

The instructions stored in the memory may be configured to control or coordinate operations of other components of the electronic device200. The components are, for example but not limited to, another processor, an analog or digital circuit, a volatile or nonvolatile memory module, a display, a speaker, a microphone, a rotary input device, a button, or other physical input devices, a biometric authentication sensor and/or system, a force or touch input/output component, a communication module (for example, a wireless interface and/or a power connector), and/or a haptic device or a haptic feedback device.

The memory may further store electronic data usable by the stylus or the processor. For example, the memory may store electronic data or content (such as a media file, a document, and an application), device settings and preferences, a timing signal and a control signal, data, data structures, or databases used for various modules, a file or a configuration related to detection of a tip signal and/or a ring signal, and the like. The memory may be configured as any type of memory. For example, the memory may be implemented as a random access memory, a read-only memory, a flash memory, a removable memory, another type of storage element, or a combination of these devices.

The electronic device200further includes the power subsystem240. The power subsystem240may include a battery or another power supply. The power subsystem240may be configured to provide power to the electronic device200. The power subsystem240may be further coupled to the power connector250. The power connector250may be any proper connector or port, and may be configured to receive power from an external power supply and/or configured to provide power to an external load. For example, in some implementation solutions, the power connector250may be configured to recharge a battery in the power subsystem240. In another implementation solution, the power connector250may be configured to transmit power stored in (or available to) the power subsystem240to the stylus100.

The electronic device200further includes the wireless interface260to facilitate electronic communication between the electronic device200and the stylus100. In an implementation solution, the electronic device200may be configured to communicate with the stylus100through a low energy Bluetooth communication interface or a near field communication interface. In another example, the communication interface facilitates electronic communication between the electronic device200and an external communication network, a device, or a platform.

The wireless interface260(whether a communication interface between the electronic device200and the stylus100or another communication interface) may be implemented as one or more wireless interfaces, a Bluetooth interface, a near field communication interface, a magnetic interface, a universal serial bus interface, an inductance interface, a resonant interface, a capacitive coupling interface, a Wi-Fi interface, a TCP/IP interface, a network communication interface, an optical interface, an acoustic interface, or any conventional communication interface.

The electronic device200further includes the display270. The display270may be located behind the input surface220, or may be integrated with the input surface220. The display270) may be communicatively coupled to the processor210. The processor210may present information to a user through the display270. In many cases, the processor210presents, through the display270, a graphical user interface with which a user can interact. In many cases, the user manipulates the stylus100to interact with a graphical user interface.

It is appreciated by a person skilled in the art that some of the foregoing specific details presented by the electronic device200may not be required to practice the particular described implementation solutions or equivalents thereof. Similarly, another electronic device may include more subsystems, modules, components, and the like. In a proper case, some submodules may be implemented as software or hardware. Therefore, it should be understood that the foregoing descriptions are not intended to be exhaustive or to limit the disclosure to the exact form described in this specification. On the contrary, it is appreciated by a person of ordinary skill in the art that many modifications and variations are possible based on the foregoing teachings.

FIG.8is a schematic diagram of a hardware structure of a wireless keyboard according to an embodiment of this application. Referring toFIG.8, the wireless keyboard300may include a processor310, a memory320, a charging interface330, a charging management module340), a wireless charging coil350, a battery360, a wireless communication module370, a touchpad380, and a keyboard390.

The processor310, the memory320, the charging interface330, the charging management module340, the battery360, the wireless communication module370, the touchpad380, the keyboard390, and the like may all be disposed on a keyboard body (that is, the second portion302shown inFIG.4) of the wireless keyboard300. The wireless charging coil350may be disposed in the connecting portion304(shown inFIG.4) for movably connecting the keyboard body and a support. It can be understood that the structure shown in this embodiment does not constitute a specific limitation on the wireless keyboard300. In some other embodiments, the wireless keyboard300may include more or fewer components than those shown in the figure, or combine some components, or split some components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

The memory320may be configured to store program code, for example, program code used to wirelessly charge the stylus100. The memory320may further store a Bluetooth address for uniquely identifying the wireless keyboard300. In addition, the memory320may further store connection data of an electronic device successfully paired with the wireless keyboard300. For example, the connection data may be a Bluetooth address of the electronic device successfully paired with the wireless keyboard300. Based on the connection data, the wireless keyboard300can be automatically paired with the electronic device without configuring a connection between the wireless keyboard300and the electronic device, for example, performing validity verification. The Bluetooth address may be a media access control (media access control, MAC) address.

The processor310may be configured to execute the foregoing application program code, and invoke related modules to implement functions of the wireless keyboard300in the embodiments of this application, for example, implement a wired charging function, a reverse wireless charging function, a wireless communication function, and the like of the wireless keyboard300. The processor310may include one or more processing units, and different processing units may be separate devices or may be integrated into one or more processors310. The processor310may be specifically an integrated control chip, or may include a circuit including various active and/or passive components, and the circuit is configured to perform functions of the processor310described in this embodiment of this application. The processor of the wireless keyboard300may be a microprocessor.

The wireless communication module370may be configured to support data exchange in wireless communication that is between the wireless keyboard300and another electronic device and that includes Bluetooth (bluetooth, BT), a global navigation satellite system (global navigation satellite system, GNSS), a wireless local area network (wireless local area networks, WLAN) (for example, a wireless fidelity (wireless fidelity. Wi-Fi) network), frequency modulation (frequency modulation, FM), a near field communication (near field communication, NFC) technology, an infrared (infrared, IR) technology, and the like.

In some embodiments, the wireless communication module370may be a Bluetooth chip. The wireless keyboard300may be a Bluetooth keyboard. The wireless keyboard300may be paired with a Bluetooth chip of another electronic device through the Bluetooth chip and establish a wireless connection, to implement wireless communication between the wireless keyboard300and the another electronic device through the wireless connection.

In addition, the wireless communication module370may further include an antenna. The wireless communication module370receives an electromagnetic wave through the antenna, performs frequency modulation and filtering processing on an electromagnetic wave signal, and sends a processed signal to the processor310. The wireless communication module370may further receive a to-be-sent signal from the processor310, perform frequency modulation and amplification on the signal, and convert the signal into an electromagnetic wave for radiation through the antenna.

In some embodiments, the wireless keyboard300may support wired charging. Specifically, the charging management module340may receive a charging input of a wired charger through the charging interface330.

In some other embodiments, the wireless keyboard300may support forward wireless charging. The charging management module340may receive a wireless charging input through the wireless charging coil350of the wireless keyboard300. Specifically, the charging management module340is connected to the wireless charging coil350through a matching circuit. The wireless charging coil350may be coupled to the wireless charging coil of the wireless charger to induce an alternating electromagnetic field emitted by the wireless charging coil350of the wireless charger and generate an alternating electrical signal. The alternating current signal generated by the wireless charging coil350is transmitted to the charging management module340through the matching circuit, so as to charge the battery330wirelessly.

The charging management module340may further supply power to the wireless keyboard300while charging the battery330. The charging management module340receives an input of the battery330, and supplies power to the processor310, the memory320, an external memory, the wireless communication module370, and the like. The charging management module340may be further configured to monitor parameters such as a battery capacity, a battery cycle count, and a battery health status (such as leakage or impedance) of the battery360. In some other embodiments, the charging management module340may alternatively be disposed in the processor310.

In some other embodiments, the wireless keyboard300may support reverse wireless charging. Specifically, the charging management module340may further receive an input of the charging interface330or the battery360, and convert a direct electric signal that is input by the charging interface330or the battery360into an alternating electric signal. The alternating electric signal is transmitted to the wireless charging coil350through a matching circuit. The wireless charging coil350may generate an alternating electromagnetic field when receiving the alternating electric signal. A wireless charging coil of another mobile terminal induces the alternating electromagnetic field to perform wireless charging. To be specific, the wireless keyboard300may also wirelessly charge the another mobile terminal. In an embodiment, the wireless charging coil350may be disposed in the accommodating portion303of the wireless keyboard300, and a wireless charging coil is disposed in the stylus rod20of the stylus100. When the stylus100is placed in the accommodating portion303, the wireless keyboard300may charge the stylus100through the wireless charging coil350.

It should be noted that the matching circuit may be integrated into the charging management module340, and the matching circuit may be independent of the charging management module340. This is not limited in this embodiment of this application.FIG.8is a schematic diagram of a hardware structure of the wireless keyboard300by using an example in which the matching circuit may be integrated into the charging management module340.

The charging interface350) may be configured to provide a wired connection for charging or communication between the wireless keyboard300and another electronic device (for example, the wired charger of the wireless keyboard300).

A touch sensor is integrated into the touchpad380. A notebook computer may receive a user control command on the notebook computer through the touchpad380and the keyboard390.

It can be understood that the structure shown in this embodiment of this application does not constitute a specific limitation on the wireless keyboard300. The wireless keyboard300may have more or fewer components than those shown inFIG.8, may combine two or more components, or may have different component configurations. For example, a housing of the wireless keyboard300may alternatively be provided with an accommodating portion for accommodating the stylus100. The wireless charging coil350is disposed in the accommodating portion, and is configured to wirelessly charge the stylus100when the stylus100is accommodated in the accommodating portion.

For another example, the outer surface of the wireless keyboard300may further include components such as a button, an indicator (which may indicate a state such as a battery level, an incoming/outgoing call, and a pairing mode), and a display screen (which may prompt a user with related information). The button may be a physical button, a touch key (used in collaboration with the touch sensor), or the like, and is used to trigger an operation such as power-on, power-off, starting charging, or stopping charging.

Referring to the related descriptions inFIG.3, after the stylus is wirelessly connected to the electronic device, the stylus may send a downlink signal to the electronic device. Based on the downlink signal, the electronic device may determine a location and an inclination angle of the stylus, and further display handwriting on the touchscreen based on the location and the inclination angle of the stylus. When the stylus is not wirelessly connected to the electronic device, the stylus cannot interact with the electronic device. A precondition for wireless connection between the stylus and the electronic device is pairing. Therefore, the stylus needs to be paired with and connected to the electronic device before providing an input to the electronic device.

A process of pairing between the electronic device and the stylus is a mutual authentication process between the two devices. After the electronic device is paired with the stylus, the electronic device and the stylus may not have to be paired each time for a subsequent connection. For the pairing between the electronic device and the stylus, mutual authentication may be performed through personal identification number (personal identification number. PIN) authentication. After the electronic device is paired with the stylus, the electronic device may establish a connection based on a media access control (MAC) address of the stylus. It should be understood that the process of pairing and connection between the electronic device and the stylus is briefly described herein. For details, refer to related descriptions in a standard protocol for Bluetooth pairing and connection.

In an embodiment, the electronic device and the stylus each have a Bluetooth function. When the electronic device is paired with the stylus, the user can perform an operation on the electronic device to enable Bluetooth on the electronic device, so as to scan a Bluetooth-enabled device around. The electronic device may display, on a graphical user interface, an identifier of a stylus detected by scanning, and the user taps, on the graphical user interface, on an identifier of a stylus that needs to be paired, to further implement pairing between the electronic device and the stylus. After the pairing between the electronic device and the stylus is completed, a Bluetooth connection may be established between the electronic device and the stylus.

A process of triggering the pairing between the electronic device and the stylus by the user is complex. At present, the stylus may broadcast a packet. Based on the packet, the electronic device can actively discover the stylus, and can be paired with and connected to the stylus when discovering the stylus. Referring toFIG.9, the stylus may be attached to the electronic device. When the stylus is attached to the electronic device, if the electronic device has enabled the Bluetooth function, the electronic device may display a pairing dialog box400. A process of displaying the pairing dialog box by the electronic device may be: When the stylus is attached to the electronic device, the stylus broadcasts a packet through a Bluetooth common channel, where the packet includes the MAC address of the stylus. The electronic device may scan, through Bluetooth low energy (bluetooth low energy, BLE), the packet broadcast by the stylus, and then parse the packet to obtain the MAC address of the stylus. Based on the MAC address of the stylus, the electronic device displays the pairing dialog box to remind the user to trigger the stylus and the electronic device to perform pairing. The user may operate the dialog box to trigger the electronic device to perform pairing with and connection to the stylus based on the MAC address of the stylus. In this example, pairing and connection are performed synchronously on the stylus and the electronic device. Specifically, with reference to related descriptions of a conventional technology, a precondition for the pairing and connection between the stylus and the electronic device is that the electronic device obtains the MAC address of the stylus and displays the pairing dialog box.

As described above, when the stylus is paired with the electronic device, the MAC address of the stylus is broadcast over Bluetooth. If a plurality of Bluetooth-enabled electronic devices exist around the stylus, the plurality of electronic devices each may display a pairing dialog box, causing inconvenience to users.

In the scenario shown inFIG.1, the electronic device, the wireless keyboard, and the stylus all have the Bluetooth function. In an embodiment, with reference to the related descriptions ofFIG.9, the stylus may be paired with and connected to the electronic device by using a broadcast packet. However, this may still lead to a dialog box on other Bluetooth-enabled electronic devices around the stylus.

This embodiment of this application provides the pairing method for a stylus and an electronic device. In the scenario shown inFIG.1, the stylus uses the wireless keyboard as an intermediate apparatus for transmitting the MAC address of the stylus, to transmit the MAC address of the stylus to the electronic device, thereby enabling the electronic device to display the pairing dialog box. Because the stylus can directionally transmit the MAC address of the stylus to the electronic device by using the wireless keyboard, other Bluetooth-enabled electronic devices around the stylus each can be prevented from displaying a dialog box, thereby improving user experience.

It should be understood that, the pairing method for a stylus and an electronic device provided in this application may be applied to the first pairing process or a re-pairing process of the electronic device and the stylus. After the electronic device is paired with the stylus, the electronic device and the stylus always maintain a paired state, and the electronic device and the stylus may not have to be paired each time for a subsequent connection. In an embodiment, if the user restarts the electronic device or enables a flight mode of the electronic device, or the stylus is paired with another electronic device, or the electronic device and the stylus are disconnected for a long time, or the like, and the stylus needs to be reconnected to the electronic device, the electronic device and the stylus need to be paired again.

Before describing the pairing method for a stylus and an electronic device provided in this embodiment of this application, structures of the stylus the wireless keyboard, and the electronic device in this embodiment of this application are further described.

In an embodiment, referring toFIG.10A, the stylus rod20of the stylus100is provided with a first coil90, and the connecting portion304of the wireless keyboard300is provided with a second coil3031. In an embodiment, the second coil3031is located in a space between the connecting portion304and the accommodating portion303, or the second coil3031is located in the accommodating portion303. A location of the second coil3031is not limited in this embodiment. When the stylus100is accommodated in the accommodating portion303, the wireless keyboard300may transmit electric energy to the stylus100through the second coil3031, and the stylus100receives the electric energy from the second coil3031through the first coil90, thereby enabling the wireless keyboard300to charge the stylus100. For the charging of the stylus100by the wireless keyboard300, refer to related descriptions in the Qi protocol.

The first coil90may be understood as being included in the charging module190shown inFIG.6. In an embodiment, the first coil90may be connected to the processor110. The second coil3031is included in the wireless charging coil350shown inFIG.8. In an embodiment, the second coil3031may be connected to the processor310. It should be understood that, other portions of the wireless keyboard300are not shown inFIG.10A.

In an embodiment, referring toFIG.10B, the first support301aof the wireless keyboard300is provided with a third coil3032, and the electronic device200is provided with a fourth coil202. When the electronic device200is placed on the first support301a, the third coil3032overlaps the fourth coil202, and the electronic device200can charge the wireless keyboard300. In an embodiment, the third coil3032is included in the wireless charging coil350shown inFIG.8. In an embodiment, the third coil3032may be connected to the processor310. The fourth coil202is included in the power subsystem240shown inFIG.7, and may be connected to the processor210. It should be understood that, for the first coil90in the stylus100and the second coil3031in the wireless keyboard300shown inFIG.10B, refer to the related descriptions inFIG.10A. A coil is represented by an arc dashed line in bothFIG.10AandFIG.10B.

The pairing method for a stylus and an electronic device provided in this embodiment of this application is described below with reference to specific embodiments. The following embodiments may be mutually combined, and same or similar concepts or processes may not be repeatedly described in some embodiments.

FIG.11is a schematic flowchart of an embodiment of a pairing method for a stylus and an electronic device according to an embodiment of this application. As shown inFIG.11, the pairing method for a stylus and an electronic device may include the following steps.

S1101. A stylus sends a pairing request to a wireless keyboard through a first coil and a second coil.

Referring to the related descriptions ofFIG.8, an alternating current exists in the second coil of the wireless keyboard, and the second coil may generate an alternating electromagnetic field based on the alternating current. Referring toFIG.5A, after the stylus is accommodated in the accommodating portion of the wireless keyboard, based on an electromagnetic induction principle, the first coil can sense the alternating electromagnetic field generated by the second coil, and an induced current is generated in the first coil, so that electric energy can be transmitted from the wireless keyboard to the stylus, and the wireless keyboard can charge the stylus.

When the wireless keyboard charges the stylus, the stylus may send the pairing request to the wireless keyboard through the first coil, and the wireless keyboard may receive the pairing request from the first coil through the second coil. The pairing request is used to instruct an electronic device to output a pairing dialog box. In an embodiment, the pairing request may include an identifier of the stylus. The identifier is used to uniquely represent the stylus. For example, the identifier of the stylus may be a MAC address of the stylus, that is, the pairing request may include the MAC address of the stylus. In an embodiment, the pairing request may further include a model of the stylus, factory information, and the like. The factory information may include a production batch and manufacturer information of the stylus.

In an embodiment, referring to a ofFIG.12, a processor in the stylus is configured to control the first coil to send the pairing request to the wireless keyboard in response to that the wireless keyboard charges the stylus. A dashed line is used to represent transmission of electric energy in a ofFIG.12. In a ofFIG.12, the processor and a Bluetooth module in the stylus may be respectively understood as the processor110and the Bluetooth module180inFIG.6above; a processor and a Bluetooth module in the wireless keyboard may be respectively understood as the processor310and the wireless communication module370inFIG.8above; and a processor and a Bluetooth module in the electronic device may be respectively understood as the processor210and the wireless interface260inFIG.7above. It should be understood that, inFIG.12, the wireless communication module370is used as an example of the Bluetooth module in the wireless keyboard, and the wireless interface260is used as an example of the Bluetooth module in the electronic device. In an embodiment, the Bluetooth modules inFIG.12each may be replaced with another wireless communication module.

In an embodiment, the stylus may communicate with the wireless keyboard based on a Qi protocol. Currently, based on a wireless charging mode of the Qi protocol, a process in which the wireless keyboard charges the stylus may include three stages, which are sequentially a ping stage, an identification and configuration stage, and an electric energy transmission stage. At each stage, data packets may be exchanged between the stylus and the wireless keyboard. For example, at the ping stage, a signal strength data packet and a transmission termination data packet may be exchanged between the stylus and the wireless keyboard. At the identification and configuration stage, a configuration data packet, an identity data packet, and a transmission termination data packet may be exchanged between the stylus and the wireless keyboard. At the electric energy transmission stage, a control error data packet and a received power packet may be exchanged between the stylus and the wireless keyboard. For the data packets at each stage, refer to related descriptions of the current Qi protocol. In an embodiment, the stylus may include the pairing request in a data packet at any stage in the foregoing charging process.

In an embodiment, the data packet at any stage in the charging process may include a preamble portion, a header portion, a data portion, and a checksum portion. For example, the stylus may include the pairing request in the data portion of the data packet. The data portion may carry the pairing request in a form of a field, for example, the field may be “11:22:33:44:55:66”, to represent the MAC address of the stylus.

In an embodiment, the stylus may communicate with the wireless keyboard based on a private protocol. A process in which the stylus communicates with the wireless keyboard based on the private protocol may include a handshake stage and a pairing stage. At the handshake stage and the pairing stage, the stylus may exchange data packets with the wireless keyboard. The stylus may include the pairing request in a data packet at any stage of the communication. For example, the data packet at any stage of the communication may include a header (header) portion, a command (command) portion, and a data (data) portion. For example, the stylus may include the pairing request in the data portion of the data packet, and the data portion may carry the pairing request in a form of a field.

In an embodiment, in response to that the wireless keyboard charges the stylus, the stylus may obtain a status of connection between the stylus and the electronic device. The connection status represents whether the stylus is wirelessly connected to the electronic device. In an embodiment, in response to that the wireless keyboard charges the stylus, the stylus may detect whether the stylus is connected to the electronic device, to further obtain the connection status. Alternatively, the electronic device may detect the connection status, and if the electronic device is already wirelessly connected to the stylus, the electronic device may send the connection status to the stylus. If the electronic device is not wirelessly connected to the stylus, the electronic device may broadcast the connection status, so that the stylus receives the connection status. For example, the electronic device broadcasts the connection status through a Bluetooth channel, and the stylus may receive the connection status. An example in which a wireless connection between the stylus and the electronic device is a Bluetooth connection is used for description in the following embodiments.

If the stylus detects that the stylus is already connected to the electronic device over Bluetooth, when the wireless keyboard charges the stylus, the stylus may not send the pairing request to the wireless keyboard.

In an embodiment, a pairing button may be provided on the stylus. The pairing button is configured to trigger the stylus to send the pairing request. When the wireless keyboard charges the stylus, if the stylus is not connected to the electronic device over Bluetooth and the stylus detects that the user operates the pairing button, the stylus may send the pairing request to the wireless keyboard through the first coil.

In an embodiment, after the stylus is historically paired with and connected to the electronic device, the stylus may store information about the electronic device. The information about the electronic device may include, but is not limited to, a MAC address of the electronic device. It should be understood that, in a process in which the stylus is historically paired with and connected to the electronic device, the electronic device may feed back the MAC address of the electronic device to the stylus. When the wireless keyboard charges the stylus, if the stylus is not connected to the electronic device over Bluetooth, the stylus may determine, based on the information about the electronic device, whether to send the pairing request to the wireless keyboard through the first coil. When the wireless keyboard charges the stylus, the stylus may send a connection request to the electronic device based on the stored MAC address of the electronic device. If the stylus can receive a connection response from the electronic device, the stylus may establish a connection to the electronic device, and the stylus does not send the pairing request to the wireless keyboard. If the stylus does not receive a connection response from the electronic device, the stylus determines that the stylus needs to be paired with and connected to the electronic device again, and the stylus may send a pairing request to the wireless keyboard through the first coil.

S1102. The wireless keyboard sends the pairing request to the electronic device.

The pairing request is used to instruct the wireless keyboard to send the pairing request to the electronic device. To be specific, when receiving the pairing request from the stylus the wireless keyboard may forward the pairing request to the electronic device.

For structures of the wireless keyboard and the electronic device, refer to the illustration inFIG.10A. In an embodiment, the wireless keyboard is already in a connection (for example, a Bluetooth connection) for wireless communication to the electronic device in advance. Because the pairing request from the stylus may be sent based on the Qi protocol or another private protocol, a data packet format for carrying the pairing request is a data packet format supported by the Qi protocol or another private protocol. To enable the electronic device to identify the pairing request from the wireless keyboard, the wireless keyboard may convert, based on a manner of connection between the wireless keyboard and the electronic device, a format of a data packet from the stylus into a format of a data packet that can be identified by the electronic device. In an embodiment, if the wireless keyboard is connected to the electronic device over Bluetooth in advance, the wireless keyboard may convert the data packet from the stylus into a Bluetooth data packet that can be identified by the electronic device, so as to further send a Bluetooth data packet carrying the pairing request to the electronic device. In an embodiment, the wireless keyboard may parse the data packet carrying the pairing request from the stylus, to obtain the MAC address of the stylus, the model of the stylus, the factory information, and the like. The wireless keyboard may encapsulate the MAC address of the stylus, the model of the stylus, and the factory information into a data packet in Bluetooth format.

Referring to b ofFIG.12, the wireless keyboard may receive the pairing request from the stylus based on the second coil, the processor in the wireless keyboard may send the pairing request to the electronic device by using the Bluetooth module in the wireless keyboard, and the electronic device may receive the pairing request based on the Bluetooth module in the electronic device. It should be understood that, when the wireless keyboard sends the pairing request to the electronic device, as illustrated in b ofFIG.12, the wireless keyboard may charge the stylus. Accordingly, the user may alternatively remove the stylus from the accommodating portion, and the wireless keyboard in b ofFIG.12may not charge the stylus.

For structures of the wireless keyboard and the electronic device, refer to the illustration inFIG.10B. In an embodiment, when the electronic device is placed in a support B of the wireless keyboard, the electronic device may transmit electric energy to the third coil through the fourth coil, or the wireless keyboard may transmit electric energy to the fourth coil through the third coil. For details, refer to a wireless charging principle of the wireless keyboard inFIG.8. In this embodiment, when the wireless keyboard receives the pairing request from the stylus, the wireless key board may not process the pairing request, but directly send the pairing request to the electronic device through the third coil. For example, the wireless keyboard may send, to the electronic device through the third coil by using the Qi protocol or another private protocol, the data packet carrying the pairing request from the stylus. For details, refer to the related descriptions in which the stylus sends the pairing request to the wireless keyboard through the first coil.

Referring to b ofFIG.13, the wireless keyboard may receive the pairing request from the stylus based on the second coil, the processor in the wireless keyboard may send the pairing request to the electronic device through the third coil, and the electronic device may receive the pairing request based on the fourth coil. For a inFIG.13, refer to the related descriptions of a inFIG.12.

Compared with that inFIG.12andFIG.13, the wireless keyboard can be used as an intermediate apparatus to forward the pairing request from the stylus to the electronic device. Compared withFIG.13, inFIG.12, the electronic device inFIG.12can forward the pairing request from the stylus to the electronic device, without being placed on the support B of the wireless keyboard.

S1103. The electronic device displays a pairing dialog box based on the pairing request.

The electronic device receives the pairing request from the wireless keyboard, and may parse the pairing request to obtain the MAC address of the stylus.

In an embodiment, the electronic device receives, based on Bluetooth, the pairing request forwarded from the wireless keyboard, or the electronic device receives, based on the fourth coil, the pairing request forwarded from the wireless keyboard, and the electronic device has enabled Bluetooth. When the electronic device can parse the pairing request to obtain the MAC address of the stylus, the electronic device may display a pairing dialog box600. The pairing dialog box is used to remind the user that there is a stylus to be paired. As shown inFIG.14, a graphical user interface of the electronic device may display prompt information601indicating whether to pair with the stylus, and an “OK” control602and a “Cancel” control603. A form of the pairing dialog box displayed by the electronic device is not limited in this embodiment of this application.

In an embodiment, the electronic device may output pairing information based on the pairing request. A manner of outputting the pairing information may be, but is not limited to, displaying the pairing dialog box, or prompting, in a voice manner, the user to trigger the electronic device and the stylus to perform pairing. A manner of outputting the pairing information by the electronic device is not limited in this embodiment of this application.

In an embodiment, if the electronic device receives, based on the fourth coil, the pairing request forwarded from the wireless keyboard, the electronic device may detect, upon receiving the pairing request, whether the electronic device enables Bluetooth. “Whether the electronic device enables Bluetooth” may be understood as whether a Bluetooth function is enabled. If the electronic device does not enable Bluetooth, the electronic device may display a dialog box500shown inFIG.15for prompting the user to enable Bluetooth, to prompt the user to enable Bluetooth on the electronic device. After the user enables Bluetooth on the electronic device, the electronic device may display the graphical user interface shown inFIG.14. For details, refer to the related descriptions above. It should be understood that. “Bluetooth” in this embodiment of this application is an example for description, and may be replaced with another wireless connection function or a wireless connection mode.

In an embodiment, when the pairing request includes the model of the stylus and the factory information, the electronic device may obtain an image of the stylus based on the model of the stylus, and may further display an image604of the stylus when displaying the pairing dialog box. In an embodiment, the electronic device may store a mapping relationship between a model and an image of a stylus. The mapping relationship may include different models of styluses and an image of the stylus of each model. The electronic device may obtain the image of the stylus based on the model of the stylus and the mapping relationship. In an embodiment, the electronic device may further determine a manufacturer identifier based on the factory information, and further display the manufacturer identifier when displaying the pairing dialog box. InFIG.15, brand A may represent the manufacturer identifier and X1 may represent the model of the stylus.

When the pairing dialog box is displayed on the graphical user interface of the electronic device, the user may operate the “OK” control to trigger the electronic device and the stylus to perform pairing. In an embodiment, the electronic device and the stylus may be paired and connected based on a Bluetooth manner. Details are not described in this embodiment of this application. For details, refer to related descriptions of existing pairing and connection.

In the pairing method for a stylus and an electronic device provided in this embodiment of this application, the stylus may send the pairing request to the wireless keyboard through the first coil, the wireless keyboard may forward the pairing request to the electronic device, and the electronic device displays the pairing dialog box based on the pairing request. In this embodiment of this application, the stylus uses the wireless keyboard as an intermediate apparatus for pairing the electronic device with the stylus, and the wireless keyboard may transmit the pairing request from the stylus to the electronic device, so that the electronic device displays the dialog box and the electronic device can be paired with the stylus. Because the stylus can transmit the MAC address of the stylus to the electronic device by using the wireless keyboard, to achieve a purpose of directionally transmitting the MAC address of the stylus to the electronic device, other electronic devices around the stylus each can be prevented from displaying a dialog box, thereby improving user experience.

An embodiment of this application further provides a stylus shown inFIG.6. A processor in the stylus may read a program stored in a memory to execute the actions performed by the stylus in the foregoing pairing method. It should be understood that the memory is not shown inFIG.6.

An embodiment of this application further provides an electronic device shown inFIG.7. A processor in the electronic device may read a program stored in a memory to execute the actions performed by the electronic device in the foregoing pairing method. It should be understood that the memory is not shown inFIG.7.

An embodiment of this application further provides a wireless keyboard shown inFIG.8. A processor in the wireless keyboard can read a program stored in a memory to execute the actions performed by the wireless keyboard in the foregoing pairing method. It should be understood that the memory is not shown inFIG.8.

An embodiment of this application further provides a pairing system including a stylus shown inFIG.6, an electronic device shown inFIG.7, and a wireless keyboard shown inFIG.8. The pairing system can perform the pairing method in the foregoing embodiments. The stylus can execute the actions performed by the stylus in the foregoing pairing method. The electronic device can execute the actions performed by the electronic device in the foregoing pairing method. The wireless keyboard can execute the actions performed by the wireless keyboard in the foregoing pairing method.

The term “a plurality of” in this specification refers to two or more. The term “and/or” in this specification describes only an association relationship for describing associated objects and represents that three relationships can exist. For example, “A and/or B” can represent the following three cases: Only A exists, both A and B exist, and only B exists. In addition, the character “/” in this specification generally indicates an “or” relationship between the associated objects. In a formula, the character “/” indicates that the associated objects are in a “division” relationship.

It can be understood that, in the embodiments of this application, various numeric numbers are distinguished merely for ease of description and are not used to limit the scope of the embodiments of this application,

It can be understood that, in the embodiments of this application, a sequence number of each of the foregoing processes does not mean a sequence of execution. The sequence of execution of the processes should be determined based on functions and internal logic of the processes, and no limitation should be imposed on an implementation process of the embodiments of this application.