Method for device connection, active pen, terminal device, and electronic device

CN122934233APending Publication Date: 2026-10-16MAXEYE SMART TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611141356.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-10-16

AI Technical Summary

Benefits of technology

[0050] According to the method and related equipment for device connection provided in the embodiments of this disclosure, the exchange of Bluetooth pairing information such as Bluetooth device address and pairing identifier is completed by reusing the existing touch analog signal link between the active pen and the terminal device. This eliminates the need for manual operation by the user and completes Bluetooth pairing or key binding without the user's awareness, significantly improving the convenience and stability of Bluetooth connection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122934233A_ABST
    Figure CN122934233A_ABST
Patent Text Reader

Abstract

A method, a stylus, a terminal device, and an electronic device for device connection are provided. The method includes: receiving, by an input device, a first instruction carrying a first marker sent by a terminal device through an uplink of a touch analog signal link; in response to recognizing the first marker, sending, by the input device, first data to the terminal device through a downlink of the touch analog signal link, the first data including at least a Bluetooth device address of the input device; receiving, by the input device, a write instruction sent by the terminal device through the uplink, the write instruction including at least a first pairing identifier and a Bluetooth device address of the terminal device; and directing, by the input device, a Bluetooth connection request to the terminal device, the Bluetooth connection request including the Bluetooth device address of the input device and the Bluetooth device address of the terminal device, so that the terminal device establishes a Bluetooth connection with the input device based on the first pairing identifier in response to recognizing the Bluetooth connection request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of wireless communication technology, and more specifically to the fields of short-range wireless communication, Bluetooth, Bluetooth Low Energy (BLE), and human-computer interaction devices, and even more specifically to a method for device connection, an active pen, a terminal device, an electronic device, a storage medium, and a computer program product. Background Technology

[0002] Active pens are widely used in terminal devices such as tablets, touch-screen laptops, and professional drawing displays. To provide enhanced functions such as pressure sensitivity, side peaks, and shortcut keys, active pens typically need to establish a Bluetooth connection with the terminal device.

[0003] In related technologies, the methods for establishing a Bluetooth connection between an active pen and a terminal device can be mainly divided into three categories: minimalist magnetic pairing, standard Bluetooth manual pairing, and pairing triggered by a wired connection. In minimalist magnetic pairing, the active pen is attached to the designated magnetic area of ​​the terminal device, and a pairing prompt automatically appears on the screen. In manual Bluetooth pairing, the pen's function button is pressed and held to enter pairing mode, and the device is manually selected and connected from the terminal device's Bluetooth settings list. In wired pairing, the active pen is connected to the terminal device via a USB Type-C cable, and a pairing prompt automatically appears. Summary of the Invention

[0004] This disclosure provides a method for device connection, an active pen, a terminal device, an electronic device, a storage medium, and a computer program product.

[0005] One aspect of this disclosure provides a method for device connection, applied to an input device, including: The receiving terminal device sends a first instruction carrying a first tag via the uplink of the touch analog signal link; In response to identifying the first tag, first data is sent to the terminal device via the downlink of the touch analog signal link, the first data including at least the Bluetooth device address of the input device; The receiving terminal device sends a write command via the uplink, the write command including at least a first pairing identifier and the Bluetooth device address of the terminal device; and A Bluetooth connection request is broadcast to the terminal device. The Bluetooth connection request includes the Bluetooth device address of the input device and the Bluetooth device address of the terminal device, so that the terminal device responds to the recognition of the Bluetooth connection request and establishes a Bluetooth connection with the input device based on the first pairing identifier.

[0006] In one exemplary implementation, receiving the first instruction may include: The receiving terminal device sends a first read instruction carrying a first request flag in the first uplink time slot of the touch analog signal link; The receiving terminal device sends a second read command carrying a second request flag in the second uplink time slot of the touch analog signal link; and The receiving terminal device sends a third read instruction carrying a third request flag in the third uplink time slot of the touch analog signal link.

[0007] In one exemplary implementation, sending first data to a terminal device in response to identifying a first tag may include: In response to recognizing the first request marker, first response data is sent to the terminal device in the first downlink time slot of the touch analog signal link. The first response data includes the 0th byte and the 1st byte of the Bluetooth device address of the input device. In response to identifying the second request marker, second response data is sent to the terminal device in the second downlink time slot of the touch analog signal link. The second response data includes the second and third bytes of the Bluetooth device address of the input device; and In response to the identification of the third request marker, a third response data is sent to the terminal device in the third downlink time slot of the touch analog signal link. The third response data includes the fourth and fifth bytes of the Bluetooth device address of the input device.

[0008] In one exemplary embodiment, before receiving a write command sent by the terminal device, the method may further include: The receiving terminal device sends a second instruction carrying a second tag via the uplink; and In response to the identification of the second tag, second data is sent to the terminal device via the downlink. The second data includes at least information about the device address type of the input device.

[0009] In one exemplary embodiment, before receiving the first instruction sent by the terminal device, the method may further include: The receiving terminal device sends a second instruction carrying a second tag via the uplink; and In response to identifying the second tag, second data is sent to the terminal device via the downlink. The second data includes at least Bluetooth connection status information of the input device, so that the terminal device can identify whether the input device is in a Bluetooth connected state based on the Bluetooth connection status information.

[0010] In one exemplary implementation, the first instruction is sent by the terminal device in response to recognizing that the input device is in a state of not being connected to Bluetooth.

[0011] In one exemplary embodiment, after sending the second data to the terminal device and before receiving the first instruction sent by the terminal device, the method may further include: Receive a third instruction carrying a third tag; wherein the third instruction is sent by the terminal device via the uplink in response to recognizing that the input device is in a Bluetooth connected state based on Bluetooth connection status information; and In response to the identification of a third marker, third data is sent to the terminal device via the downlink; wherein the third data includes at least a second pairing identifier, such that the terminal device sends a first instruction in response to the inability to identify the second pairing identifier.

[0012] In one exemplary embodiment, before receiving a write command sent by the terminal device, the method may further include: The receiving terminal device sends a second instruction carrying a second tag via the uplink; and In response to identifying the second marker, second data is sent to the terminal device via the downlink. The second data includes at least first out-of-band (OOB) data length information and / or information on the pairing modes that the input device can support; wherein the value of the first OOB data length information is used to indicate the length of the first OOB data that the input device can provide.

[0013] In one exemplary implementation, before broadcasting a Bluetooth connection request to the terminal device, the method may further include: The receiving terminal device sends a fourth instruction carrying a fourth tag via the uplink; wherein the fourth instruction is sent by the terminal device in response to recognizing that the value of the first OOB data length information is not 0; and In response to the identification of the fourth marker, fourth data is sent to the terminal device via the downlink; wherein the fourth data includes first OOB data, so that the terminal device sets the encryption method of OOB pairing according to the first OOB data.

[0014] In one exemplary implementation, before broadcasting a Bluetooth connection request to the terminal device, the method may further include: The receiving terminal device sends a fifth instruction carrying a fifth tag via the uplink; wherein the fifth instruction is sent by the terminal device when it recognizes that the value of the first OOB data length information is 0, and determines that the input device supports OOB pairing based on the information of the pairing modes that the input device can support.

[0015] In one exemplary embodiment, after receiving the fifth instruction sent by the terminal device and before broadcasting a Bluetooth connection request to the terminal device, the method may further include: In response to the recognition of the fifth marker, second OOB data is generated; The fifth data is sent to the terminal device via the downlink, and the fifth data includes at least the second OOB data length information; wherein, the input device sets the value of the second OOB data length information according to the length of the second OOB data. The receiving terminal device sends a sixth instruction carrying a sixth marker via the uplink; wherein the sixth instruction is sent by the terminal device in response to recognizing that the value of the second OOB data length information is not 0; and In response to the identification of the sixth marker, sixth data is sent to the terminal device via the downlink; wherein the sixth data includes second OOB data, so that the terminal device sets the encryption method of OOB pairing according to the second OOB data.

[0016] One aspect of this disclosure provides a method for device connection, applied to a terminal device, including: The first instruction carrying the first tag is sent to the input device via the uplink of the touch analog signal link; The input device receives first data transmitted via a downlink through a touch analog signal link in response to recognizing a first tag. The first data includes at least the Bluetooth device address of the input device. A first pairing identifier is generated for the input device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device. A write command is sent to the input device via the uplink; wherein the write command includes at least a first pairing identifier and the Bluetooth device address of the terminal device, so that the input device broadcasts a Bluetooth connection request to the terminal device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; and In response to the Bluetooth connection request, a Bluetooth connection is established with the input device based on the first pairing identifier.

[0017] In one exemplary implementation, sending a write command to an input device may include: Send a first write instruction to the input device; wherein the first write instruction includes the Bluetooth device address of the terminal device, and the index information of the Bluetooth device address of the terminal device; and Send a second write instruction to the input device; wherein the second write instruction includes a first pairing identifier.

[0018] In one exemplary implementation, the method may further include, before sending a write command to the input device: A second instruction carrying a second tag is sent to the input device via the uplink, so that the input device responds by recognizing the second tag and sending second data to the terminal device via the downlink. The second data includes at least information about the device address type of the input device.

[0019] In one exemplary implementation, the method may further include, before sending the first instruction to the input device: A second instruction carrying a second tag is sent to the input device via the uplink, so that the input device responds by recognizing the second tag and sending second data to the terminal device via the downlink. The second data includes at least the Bluetooth connection status information of the input device.

[0020] In one exemplary embodiment, after sending the second instruction to the input device and before sending the first instruction to the input device, the method may further include: Based on the Bluetooth connection status information of the input device, it can identify whether the input device is in a state of not being connected to Bluetooth.

[0021] In one exemplary embodiment, after sending the second instruction to the input device and before sending the first instruction to the input device, the method may further include: Based on the Bluetooth connection status information of the input device, identify whether the input device is in a Bluetooth connected state; A third instruction carrying a third tag is sent to the input device via the uplink, causing the input device to respond by recognizing the third tag and sending third data to the terminal device via the downlink; wherein the third data includes at least a second pairing identifier; and It was determined that the second pair identifier could not be recognized.

[0022] In one exemplary implementation, the method may further include, before sending a write command to the input device: Sending a second instruction carrying a second tag to the input device via the uplink; and The receiving input device, in response to recognizing the second tag, sends second data to the terminal device via a downlink. The second data includes at least first OOB data length information and / or information on pairing modes that the input device can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the input device can provide.

[0023] In one exemplary implementation, the method may further include, prior to establishing a Bluetooth connection with the input device: In response to the detection that the value of the first OOB data length information is not 0, a fourth instruction carrying a fourth marker is sent to the input device via the uplink, causing the input device to respond to the recognition of the fourth marker and send fourth data to the terminal device via the downlink; wherein the fourth data includes the first OOB data; and Set the encryption method for OOB pairing based on the first OOB data.

[0024] In one exemplary implementation, the method may further include, prior to establishing a Bluetooth connection with the input device: If the value of the first OOB data length information is identified as 0, and the input device is determined to support OOB pairing based on the information of the pairing modes that the input device can support, a fifth instruction carrying a fifth tag is sent to the input device via the uplink.

[0025] In one exemplary implementation, after sending the fifth instruction to the input device and before establishing a Bluetooth connection with the input device, the method may further include: The input device receives fifth data sent to the terminal device via a downlink, the fifth data including at least second OOB data length information; wherein, in response to recognizing the fifth marker, the input device generates second OOB data and sets the value of the second OOB data length information according to the length of the second OOB data; In response to the detection that the value of the second OOB data length information is not 0, a sixth instruction carrying a sixth tag is sent to the input device via the uplink, causing the input device to respond to the recognition of the sixth tag and send sixth data to the terminal device via the downlink; wherein the sixth data includes the second OOB data; and Set the encryption method for OOB pairing based on the second OOB data.

[0026] One aspect of this disclosure provides an active pen, including: a first receiving module, a first processing module, a first transmitting module, and a first Bluetooth communication module, wherein: The first receiving module is configured to receive a first instruction carrying a first tag sent by the terminal device through the uplink of the touch analog signal link; The first transmitting module is configured to transmit first data to the terminal device via the downlink of the touch analog signal link in response to the first processing module recognizing the first tag. The first data includes at least the Bluetooth device address of the active pen. The first receiving module is further configured to receive a write command sent by the terminal device via the uplink, the write command including at least a first pairing identifier and the Bluetooth device address of the terminal device; and The first Bluetooth communication module is configured to broadcast a Bluetooth connection request to the terminal device. The Bluetooth connection request includes the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device, so that the terminal device responds to the recognition of the Bluetooth connection request and establishes a Bluetooth connection with the active pen based on the first pairing identifier.

