Patent Description:
With the development of touch technologies, more and more electronic devices use a touch mode for human-computer interaction. A user may provide an input to an electronic device by touching a touchscreen of the electronic device by using a finger, or may provide an input to the electronic device by operating the touchscreen of the electronic device by using a stylus. The electronic device performs a corresponding operation based on the input of the user.

Currently, only after a stylus and an electronic device are paired and connected, the electronic device can detect an input of the stylus. The stylus and the electronic device may be paired and connected based on a Bluetooth manner. The stylus may broadcast a packet including a media access control (media access control, MAC) address of the stylus, and the electronic device may receive the packet by Bluetooth scanning. The electronic device parses the packet to obtain the MAC address of the stylus, and then displays a pairing dialog box, to remind the user to perform pairing and connection between the electronic device and the stylus.

However, if a plurality of Bluetooth-enabled electronic devices exist around the stylus, the plurality of electronic devices each can receive the packet broadcast by the stylus and can display a dialog box, causing disturbance to users. <CIT> relates to a technology for a wireless communication system involving an electronic device and a stylus pen. <CIT> relates also to method for automatically pairing a stylus with a companion electronic device such as a tablet or smartphone. <CIT> describes a leather case keyboard integrated with a solar-powered charging pen sleeve. <CIT> relates to a keyboard capable of inputting position information via ultrasonic signals from an electronic pen.

The object of the present invention is to provide a pairing method and a pairing system, so that when an electronic device and a stylus are paired, other electronic devices around the stylus are prevented from displaying a pairing dialog box. This object is solved by the attached independent claims and further embodiments and improvements of the invention are listed in the attached dependent claims. Hereinafter, up to the "brief description of the drawings", expressions like ". aspect according to the invention", "according to the invention", or "the present invention", relate to technical teaching of the broadest embodiment as claimed with the independent claims. Expressions like "implementation", "design", "optionally", "preferably", "scenario", "aspect" or similar relate to further embodiments as claimed, and expressions like "example", ". aspect according to an example", "the disclosure describes", or "the disclosure" describe technical teaching which relates to the understanding of the invention or its embodiments, which, however, is not claimed as such.

According to a first aspect according to the invention, an embodiment of this application provides a pairing method, applied to a pairing system. The pairing system includes: a stylus, a wireless keyboard, and an electronic device. The stylus includes a first coil, and the wireless keyboard includes a second coil. The wireless keyboard charges the stylus through the second coil and the first coil. In response to that the wireless keyboard charges the stylus through the second coil and the first coil, the stylus sends a pairing request to the wireless keyboard through the first coil and the second coil. The wireless keyboard sends the pairing request to the electronic device. The electronic device displays a pairing dialog box based on the pairing request, where the pairing dialog box is used to prompt a user to trigger the electronic device and the stylus to perform pairing. The pairing request is used to instruct the electronic device to display the pairing dialog box, and the pairing request may include a media access control MAC address of the stylus. In an embodiment, the pairing request may further include a model of the stylus, factory information, and the like.

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 can directionally transmit the pairing request of the stylus to the electronic device, so that the electronic device displays the dialog box while other electronic devices around the stylus are prevented from displaying a dialog box, thereby improving user experience.

In a possible implementation, the stylus does not send a pairing request to the wireless keyboard through the first coil and the second coil every time the wireless keyboard charges the stylus through the second coil and the first coil. In response to that the wireless keyboard charges the stylus through the second coil and the first coil, the stylus may obtain a status of connection between the stylus and the electronic device. When the stylus is not connected to the electronic device, the stylus sends the pairing request to the wireless keyboard through the first coil and the second coil. When the stylus is connected to the electronic device, the stylus does not send the pairing request to the wireless keyboard.

In this embodiment of this application, the stylus may intelligently determine, based on a status of connection to the electronic device, whether to send the pairing request to the wireless keyboard, so as to improve intelligence of the stylus.

In this implementation, the stylus may detect by itself the status of connection to the electronic device. Alternatively, the electronic device may detect a status of connection to the stylus and further broadcast the connection status. Accordingly, the stylus may receive the connection status from the electronic device. For example, the electronic device may broadcast the connection status through a Bluetooth channel, and the stylus may perform scanning over Bluetooth, to obtain the connection status from the electronic device.

The wireless keyboard may charge the stylus through the second coil and the first coil. In a possible implementation, the wireless keyboard may charge the stylus based on a wireless protocol through the second coil and the first coil. For example, the wireless protocol may be a Qi protocol or a private protocol.

In such an embodiment, the stylus may send the pairing request to the wireless keyboard based on the wireless protocol. The pairing request is included in any data packet exchanged between the stylus and the wireless keyboard based on the wireless protocol. It should be understood that, in a possible implementation, the wireless keyboard may charge the stylus based on the Qi protocol, and the stylus may send the pairing request to the wireless keyboard based on the private protocol.

A manner in which the wireless keyboard sends the pairing request to the electronic device is described in the following two possible manners for implementation:.

Manner <NUM>: The wireless keyboard is in a connection for wireless communication to the electronic device, and the connection for wireless communication may be but is not limited to a Bluetooth connection, a Wi-Fi connection, or the like. In this manner, when the wireless keyboard receives the pairing request from the stylus, to enable the electronic device to parse the pairing request, the wireless keyboard may convert the pairing request sent based on the wireless protocol into a pairing request supporting a format for the wireless communication.

The wireless keyboard may parse the pairing request to obtain the MAC address of the stylus; and encapsulate the MAC address in a data packet in the format for the wireless communication; and the wireless keyboard sends the data packet in the format for the wireless communication to the electronic device.

In this manner, the electronic device receives the pairing request from the wireless keyboard based on the connection for wireless communication, and may display the pairing dialog box.

Manner <NUM>: The wireless keyboard includes a third coil, the electronic device includes a fourth coil, and the electronic device charges the wireless keyboard through the fourth coil and the third coil, or the wireless keyboard charges the electronic device through the third coil and the fourth coil. In this manner, the wireless keyboard sends the pairing request to the electronic device through the third coil and the fourth coil.

The wireless keyboard sends the pairing request to the electronic device based on a wireless protocol. The wireless protocol may be the same as or different from the wireless protocol used by the stylus to send the pairing request. The pairing request is included in any data packet exchanged between the wireless keyboard and the electronic device based on the wireless protocol.

In this manner, the electronic device receives the pairing request from the wireless keyboard based on the fourth coil, and can detect whether the electronic device enables a wireless communication function, because the electronic device needs to be paired with and connected to the stylus based on the wireless communication function. The wireless communication function may be a Bluetooth function, a Wi-Fi function, or the like. If the electronic device does not enable the wireless communication function, the electronic device may output a prompt dialog box. The prompt dialog box is used to prompt the user to enable the wireless communication function of the electronic device. If the electronic device enables the wireless communication function, the electronic device may output the pairing dialog box.

According to a second aspect not claimed, an embodiment of this application provides a pairing method, applied to a stylus. The stylus includes a first coil, and a wireless keyboard includes a second coil. The method includes: In response to that the wireless keyboard charges the stylus through the second coil and the first coil, the stylus sends a pairing request to the wireless keyboard through the first coil and the second coil.

In a possible implementation, before the stylus sends the pairing request to the wireless keyboard through the first coil and the second coil, the method further includes: The stylus obtains a status of connection between the stylus and the electronic device.

The sending a pairing request to the wireless keyboard includes: In response to that the stylus is not connected to the electronic device, the stylus sends the pairing request to the wireless keyboard through the first coil and the second coil.

In a possible implementation, that the stylus obtains a status of connection between the stylus and the electronic device includes: The stylus detects the connection status.

In a possible implementation, that the stylus obtains a status of connection between the stylus and the electronic device includes: The stylus receives the connection status broadcast by the electronic device.

In a possible implementation, the sending a pairing request to the wireless keyboard includes: The stylus sends the pairing request to the wireless keyboard based on the wireless protocol.

In a possible implementation, the pairing request is included in any data packet exchanged between the stylus and the wireless keyboard based on the wireless protocol.

In a possible implementation, the pairing request includes a media access control MAC address of the stylus.

According to a third aspect not claimed, an embodiment of this application provides a pairing method, applied to a wireless keyboard. A stylus includes a first coil, and the wireless keyboard includes a second coil. The method includes:
the wireless keyboard receives a pairing request from the stylus through the second coil, and sends the pairing request to the electronic device.

In a possible implementation, that the wireless keyboard charges the stylus through the second coil and the first coil includes: The wireless keyboard charges the stylus based on a wireless protocol through the second coil and the first coil. That the wireless keyboard receives a pairing request from the stylus through the second coil includes: The wireless keyboard receives the pairing request from the stylus based on the wireless protocol through the second coil.

In a possible implementation, the wireless keyboard is in a connection for wireless communication to the electronic device. Before the wireless keyboard sends the pairing request to the electronic device, the method further includes: The wireless keyboard parses the pairing request to obtain the MAC address of the stylus; and encapsulates the MAC address in a data packet in a format for the wireless communication. That the wireless keyboard sends the pairing request to the electronic device includes: The wireless keyboard sends the data packet in the format for the wireless communication to the electronic device.

In a possible implementation, the wireless keyboard includes a third coil, and the electronic device includes a fourth coil. The electronic device charges the wireless keyboard through the fourth coil and the third coil. That the wireless keyboard sends the pairing request to the electronic device includes: The wireless keyboard sends the pairing request to the electronic device through the third coil and the fourth coil.

In a possible implementation, the sending the pairing request to the electronic device includes: The wireless keyboard sends the pairing request to the electronic device based on a wireless protocol.

In a possible implementation, the pairing request is included in any data packet exchanged between the wireless keyboard and the electronic device based on the wireless protocol.

According to a fourth aspect not claimed, an embodiment of this application provides a pairing method, applied to an electronic device. The method includes:
the electronic device receives a pairing request from a wireless keyboard; and the electronic device displays a pairing dialog box based on the pairing request, where the pairing dialog box is used to prompt a user to trigger the electronic device and the stylus to perform pairing.

In a possible implementation, the electronic device detects the connection status and broadcasts the connection status.

In a possible implementation, the wireless keyboard is in a connection for wireless communication to the electronic device. That the electronic device receives a pairing request from a wireless keyboard includes: The electronic device receives a data packet in a format for the wireless communication, where the data packet includes the pairing request.

In a possible implementation, the wireless keyboard includes a third coil, and the electronic device includes a fourth coil. The electronic device charges the wireless keyboard through the fourth coil and the third coil. That the electronic device receives a pairing request from a wireless keyboard includes: The electronic device receives the pairing request from the wireless keyboard through the fourth coil.

In a possible implementation, the pairing request is sent by the wireless keyboard to the electronic device based on a wireless protocol.

In a possible implementation, the method further includes: In response to receiving the pairing request from the wireless keyboard, the electronic device detects whether the electronic device enables a wireless communication function; and if the electronic device does not enable the wireless communication function, the electronic device outputs a prompt dialog box, where the prompt dialog box is used to prompt the user to enable the wireless communication function of the electronic device.

According to a fifth aspect not claimed, an embodiment of this application provides a stylus, including a processor and a memory, where the memory stores computer executable instructions; and the processor executes the computer executable instructions stored in the memory, so that the processor executes the method according to the second aspect.

According to a sixth aspect not claimed, an embodiment of this application provides a wireless keyboard, including a processor and a memory, where the memory stores computer executable instructions; and the processor executes the computer executable instructions stored in the memory, so that the processor executes the method according to the third aspect.

According to a seventh aspect not claimed, an embodiment of this application provides an electronic device, including a processor and a memory, where the memory stores computer executable instructions; and the processor executes the computer executable instructions stored in the memory, so that the processor executes the method according to the fourth aspect.