[0027] In one exemplary implementation, the first receiving module may be configured to receive a first instruction in the following manner: The receiving terminal device sends a first read instruction carrying a first request flag in the first uplink time slot of the touch analog signal link; The receiving terminal device sends a second read command carrying a second request flag in the second uplink time slot of the touch analog signal link; and The receiving terminal device sends a third read instruction carrying a third request flag in the third uplink time slot of the touch analog signal link.

[0028] In one exemplary implementation, the first sending module can be configured to send first data in the following manner: In response to the first processing module recognizing the first request marker, the first response data is sent to the terminal device in the first downlink time slot of the touch analog signal link. The first response data includes the 0th byte and the 1st byte of the Bluetooth device address of the active pen. In response to the first processing module recognizing the second request marker, second response data is sent to the terminal device in the second downlink time slot of the touch analog signal link. The second response data includes the second and third bytes of the Bluetooth device address of the active pen; and In response to the first processing module recognizing the third request marker, a third response data is sent to the terminal device in the third downlink time slot of the touch analog signal link. The third response data includes the fourth and fifth bytes of the Bluetooth device address of the active pen.

[0029] In one exemplary embodiment, the first receiving module may further be configured to receive a second instruction carrying a second tag sent by the terminal device via the uplink before receiving a write instruction sent by the terminal device; and The first sending module can also be configured to send second data to the terminal device via the downlink in response to the first processing module recognizing the second tag. The second data includes at least information about the device address type of the active pen.

[0030] In one exemplary embodiment, the first receiving module may further be configured to receive a second instruction carrying a second tag sent by the terminal device via an uplink, before receiving the first instruction sent by the terminal device; and The first transmitting module can also be configured to send second data to the terminal device via a downlink in response to the first processing module recognizing the second tag. The second data includes at least the Bluetooth connection status information of the active pen, so that the terminal device can identify whether the active pen is in a Bluetooth-connected state based on the Bluetooth connection status information.

[0031] In one exemplary implementation, the first instruction is sent by the terminal device in response to recognizing that the active pen is not connected to Bluetooth.

[0032] In one exemplary embodiment, the first receiving module may further be configured to receive a third instruction carrying a third tag after the first sending module sends the second data to the terminal device and before receiving the first instruction sent by the terminal device; wherein the third instruction is sent by the terminal device via the uplink in response to recognizing that the active pen is in a Bluetooth connected state based on Bluetooth connection status information; and The first sending module can also be configured to send third data to the terminal device via a downlink in response to the first processing module recognizing the third tag; wherein the third data includes at least a second pairing identifier, so that the terminal device sends a first instruction in response to the inability to recognize the second pairing identifier.

[0033] In one exemplary embodiment, the first receiving module may further be configured to receive a second instruction carrying a second tag sent by the terminal device via the uplink before receiving a write instruction sent by the terminal device; and The first sending module can also be configured to send second data to the terminal device via a downlink in response to the first processing module recognizing the second tag. The second data includes at least first OOB data length information and / or information on the pairing modes that the active pen can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the active pen can provide.

[0034] In one exemplary embodiment, the first receiving module may further be configured to receive a fourth instruction carrying a fourth tag sent by the terminal device via the uplink before the first Bluetooth communication module broadcasts a Bluetooth connection request to the terminal device; wherein the fourth instruction is sent by the terminal device in response to recognizing that the value of the first OOB data length information is not 0; and The first sending module can also be configured to send fourth data to the terminal device via the downlink in response to the first processing module recognizing the fourth tag; wherein the fourth data includes first OOB data, so that the terminal device sets the encryption method of OOB pairing according to the first OOB data.

[0035] In one exemplary embodiment, the first receiving module may also be configured to receive a fifth instruction carrying a fifth tag sent by the terminal device via the uplink before the first Bluetooth communication module broadcasts a Bluetooth connection request to the terminal device; wherein the fifth instruction is sent by the terminal device when it recognizes that the value of the first OOB data length information is 0 and determines that the active pen supports OOB pairing based on the information of the pairing modes that the active pen can support.

[0036] In one exemplary embodiment, the first processing module may be configured to generate second OOB data in response to recognizing the fifth tag after the first receiving module receives the fifth instruction sent by the terminal device and before the first Bluetooth communication module broadcasts a Bluetooth connection request to the terminal device. The first sending module can also be configured to send fifth data to the terminal device via the downlink, the fifth data including at least the second OOB data length information; wherein, the active pen sets the value of the second OOB data length information according to the length of the second OOB data. The first receiving module can also be configured to receive a sixth instruction carrying a sixth marker sent by the terminal device via the uplink; wherein the sixth instruction is sent by the terminal device in response to recognizing that the value of the second OOB data length information is not 0; and The first sending module can also be configured to send sixth data to the terminal device via the downlink in response to the first processing module recognizing the sixth tag; wherein the sixth data includes second OOB data, so that the terminal device sets the encryption method of OOB pairing according to the second OOB data.

[0037] One aspect of this disclosure provides a terminal device, including: a second receiving module, a second processing module, a second transmitting module, and a second Bluetooth communication module, wherein: The second transmitting module is configured to send a first instruction carrying a first tag to the input device via the uplink of the touch analog signal link; The second receiving module is configured to receive first data sent by the input device in response to recognizing the first tag via the downlink of the touch analog signal link, the first data including at least the Bluetooth device address of the input device; The second processing module is configured to generate a first pairing identifier for the input device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device. The second sending module is further configured to send a write command to the input device via the uplink; wherein the write command includes at least a first pairing identifier and the Bluetooth device address of the terminal device, so that the input device broadcasts a Bluetooth connection request to the terminal device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; and The second Bluetooth communication module is configured to establish a Bluetooth connection with the input device based on the first pairing identifier in response to a Bluetooth connection request.

[0038] In one exemplary implementation, the second sending module can be configured to send a write command to the input device in the following manner: Send a first write instruction to the input device; wherein the first write instruction includes the Bluetooth device address of the terminal device, and the index information of the Bluetooth device address of the terminal device; and Send a second write instruction to the input device; wherein the second write instruction includes a first pairing identifier.

[0039] In one exemplary embodiment, the second sending module may also be configured to send a second instruction carrying a second tag to the input device via an uplink before sending a write instruction to the input device, so that the input device, in response to recognizing the second tag, sends second data to the terminal device via a downlink, the second data including at least information about the device address type of the input device.

[0040] In one exemplary embodiment, the second sending module may also be configured to send a second instruction carrying a second tag to the input device via an uplink before sending the first instruction to the input device, so that the input device, in response to recognizing the second tag, sends second data to the terminal device via a downlink, the second data including at least the Bluetooth connection status information of the input device.

[0041] In one exemplary embodiment, the second processing module may also be configured to identify, based on the Bluetooth connection status information of the input device, that the input device is not in a state of not being connected to Bluetooth after the second sending module sends the second instruction to the input device and before sending the first instruction to the input device.

[0042] In one exemplary embodiment, the second processing module may also be configured to identify that the input device is in a Bluetooth-connected state based on the Bluetooth connection status information of the input device after the second sending module sends the second instruction to the input device and before sending the first instruction to the input device. The second sending module can also be configured to send a third instruction carrying a third tag to the input device via the uplink, so that the input device, in response to recognizing the third tag, sends third data to the terminal device via the downlink; wherein the third data includes at least a second pairing identifier; and The second processing module can also be configured to determine that the second pairing identifier cannot be recognized.

[0043] In one exemplary embodiment, the second sending module may further be configured to send a second instruction carrying a second tag to the input device via an uplink before sending a write instruction to the input device; and The second receiving module can also be configured to receive second data sent by the input device to the terminal device via a downlink in response to recognizing the second tag. The second data includes at least first OOB data length information and / or information on pairing modes that the input device can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the input device can provide.

[0044] In one exemplary embodiment, the second sending module may also be configured to, before the second Bluetooth communication module establishes a Bluetooth connection with the input device, in response to the second processing module recognizing that the value of the first OOB data length information is not 0, send a fourth instruction carrying a fourth tag to the input device via the uplink, so that the input device, in response to recognizing the fourth tag, sends fourth data to the terminal device via the downlink; wherein the fourth data includes the first OOB data, so that the terminal device sets the encryption method of OOB pairing according to the first OOB data.

[0045] In one exemplary embodiment, the second sending module may also be configured to send a fifth instruction carrying a fifth tag to the input device via the uplink before the second Bluetooth communication module establishes a Bluetooth connection with the input device, provided that the second processing module recognizes that the value of the first OOB data length information is 0 and the second processing module determines that the input device supports OOB pairing based on the information of the pairing modes that the input device can support.

[0046] In one exemplary embodiment, the second receiving module may also be configured to receive fifth data sent by the input device to the terminal device via a downlink after the second sending module sends the fifth instruction to the input device and before the second Bluetooth communication module establishes a Bluetooth connection with the input device. The fifth data includes at least second OOB data length information. In this embodiment, the input device generates second OOB data in response to recognizing the fifth marker and sets the value of the second OOB data length information according to the length of the second OOB data. The second sending module can also be configured to, in response to the second processing module recognizing that the value of the second OOB data length information is not 0, send a sixth instruction carrying a sixth tag to the input device via the uplink, so that the input device, in response to recognizing the sixth tag, sends the sixth data to the terminal device via the downlink; wherein the sixth data includes the second OOB data, so that the terminal device sets the encryption method of OOB pairing according to the second OOB data.

[0047] One aspect of this disclosure provides an electronic device, including: At least one processor; and The memory is communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the device connectivity method provided in any aspect of the embodiments of this disclosure.

[0048] One aspect of this disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are configured to cause the computer to perform a method for device connectivity provided in any aspect of this disclosure.

[0049] One aspect of this disclosure provides a computer program product including a computer program that, when executed by a processor, implements the method for device connectivity provided in any aspect of this disclosure.

[0050] According to the method and related equipment for device connection provided in the embodiments of this disclosure, the exchange of Bluetooth pairing information such as Bluetooth device address and pairing identifier is completed by reusing the existing touch analog signal link between the active pen and the terminal device. This eliminates the need for manual operation by the user and completes Bluetooth pairing or key binding without the user's awareness, significantly improving the convenience and stability of Bluetooth connection.

[0051] It should be understood that the description in this section is not intended to identify key or important features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0052] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure.

[0053] Figure 1 This is a schematic diagram illustrating an application scenario of the device connection method provided in this disclosure.

[0054] Figure 2 This is a schematic diagram of the hardware structure of an active pen provided in an embodiment of this disclosure.

[0055] Figure 3 This is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of this disclosure.

[0056] Figure 4 This is a schematic diagram of the structure of an active pen provided in an embodiment of this disclosure.

[0057] Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this disclosure.

[0058] Figure 6 This is a schematic flowchart of a method for device connection provided in an embodiment of the present disclosure.

[0059] Figure 7 This is an example of a method for device connection provided in an embodiment of the present disclosure.

[0060] Figure 8 A schematic block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0061] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0062] In all the pairing processes—from the minimalist magnetic pairing to standard Bluetooth manual pairing and wired connection-triggered pairing—user intervention is required. For example, in standard Bluetooth manual pairing, the user needs to manually enable the pen's Bluetooth broadcast, access the terminal device's system settings, scan for devices, and click the pairing option; they may even need to manually enter a PIN code. Similarly, in the minimalist magnetic pairing process, the user needs to manually place the pen on the terminal device's designated magnetic area. And in wired connection-triggered pairing, the user needs to manually connect the pen to the terminal device via a USB Type-C cable.

[0063] These processes all require manual operation by the user, which is cumbersome, unintuitive, and inconvenient. To achieve seamless Bluetooth pairing between the active pen and the terminal device, Out-of-Band (OOB) pairing has been proposed. OOB pairing refers to the Bluetooth pairing process where device discovery and key exchange occur on a wireless channel other than Bluetooth itself, such as Radio Frequency (RF) or Near Field Communication (NFC), while authentication and connection establishment occur on the Bluetooth RF channel. Because OOB pairing exchanges the security credentials required for pairing through other physical channels, users can simply pick up the active pen and use it without manually entering system settings, searching for devices, or confirming passwords, thus achieving seamless Bluetooth pairing.