According to an eighth aspect according to the invention, an embodiment of this application provides a pairing system, where the pairing system includes the stylus according to the fifth aspect, the wireless keyboard according to the sixth aspect, and the electronic device according to the seventh aspect, and the system can execute the method according to the first aspect.

According to a ninth aspect not claimed, an embodiment of this application provides a computer program product including instructions, where when the computer program product is run on a computer, the computer is enabled to execute the methods according to the second to the fourth aspects.

According to a tenth aspect not claimed, an embodiment of this application provides a computer-readable storage medium, where the computer-readable storage medium stores instructions, and when the instructions are run on a computer, the computer is enabled to execute the methods according to the second to the fourth aspects.

For beneficial effects of the possible implementations of the second aspect to the tenth aspect, refer to the beneficial effects brought by the first aspect and the possible implementations of the first aspect.

The embodiments of this application provide the pairing method and the pairing system. The pairing system includes the stylus, the wireless keyboard, and the electronic device. The stylus includes the first coil, and the wireless keyboard includes the second coil. The method includes: In response to that the wireless keyboard charges the stylus through the second coil and the first coil, the stylus sends the pairing request to the wireless keyboard through the first coil and the second coil. The wireless keyboard sends the pairing request to the electronic device. The electronic device displays the pairing dialog box based on the pairing request, where the pairing dialog box is used to prompt the user to trigger the electronic device and the stylus to perform pairing. In the embodiments 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 can directionally transmit the pairing request from the stylus to the electronic device, so that the electronic device displays the dialog box while other electronic devices around the stylus are prevented from displaying a dialog box, thereby improving user experience.

<FIG> is a schematic diagram of a scenario to which the embodiments of this application are applicable. Referring to <FIG>, the scenario includes a stylus (stylus) <NUM>, an electronic device <NUM>, and a wireless keyboard <NUM>. In <FIG>, an example in which the electronic device <NUM> is a tablet (tablet) is used for description. The stylus <NUM> and the wireless keyboard <NUM> each may provide an input to the electronic device <NUM>, and in response to the input, the electronic device <NUM> performs an operation based on the input of the stylus <NUM> or the wireless keyboard <NUM>. A touch area may be disposed on the wireless keyboard <NUM>. The stylus <NUM> may operate the touch area of the wireless keyboard <NUM> to provide an input to the wireless keyboard <NUM>, and based on the input of the stylus <NUM>, the wireless keyboard <NUM> may perform an operation in response to the input. In an embodiment, the stylus <NUM> and the electronic device <NUM>, the stylus <NUM> and the wireless keyboard <NUM>, and the electronic device <NUM> and the wireless keyboard <NUM> may 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 stylus <NUM> may be, but is not limited to, an inductive stylus and a capacitive stylus. The electronic device <NUM> has a touchscreen <NUM>. When the stylus <NUM> is an inductive stylus, an electromagnetic induction board needs to be integrated on the touchscreen <NUM> of the electronic device <NUM> interacting with the stylus <NUM>. 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 touchscreen <NUM>. The touchscreen <NUM> of the electronic device <NUM> may also be referred to as a touch screen, and the stylus <NUM> may 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 stylus <NUM> is an active capacitive stylus, an electrode array needs to be integrated on the touchscreen <NUM> of the electronic device <NUM> interacting with the stylus <NUM>. In an embodiment, the electrode array may be a capacitive electrode array. The electronic device <NUM> may 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 touchscreen <NUM>.

<FIG> is a schematic diagram of a structure of a stylus according to an embodiment of this application. Referring to <FIG>, the stylus <NUM> may include a stylus tip <NUM>, a stylus rod <NUM>, and a rear cover <NUM>. The inside of the stylus rod <NUM> is in a hollow structure. The stylus tip <NUM> and the rear cover <NUM> are respectively located at two ends of the stylus rod <NUM>. The rear cover <NUM> and the stylus rod <NUM> may be connected through plugging or snapping. For a fitting relationship between the stylus tip <NUM> and the stylus rod <NUM>, refer to descriptions in <FIG>.

<FIG> is a schematic diagram of a partially split structure of a stylus according to an embodiment of this application. Referring to <FIG>, the stylus <NUM> further includes a spindle component <NUM>. The spindle component <NUM> is located in the stylus rod <NUM>, and the spindle component <NUM> is slidably disposed in the stylus rod <NUM>. The spindle component <NUM> has an external screw thread <NUM>, and the stylus tip <NUM> includes a writing end <NUM> and a connecting end <NUM>. The connecting end <NUM> of the stylus tip <NUM> has an internal screw thread (not shown) fitting the external screw thread <NUM>.

When the spindle component <NUM> is assembled into the stylus rod <NUM>, the connecting end <NUM> of the stylus tip <NUM> extends into the stylus rod <NUM> and is threadedly connected to the external screw thread <NUM> of the spindle component <NUM>. In some other examples, the connecting end <NUM> of the stylus tip <NUM> may alternatively be connected to the spindle component <NUM> in a detachable manner such as snapping. The connecting end <NUM> of the stylus tip <NUM> is detachably connected to the spindle component <NUM>, to implement replacement of the stylus tip <NUM>.

To detect pressure applied to the writing end <NUM> of the stylus tip <NUM>, as shown in <FIG>, there is a gap 10a between the stylus tip <NUM> and the stylus rod <NUM>. In this way, it can be ensured that when the writing end <NUM> of the stylus tip <NUM> is subjected to an external force, the stylus tip <NUM> can move toward the stylus rod <NUM>, and movement of the stylus tip <NUM> drives the spindle component <NUM> to move in the stylus rod <NUM>. To detect the external force, as shown in <FIG>, a pressure sensing component <NUM> is disposed on the spindle component <NUM>. A part of the pressure sensing component <NUM> is fixedly connected to a fastener in the stylus rod <NUM>, and a part of the pressure sensing component <NUM> is fixedly connected to the spindle component <NUM>. In this way, when the spindle component <NUM> moves with the stylus tip <NUM>, because the part of the pressure sensing component <NUM> is fixedly connected to the fastener in the stylus rod <NUM>, movement of the spindle component <NUM> drives deformation of the pressure sensing component <NUM>, and the deformation of the pressure sensing component <NUM> is transmitted to a circuit board <NUM> (for example, the pressure sensing component <NUM> and the circuit board <NUM> can be electrically connected through a wire or a flexible circuit board). The circuit board <NUM> detects the pressure of the writing end <NUM> of the stylus tip <NUM> based on the deformation of the pressure sensing component <NUM>, and therefore controls a line thickness of the writing end <NUM> based on the pressure of the writing end <NUM> of the stylus tip <NUM>.

It should be noted that detection on the pressure of the stylus tip <NUM> includes but is not limited to the foregoing method. For example, a pressure sensor may be further disposed at the writing end <NUM> of the stylus tip <NUM>, and the pressure of the stylus tip <NUM> is detected by the pressure sensor.

In this embodiment, as shown in <FIG>, the stylus <NUM> further includes a plurality of electrodes. The plurality of electrodes may be, for example, a first transmitting electrode <NUM>, a ground electrode <NUM>, and a second transmitting electrode <NUM>. The first transmitting electrode <NUM>, the ground electrode <NUM>, and the second transmitting electrode <NUM> are electrically connected to the circuit board <NUM>. The first transmitting electrode <NUM> may be located in the stylus tip <NUM> and close to the writing end <NUM>. The circuit board <NUM> may be configured to provide a signal control board to each of the first transmitting electrode <NUM> and the second transmitting electrode <NUM>, and the first transmitting electrode <NUM> is configured to transmit a first signal. When the first transmitting electrode <NUM> is close to the touchscreen <NUM> of the electronic device <NUM>, a coupling capacitance may be formed between the first transmitting electrode <NUM> and the touchscreen <NUM> of the electronic device <NUM>, so that the electronic device <NUM> can receive the first signal. The second transmitting electrode <NUM> is configured to transmit a second signal, and the electronic device <NUM> can determine an inclination angle of the stylus <NUM> based on the received second signal. In this embodiment of this application, the second transmitting electrode <NUM> may be located on an inner wall of the stylus rod <NUM>. In an example, the second transmitting electrode <NUM> may alternatively be located on the spindle component <NUM>.

The ground electrode <NUM> may be located between the first transmitting electrode <NUM> and the second transmitting electrode <NUM>, or the ground electrode <NUM> may be located at an outer periphery of the first transmitting electrode <NUM> and the second transmitting electrode <NUM>, and the ground electrode <NUM> is configured to reduce coupling between the first transmitting electrode <NUM> and the second transmitting electrode <NUM>.

When the electronic device <NUM> receives a first signal from the stylus <NUM>, a capacitance value at a corresponding location on the touchscreen <NUM> changes. Based on this, the electronic device <NUM> may determine a location of the stylus <NUM> (or the stylus tip of the stylus <NUM>) on the touchscreen <NUM> based on the change in the capacitance value on the touchscreen <NUM>. In addition, the electronic device <NUM> may obtain the inclination angle of the stylus <NUM> by using a double-tip projection method in an inclination angle detection algorithm. Because locations of the first transmitting electrode <NUM> and the second transmitting electrode <NUM> in the stylus <NUM> are different, when the electronic device <NUM> receives the first signal and a second signal from the stylus <NUM>, capacitance values at the two locations on the touchscreen <NUM> change. The electronic device <NUM> may obtain the inclination angle of the stylus <NUM> based on a distance between the first transmitting electrode <NUM> and the second transmitting electrode <NUM> and a distance between the two locations at which the capacitance values on the touchscreen <NUM> change. For more detailed descriptions of obtaining the inclination angle of the stylus <NUM>, refer to related descriptions of the double-tip projection method in the conventional technology.

In this embodiment of this application, as shown in <FIG>, the stylus <NUM> further includes a battery assembly <NUM>, where the battery assembly <NUM> is configured to provide power to the circuit board <NUM>. The battery assembly <NUM> may include a lithium-ion battery, or the battery assembly <NUM> may 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 assembly <NUM> may be a rechargeable battery or a disposable battery. When the battery included in the battery assembly <NUM> may be the rechargeable battery, the stylus <NUM> can charge the battery in the battery assembly <NUM> through wireless charging.

When the stylus <NUM> is an active capacitive stylus, as shown in <FIG>, after the electronic device <NUM> is wirelessly connected to the stylus <NUM>, the electronic device <NUM> may send an uplink signal to the stylus <NUM> through the electrode array integrated on the touchscreen <NUM>. The stylus <NUM> may receive the uplink signal through a receiving electrode, and the stylus <NUM> transmits a downlink signal through a transmitting electrode (for example, the first transmitting electrode <NUM> and the second transmitting electrode <NUM>). The downlink signal includes the first signal and the second signal. When the stylus tip <NUM> of the stylus <NUM> is in contact with the touchscreen <NUM>, the capacitance value at the corresponding location on the touchscreen <NUM> changes, and the electronic device <NUM> may determine a location of the stylus tip <NUM> of the stylus <NUM> on the touchscreen <NUM> based on the capacitance value on the touchscreen <NUM>. In an embodiment, the uplink signal and the downlink signal may be square wave signals.

In an embodiment, as shown in <FIG>, the wireless keyboard <NUM> may include a first portion <NUM> and a second portion <NUM>. For example, the wireless keyboard <NUM> may include a keyboard body and a keyboard cover. The first portion <NUM> may be the keyboard cover, and the second portion <NUM> is the keyboard body. The first portion <NUM> is configured to place the electronic device <NUM>, and the second portion <NUM> may be provided with a button, a touchpad, or the like for a user operation.