[0064] In contrast to Out-of-Band (OOB) pairing, in-band pairing refers to a Bluetooth pairing process where device discovery, key exchange, authentication, and connection establishment all occur on the Bluetooth radio frequency channel. Because in-band pairing exchanges the security credentials required for pairing via the Bluetooth radio frequency channel, users still need to manually access system settings, search for devices, or confirm passwords, thus preventing seamless Bluetooth pairing.

[0065] In other words, not all active pens can achieve seamless Bluetooth pairing without the user noticing.

[0066] To address the aforementioned technical issues, this disclosure provides a method for device connection, an active pen, and a terminal device. It aims to provide an active pen system and a user-unnoticed Bluetooth pairing method. By reusing the existing touch analog signal link between the active pen and the touchscreen, Bluetooth pairing information is automatically exchanged, completing Bluetooth pairing or key binding without the user's awareness, significantly improving the convenience and stability of Bluetooth connections.

[0067] The device connection method provided in this disclosure is applied to user-invisible Bluetooth pairing between an input device and a terminal device. The input device includes, but is not limited to, an active pen, and may also include, for example, touchscreen automated testing equipment and signal acquisition and conversion equipment used in industrial testing and automation, game controllers used in consumer electronics, and even another terminal device. For example, two terminal devices can communicate via a touchscreen. In this mode, the touchscreen's driving and sensing channels can be multiplexed as signal transmitters and receivers, essentially establishing a touch analog signal link at the touch sensor level, achieving "screen-to-screen" data transmission. In this case, either terminal device can be considered an input device relative to the other. In the following, using an active pen as an example, the device connection method, the active pen, and the terminal device using this method will be described in detail.

[0068] Figure 1 This diagram illustrates an application scenario of the device connection method provided in this embodiment. Based on the hardware components of the active pen 10 and the terminal device 20, a touch analog signal link can be established between the active pen 10 and the terminal device 20, thereby realizing short-range wireless communication based on the touch analog signal link.

[0069] Figure 2 This is a schematic diagram of a hardware structure for an active pen 10 provided in an embodiment of this disclosure. Figure 2As shown, the active pen 10 includes at least a microcontroller (MCU) 101, a digital-to-analog converter (DAC) 102, a transmitter (Tx) 103, a receiver (Rx) 104, and a pressure sensor 105. The MCU 101 can process and analyze signals from the pressure sensor 105 and Rx 104, and generate or process data to be transmitted. The DAC 102 can convert digital signals into analog signals. The Tx 103 can transmit downlink analog signals to a terminal device via the pen tip electrodes. The Rx 104 can receive uplink analog signals from the terminal device. The working principle of the active pen 10 is roughly as follows: Pressure sensor 105 detects the pressure on the pen tip and converts the physical deformation into an electrical signal. This physical deformation is converted into an analog voltage signal, which is typically directly fed into the built-in analog-to-digital converter (ADC) of MCU 101 for sampling, or processed by a separate ADC to transmit the digitized pressure value to MCU 101. MCU 101 encapsulates and modulates the data to be transmitted, generating a digital baseband signal, which is then fed into DAC 102 to convert it into an analog signal. The analog signal output from DAC 102 is then amplified and driven by a circuit, and coupled to the touchscreen via Tx 103 through the pen tip electrode. Rx 104 captures the uplink analog signal from the terminal device, which, after necessary filtering and amplification, is fed into the ADC to convert it into a digital signal, and finally processed by MCU 101. MCU 101, as the core controller of the active pen 10, configures parameters such as the gain of DAC 102 and the sampling rate of the ADC in real time through interfaces such as GPIO, SPI, or I2C. 101 will also adjust the sampling strategy of pressure sensor 105 or the working mode of active pen 10 according to the parsed uplink instructions.

[0070] Figure 3 This is a schematic diagram of a hardware structure of a terminal device 20 provided in an embodiment of this disclosure. For example... Figure 3As shown, the terminal device 20 includes at least channels, an analog front-end (AFE) 202, an ADC 203, and a main chip 204. The channels are numerous transmit / receive channels (Tx / Rx Channels) 201 on the terminal device 20, which intersect to form a sensing grid under the touchscreen. The Tx / Rx channels 201 can act as Rx terminals (e.g., in the downlink time slot of the touch analog signal link) to receive downlink analog signals transmitted by the active pen. The Tx / Rx channels 201 can also act as Tx terminals (e.g., in the uplink time slot of the touch analog signal link) to transmit uplink analog signals. The AFE 202 can perform preprocessing such as amplification and filtering on the received weak analog signals. The ADC 203 can digitize the preprocessed analog signals and pass them to the main chip 204 for processing. The main chip 204 can calculate the precise coordinates, pressure, and other information of the active pen and report it to the operating system of the terminal device 20. The working principle of terminal device 20 is roughly as follows: According to the protocol timing, the main control chip 204 applies a driving signal to the touch electrodes of the touch screen through the Tx / Rx channel 201 in the uplink time slot of the touch analog signal link, forming an uplink analog signal, which is received by the active pen to achieve communication synchronization. In the downlink time slot of the touch analog signal link, the downlink analog signal emitted by the active pen is captured by the touch screen's Tx / Rx channel 201. The captured signal first enters the AFE 202, which is responsible for amplifying and filtering the weak charge signal to improve the signal-to-noise ratio. The processed signal is then sent to the ADC 203 to quantize the analog voltage into a digital signal. The digitized data is transmitted to the main control chip 204 via an internal bus such as SPI or I2C. The main control chip 204 executes the core algorithm: determining the X / Y coordinates of the pen tip by calculating the signal strength distribution of different Tx / Rx channels 201, and demodulating information such as pressure and pen identification in the data packet. The main control chip 204 also sends the signal to the AFE via the internal bus. 202 sends control commands (such as setting gain, adjusting filter parameters, etc.) and sends commands to the touch screen sensor (such as selecting channels in a specific area, adjusting scanning frequency, etc.) to achieve dynamically optimized touch detection.

[0071] The establishment and communication of the touch analog signal link between the active pen and the terminal device generally follows a process from "physical contact wake-up" to "protocol handshake synchronization" and then to "stable data communication." The entire process can be led by the terminal device, with the active pen cooperating, ultimately achieving a smooth writing experience.

[0072] Phase 1: Physical wake-up and pre-synchronization, which can be triggered by the proximity of the pen to the terminal device.

[0073] Hardware wake-up: The active pen integrates a motion or pressure sensor 105. When the user holds the pen or the pen tip touches the touchscreen, the sensor generates an electrical signal due to deformation or movement. Once the signal exceeds a threshold, an interrupt is generated, waking up the active pen's MCU 101 and switching it from sleep mode to working mode.

[0074] Physical sensing: When the pen tip approaches the touchscreen, a weak coupling capacitance is formed between the transmitting electrode inside the pen tip and the sensing electrode on the touchscreen. This physical phenomenon is the basis of analog communication.

[0075] Active "broadcast" location: After the stylus is activated, it can actively send a brief pre-synchronization signal (such as a pulse of a specific frequency) through the pen tip. This signal does not transmit data, but rather acts like a "I'm here" broadcast, informing the terminal device of its presence and approximate location. Its purpose is to allow the terminal device to quickly orient itself without having to scan the entire screen.

[0076] Phase Two: Protocol Handshake and Synchronization, which is the key step in establishing a dedicated communication link.

[0077] Targeted response from the terminal device: After detecting the pre-synchronization signal of the active stylus on the channel of the terminal device's touchscreen, it quickly determines the approximate area where the active stylus is located. Subsequently, the terminal device no longer broadcasts across the entire screen, but instead sends an uplink beacon containing a synchronization clock and instructions only to that area. This precise "calling" greatly shortens the response time and reduces power consumption.

[0078] Active pen parsing and response: After receiving a directional uplink beacon, the active pen parses the timing parameters required for communication (such as the time division duplex (TDD) frame structure and time slot allocation). Once the active pen and the terminal device are synchronized in time and frequency, the active pen sends an acknowledgment signal to confirm the synchronization.

[0079] Locking communication parameters: After the terminal device confirms that the response is correct, the communication parameters (such as frequency and time slot) of both parties are locked, and the analog communication link dedicated to this active pen is officially established.

[0080] It should be noted that the above-described process for establishing a touch analog signal link between the active pen and the terminal device is merely an example. The establishment of this link can also be led by the active pen, with the terminal device providing support. The communication protocol used for the touch analog signal link can include, but is not limited to, the Universal Stylus Initiative, the Microsoft Pen Protocol, Active Electrostatic, the Goodix Pen Protocol / High-voltage Protocol, or the Wacom Generic Protocol. The timing parameters required for communication based on the touch analog signal link (e.g., TDD frame structure, time slot allocation) can also be flexibly set according to usage requirements. In summary, this disclosure does not impose specific limitations on the process of establishing the touch analog signal link between the active pen and the terminal device, the communication protocol used, or the timing parameters required for communication, as long as stable data communication can be established between the active pen and the terminal device based on the touch analog signal link.

[0081] After the active pen and the terminal device are brought close together and data communication based on the touch analog signal link is established, the Bluetooth pairing process between the active pen and the terminal device can be started, which is the method for device connection provided in the embodiments of this disclosure.

[0082] like Figure 4 The diagram shown is a structural schematic of an active pen 10 provided in an embodiment of this disclosure. Implementing the device connection method provided in this embodiment mainly involves functional modules including a first receiving module 401, a first processing module 402, a first sending module 403, and a first Bluetooth communication module 404, all included in the active pen.

[0083] In one exemplary embodiment, the first receiving module 401 can be implemented by the Rx 104 of the active pen. The first receiving module 401 can be configured to capture an uplink analog signal carrying instructions from the terminal device during the uplink time slot of the touch analog signal link. This uplink analog signal, after necessary filtering and amplification, can be detected by the active pen's ADC (Analog-to-Digital Converter). Figure 4 (Not shown in the image) is converted into a digital signal.

[0084] In one exemplary embodiment, the first processing module 402 can be implemented by the MCU 101 of the active pen. The first processing module 402 can be configured to process and parse the digital signal converted from the uplink analog signal according to the protocol format, based on the protocol and / or version information of the user-invisible Bluetooth pairing pre-stored by the active pen. For example, when the uplink analog signal carries a read command sent by the terminal device, the first processing module 402 can identify the request marker carried by the read command based on the protocol format, and in response to identifying the request marker, know what kind of data the terminal device requests from the active pen. As another example, when the uplink analog signal carries a write command sent by the terminal device, the first processing module 402 can identify the format of the write command based on the protocol format, thereby parsing the content of the digitized write command. The first processing module 402 can also be configured to acquire, process, and perform calculations on the data. For example, the first processing module 402 can read the active pen's identification identifier and its pairing key / confirmation value, and generate the active pen's OOB data (including a random value, confirmation value, or temporary key (TK) value). The first processing module 402 can also be configured to respond to a request flag in the identification read command, acquire the corresponding data, and encapsulate and modulate the data according to the protocol format to generate a digital baseband signal (i.e., response data). This digital baseband signal can be transmitted through the active pen's DAC 102 (…). Figure 4 (Not shown in the image) is converted into an analog signal.

[0085] In one exemplary embodiment, the first transmitting module 403 can be implemented by the Tx 103 of the active pen. The analog signal output by the DAC 102 of the active pen is amplified and driven by the circuitry, and then transmitted by the first transmitting module 403 through the pen tip electrode (…) in the downlink time slot of the touch analog signal link. Figure 4 (Not shown) is coupled to the touchscreen of the terminal device to form a downlink analog signal carrying response data.

[0086] In one exemplary embodiment, the first Bluetooth communication module 404 can be implemented by the Bluetooth communication module of the active pen and its associated antenna. The first Bluetooth communication module 404 may include BLE functionality and can be configured to perform Directed Advertising. The first Bluetooth communication module 404 can also be configured to authenticate the terminal device and manage data communication based on the Bluetooth connection after obtaining a pairing identifier (or key) for Bluetooth pairing.

[0087] like Figure 5The diagram shown is a structural schematic of a terminal device 20 provided in an embodiment of this disclosure. Implementing the device connection method provided in this embodiment mainly involves functional modules including a second receiving module 501, a second processing module 502, a second sending module 503, and a second Bluetooth communication module 504 included in the terminal device 20.