When the wireless keyboard <NUM> is used, the first portion <NUM> and the second portion <NUM> of the wireless keyboard <NUM> need to be opened. When the wireless keyboard <NUM> is not used, the first portion <NUM> and the second portion <NUM> of the wireless keyboard <NUM> can be closed. In an embodiment, the first portion <NUM> and the second portion <NUM> of the wireless keyboard <NUM> are rotatably connected to each other. For example, the first portion <NUM> and the second portion <NUM> may be connected through a rotating shaft or a hinge. Alternatively, in some examples, the first portion <NUM> and the second portion <NUM> are rotatably connected by using a flexible material (for example, a leather material or a cloth material). Alternatively, in some examples, the first portion <NUM> and the second portion <NUM> may be integrally formed, and a connection part between the first portion <NUM> and the second portion <NUM> is thinned, so that the connection part between the first portion <NUM> and the second portion <NUM> can be bent. A manner of the connection between the first portion <NUM> and the second portion <NUM> may include but is not limited to the foregoing rotational connection manners.

The first portion <NUM> may include at least two rotatably connected supports. For example, as shown in <FIG>, the first portion <NUM> includes a first support 301a and a second support 301b. The first support 301a and the second support 301b are rotatably connected to each other. During use, the first support 301a and the second support 301b may be used to jointly support the electronic device <NUM> (for details, refer to <FIG>). Alternatively, the first support 301a supports the second support 301b, and the second support 301b supports the electronic device <NUM>. Referring to <FIG>, the second support 301b and the second portion <NUM> are rotatably connected to each other.

As shown in <FIG>, to accommodate the stylus <NUM>, the wireless keyboard <NUM> may be provided with an accommodating portion <NUM> for accommodating the stylus <NUM>. As shown in <FIG>, the accommodating portion <NUM> is a tubular cavity. During accommodation, the stylus <NUM> is inserted into the accommodating cavity along an arrow direction in <FIG>. In this embodiment, as shown in <FIG>, the second portion <NUM> and the second support 301b are rotatably connected to each other through a connecting portion <NUM>, and the accommodating portion <NUM> is disposed in the connecting portion <NUM>. The connecting portion <NUM> may be a rotating shaft.

<FIG> is 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> is 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 to <FIG>, the accommodating portion <NUM> is a circular cavity, and an inner diameter of the accommodating portion <NUM> is greater than an outer diameter of the stylus <NUM>.

In an embodiment, a magnetic material may be disposed on an inner wall of the accommodating portion <NUM>, and a magnetic material may be disposed in the stylus <NUM>, to prevent the stylus <NUM> from falling out of the accommodating portion <NUM>. The stylus <NUM> is attached in the accommodating portion <NUM> through magnetic adsorption between the magnetic materials. Certainly, in some examples, when the stylus <NUM> is fastened to the accommodating portion <NUM>, the stylus <NUM> is fastened to the accommodating portion <NUM> through magnetic adsorption or the like. For example, the stylus <NUM> may also be alternatively to the accommodating portion <NUM> through snapping.

To facilitate removal of the stylus <NUM> from the accommodating portion <NUM>, an eject structure may be disposed in the accommodating portion <NUM>. For example, one end of the stylus <NUM> is pressed, so that the eject mechanism can drive one end of the stylus <NUM> to eject from the accommodating portion <NUM>.

<FIG> is a schematic diagram of a hardware structure of a stylus according to an embodiment of this application. Referring to <FIG>, the stylus <NUM> may have a processor <NUM>. The processor <NUM> may include storage and processing circuits configured to support operations of the stylus <NUM>. 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 processor <NUM> may be configured to control an operation of the stylus <NUM>. 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 stylus <NUM> may include one or more sensors. For example, the sensor may include a pressure sensor <NUM>. The pressure sensor <NUM> may be disposed at the writing end <NUM> of the stylus <NUM> (as shown in <FIG>). Certainly, the pressure sensor <NUM> may alternatively be disposed in the stylus rod <NUM> of the stylus <NUM>. In this way, after one end of the stylus tip <NUM> of the stylus <NUM> is subject to a force, the other end of the stylus tip <NUM> moves to apply the force to the pressure sensor <NUM>. In an embodiment, the processor <NUM> may adjust, based on pressure detected by the pressure sensor <NUM>, a writing line thickness of the stylus tip <NUM> of the stylus <NUM>.

The sensor may also include an inertial sensor <NUM>. The inertial sensor <NUM> may include a three-axis accelerometer and a three-axis gyroscope, and/or another component configured to measure movement of the stylus <NUM>. 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 stylus <NUM> may include a status indicator <NUM> such as a light-emitting diode and a button <NUM>. The status indicator <NUM> is configured to prompt a user with a status of the stylus <NUM>. The button <NUM> may include a mechanical button and a non-mechanical button, and the button <NUM> may be configured to collect button press information from the user.

In this embodiment of this application, the stylus <NUM> may include one or more electrodes <NUM> (for details, refer to the descriptions in <FIG>), one electrode <NUM> may be located at the writing end of the stylus <NUM>, and one electrode <NUM> may be located in the stylus tip <NUM>. For details, refer to the foregoing related descriptions.

The stylus <NUM> may include a sensing circuit <NUM>. The sensing circuit <NUM> may sense capacitive coupling between the electrode <NUM> and a drive line on a capacitive touch sensor panel interacting with the stylus <NUM>. The sensing circuit <NUM> may 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 stylus <NUM> can sense contact with the capacitive touch sensor panel.

It can be understood that the stylus <NUM> may 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 stylus <NUM> and the electronic device <NUM> interacting with the stylus <NUM>, and receive status information and another output.

The processor <NUM> may be configured to run software that is on the stylus <NUM> and that controls an operation of the stylus <NUM>. In an operation process of the stylus <NUM>, the software running on the processor <NUM> may process a sensor input, a button input, and an input from another apparatus to monitor movement of the stylus <NUM> and an input of another user. The software running on the processor <NUM> may detect a user command and may communicate with the electronic device <NUM>.