[0088] In one exemplary embodiment, the second receiving module 501 can be implemented by the Tx / Rx channel 201 of the terminal device 20. During the downlink time slot of the touch analog signal link, the downlink analog signal carrying response data sent by the active pen is captured by the second receiving module 501. The captured signal can first enter the AFE 202 of the terminal device 20 (… Figure 5 (Not shown in the diagram), the weak charge signal is preprocessed by AFE 202 through amplification and filtering to improve the signal-to-noise ratio. The ADC203 of the terminal device 20 (… Figure 5 (Not shown in the image) can convert preprocessed analog signals into digital signals.

[0089] In one exemplary embodiment, the second processing module 502 can be implemented by the main control chip 204 of the terminal device 20, or it can be jointly implemented by the main control chip 204 and the operating system of the terminal device 20. The second processing module 502 can be configured to process and parse the digital signal converted from the downlink analog signal according to the protocol format, based on the user-insensitive Bluetooth pairing protocol and / or protocol version information pre-stored by the terminal device 20. For example, the second processing module 502 can identify the format of the response data (i.e., the digital signal converted from the downlink analog signal) from the active pen according to the protocol format, thereby parsing the content of the received response data. The second processing module 502 can also be configured to process and perform calculations on the data. For example, the second processing module 502 can perform calculations on the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device based on a preset algorithm, thereby generating a unique identifier for Bluetooth pairing for the active pen. As another example, the second processing module 502 can read the identity identifier of the terminal device, as well as information such as the pairing key / confirmation value of the terminal device, and generate OOB data (including random numbers, confirmation values, or TK values) for the terminal device.

[0090] The second processing module 502 can also be configured to generate instructions according to the protocol format (i.e., read instructions or write instructions), and according to the protocol timing, transmit them to the touch electrodes of the touch screen through the second sending module 503 in the uplink time slot of the touch analog signal link. Figure 5 (not shown) A drive signal is applied to form an uplink analog signal carrying the instruction.

[0091] In one exemplary embodiment, the second transmitting module 503 may be implemented by the Tx / Rx channel 201 of the terminal device 20. In the uplink time slot of the touch analog signal link, the second transmitting module 503 applies a driving signal to the touch electrode of the touch screen according to the instruction generated by the second processing module 502, so as to form an uplink analog signal carrying the instruction.

[0092] In one exemplary embodiment, the second Bluetooth communication module 504 can be implemented by the Bluetooth communication module of the terminal device 20 and its associated antenna. The second Bluetooth communication module 504 may include BLE functionality and can be configured to receive directional broadcasts from the active pen. The second Bluetooth communication module 504 can also be configured to authenticate the active pen and manage data communication based on the Bluetooth connection after obtaining a pairing identifier (or key) for Bluetooth pairing.

[0093] like Figure 6 As shown, it is a flowchart of a method for device connection provided in an embodiment of the present disclosure, which includes S601-S606.

[0094] In S601, the terminal device sends a first instruction carrying a first mark to the active pen via the uplink of the touch analog signal link.

[0095] In S602, in response to recognizing the first tag, the active pen sends first data to the terminal device via the downlink of the touch analog signal link. The first data includes at least the Bluetooth device address of the active pen.

[0096] In one exemplary implementation, since both the active pen and the terminal device pre-store the protocol and / or version information of the Bluetooth pairing process that allows the user to be unaware of the connection, the terminal device generates instructions according to the protocol format, and the active pen can identify these instructions from the terminal device according to the protocol format. Specifically, the terminal device can include a request flag (e.g., a first flag, or a first request flag, second request flag, third request flag, second flag, third flag, fourth flag, fifth flag, sixth flag, or seventh flag) corresponding to the read instruction (e.g., a first flag, or a first request flag, second request flag, third request flag, second flag, third flag, fourth flag, fifth flag, sixth flag, or seventh flag) in the read instruction according to the protocol format. The active pen can then identify the request flag carried in the read instruction according to the protocol format, thereby knowing what data the terminal device is requesting from the active pen.

[0097] In one exemplary implementation, the active pen responds to the recognition of the request marker carried in the read instruction by generating response data corresponding to the read instruction according to the protocol format (e.g., first data, or the first response data, second response data, third response data, second data, third data, fourth data, fifth data, or sixth data mentioned below), and sends the response data corresponding to the read instruction to the terminal device.

[0098] In one exemplary implementation, the active pen generates response data corresponding to the read command according to the protocol format, and the terminal device can process and parse the response data from the active pen corresponding to the read command according to the protocol format, thereby obtaining the data requested by the terminal device from the active pen.

[0099] For example, the terminal device carries a first tag in the first instruction according to the protocol format; the active pen identifies the first tag carried in the first instruction according to the protocol format, thereby knowing that the terminal device requests the Bluetooth device address of the active pen; in response to identifying the first tag carried in the first instruction, the active pen performs protocol encapsulation and modulation of the Bluetooth device address of the active pen according to the protocol format to generate first data; and the terminal device can process and parse the first data according to the protocol format to obtain the Bluetooth device address of the active pen.

[0100] In S603, the terminal device generates a first pairing identifier for the active pen based on the active pen's Bluetooth device address and the terminal device's Bluetooth device address.

[0101] In one exemplary implementation, the first pairing identifier is an identifier used to uniquely identify the Bluetooth pairing between the active pen and the terminal device.

[0102] In one exemplary implementation, the terminal device can first concatenate the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device according to a preset rule to obtain the concatenated Bluetooth device address. Then, it can use a key (e.g., a pre-shared key (PSK) written at the factory of the terminal device) to perform HMAC operation on the concatenated Bluetooth device address, and finally generate a first pairing identifier for the active pen.

[0103] It should be noted that the embodiments disclosed herein do not impose any limitations on the specific protocol, algorithm, or key used to generate the first pairing identifier based on the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device, as long as a unique identifier for Bluetooth pairing between the active pen and the terminal device can be generated based on the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device.

[0104] In S604, the terminal device sends a write command to the active pen via the uplink; the write command includes at least a first pairing identifier and the Bluetooth device address of the terminal device.

[0105] In one exemplary implementation, the terminal device generates a write instruction (e.g., the first write instruction or the second write instruction mentioned below) according to a protocol format, and the active pen can process and parse the write instruction from the terminal device according to the protocol format to obtain the data indicated by the terminal device to the active pen.

[0106] For example, the terminal device can encapsulate and modulate the first pairing identifier and the Bluetooth device address of the terminal device according to the protocol format to generate a write command; the active pen can process and parse the write command according to the protocol format to obtain the first pairing identifier and the Bluetooth device address of the terminal device as indicated by the terminal device to the active pen.

[0107] In S605, the active pen broadcasts a Bluetooth connection request to the terminal device. The Bluetooth connection request includes the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device.

[0108] In one exemplary implementation, after the active pen acquires the first pairing identifier, the active pen's Bluetooth communication module (i.e., the first Bluetooth communication module 404) is activated. The active pen initiates a directional broadcast to the terminal device via the Bluetooth 2.4 GHz wireless channel. The data packet of the directional broadcast explicitly contains the Bluetooth device address of the target device (i.e., the terminal device). This broadcast packet itself is a "connection request," telling the terminal device, "I know your address, I am specifically looking for you, please connect to me as soon as possible," thereby achieving a one-to-one rapid connection between the active pen and the terminal device through the known target Bluetooth MAC address (i.e., the Bluetooth device address of the terminal device).

[0109] In S606, the terminal device responds to the Bluetooth connection request by establishing a Bluetooth connection with the active pen based on the first pairing identifier.

[0110] In one exemplary implementation, after both the active pen and the terminal device obtain the first pairing identifier, their respective Bluetooth communication modules (i.e., the first Bluetooth communication module 404 and the second Bluetooth communication module 504) are activated. Based on the first pairing identifier and the Bluetooth device addresses of both parties, they perform complex mathematical operations via the Bluetooth 2.4GHz wireless channel to verify each other's identities. After successful verification, the respective Bluetooth communication modules of the active pen and the terminal device are responsible for establishing an encrypted data connection and managing all subsequent data communications.

[0111] For example, after the Bluetooth communication modules of both the active pen and the terminal device are activated, both parties confirm the use of Just Works mode. At this time, the TK in the Bluetooth pairing process is set to a fixed default value, which is a 128-bit value all zeros. The initiating device (i.e., the active pen) and the responding device (i.e., the terminal device) each generate a 128-bit random number, usually called Mrand and Srand. Then, both parties use a c1 function with an approximate AES algorithm as input, taking the fixed TK value (0), their respective generated random numbers, and Bluetooth pairing information exchanged through the touch analog signal link (e.g., the Bluetooth device addresses and first pairing identifiers of both parties) as input, to calculate their respective confirmation values, namely Mconfirm and Sconfirm. Both parties exchange their confirmation values, and then exchange their random numbers. Each device recalculates its confirmation value using the random number sent by the other party and its own TK value (still 0), and compares it with the previously received confirmation value. If the calculation results match, it means that both parties have the same TK, Bluetooth pairing information, and correct random number, i.e., authentication is successful; otherwise, pairing fails. After successful authentication, both parties proceed to the key generation step. At this point, the system uses another algorithm called s1, taking the TK (still a fixed value of 0) and the previously exchanged random numbers (Mrand and Srand) as input, to calculate the final short-term key (STK). This newly generated STK is the actual session key used to encrypt the current Bluetooth connection.

[0112] It should be noted that, regarding the specific implementation of the active pen and the terminal device verifying each other's identities and establishing an encrypted data connection on the Bluetooth 2.4 GHz wireless channel based on the Bluetooth pairing information exchanged through the touch analog signal link, relevant technologies can be referenced, and this disclosure does not limit them in any way.

[0113] According to the method for device connection, active pen and terminal device provided in the embodiments of this disclosure, the exchange of Bluetooth pairing information such as Bluetooth device address and pairing identifier is completed by reusing the existing touch analog signal link between the active pen and the terminal device, so that Bluetooth pairing or key binding can be completed without the user's manual operation, significantly improving the convenience and stability of Bluetooth connection.

[0114] Furthermore, by reusing the existing touch analog signal link between the active pen and the terminal device to exchange Bluetooth device addresses, the active pen can broadcast a Bluetooth connection request to the terminal device on the 2.4GHz Bluetooth wireless channel based on the terminal device's Bluetooth device address. This avoids the "no device found" situation in the traditional Bluetooth pairing process and significantly improves user experience satisfaction.

[0115] Furthermore, in the device connection method provided in this embodiment, since device discovery and Bluetooth pairing information exchange during the Bluetooth pairing process have been completed based on the touch analog signal link, the user's manual operations such as enabling Bluetooth broadcasting of the active pen, entering the terminal device's system for settings, scanning devices, and clicking pairing are eliminated. Therefore, even for active pens that only support in-band pairing in related technologies (i.e., active pens that cannot support OOB pairing), user-unnoticed Bluetooth pairing between the active pen and the terminal device can still be achieved. In other words, for active pens that cannot support OOB pairing, the performance of existing active pens that cannot support OOB pairing can be improved simply through software upgrades, enabling active pens that cannot support OOB pairing to also support user-unnoticed Bluetooth pairing.

[0116] In one optional implementation, the first instruction may include multiple read instructions, and correspondingly, the first data may include multiple response data. For example, the first instruction may include a first read instruction, a second read instruction, and a third read instruction; correspondingly, the first tag corresponding to the first instruction may include a first request tag carried by the first read instruction, a second request tag carried by the second read instruction, and a third request tag carried by the third read instruction; correspondingly, the first data may include first response data, second response data, and third response data corresponding to the first request tag, the second request tag, and the third request tag, respectively.

[0117] In this embodiment, the S601 terminal device sends a first instruction carrying a first tag to the active pen via the uplink of the touch analog signal link, and the S602 active pen, in response to recognizing the first tag, sends first data to the terminal device via the downlink of the touch analog signal link, which may include: The terminal device sends a first read instruction carrying a first request tag to the active pen in the first uplink time slot of the touch analog signal link; In response to recognizing the first request marker, the active pen sends first response data to the terminal device in the first downlink time slot of the touch analog signal link. The first response data includes the 0th byte and the 1st byte of the active pen's Bluetooth device address. The terminal device sends a second read instruction carrying a second request marker to the active pen in the second uplink time slot of the touch analog signal link; In response to the recognition of the second request marker, the active pen sends second response data to the terminal device in the second downlink time slot of the touch analog signal link. The second response data includes the second and third bytes of the active pen's Bluetooth device address. The terminal device sends a third read command carrying a third request flag to the active pen in the third uplink time slot of the touch analog signal link; and In response to the identification of the third request marker, the active pen sends third response data to the terminal device in the third downlink time slot of the touch analog signal link. The third response data includes the fourth and fifth bytes of the active pen's Bluetooth device address.

[0118] In this embodiment, taking the Bluetooth device address of the active pen as including 48 bits / 6 bytes of data as an example, the terminal device sends three read commands carrying different request markers; the active pen splits the active pen's Bluetooth device address into three response data, each response data carrying 16 bits / 2 bytes of data from the active pen's Bluetooth device address, and the active pen sends response data corresponding to each of the three read commands to the terminal device.

[0119] In this implementation, by splitting the data, each packet is shorter and occupies less channel time. Shorter packets have smaller transmission time windows, making it easier to find gaps with less interference to complete transmission. In noisy environments, this significantly reduces the probability of packet collisions and interference, improving communication success rate and stability, making it particularly suitable for high real-time scenarios such as communication between an active pen and a terminal device. Furthermore, distributing critical data across multiple packets and employing a strategy of "independent acknowledgment for each packet" (i.e., packet-by-packet acknowledgment) means that if a fragment fails to transmit, only that fragment needs to be retransmitted, rather than the entire 6-byte address, improving overall anti-interference capability and transmission efficiency. Moreover, this mechanism allows the system to flexibly adjust the length of individual packets as needed, without being fixed to a single 6-byte packet format, providing protocol-level scalability for dynamically adding or removing request parameters in the future.

[0120] In one alternative implementation, the terminal device may also send a read command to the active pen in one uplink time slot of the touch analog signal link, and the active pen carries the Bluetooth device address of the active pen in multiple response data and responds to the read command in multiple downlink time slots of the touch analog signal link.

[0121] In one optional implementation, the S604 terminal device sending a write command to the active pen may include: The terminal device sends a first write command to the active pen; wherein the first write command includes the Bluetooth device address of the terminal device, and the index information of the Bluetooth device address of the terminal device; and The terminal device sends a second write command to the active pen; wherein the second write command includes a first pairing identifier.

[0122] In this implementation, "identity information" (address and index) and "behavioral instructions" (pairing identifier) ​​are sent separately, achieving clear logical decoupling. This clear, step-by-step processing flow contributes to the stable operation of the device firmware, especially in small devices with limited processing capabilities (such as active pens). The active pen's MCU 101 can process these two types of information in a time-sharing and orderly manner, avoiding the parsing of mixed fields in the same data packet, thereby reducing the probability of data parsing errors. Furthermore, by writing pairing information step-by-step and in an orderly manner, it ensures that each step builds upon previous successes. If the first write instruction (address transmission) fails, the second write instruction (pairing start) will not be executed, thus avoiding starting pairing midway or in an erroneous state. This design effectively improves the robustness of the entire pairing process.

[0123] In one exemplary implementation, the first write instruction may include an index field and an address field. The index field carries index information of the Bluetooth device address of the terminal device, and the address field carries part or all of the data of the Bluetooth device address of the terminal device. The address field may occupy a set number of bits in the first write instruction, for example, 12 bits. The index field may occupy a set number of bits in the first write instruction, for example, 4 bits. The index information of the Bluetooth device address of the terminal device is used to indicate the position of the data (e.g., 12 bits of data) carried in the address field of this instruction within the total data of the Bluetooth device address of the terminal device.

[0124] Taking the terminal device's Bluetooth device address as including 48 bits of data and the first write instruction as including 16 bits of data as an example, the terminal device needs to send 4 first write instructions to the active pen. Each first write instruction includes a 4-bit index field and a 12-bit address field. The index field in each first write instruction is used to indicate the position of the 12-bit data carried in the address field of this first instruction in the total data of the terminal device's Bluetooth device address.

[0125] In this implementation, a large block of data, such as 48 bits, to be transmitted at once is split into multiple smaller packets carrying only 12 bits of data each. In wireless communication, shorter data packets result in shorter transmission times and a lower probability of interference and collisions, significantly improving the success rate of data transmission in complex environments (such as those with interference from 2.4GHz signals like Wi-Fi and Bluetooth). Furthermore, by setting an index field, each data fragment carries a clear "location tag." This allows the receiving end (the active pen) to perform ordered reassembly (even if multiple data packets arrive out of order, the original 48-bit address can be correctly recovered based on the index) and missing data detection (if the received indexes are not contiguous, the lost fragment can be accurately located and retransmitted without retransmitting all data). Finally, this "data + index" fragmentation structure allows the system to flexibly adapt to data transmission requirements of different lengths. Whether transmitting a 48-bit Bluetooth device address or potentially longer identifiers in the future, it can be easily supported by adjusting the number of fragments without modifying the underlying communication frame structure.

[0126] In an optional implementation, before the S604 terminal device sends a write command to the active pen via the uplink, the method may further include: The terminal device sends a second instruction carrying a second tag to the active pen via the uplink; and In response to the identification of the second tag, the active pen sends second data to the terminal device via the downlink. The second data includes at least information about the active pen's device address type.

[0127] In this embodiment, the second data may include a BLE address type field, which carries information about the device address type of the active pen. The BLE address type field may occupy a set number of bits in the second data, for example, 2 bits. The device address type information of the active pen may include an identifier that uniquely identifies the device address type of the active pen. The BLE address type field can explicitly indicate whether the Bluetooth device address of the active pen is a public address or a random address, enabling the terminal device to correctly handle address resolution under different privacy policies and enhancing the compatibility of the active pen with terminal devices employing different privacy policies.

[0128] The device address type of the active pen can include, but is not limited to, an identity address, a resolvable private address, or a non-resolvable private address; among which, the identity address can include, but is not limited to, a public address or a random static address.

[0129] In other words, before the terminal device generates a write command, preferably before the terminal device requests the active pen to respond with its own Bluetooth device address, the terminal device can first request the active pen to respond with its own device address type information, so as to facilitate the terminal device to parse the received active pen's Bluetooth device address later.

[0130] In an optional implementation, before the S601 terminal device sends the first instruction to the active pen, the method may further include: The terminal device sends a second instruction carrying a second tag to the active pen via the uplink; and In response to the identification of the second tag, the active pen sends second data to the terminal device via the downlink. The second data includes at least the Bluetooth connection status information of the active pen.

[0131] In this embodiment, the second data may include a connection status field, which carries the Bluetooth connection status information of the active pen. The connection status field may occupy a set number of bits in the second data, for example, 1 bit. The Bluetooth connection status information of the active pen may include an identifier indicating the current Bluetooth connection status of the active pen. For example, an identifier "0" indicates that the active pen is currently not connected to Bluetooth, and an identifier "1" indicates that the active pen is currently connected to Bluetooth. Accordingly, the current Bluetooth connection status of the active pen may include: being connected to Bluetooth or being not connected to Bluetooth.

[0132] In other words, before the terminal device requests the active pen to respond to its Bluetooth device address, the terminal device can first request the active pen to respond to its current Bluetooth connection status.

[0133] In an optional implementation, after the active pen sends the second data to the terminal device and before the terminal device sends the first instruction to the active pen in S601, the method may further include: the terminal device identifying that the active pen is in a state of not being connected to Bluetooth based on Bluetooth connection status information.

[0134] In other words, before the terminal device requests the active pen to respond with its Bluetooth device address, it can first determine that the active pen is in a Bluetooth-disconnected state based on the identifier in the connection status field carried in the second data, which indicates the current Bluetooth connection status of the active pen, in order to prevent repeated connections.

[0135] In an optional implementation, after the active pen sends the second data to the terminal device and before the terminal device sends the first instruction to the active pen in S601, the method may further include: Based on the Bluetooth connection status information of the active pen, the terminal device can identify that the active pen is in a Bluetooth connected state. The terminal device sends a third instruction carrying a third tag to the active pen via the uplink; In response to the identification of the third marker, the active pen sends third data to the terminal device via the downlink; wherein the third data includes at least a second pairing identifier; and The terminal device has determined that it cannot recognize the second pairing identifier.

[0136] In this embodiment, the third data may include a pairing identifier field, which carries a second pairing identifier. The pairing identifier field may occupy a set number of bits in the third data, for example, 8 bits. The second pairing identifier is an identifier used to uniquely identify the current Bluetooth pairing of the active pen.

[0137] In this embodiment, when the terminal device identifies that the active pen is in a Bluetooth-connected state based on the second data, the active pen can carry the second pairing identifier (i.e., the identifier of the active pen's current Bluetooth pairing) in the pairing identifier field of the third data. The terminal device then matches the second pairing identifier with the pairing identifier stored in the terminal device itself (for example, the terminal device determines whether it has already stored the second pairing identifier; if so, the match is successful; otherwise, the match is unsuccessful). If the match is successful, the terminal device determines that it has established a Bluetooth connection with the active pen; otherwise, the terminal device determines that the active pen's current Bluetooth pairing target is another device.

[0138] In other words, after the active pen responds to the terminal device with its current Bluetooth connection status, but before the terminal device generates a write command, preferably before the terminal device requests the active pen to respond with its Bluetooth device address, and after the terminal device has determined that the active pen is connected to Bluetooth, the terminal device can request the active pen to respond with its current Bluetooth connection pairing identifier (i.e., the second pairing identifier). Only if the terminal device determines that it does not have the second pairing identifier stored, that is, if the terminal device determines that the active pen has not yet established a Bluetooth connection with itself, will the terminal device request the active pen to respond with its Bluetooth device address.

[0139] Furthermore, it should be noted that if the terminal device determines that it has stored the second pairing identifier, thereby determining that the active pen has established a Bluetooth connection with itself, then the terminal device does not need to request the active pen to respond with the active pen's Bluetooth device address, nor does it need to perform any subsequent steps.

[0140] In an alternative implementation, before the S604 terminal device sends a write command to the active pen, the method may further include: The terminal device sends a second instruction carrying a second tag to the active pen via the uplink; and In response to the identification of the second marker, the active pen sends second data to the terminal device via the downlink. The second data includes at least information about the pairing modes that the active pen can support.

[0141] In this embodiment, the second data may include a first pairing mode field, which carries information about the pairing modes supported by the active pen. The first pairing mode field may occupy a set number of bits in the second data, for example, 3 bits. The information about the pairing modes supported by the active pen may be an identifier used to uniquely identify the pairing modes supported by the active pen.

[0142] The pairing modes supported by the active pen can include BLE pairing; BLE pairing can include in-band pairing, OOB pairing, or quick pairing; in-band pairing includes, but is not limited to, Google Fast Pair or Microsoft Swift Pair; OOB pairing includes, but is not limited to, NFC Mode; quick pairing is an upper-layer application built on the BLE pairing mechanism, and is a pairing scheme in BLE pairing that is parallel to Google Fast Pair, Microsoft Swift Pair, or NFC Mode, for example, quick pairing can include quick pairing schemes based on proprietary protocols, etc.

[0143] In other words, before the terminal device generates a write command, preferably before the terminal device requests the active pen to respond with its own Bluetooth device address, the terminal device can first request the active pen to respond with information about the pairing modes it can support, so that in S606 the terminal device can use the pairing modes supported by the active pen to establish a Bluetooth connection with the active pen.

[0144] In an optional implementation, if the second data includes information on pairing modes that the active pen can support, the method may further include, before the S604 terminal device sends a write command to the active pen, the terminal device determining a pairing mode for Bluetooth pairing between the active pen and the terminal device based on the information on pairing modes that the active pen can support carried in the second data.

[0145] In this embodiment, the write command sent by the terminal device to the active pen, for example, the second write command, may further include a second pairing mode field, which carries information about a determined pairing mode. The second pairing mode field may occupy a set number of bits in the second write command, for example, 3 bits. The information about the determined pairing mode may be an identifier used to uniquely identify the determined pairing mode.

[0146] In other words, the terminal device can determine the pairing mode for Bluetooth pairing between the active pen and the terminal device based on the pairing mode information that the active pen can support, and send the pairing mode information in the write command to the active pen so that the terminal device and the active pen can perform the Bluetooth pairing process on the Bluetooth radio frequency channel based on the determined pairing mode.

[0147] It should be noted that when the pairing mode is determined to be in-band pairing, the Bluetooth pairing process between the terminal device and the active pen is as described above. Both the active pen and the terminal device can complete the identity verification and key generation based on the TK value (0), their respective generated random numbers, and the Bluetooth pairing information exchanged through the touch analog signal link. This will not be elaborated here.

[0148] In an alternative implementation, before the S604 terminal device sends a write command to the active pen, the method may further include: The terminal device sends a second instruction carrying a second tag to the active pen via the uplink; and In response to the identification of the second marker, the active pen sends second data to the terminal device via the downlink. The second data includes at least first OOB data length information. The value of the first OOB data length information is used to indicate the length of the first OOB data that the active pen can provide.

[0149] In this embodiment, the second data may include an OOB data length field, which carries the length information of the first OOB data. The OOB data length field may occupy a set number of bits in the second data, for example, 7 bits.

[0150] In other words, before the terminal device sends a write command to the active pen, preferably before the terminal device determines the pairing mode, the terminal device can first request the active pen to respond with the OOB data length that the active pen can provide, so as to know whether the active pen supports OOB pairing and whether the active pen can provide OOB data.

[0151] In one optional implementation, the terminal device determines the pairing mode for Bluetooth pairing between the active pen and the terminal device based on information about the pairing modes that the active pen can support. This may include: if the active pen supports OOB pairing based on information about the pairing modes that the active pen can support, and the value of the first OOB data length information is not "0", the terminal device determines that the pairing mode for Bluetooth pairing between the active pen and the terminal device is OOB pairing.

[0152] In this implementation, if the terminal device determines that the active pen supports OOB pairing based on information about the pairing modes that the active pen can support, such as NFC Mode, and determines that the value of the first OOB data length information is not "0", then the terminal device determines that the current Bluetooth pairing with the active pen uses OOB pairing.

[0153] In one optional implementation, the terminal device determines the pairing mode for Bluetooth pairing between the active pen and the terminal device based on information about the pairing modes that the active pen can support. This may include: if it is determined based on information about the pairing modes that the active pen can support that the active pen does not support OOB pairing and the value of the first OOB data length information is "0", the terminal device determines that the pairing mode for Bluetooth pairing between the active pen and the terminal device is non-OOB pairing, such as in-band pairing.

[0154] In this implementation, if the terminal device determines that the active pen supports non-OOB pairing, such as Google Fast Pair or Microsoft Swift Pair, based on information about the pairing modes that the active pen can support, and determines that the value of the first OOB data length information is "0", then the terminal device determines that the current Bluetooth pairing with the active pen uses in-band pairing.

[0155] In one optional implementation, the second instruction in this embodiment can be a single read instruction sent via an uplink time slot of the touch analog signal link; correspondingly, the second data in this embodiment can also be a single response data sent via a downlink time slot of the touch analog signal link, which may simultaneously include a BLE address type field, a first pairing mode field, a connection status field, and an OOB data length field. Furthermore, the second data may also include other fields, such as a version field indicating the protocol version for seamless pairing. In other words, the pairing information exchange (e.g., Bluetooth device address, pairing mode, connection status, OOB data length, etc.) that might otherwise require multiple interactions is compressed into a single transmission within a single time slot. This significantly reduces waiting and retransmission time in noisy 2.4GHz environments, ensuring that the active pen can complete information exchange the instant it touches the screen, which is key to achieving the ultimate user experience of "instant connection and use upon pen touch." Furthermore, with the fixed time slot length of the TDD frame structure, multiple fields are "packaged" into a single instruction, ensuring that each communication carries more complete status information. This effectively reduces communication overhead and failure probability caused by missing information or the need for multiple confirmations, making interaction on the touch analog signal link more efficient. Moreover, it enables the protocol to evolve. When adding new features in the future, version numbers can be used for differentiation, allowing both new and old devices to correctly identify and select the supported operating mode, achieving backward compatibility.

[0156] In one optional implementation, the second instruction in this embodiment of the present disclosure may refer to a collective term for multiple read instructions sent through multiple uplink time slots of the touch analog signal link; correspondingly, the second data in this embodiment of the present disclosure may also be multiple response data sent through multiple downlink time slots of the touch analog signal link in response to the multiple read instructions. The multiple response data may carry a BLE address type field, a first pairing mode field, a connection status field, a version field, or an OOB data length field, etc.

[0157] In an optional implementation, preferably, before the S606 terminal device establishes a Bluetooth connection with the active pen, and before the S605 active pen broadcasts a Bluetooth connection request to the terminal device, the method may further include: In response to the detection that the value of the first OOB data length information is not 0, the terminal device sends a fourth instruction carrying a fourth tag to the active pen through the uplink; In response to the identification of the fourth marker, the active pen sends fourth data to the terminal device via the downlink; wherein the fourth data includes the first OOB data; and The terminal device sets the encryption method for OOB pairing based on the first OOB data.

[0158] In this embodiment, when the terminal device recognizes that the value of the first OOB data length information of the active pen response is not "0", the terminal device knows that the active pen can support OOB pairing and can provide OOB data, and then the terminal device requests the active pen to respond with the active pen's OOB data.

[0159] In one alternative implementation, the fourth instruction carrying the fourth tag may be a separate read instruction sent by the terminal device to request an active pen response to the first OOB data.

[0160] In an optional implementation, the fourth instruction carrying the fourth flag can also be a second write instruction with a pairing instruction field. That is, the second write instruction can also include a pairing instruction field, which can be used to indicate the actual pairing action initiated by the terminal device. The pairing instruction field can occupy a set number of bits in the second write instruction, for example, 2 bits. The terminal device can carry the "OOB Read" flag in the pairing instruction field of the second write instruction. Thus, when the terminal device sends the second write instruction to the active pen, it explicitly tells the active pen: "I want to read your OOB data."

[0161] In this embodiment, the fourth data may include an OOB data field, which carries the first OOB data. The number of bits occupied by the OOB data field in the fourth data can be flexibly set according to the length of the first OOB data that the active pen can provide, for example, 64 bits or 192 bits. That is, the fourth data can actually be one or more response data transmitted through multiple downlink time slots of the touch analog signal link. The active pen can carry the provided first OOB data in the fourth data (one or more response data) so that the terminal device can obtain the OOB data provided by the active pen.

[0162] In an optional implementation, preferably, before the S606 terminal device establishes a Bluetooth connection with the active pen, and before the S605 active pen broadcasts a Bluetooth connection request to the terminal device, the method may further include: If the value of the first OOB data length information is identified as "0", preferably, if the value of the first OOB data length information is identified as "0" and it is determined that the active pen can support OOB pairing based on the information of the pairing modes that the active pen can support, the terminal device sends a fifth instruction carrying a fifth tag to the active pen through the uplink.

[0163] In this embodiment, when the terminal device recognizes that the value of the first OOB data length information of the active pen response is "0", the terminal device knows that the active pen cannot currently provide OOB data, and then requests the active pen to generate OOB data.

[0164] In a preferred embodiment, if the terminal device recognizes that the value of the first OOB data length information of the active pen response is "0", but determines that the active pen can support OOB pairing, the terminal device knows that the active pen can support OOB pairing but cannot provide OOB data at present, and then requests the active pen to generate OOB data.

[0165] In another preferred embodiment, if the terminal device recognizes that the value of the first OOB data length information of the active pen response is "0", and determines that the active pen does not support OOB pairing based on the first pairing mode field in the second data, the terminal device knows that the active pen cannot support OOB pairing. Therefore, the terminal device does not need to request the active pen to generate OOB data, and can directly determine that the Bluetooth pairing process on the Bluetooth radio frequency channel uses in-band pairing (that is, the encryption method of in-band pairing).

[0166] In an optional implementation, preferably, before the S606 terminal device establishes a Bluetooth connection with the active pen, and before the S605 active pen broadcasts a Bluetooth connection request to the terminal device, the method may further include: In response to the recognition of the fifth marker, the active pen generates second OOB data; The active pen sends fifth data to the terminal device via the downlink. The fifth data includes at least the length information of the second OOB data. The active pen sets the value of the second OOB data length information according to the length of the second OOB data. In response to the detection that the value of the second OOB data length information is not 0, the terminal device sends a sixth instruction carrying the sixth tag to the active pen through the uplink; In response to the identification of the sixth marker, the active pen sends sixth data to the terminal device via the downlink; wherein the sixth data includes second OOB data; and The terminal device sets the encryption method for OOB pairing based on the second OOB data.

[0167] In one alternative implementation, in response to the recognition of the fifth tag, the active pen calls functions such as `aci_gap_set_oob_data` or `BLE_SMP_GenerateScOobData` to generate OOB data. The active pen then extracts the generated OOB data, i.e., the second OOB data, from the protocol stack using instructions such as `aci_gap_get_oob_data` or `sd_ble_gap_lesc_oob_data_get`. The specific implementation of the active pen generating the second OOB data can be found in related technologies, and this disclosure does not impose specific limitations on it.

[0168] In one optional implementation, the fifth data may include an OOB data length field, which carries second OOB data length information. The OOB data length field may occupy a set number of bits in the fifth data, for example, 7 bits. The value of the second OOB data length information is used to indicate the length of the OOB data (i.e., the second OOB data) generated by the active pen.

[0169] In one optional implementation, the sixth data may include an OOB data field, which carries the second OOB data. The number of bits occupied by the OOB data field in the sixth data can be flexibly set according to the length of the second OOB data that the active pen can provide, for example, 64 bits or 192 bits. That is, the sixth data can actually be one or more response data transmitted through multiple downlink time slots of the touch analog signal link. The active pen can carry the provided second OOB data in the sixth data (one or more response data) so that the terminal device can obtain the OOB data provided by the active pen.

[0170] In other words, after regenerating the OOB data (i.e., the second OOB data) in response to a request from the terminal device, the active pen can send the length information of the regenerated OOB data back to the terminal device, so that the terminal device knows that the active pen has regenerated the OOB data and its length. Furthermore, in response to confirming that the active pen has regenerated the OOB data, the terminal device can request the active pen to acknowledge the regenerated OOB data.

[0171] In one optional implementation, the terminal device sets the encryption method for OOB pairing based on OOB data (including first OOB data or second OOB data), which may include: In response to acquiring the first OOB data or the second OOB data, the terminal device sends a seventh instruction carrying a seventh tag to the active pen via the uplink, so that the active pen can identify the seventh tag and determine that the terminal device has OOB data. The terminal device calls the API of the protocol stack (such as aci_gap_set_oob_data) to instruct the terminal device's Bluetooth communication module (i.e., the second Bluetooth communication module 504) to generate the third OOB data required for pairing (i.e., the terminal device's own OOB data, including random numbers, acknowledgment values ​​or TK values). The terminal device retrieves the third OOB data via another API (such as aci_gap_get_oob_data) and sends it to the active pen via the uplink; and The terminal device writes the first OOB data or the second OOB data (such as TK or random number / acknowledgment value) into the Bluetooth protocol stack through a specific API (such as Gap_LeScSetPeerOobData) for use in the key generation stage.

[0172] In one alternative implementation, the seventh instruction carrying the seventh marker may be a separate read instruction sent by the terminal device to inform the active pen that "I have OOB data available".

[0173] In an alternative implementation, the seventh instruction carrying the seventh flag can also be a second write instruction with a pairing instruction field. For example, the terminal device can carry the OOB pair flag in the pairing instruction field of the second write instruction to inform the active pen that "I have OOB data available".

[0174] It should be noted that key generation occurs during the process of establishing a Bluetooth connection between the S606 terminal device and the active pen, specifically during Bluetooth pairing based on the OOB pairing mode (on the Bluetooth radio frequency channel). In other words, after the terminal device sets the encryption method for OOB pairing, during the Bluetooth connection establishment process between the S606 terminal device and the active pen, both devices can automatically invoke different algorithms to generate a key based on the type of their OOB data (first OOB data, second OOB data, and third OOB data) to encrypt the current Bluetooth pairing.

[0175] For traditional Bluetooth pairing (LE Legacy Pairing), if both the terminal device and the active pen are in BLE Legacy Pairing mode, the core data exchanged via the touch analog signal link is a TK (Trust Key). The terminal device uses the TK value and a random number from the first or second OOB (Out-of-Band) data, combined with its own TK value and random number (i.e., the third OOB data), to calculate the STK (Short-Terminal Key) using the c1 function defined in the Bluetooth specification (which can be approximated as the AES encryption algorithm). This STK is then used to encrypt the current Bluetooth connection.

[0176] For LE Secure Connections, the out-of-band (OOB) exchanged data includes a random number and acknowledgment value used in public-key cryptography. In this case, the OOB data provides crucial authentication information for Elliptic Curve Diffie-Hellman (ECDH) key exchange. Both the terminal device and the active pen use this OOB data to verify each other's public keys and calculate a shared Long-Term Key (LTK). This LTK is used not only to encrypt the current Bluetooth connection but is also securely stored (i.e., bonded) for seamless, fast, and secure encrypted reconnection in subsequent connections.

[0177] It should be noted that the specific process by which the terminal device and the active pen encrypt the Bluetooth connection based on their respective OOB data, the pairing method used, and the protocol (e.g., traditional pairing or secure connection pairing) can all be referred to relevant technologies, and this disclosure does not limit them in any way.

[0178] In an optional implementation, after the terminal device sends the fifth instruction to the active pen, and before the terminal device establishes a Bluetooth connection with the active pen in S606, preferably before the active pen broadcasts a Bluetooth connection request to the terminal device in S605, the method may further include: In response to identifying the fifth marker, if it is determined that the second OOB data cannot be generated, the active pen sends the fifth data to the terminal device via the downlink. The fifth data includes at least the second OOB data length information, and the value of the second OOB data length information is set to 0 by the active pen.

[0179] In this embodiment, in response to identifying the fifth marker, if the active pen cannot support OOB pairing or fails to generate OOB data, the active pen can set the value of the second OOB data length information to "0" and carry it in the OOB data length field of the fifth data. The terminal device can then determine that the active pen cannot provide OOB data based on the value carried in the OOB data length field of the fifth data, thereby determining that the Bluetooth pairing process on the Bluetooth radio frequency channel uses in-band pairing (i.e., in-band pairing encryption).

[0180] like Figure 7 As shown, this is an example of a method for device connection provided in an embodiment of this disclosure.

[0181] In 701, after the active pen and the terminal device are brought close together and data communication based on the touch analog signal link is established, the Bluetooth pairing process between the active pen and the terminal device is initiated.

[0182] In 702, the terminal device sends a command to the active pen to read information such as connection status. Specifically, the terminal device sends a second command carrying a second flag (e.g., reading flag "0") to the active pen via the uplink. In response to recognizing the second flag, the active pen sends second data to the terminal device via the downlink. As shown in Table 1, which is an illustration of the second data, the second data includes 16 bits of binary data, including a BLE address type field, a connection status field, a version field, a first pairing mode field, and an OOB data length field.

[0183] Table 1: The BLE address type field is used to carry information about the device address type of the active pen. For example, in the BLE address type field, binary data "00" is used to represent Public Address, binary data "01" is used to represent RandomStatic Address, binary data "10" is used to represent Random Private Resolvable, and binary data "11" is used to represent Random Private non-Resolvable.

[0184] The connection status field is used to carry the Bluetooth connection status information of the active pen. For example, in the connection status field, binary data "0" is used to indicate that the active pen is not connected to Bluetooth, and binary data "1" is used to indicate that the active pen is connected to Bluetooth.

[0185] The first pairing mode field is used to carry information about the pairing modes that the active pen can support. For example, in the first pairing mode field, binary data "000" is used to represent None, which means that the active pen does not support fast pairing, but supports BLE pairing; binary data "001" is used to represent Basic, which means that the active pen supports fast pairing; binary data "010" is used to represent that the active pen can support Google Fast Pair; binary data "011" is used to represent that the active pen can support Microsoft Swift Pair; and binary data "100" is used to represent that the active pen can support NFC Mode.

[0186] In step 703, the terminal device determines whether the connection status of the active pen is true based on the Bluetooth connection status information of the active pen in the connection status field; if it is true (i.e., the active pen is in a Bluetooth connected state), then step S704 is executed; otherwise (i.e., the active pen is in a Bluetooth unconnected state), step S707 is executed.

[0187] In 704, the terminal device sends an instruction to read the quick pairing identifier (ID). Specifically, the terminal device sends a third instruction carrying a third mark (e.g., reading mark "8") to the active pen via the uplink, so that the active pen responds to the recognition of the third mark and sends third data to the terminal device via the downlink. As shown in Table 2, which is an illustration of the third data, the third data includes a pairing identifier field (i.e., the quick pairing ID field in Table 2). The pairing identifier field is used to carry a second pairing identifier (i.e., the quick pairing ID).

[0188] Table 2 In step 705, the terminal device determines whether the quick pairing ID matches. Specifically, the terminal device determines whether it has stored the second pairing identifier. If so, it executes step S706; otherwise, it executes step S707.

[0189] In step 706, the terminal device determines that the active pen has established a Bluetooth connection with itself and executes step S714.

[0190] In 707, the terminal device sends an instruction to read the MAC address. Specifically, the terminal device sends a first read instruction to the active pen carrying a first request flag (e.g., read flag "1"); in response to recognizing the first request flag, the active pen sends first response data to the terminal device, the first response data including the 0th and 1st bytes of the active pen's Bluetooth device address; the terminal device sends a second read instruction to the active pen carrying a second request flag (e.g., read flag "2"); in response to recognizing the second request flag, the active pen sends second response data to the terminal device, the second response data including the 2nd and 3rd bytes of the active pen's Bluetooth device address; the terminal device sends a third read instruction to the active pen carrying a third request flag (e.g., read flag "3"); and in response to recognizing the third request flag, the active pen sends third response data to the terminal device, the third response data including the 4th and 5th bytes of the active pen's Bluetooth device address. As shown in Table 3, it is an illustration of the first response data (the first row of Table 3, corresponding to the read mark "1"), the second response data (the second row of Table 3, corresponding to the read mark "2"), and the third response data (the third row of Table 3, corresponding to the read mark "3").

[0191] Table 3: In step 708, the terminal device determines whether the OOB data length is "0". Specifically, the terminal device determines whether the value of the first OOB data length information is "0" based on the OOB data length field in the second data. If it is, it determines that the active pen cannot provide OOB data and executes step 709; otherwise, it determines that the active pen can provide OOB data and executes step 715.

[0192] In 709, the terminal device sends an instruction to set the MAC address. Specifically, the terminal device sends one or more first write instructions to the active pen, as shown in Table 4, which is an example of a first write instruction. The first write instruction includes an index field and an address field (i.e., the MAC address information field in Table 4). The index field in each first write instruction is used to indicate the position of the 12-bit data carried in the address field of this first instruction in the total data of the terminal device's Bluetooth device address.

[0193] Table 4: In 710, the terminal device generates a quick pairing ID. Specifically, the terminal device generates a first pairing identifier based on the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device.

[0194] In 711, the terminal device sends a pairing instruction to the active pen. Specifically, the terminal device sends a second write instruction to the active pen, as shown in Table 5, which is an illustration of the second write instruction. The second write instruction includes a second pairing mode field, a pairing instruction field, and a quick pairing ID field.

[0195] The second pairing mode field is used to carry information about the specific pairing mode. For example, in the second pairing mode field, binary data "000" is used to represent None, which means that the specific pairing mode is BLE pairing but not fast pairing; binary data "001" is used to represent Basic, which means that the specific pairing mode is fast pairing; binary data "010" is used to represent Google Fast Pair; binary data "011" is used to represent Microsoft Swift Pair; and binary data "100" is used to represent NFC Mode.

[0196] Table 5: The pairing instruction field is used to indicate the actual pairing behavior initiated by the terminal device. For example, in the pairing instruction field, binary data "01" is used to indicate Start FP, which is used to trigger quick pairing; binary data "10" is used to indicate reading OOB data (OOB Read); and binary data "11" is used to indicate the OOB pair flag (OOB Pair Flag). In addition, binary data "00" can be reserved.

[0197] The Quick Pair ID field is used to carry the first pairing identifier.

[0198] In the 712, the active pen initiates a targeted broadcast to the terminal device. Specifically, the active pen broadcasts a Bluetooth connection request to the terminal device on the 2.4 GHz Bluetooth wireless channel based on the terminal device's Bluetooth device address.

[0199] In step 713, the terminal device establishes a Bluetooth connection with the active pen. Specifically, in response to recognizing a Bluetooth connection request, the terminal device establishes a Bluetooth connection with the active pen on the 2.4 GHz wireless channel based on a first pairing identifier. After Bluetooth pairing is complete, step 714 is executed.

[0200] Table 6: In 715, the terminal device sends instructions to read OOB data. Specifically, the terminal device sends four fourth instructions to the active pen, each carrying a read marker "4", "5", "6", and "7". In response to recognizing the read markers "4", "5", "6", and "7", the active pen sends four fourth data to the terminal device, as shown in Table 6 above, which is an illustration of one type of fourth data. Each fourth data includes an OOB data field, which is used to carry 16 bits of data from the first OOB data.

[0201] Furthermore, as shown in Table 7, which illustrates another type of fourth data, if the OOB data provided by the active pen is relatively long, such as 192 bits, the terminal device can continue to send additional fourth instructions to the active pen, each carrying a read flag from "0" to "8" (to distinguish them, the additional fourth instructions can have different instruction identifiers). In response to recognizing the additional fourth instructions, the active pen sends additional fourth data to the terminal device, as shown in Table 7, which illustrates one type of additional fourth data. The additional fourth data includes an additional OOB data field and a reserved field. The additional OOB data field in each additional fourth data is used to carry 16 bits of data from the first OOB data.

[0202] Table 7: In step 716, the terminal device sets the OOB encryption method. Specifically, the terminal device sets the encryption method for the OOB pairing based on the first OOB data. After the encryption method for the OOB pairing is set, step S709 is executed.

[0203] In version 714, the Bluetooth pairing process between the active pen and the terminal device is terminated.

[0204] This disclosure also provides an active pen system configured to implement the device connection method provided in this disclosure, the active pen system including an active pen 10 and a terminal device 20 provided in this disclosure.

[0205] Furthermore, regarding how the active pen 10 and the terminal device 20 provided in this disclosure embodiment specifically implement each step of the device connection method provided in this disclosure embodiment based on each functional module or hardware component, please refer to the foregoing description of the active pen 10, the terminal device 20 and the device connection method, which will not be repeated here.

[0206] This disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0207] Figure 8This is a schematic block diagram of an electronic device 800 provided for embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0208] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.

[0209] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0210] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as a method for device connectivity. For example, in some embodiments, a method for device connectivity may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of a method for device connectivity described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform a method for device connectivity by any other suitable means (e.g., by means of firmware).

[0211] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0212] Program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0213] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0214] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0215] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0216] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0217] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0218] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for device connection, applied to an input device, comprising: The receiving terminal device sends a first instruction carrying a first tag via the uplink of the touch analog signal link; In response to recognizing the first tag, first data is sent to the terminal device via the downlink of the touch analog signal link, the first data including at least the Bluetooth device address of the input device; The terminal device receives a write command sent via the uplink, the write command including at least a first pairing identifier and the Bluetooth device address of the terminal device; as well as The terminal device broadcasts a Bluetooth connection request, which includes the Bluetooth device address of the input device and the Bluetooth device address of the terminal device, so that the terminal device, in response to recognizing the Bluetooth connection request, establishes a Bluetooth connection with the input device based on the first pairing identifier.

2. The method according to claim 1, wherein, Receiving the first instruction includes: Receive the first read instruction carrying a first request flag sent by the terminal device in the first uplink time slot of the touch analog signal link; Receive the second read instruction carrying the second request flag sent by the terminal device in the second uplink time slot of the touch analog signal link; and The terminal device receives a third read instruction carrying a third request flag, sent in the third uplink time slot of the touch analog signal link.