To support wireless communication between the stylus <NUM> and the electronic device <NUM>, the stylus <NUM> may include a wireless module. In <FIG>, an example in which the wireless module is a Bluetooth module <NUM> is 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 module <NUM> may include a radio frequency transceiver, for example, a transceiver. The Bluetooth module <NUM> may 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 stylus <NUM> may further include a charging module <NUM>. The charging module <NUM> may support charging of the stylus <NUM> to provide power to the stylus <NUM>.

It should be understood that, the electronic device <NUM> in 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 device <NUM> may 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> is a schematic diagram of a hardware structure of an electronic device according to an embodiment of this application. Referring to <FIG>, the electronic device <NUM> may include a plurality of subsystems. The subsystems cooperate to perform, coordinate, or monitor one or more operations or functions of the electronic device <NUM>. The electronic device <NUM> includes a processor <NUM>, an input surface <NUM>, a coordination engine <NUM>, a power subsystem <NUM>, a power connector <NUM>, a wireless interface <NUM>, and a display <NUM>.

For example, the coordination engine <NUM> may be configured to: communicate with another subsystem of the electronic device <NUM> and/or process data; communicate with and/or exchange data with the stylus <NUM>; 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 stylus <NUM>; position the stylus <NUM> based on locations of a tip signal crossing area and a ring signal crossing area, and the like.

The coordination engine <NUM> of the electronic device <NUM> includes or may be communicatively coupled, in another manner, to a sensor layer located below the input surface <NUM> or integrated with the input surface. The coordination engine <NUM> uses the sensor layer to position the stylus <NUM> on the input surface <NUM>, and uses the technology described in this specification to estimate an angular location of the stylus <NUM> relative to a plane of the input surface <NUM>. In an embodiment, the input surface <NUM> may be referred to as a touchscreen <NUM>.

For example, the sensor layer of the coordination engine <NUM> of the electronic device <NUM> is 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 tip <NUM> of the stylus <NUM> and/or touch of a finger of the user. In many cases, the coordination engine <NUM> may be configured to detect, through capacitive coupling, the tip signal and the ring signal received from the stylus <NUM> through 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 device <NUM> to identify the stylus <NUM>. 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 engine <NUM>.

The processor <NUM> may use the stylus identity information to receive an input from more than one stylus simultaneously. Specifically, the coordination engine <NUM> may be configured to transmit, to the processor <NUM>, a location and/or an angular location that are/is of each of several styluses and that are/is detected by the coordination engine <NUM>. In another case, the coordination engine <NUM> may further transmit, to the processor <NUM>, information about relative locations and/or relative angular locations that are of a plurality of styluses and that are detected by the coordination engine <NUM>. For example, the coordination engine <NUM> may notify the processor <NUM> of 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 device <NUM> to identify a specific user. Such information is usually referred to as "user identity" information in this specification.

The coordination engine <NUM> may forward the user identity information (if the user identity information can be detected and/or can be restored) to the processor <NUM>. If the user identity information cannot be restored from the tip signal and/or the ring signal, the coordination engine <NUM> may optionally indicate to the processor <NUM> that the user identity information is unavailable. The processor <NUM> can 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 processor <NUM> may 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 device <NUM> to identify settings or preferences of the user or the stylus <NUM>. Such information is usually referred to as "stylus settings" information in this specification.

The coordination engine <NUM> may forward the stylus settings information (if the stylus settings information can be detected and/or can be restored) to the processor <NUM>. If the stylus settings information cannot be restored from the tip signal and/or the ring signal, the coordination engine <NUM> may optionally indicate to the processor <NUM> that the stylus settings information is unavailable. The electronic device <NUM> can 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 processor <NUM> may be configured to perform, coordinate, and/or manage functions of the electronic device <NUM>. Such functions may include, but are not limited to, communicating with and/or exchanging data with other subsystems of the electronic device <NUM>; communicating with and/or exchanging data with the stylus <NUM>; 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 processor <NUM> may 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 processor <NUM> may 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 device <NUM>.

The instructions stored in the memory may be configured to control or coordinate operations of other components of the electronic device <NUM>. 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 device <NUM> further includes the power subsystem <NUM>. The power subsystem <NUM> may include a battery or another power supply. The power subsystem <NUM> may be configured to provide power to the electronic device <NUM>. The power subsystem <NUM> may be further coupled to the power connector <NUM>. The power connector <NUM> may 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 connector <NUM> may be configured to recharge a battery in the power subsystem <NUM>. In another implementation solution, the power connector <NUM> may be configured to transmit power stored in (or available to) the power subsystem <NUM> to the stylus <NUM>.

The electronic device <NUM> further includes the wireless interface <NUM> to facilitate electronic communication between the electronic device <NUM> and the stylus <NUM>. In an implementation solution, the electronic device <NUM> may be configured to communicate with the stylus <NUM> through a low energy Bluetooth communication interface or a near field communication interface. In another example, the communication interface facilitates electronic communication between the electronic device <NUM> and an external communication network, a device, or a platform.