3. The method according to claim 2, wherein, In response to recognizing the first marker, sending the first data to the terminal device includes: In response to recognizing the first request marker, first response data is sent to the terminal device in the first downlink time slot of the touch analog signal link. The first response data includes the 0th byte and the 1st byte of the Bluetooth device address of the input device. In response to recognizing the second request marker, second response data is sent to the terminal device in the second downlink time slot of the touch analog signal link. The second response data includes the second and third bytes of the Bluetooth device address of the input device. In response to recognizing the third request marker, third response data is sent to the terminal device in the third downlink time slot of the touch analog signal link. The third response data includes the fourth and fifth bytes of the Bluetooth device address of the input device.

4. The method according to any one of claims 1 to 3, further comprising, before receiving the write instruction sent by the terminal device: Receive a second instruction carrying a second tag sent by the terminal device through the uplink; as well as In response to identifying the second tag, second data is sent to the terminal device via the downlink, the second data including at least information about the device address type of the input device.

5. The method according to claim 1, further comprising, before receiving the first instruction sent by the terminal device: Receive a second instruction carrying a second tag sent by the terminal device through the uplink; as well as In response to identifying the second tag, second data is sent to the terminal device via the downlink. The second data includes at least Bluetooth connection status information of the input device, so that the terminal device can identify whether the input device is in a Bluetooth connected state based on the Bluetooth connection status information.

6. The method according to claim 5, wherein, The first instruction is sent by the terminal device in response to recognizing that the input device is not connected to Bluetooth.

7. The method according to claim 5, further comprising, after sending the second data to the terminal device and before receiving the first instruction sent by the terminal device: Receive a third instruction carrying a third tag; wherein the third instruction is sent by the terminal device via the uplink in response to recognizing that the input device is in the connected Bluetooth state based on the Bluetooth connection status information; and In response to recognizing the third marker, third data is sent to the terminal device via the downlink; wherein the third data includes at least a second pairing identifier, such that the terminal device, in response to being unable to recognize the second pairing identifier, sends the first instruction.

8. The method according to claim 1, further comprising, before receiving the write instruction sent by the terminal device: Receive a second instruction carrying a second tag sent by the terminal device through the uplink; as well as In response to identifying the second marker, second data is sent to the terminal device via the downlink. The second data includes at least first out-of-band (OOB) data length information and / or information on pairing modes that the input device can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the input device can provide.

9. The method according to claim 8, further comprising, before broadcasting the Bluetooth connection request to the terminal device: The terminal device receives a fourth instruction carrying a fourth flag, transmitted via the uplink; wherein the fourth instruction is sent by the terminal device in response to recognizing that the value of the first OOB data length information is not 0; and In response to identifying the fourth marker, fourth data is sent to the terminal device via the downlink; wherein the fourth data includes the first OOB data, so that the terminal device sets the encryption method for OOB pairing based on the first OOB data.