The wireless interface <NUM> (whether a communication interface between the electronic device <NUM> and the stylus <NUM> or 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 device <NUM> further includes the display <NUM>. The display <NUM> may be located behind the input surface <NUM>, or may be integrated with the input surface <NUM>. The display <NUM> may be communicatively coupled to the processor <NUM>. The processor <NUM> may present information to a user through the display <NUM>. In many cases, the processor <NUM> presents, through the display <NUM>, a graphical user interface with which a user can interact. In many cases, the user manipulates the stylus <NUM> to 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 device <NUM> may 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> is a schematic diagram of a hardware structure of a wireless keyboard according to an embodiment of this application. Referring to <FIG>, the wireless keyboard <NUM> may include a processor <NUM>, a memory <NUM>, a charging interface <NUM>, a charging management module <NUM>, a wireless charging coil <NUM>, a battery <NUM>, a wireless communication module <NUM>, a touchpad <NUM>, and a keyboard <NUM>.

The processor <NUM>, the memory <NUM>, the charging interface <NUM>, the charging management module <NUM>, the battery <NUM>, the wireless communication module <NUM>, the touchpad <NUM>, the keyboard <NUM>, and the like may all be disposed on a keyboard body (that is, the second portion <NUM> shown in <FIG>) of the wireless keyboard <NUM>. The wireless charging coil <NUM> may be disposed in the connecting portion <NUM> (shown in <FIG>) 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 keyboard <NUM>. In some other embodiments, the wireless keyboard <NUM> may 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 memory <NUM> may be configured to store program code, for example, program code used to wirelessly charge the stylus <NUM>. The memory <NUM> may further store a Bluetooth address for uniquely identifying the wireless keyboard <NUM>. In addition, the memory <NUM> may further store connection data of an electronic device successfully paired with the wireless keyboard <NUM>. For example, the connection data may be a Bluetooth address of the electronic device successfully paired with the wireless keyboard <NUM>. Based on the connection data, the wireless keyboard <NUM> can be automatically paired with the electronic device without configuring a connection between the wireless keyboard <NUM> and the electronic device, for example, performing validity verification. The Bluetooth address may be a media access control (media access control, MAC) address.

The processor <NUM> may be configured to execute the foregoing application program code, and invoke related modules to implement functions of the wireless keyboard <NUM> in 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 keyboard <NUM>. The processor <NUM> may include one or more processing units, and different processing units may be separate devices or may be integrated into one or more processors <NUM>. The processor <NUM> may 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 processor <NUM> described in this embodiment of this application. The processor of the wireless keyboard <NUM> may be a microprocessor.

The wireless communication module <NUM> may be configured to support data exchange in wireless communication that is between the wireless keyboard <NUM> and 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 module <NUM> may be a Bluetooth chip. The wireless keyboard <NUM> may be a Bluetooth keyboard. The wireless keyboard <NUM> may 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 keyboard <NUM> and the another electronic device through the wireless connection.

In addition, the wireless communication module <NUM> may further include an antenna. The wireless communication module <NUM> receives an electromagnetic wave through the antenna, performs frequency modulation and filtering processing on an electromagnetic wave signal, and sends a processed signal to the processor <NUM>. The wireless communication module <NUM> may further receive a to-be-sent signal from the processor <NUM>, 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 keyboard <NUM> may support wired charging. Specifically, the charging management module <NUM> may receive a charging input of a wired charger through the charging interface <NUM>.

In some other embodiments, the wireless keyboard <NUM> may support forward wireless charging. The charging management module <NUM> may receive a wireless charging input through the wireless charging coil <NUM> of the wireless keyboard <NUM>. Specifically, the charging management module <NUM> is connected to the wireless charging coil <NUM> through a matching circuit. The wireless charging coil <NUM> may be coupled to the wireless charging coil of the wireless charger to induce an alternating electromagnetic field emitted by the wireless charging coil <NUM> of the wireless charger and generate an alternating electrical signal. The alternating current signal generated by the wireless charging coil <NUM> is transmitted to the charging management module <NUM> through the matching circuit, so as to charge the battery <NUM> wirelessly.

The charging management module <NUM> may further supply power to the wireless keyboard <NUM> while charging the battery <NUM>. The charging management module <NUM> receives an input of the battery <NUM>, and supplies power to the processor <NUM>, the memory <NUM>, an external memory, the wireless communication module <NUM>, and the like. The charging management module <NUM> may 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 battery <NUM>. In some other embodiments, the charging management module <NUM> may alternatively be disposed in the processor <NUM>.

In some other embodiments, the wireless keyboard <NUM> may support reverse wireless charging. Specifically, the charging management module <NUM> may further receive an input of the charging interface <NUM> or the battery <NUM>, and convert a direct electric signal that is input by the charging interface <NUM> or the battery <NUM> into an alternating electric signal. The alternating electric signal is transmitted to the wireless charging coil <NUM> through a matching circuit. The wireless charging coil <NUM> may 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 keyboard <NUM> may also wirelessly charge the another mobile terminal. In an embodiment, the wireless charging coil <NUM> may be disposed in the accommodating portion <NUM> of the wireless keyboard <NUM>, and a wireless charging coil is disposed in the stylus rod <NUM> of the stylus <NUM>. When the stylus <NUM> is placed in the accommodating portion <NUM>, the wireless keyboard <NUM> may charge the stylus <NUM> through the wireless charging coil <NUM>.

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

The charging interface <NUM> may be configured to provide a wired connection for charging or communication between the wireless keyboard <NUM> and another electronic device (for example, the wired charger of the wireless keyboard <NUM>).

A touch sensor is integrated into the touchpad <NUM>. A notebook computer may receive a user control command on the notebook computer through the touchpad <NUM> and the keyboard <NUM>.

It can be understood that the structure shown in this embodiment of this application does not constitute a specific limitation on the wireless keyboard <NUM>. The wireless keyboard <NUM> may have more or fewer components than those shown in <FIG>, may combine two or more components, or may have different component configurations. For example, a housing of the wireless keyboard <NUM> may alternatively be provided with an accommodating portion for accommodating the stylus <NUM>. The wireless charging coil <NUM> is disposed in the accommodating portion, and is configured to wirelessly charge the stylus <NUM> when the stylus <NUM> is accommodated in the accommodating portion.

For another example, the outer surface of the wireless keyboard <NUM> may 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 in <FIG>, 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 to <FIG>, 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 box <NUM>. 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 in <FIG>, the electronic device, the wireless keyboard, and the stylus all have the Bluetooth function. In an embodiment, with reference to the related descriptions of <FIG>, 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 in <FIG>, 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 to <FIG>, the stylus rod <NUM> of the stylus <NUM> is provided with a first coil <NUM>, and the connecting portion <NUM> of the wireless keyboard <NUM> is provided with a second coil <NUM>. In an embodiment, the second coil <NUM> is located in a space between the connecting portion <NUM> and the accommodating portion <NUM>, or the second coil <NUM> is located in the accommodating portion <NUM>. A location of the second coil <NUM> is not limited in this embodiment. When the stylus <NUM> is accommodated in the accommodating portion <NUM>, the wireless keyboard <NUM> may transmit electric energy to the stylus <NUM> through the second coil <NUM>, and the stylus <NUM> receives the electric energy from the second coil <NUM> through the first coil <NUM>, thereby enabling the wireless keyboard <NUM> to charge the stylus <NUM>. For the charging of the stylus <NUM> by the wireless keyboard <NUM>, refer to related descriptions in the Qi protocol.

The first coil <NUM> may be understood as being included in the charging module <NUM> shown in <FIG>. In an embodiment, the first coil <NUM> may be connected to the processor <NUM>. The second coil <NUM> is included in the wireless charging coil <NUM> shown in <FIG>. In an embodiment, the second coil <NUM> may be connected to the processor <NUM>. It should be understood that, other portions of the wireless keyboard <NUM> are not shown in <FIG>.

In an embodiment, referring to <FIG>, the first support 301a of the wireless keyboard <NUM> is provided with a third coil <NUM>, and the electronic device <NUM> is provided with a fourth coil <NUM>. When the electronic device <NUM> is placed on the first support 301a, the third coil <NUM> overlaps the fourth coil <NUM>, and the electronic device <NUM> can charge the wireless keyboard <NUM>. In an embodiment, the third coil <NUM> is included in the wireless charging coil <NUM> shown in <FIG>. In an embodiment, the third coil <NUM> may be connected to the processor <NUM>. The fourth coil <NUM> is included in the power subsystem <NUM> shown in <FIG>, and may be connected to the processor <NUM>. It should be understood that, for the first coil <NUM> in the stylus <NUM> and the second coil <NUM> in the wireless keyboard <NUM> shown in <FIG>, refer to the related descriptions in <FIG>. A coil is represented by an arc dashed line in both <FIG> and <FIG>.

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> is 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 in <FIG>, the pairing method for a stylus and an electronic device may include the following steps.

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

Referring to the related descriptions of <FIG>, 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 to <FIG>, 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 of <FIG>, 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 of <FIG>. In a of <FIG>, the processor and a Bluetooth module in the stylus may be respectively understood as the processor <NUM> and the Bluetooth module <NUM> in <FIG> above; a processor and a Bluetooth module in the wireless keyboard may be respectively understood as the processor <NUM> and the wireless communication module <NUM> in <FIG> above; and a processor and a Bluetooth module in the electronic device may be respectively understood as the processor <NUM> and the wireless interface <NUM> in <FIG> above. It should be understood that, in <FIG>, the wireless communication module 370is used as an example of the Bluetooth module in the wireless keyboard, and the wireless interface <NUM> is used as an example of the Bluetooth module in the electronic device. In an embodiment, the Bluetooth modules in <FIG> each 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 "<NUM>:<NUM>:<NUM>:<NUM>:<NUM>:<NUM>", 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.

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 in <FIG>. 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 of <FIG>, 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 of <FIG>, 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 of <FIG> may not charge the stylus.

For structures of the wireless keyboard and the electronic device, refer to the illustration in <FIG>. 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 in <FIG>. In this embodiment, when the wireless keyboard receives the pairing request from the stylus, the wireless keyboard 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 of <FIG>, 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 in <FIG>, refer to the related descriptions of a in <FIG>.

Compared with that in <FIG> and <FIG>, the wireless keyboard can be used as an intermediate apparatus to forward the pairing request from the stylus to the electronic device. Compared with <FIG>, in <FIG>, the electronic device in <FIG> can forward the pairing request from the stylus to the electronic device, without being placed on the support B of the wireless keyboard.

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 box <NUM>. The pairing dialog box is used to remind the user that there is a stylus to be paired. As shown in <FIG>, a graphical user interface of the electronic device may display prompt information <NUM> indicating whether to pair with the stylus, and an "OK" control <NUM> and a "Cancel" control <NUM>. 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 box <NUM> shown in <FIG> for 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 in <FIG>. 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 image <NUM> of 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. In <FIG>, 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 in <FIG>. 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 in <FIG>.

An embodiment of this application further provides an electronic device shown in <FIG>. 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 in <FIG>.

An embodiment of this application further provides a wireless keyboard shown in <FIG>. 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 in <FIG>.

An embodiment of this application further provides a pairing system including a stylus shown in <FIG>, an electronic device shown in <FIG>, and a wireless keyboard shown in <FIG>. 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 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,.

Claim 1:
A pairing method, applied to a pairing system, wherein the pairing system comprises a stylus (<NUM>), a wireless keyboard (<NUM>), and an electronic device (<NUM>), wherein the stylus (<NUM>) comprises a first coil (<NUM>), the wireless keyboard (<NUM>) comprises an accommodating portion (<NUM>) for accommodating the stylus (<NUM>) and a second coil (<NUM>) configured to charge the stylus through the first coil (<NUM>) when the stylus (<NUM>) is accommodated into the accommodating portion (<NUM>), and the method comprises:
in response to inserting the stylus in the accommodating portion (<NUM>) and to the wireless keyboard (<NUM>) charging the stylus (<NUM>) through the second coil (<NUM>) and the first coil (<NUM>), sending (S1101), by the stylus (<NUM>), a pairing request to the wireless keyboard (<NUM>) through the first coil (<NUM>) and the second coil (<NUM>);
sending, by the wireless keyboard (<NUM>), the pairing request to the electronic device (<NUM>);
and
displaying, by the electronic device (<NUM>), a pairing dialog box (<NUM>, <NUM>) based on the pairing request, wherein the pairing dialog box (<NUM>, <NUM>) is used to prompt a user to trigger the electronic device (<NUM>) and the stylus (<NUM>) to perform pairing.