10. The method of claim 8, further comprising, before broadcasting the Bluetooth connection request to the terminal device: The terminal device receives a fifth instruction carrying a fifth marker sent via the uplink; wherein the fifth instruction is sent by the terminal device when it recognizes that the value of the first OOB data length information is 0, and determines that the input device supports OOB pairing based on the information of the pairing modes that the input device can support.

11. The method according to claim 10, further comprising, after receiving the fifth instruction sent by the terminal device and before broadcasting the Bluetooth connection request to the terminal device in a targeted manner: In response to recognizing the fifth marker, second OOB data is generated; The fifth data is sent to the terminal device via the downlink, and the fifth data includes at least the second OOB data length information; wherein, the input device sets the value of the second OOB data length information according to the length of the second OOB data; The terminal device receives a sixth instruction carrying a sixth marker, transmitted via the uplink; wherein the sixth instruction is sent by the terminal device in response to recognizing that the value of the second OOB data length information is not 0; and In response to identifying the sixth marker, sixth data is sent to the terminal device via the downlink; wherein the sixth data includes the second OOB data, so that the terminal device sets the encryption method for OOB pairing based on the second OOB data.

12. A method for device connection, applied to a terminal device, comprising: The first instruction carrying the first tag is sent to the input device via the uplink of the touch analog signal link; The input device receives first data transmitted via the downlink of the touch analog signal link in response to recognizing the first tag, wherein the first data includes at least the Bluetooth device address of the input device; A first pairing identifier is generated for the input device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; A write command is sent to the input device via the uplink; wherein the write command includes at least the first pairing identifier and the Bluetooth device address of the terminal device, so that the input device broadcasts a Bluetooth connection request to the terminal device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; as well as In response to recognizing the Bluetooth connection request, a Bluetooth connection is established with the input device based on the first pairing identifier.

13. The method of claim 12, further comprising, before sending the write instruction to the input device: A second instruction carrying a second tag is sent to the input device via the uplink; as well as The input device receives second data sent to the terminal device via the downlink in response to recognizing the second tag. The second data includes at least first out-of-band (OOB) data length information and / or information on pairing modes that the input device can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the input device can provide.

14. The method of claim 13, further comprising, before establishing the Bluetooth connection with the input device: In response to the detection that the value of the first OOB data length information is not 0, a fourth instruction carrying a fourth marker is sent to the input device via the uplink, causing the input device to respond to the recognition of the fourth marker and send fourth data to the terminal device via the downlink; wherein the fourth data includes the first OOB data; and Set the encryption method for OOB pairing based on the first OOB data.

15. The method of claim 13, further comprising, before establishing the Bluetooth connection with the input device: If the value of the first OOB data length information is identified as 0, and the input device is determined to support OOB pairing based on the information of the pairing modes that the input device can support, a fifth instruction carrying a fifth tag is sent to the input device through the uplink.

16. The method of claim 15, further comprising, after sending the fifth instruction to the input device and before establishing the Bluetooth connection with the input device: The input device receives fifth data sent to the terminal device via the downlink, the fifth data including at least second OOB data length information; wherein, in response to recognizing the fifth marker, the input device generates second OOB data and sets the value of the second OOB data length information according to the length of the second OOB data; In response to the detection that the value of the second OOB data length information is not 0, a sixth instruction carrying a sixth marker is sent to the input device via the uplink, causing the input device to send sixth data to the terminal device via the downlink in response to the recognition of the sixth marker; wherein the sixth data includes the second OOB data; and Set the encryption method for OOB pairing based on the second OOB data.

17. An active pen, comprising: The system comprises a receiving module (401), a processing module (402), a transmitting module (403), and a Bluetooth communication module (404), wherein: The receiving module (401) is configured to receive a first instruction carrying a first tag sent by the terminal device through the uplink of the touch analog signal link; The sending module (403) is configured to send first data to the terminal device via the downlink of the touch analog signal link in response to the processing module (402) recognizing the first tag, wherein the first data includes at least the Bluetooth device address of the active pen; The receiving module (401) is further configured to receive a write instruction sent by the terminal device through the uplink, the write instruction including at least a first pairing identifier and the Bluetooth device address of the terminal device; and The Bluetooth communication module (404) is configured to broadcast a Bluetooth connection request to the terminal device. The Bluetooth connection request includes the Bluetooth device address of the active pen and the Bluetooth device address of the terminal device, so that the terminal device responds to the recognition of the Bluetooth connection request and establishes a Bluetooth connection with the active pen based on the first pairing identifier.

18. The active pen according to claim 17, wherein, The receiving module (401) is configured to receive the first instruction in the following manner: Receive the first read instruction carrying a first request flag sent by the terminal device in the first uplink time slot of the touch analog signal link; Receive a second read instruction carrying a second request flag sent by the terminal device in the second uplink time slot of the touch analog signal link; as well as The terminal device receives a third read instruction carrying a third request flag, sent in the third uplink time slot of the touch analog signal link.

19. The active pen according to claim 18, wherein, The sending module (403) is configured to send the first data in the following manner: In response to the processing module (402) recognizing the first request marker, the first response data is sent to the terminal device in the first downlink time slot of the touch analog signal link. The first response data includes the 0th byte and the 1st byte of the Bluetooth device address of the active pen. In response to the processing module (402) recognizing the second request marker, second response data is sent to the terminal device in the second downlink time slot of the touch analog signal link. The second response data includes the second and third bytes of the Bluetooth device address of the active pen. In response to the processing module (402) recognizing the third request marker, a third response data is sent to the terminal device in the third downlink time slot of the touch analog signal link. The third response data includes the fourth and fifth bytes of the Bluetooth device address of the active pen.

20. The active pen according to any one of claims 17 to 19, wherein: The receiving module (401) is further configured to receive a second instruction carrying a second tag sent by the terminal device via the uplink before receiving the write instruction sent by the terminal device; and The sending module (403) is further configured to send second data to the terminal device via the downlink in response to the processing module (402) recognizing the second tag, the second data including at least the device address type information of the active pen.

21. The active pen according to claim 17, wherein: The receiving module (401) is further configured to receive a second instruction carrying a second tag sent by the terminal device via the uplink before receiving the first instruction sent by the terminal device; and The sending module (403) is further configured to send second data to the terminal device via the downlink in response to the processing module (402) recognizing the second tag. The second data includes at least the Bluetooth connection status information of the active pen, so that the terminal device can identify whether the active pen is in a Bluetooth-connected state based on the Bluetooth connection status information.

22. The active pen according to claim 21, wherein, The first instruction is sent by the terminal device in response to recognizing that the active pen is not connected to Bluetooth.

23. The active pen according to claim 21, wherein: The receiving module (401) is further configured to receive a third instruction carrying a third tag after the sending module (403) sends the second data to the terminal device and before receiving the first instruction sent by the terminal device; wherein the third instruction is sent by the terminal device through the uplink in response to recognizing that the active pen is in the connected Bluetooth state based on the Bluetooth connection status information; and The sending module (403) is further configured to send third data to the terminal device via the downlink in response to the processing module (402) recognizing the third tag; wherein the third data includes at least a second pairing identifier, so that the terminal device sends the first instruction in response to the inability to recognize the second pairing identifier.

24. The active pen according to claim 17, wherein: The receiving module (401) is further configured to receive a second instruction carrying a second tag sent by the terminal device via the uplink before receiving the write instruction sent by the terminal device; and The sending module (403) is further configured to send second data to the terminal device via the downlink in response to the processing module (402) recognizing the second tag. The second data includes at least first out-of-band (OOB) data length information and / or information on the pairing modes that the active pen can support. The value of the first OOB data length information is used to indicate the length of the first OOB data that the active pen can provide.

25. The active pen according to claim 24, wherein: The receiving module (401) is further configured to receive a fourth instruction carrying a fourth tag sent by the terminal device via the uplink before the Bluetooth communication module (404) broadcasts the Bluetooth connection request to the terminal device; wherein the fourth instruction is sent by the terminal device in response to recognizing that the value of the first OOB data length information is not 0; and The sending module (403) is further configured to send fourth data to the terminal device via the downlink in response to the processing module (402) recognizing the fourth tag; wherein the fourth data includes the first OOB data, so that the terminal device sets the encryption method of OOB pairing according to the first OOB data.

26. The active pen according to claim 24, wherein: The receiving module (401) is further configured to receive a fifth instruction carrying a fifth tag sent by the terminal device through the uplink before the Bluetooth communication module (404) broadcasts the Bluetooth connection request to the terminal device; wherein the fifth instruction is sent by the terminal device when it recognizes that the value of the first OOB data length information is 0 and determines that the active pen supports OOB pairing based on the information of the pairing modes that the active pen can support.

27. The active pen according to claim 26, wherein: The processing module (402) is configured to generate second OOB data in response to recognizing the fifth tag after the receiving module (401) receives the fifth instruction sent by the terminal device and before the Bluetooth communication module (404) broadcasts the Bluetooth connection request to the terminal device. The sending module (403) is further configured to send fifth data to the terminal device via the downlink, the fifth data including at least second OOB data length information; wherein, the active pen sets the value of the second OOB data length information according to the length of the second OOB data; The receiving module (401) is further configured to receive a sixth instruction carrying a sixth marker sent by the terminal device via the uplink; wherein the sixth instruction is sent by the terminal device in response to recognizing that the value of the second OOB data length information is not 0; and The sending module (403) is further configured to send sixth data to the terminal device via the downlink in response to the processing module (402) recognizing the sixth tag; wherein the sixth data includes the second OOB data, so that the terminal device sets the encryption method of OOB pairing according to the second OOB data.

28. A terminal device, comprising: The system comprises a receiving module (501), a processing module (502), a transmitting module (503), and a Bluetooth communication module (504), wherein: The sending module (503) is configured to send a first instruction carrying a first tag to the input device via the uplink of the touch analog signal link; The receiving module (501) is configured to receive first data sent by the input device in response to recognizing the first tag via the downlink of the touch analog signal link, wherein the first data includes at least the Bluetooth device address of the input device; The processing module (502) is configured to generate a first pairing identifier for the input device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; The sending module (503) is further configured to send a write command to the input device via the uplink; wherein the write command includes at least the first pairing identifier and the Bluetooth device address of the terminal device, so that the input device broadcasts a Bluetooth connection request to the terminal device based on the Bluetooth device address of the input device and the Bluetooth device address of the terminal device; and The Bluetooth communication module (504) is configured to establish a Bluetooth connection with the input device based on the first pairing identifier in response to recognizing the Bluetooth connection request.

29. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-16.