CN114217701B - Electronic equipment connection method and electronic equipment - Google Patents

Electronic equipment connection method and electronic equipment Download PDF

Info

Publication number
CN114217701B
CN114217701B CN202210159242.XA CN202210159242A CN114217701B CN 114217701 B CN114217701 B CN 114217701B CN 202210159242 A CN202210159242 A CN 202210159242A CN 114217701 B CN114217701 B CN 114217701B
Authority
CN
China
Prior art keywords
electronic device
management service
accessory management
hid
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210159242.XA
Other languages
Chinese (zh)
Other versions
CN114217701A (en
Inventor
张雅姝
宋业全
黄鹏飞
牛永民
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202210159242.XA priority Critical patent/CN114217701B/en
Publication of CN114217701A publication Critical patent/CN114217701A/en
Application granted granted Critical
Publication of CN114217701B publication Critical patent/CN114217701B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/033Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor
    • G06F3/0354Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor with detection of 2D relative movements between the device, or an operating part thereof, and a plane or surface, e.g. 2D mice, trackballs, pens or pucks
    • G06F3/03545Pens or stylus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/0412Digitisers structurally integrated in a display
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/0416Control or interface arrangements specially adapted for digitisers
    • G06F3/04162Control or interface arrangements specially adapted for digitisers for exchanging data with external devices, e.g. smart pens, via the digitiser sensing hardware
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/0416Control or interface arrangements specially adapted for digitisers
    • G06F3/04166Details of scanning methods, e.g. sampling time, grouping of sub areas or time sharing with display driving
    • G06F3/041662Details of scanning methods, e.g. sampling time, grouping of sub areas or time sharing with display driving using alternate mutual and self-capacitive scanning

Abstract

The application provides an electronic equipment connection method, which is applied to first electronic equipment and comprises the following steps: after the accessory management service is pulled up, acquiring the HID protocol connection state of the first electronic equipment and the second electronic equipment; if the HID protocol connection between the first electronic device and the second electronic device is successful, the accessory management service judges whether the first device label is a null value; if the first equipment label is a null value, acquiring an HID connected equipment list of the first electronic equipment, and judging whether the HID connected equipment list comprises second electronic equipment or not; and if the second electronic equipment is included, establishing the private channel protocol GATT connection between the first electronic equipment and the second electronic equipment. Furthermore, when the first electronic device is restarted under the condition that the second electronic device is attached, even if the value of the first device tag is different from that of the second device tag due to the fact that the first device tag is not assigned, the first electronic device and the second electronic device can realize a data transmission function.

Description

Electronic equipment connection method and electronic equipment
Technical Field
The present application relates to the field of terminal technologies, and in particular, to an electronic device connection method and an electronic device.
Background
With the development of touch technology, more and more electronic devices adopt a touch mode to perform human-computer interaction. At present, electronic equipment (for convenience of description, hereinafter, referred to as central equipment) such as a tablet computer can be connected with other electronic equipment (for convenience of description, hereinafter, referred to as external equipment) such as a touch pen, a wireless keyboard and a wireless sound box with professional use functions, and richer functions are realized through the cooperation of the central equipment and the external equipment. For example, the tablet pc may establish a connection with the stylus pen in a wireless manner such as bluetooth, and perform data interaction. After the tablet computer is connected with the touch pen, a user can operate the touch screen of the tablet computer through the touch pen to provide input for the tablet computer, and then the tablet computer executes corresponding operation based on the input of the touch pen.
Generally, the central device needs to detect a trigger event to trigger the establishment of bluetooth connection with the external device. The triggering events include: the method comprises the following steps that an external device adsorbs an event with a central device through a coil, or the external device is connected with the central device through a connection port, or the distance between the external device and the central device is smaller than a preset distance threshold value event. For example, the stylus is attached to the tablet pc, and the tablet pc performs subsequent bluetooth connection after detecting the trigger event. After the stylus is adsorbed on the tablet computer and is firstly paired and the Bluetooth connection is established, the tablet computer can store the related information of the stylus. After that, when the tablet personal computer and the touch pen are connected again, the connection can be automatically carried out without pairing. When the tablet personal computer is connected with the touch pen, the accessory management service needs to be pulled up to complete the connection. The conditions for pulling up the accessory management service include: the protocol connection is successful, the sensor reports the adsorption event and the USB interface reports the insertion event. After the accessory management service is successfully pulled up through the protocol connection, a device tag (mddevicetobeconnect) is assigned to connect with a private channel protocol (GATT).
However, when the tablet pc is restarted under the condition that the stylus is attached, the attachment management service is pulled up by the attachment event reported by the sensor, and therefore, after the attachment management service is pulled up, the device tag (mdevice to be connected) is not assigned, so that the private channel protocol GATT cannot be further connected. And the situation that the touch pen does not discharge water when the touch pen performs input operation on the tablet computer is further caused.
Disclosure of Invention
The application provides an electronic equipment connection method and electronic equipment, and aims to solve the problem that when a central device is restarted under the condition that an external device is adsorbed, the central device displays that the external device is connected, but the external device and the central device cannot realize a data transmission function, so that user experience is reduced.
In a first aspect, an embodiment of the present application provides an electronic device connection method, which is applied to a first electronic device, and the method includes: after the accessory management service is pulled up, acquiring the HID protocol connection state of the first electronic equipment and the second electronic equipment; wherein: the accessory management service is used for managing the HID protocol connection of the first electronic device; the pull-up condition of the accessory management service includes at least any one of: the HID protocol connection between the first electronic device and the second electronic device is successful, and the first electronic device detects the adsorption event of the second electronic device; when the accessory management service is pulled up by the condition that the HID protocol connection between the first electronic device and the second electronic device is successful, a first device label in the accessory management service is assigned as a device identification of the second electronic device; if the HID protocol connection between the first electronic device and the second electronic device is successful, the accessory management service judges whether the first device label is a null value; if the first equipment label is a null value, the accessory management service acquires an HID connected equipment list of the first electronic equipment and judges whether the HID connected equipment list comprises second electronic equipment or not; if the HID connected device list includes the second electronic device, the accessory management service establishes a proprietary channel protocol GATT connection between the first electronic device and the second electronic device.
According to the method, the first device tag is judged through the accessory management service, and under the condition that the first device tag is null, the accessory management service acquires the HID connected device list of the first electronic device. And in the event that the second electronic device is included in the list of HID connected devices, the accessory management service establishes a proprietary channel protocol GATT connection of the first electronic device with the second electronic device. Therefore, when the central device is restarted under the condition that the external device is adsorbed, and the adsorption event reported by the sensor is pulled up in the accessory management service, even if the value of the first device tag is different from that of the second device tag due to the fact that the first device tag is not assigned, the central device can establish a connection private channel protocol GATT with the external device, and the data transmission function is achieved.
In an alternative implementation, the acquiring, by an accessory management service, an HID protocol connection status of a first electronic device and a second electronic device includes: the accessory management service acquires a second equipment label from the monitoring process; and the monitoring process is used for assigning the device identifier of the second electronic device to the second device label when the HID protocol connection between the first electronic device and the second electronic device is successful. The listening process assigns a value to the second device tag before the accessory management service obtains the second device tag from the listening process. And then, after the monitoring process monitors that the HID protocol connection between the first electronic device and the second electronic device is successful, the second device label maintained by the monitoring process is assigned as the device identifier of the second electronic device. And then returning the second device label with the assigned value to the accessory management service. Therefore, the accessory management service can compare whether the values of the first equipment label and the second equipment label are the same or not by monitoring the second equipment label returned by the process, so that data interaction between the first electronic equipment and the second electronic equipment is realized, and the use experience of a user is improved.
In an alternative implementation, the method further comprises: after the HID protocols of the first electronic device and the second electronic device are successfully connected, the accessory management service acquires all device identifications of external devices successfully connected with the HID protocol of the first electronic device and generates an HID connected device list; the device identification includes a supplier identification code VID and a product identification code PID. Therefore, by acquiring all the device identifiers of the external devices successfully connected with the HID protocol of the first electronic device, whether the external devices successfully connected with the HID protocol of the first electronic device include the second electronic device can be further judged. So that the data transmission function of the first electronic device and the second electronic device can be realized under the condition that the first device label is not assigned. The method further provides a mode that the first electronic device establishes the private channel protocol GATT connection with the second electronic device, and user experience is improved.
In an alternative implementation, the accessory management service determining whether the second electronic device is included in the HID connected device list includes: if the HID connected device list comprises the supplier identification code VID and the product identification code PID of the second electronic device, the accessory management service determines that the HID connected device list comprises the second electronic device; if the supplier identification code VID and the product identification code PID of the second electronic device are not included in the HID connected device list, the accessory management service determines that the second electronic device is not included in the HID connected device list. In this way, even if the value of the first device tag is different from that of the second device tag because the first device tag is not assigned, by determining that the supplier identification code VID and the product identification code PID of the second electronic device are included in the HID connected device list, the data transmission function of the first electronic device and the second electronic device can be realized. The situation that the first electronic device displays that the second electronic device is connected but the second electronic device and the first electronic device cannot realize a data transmission function is avoided, and the use experience of a user is improved.
In an alternative implementation, the method further comprises: if the first equipment label is not a null value, the accessory management service judges whether the values of the first equipment label and the second equipment label are the same; if the values of the first device tag and the second device tag are the same, the accessory management service establishes a proprietary channel protocol GATT connection between the first electronic device and the second electronic device. In this way, if the first device tag is already assigned, under the condition that the values of the first device tag and the second device tag are determined to be the same, the private channel protocol GATT connection between the first electronic device and the second electronic device is directly established, so as to realize the data transmission function between the first electronic device and the second electronic device. The use experience of the user is improved.
In an alternative implementation, the pull-up condition of the accessory management service further includes the first electronic device detecting a port connection event of the second electronic device, the port connection event being generated when the second electronic device is connected to the first electronic device through the connection port.
In an alternative implementation, the pull-up condition of the accessory management service further includes the first electronic device detecting a distance triggering event of the second electronic device, the distance triggering event being generated when the distance of the second electronic device from the first electronic device is less than a preset distance threshold.
In an alternative implementation, the method further comprises: if the second electronic device is not included in the HID connected device list, the accessory management service does not establish a proprietary channel protocol GATT connection between the first electronic device and the second electronic device.
In an alternative implementation, the method further comprises: the HID protocol connection between the first electronic device and the second electronic device is performed synchronously with the pull-up action of the accessory management service.
In an alternative implementation manner, the process of acquiring, by the accessory management service, the second device tag from the listening process further includes: the method comprises the steps that the accessory management service sends a calling request to a monitoring process, wherein the calling request is used for calling the monitoring process to monitor the HID protocol connection state of first electronic equipment and second electronic equipment; and receiving the HID protocol connection state of the first electronic equipment and the second electronic equipment returned by the monitoring process.
In an alternative implementation, the method further comprises: if the values of the first device tag and the second device tag are not the same, the accessory management service does not establish a proprietary channel protocol (GATT) connection between the first electronic device and the second electronic device.
In a second aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor, the processor and the memory coupled; wherein the memory comprises program instructions which, when executed by the processor, cause the electronic device to perform the method as described in the first aspect above, performed by the first electronic device.
In a third aspect, the present application provides a computer-readable storage medium, in which computer program instructions are stored, and when the computer program instructions are executed, the method performed by the first electronic device according to the first aspect is implemented.
Drawings
Fig. 1 is a schematic view of a scenario provided in an embodiment of the present application;
fig. 2A is a schematic structural diagram of a stylus provided in an embodiment of the present application;
fig. 2B is a schematic diagram of a partially disassembled structure of a stylus according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of interaction between a stylus and an electronic device according to an embodiment of the present disclosure;
fig. 4 is an assembly diagram of a stylus and a wireless keyboard according to an embodiment of the present disclosure;
fig. 5A is a schematic view illustrating a stylus pen accommodated in an accommodating portion of a wireless keyboard according to an embodiment of the present disclosure;
fig. 5B is a schematic side view of an electronic device, a stylus and a wireless keyboard according to an embodiment of the present disclosure;
fig. 6 is a schematic structural frame diagram of a stylus according to an embodiment of the present disclosure;
fig. 7 is a schematic structural framework diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic flowchart illustrating a process of connecting a stylus with a tablet computer according to an embodiment of the present disclosure;
fig. 9 is a schematic flowchart of an electronic device connection method according to an embodiment of the present disclosure;
fig. 10 is an interaction diagram illustrating establishment of a protocol connection between a tablet computer and a stylus according to an embodiment of the present disclosure;
fig. 11 is a schematic diagram illustrating an external device sending a connectable broadcast according to an embodiment of the present application;
fig. 12 is a schematic diagram illustrating a suction connection between a stylus and a tablet computer according to an embodiment of the present disclosure;
fig. 13 is a schematic diagram of a connection between a wireless headset and a mobile phone provided in an embodiment of the present application;
fig. 14 is a schematic diagram illustrating a connection between a stylus and a tablet computer according to an embodiment of the present disclosure;
fig. 15 is a schematic structural diagram of an electronic device connection apparatus according to an embodiment of the present application.
Detailed Description
Fig. 1 is a schematic view of a scene applicable to the embodiment of the present application. Referring to fig. 1, the scenario includes a stylus (stylus) 100, an electronic device 200, and a wireless keyboard 300. Fig. 1 illustrates an example in which the electronic device 200 is a tablet computer (PAD). Stylus 100 and wireless keyboard 300 may provide input to electronic device 200, and electronic device 200 performs an operation responsive to the input based on the input of stylus 100 or wireless keyboard 300. A touch area may be set on wireless keyboard 300, and stylus 100 may operate the touch area of wireless keyboard 300 to provide an input to wireless keyboard 300, and wireless keyboard 300 may perform an operation in response to the input based on the input of stylus 100. In one embodiment, the stylus 100 and the electronic device 200, the stylus 100 and the wireless keyboard 300, and the electronic device 200 and the wireless keyboard 300 may be interconnected through a communication network to realize wireless signal interaction.
Fig. 2A is a schematic structural diagram of a stylus. Referring to fig. 2A, the stylus 100 may include a pen tip 10, a pen barrel 20, and a rear cap 30. The inside of the barrel 20 is a hollow structure, the nib 10 and the rear end 30 are respectively located at two ends of the barrel 20, the rear cover 30 and the barrel 20 can be inserted or engaged, and the matching relationship between the nib 10 and the barrel 20 is described in detail in fig. 2B.
Fig. 2B is a partially disassembled structural diagram of the stylus. Referring to fig. 2B, the stylus 100 further includes a spindle assembly 50, the spindle assembly 50 is located in the barrel 20, and the spindle assembly 50 is slidably disposed in the barrel 20. The spindle assembly 50 has an external thread 51 thereon, and the nib 10 includes a writing end 11 and a connecting end 12, wherein the connecting end 12 of the nib 10 has an internal thread (not shown) that is engaged with the external thread 51.
When the spindle assembly 50 is assembled into the cartridge 20, the connection end 12 of the nib 10 protrudes into the cartridge 20 and is threadedly connected with the external thread 51 of the spindle assembly 50. In some other examples, the connection end 12 of the pen tip 10 and the spindle assembly 50 may be detachably connected by a snap fit or the like. Replacement of the nib 10 is achieved by the removable connection between the connecting end 12 of the nib 10 and the spindle assembly 50.
In order to detect the pressure applied to the writing end 11 of the pen tip 10, referring to fig. 2A, a gap 10a is formed between the pen tip 10 and the pen barrel 20, so that when the writing end 11 of the pen tip 10 is subjected to an external force, the pen tip 10 can move toward the pen barrel 20, and the movement of the pen tip 10 drives the spindle assembly 50 to move within the pen barrel 20. For detecting the external force, referring to fig. 2B, a pressure sensing assembly 60 is disposed on the main shaft assembly 50, a portion of the pressure sensing assembly 60 is fixedly connected to a fixing structure in the pen holder 20, and a portion of the pressure sensing assembly 60 is fixedly connected to the main shaft assembly 50. Thus, when the main shaft assembly 50 moves along with the pen tip 10, since part of the pressure sensing assembly 60 is fixedly connected with the fixed structure in the pen holder 20, the movement of the main shaft assembly 50 drives the deformation of the pressure sensing assembly 60, the deformation of the pressure sensing assembly 60 is transmitted to the circuit board 70 (for example, the pressure sensing assembly 60 and the circuit board 70 can be electrically connected through a wire or a flexible circuit board), and the circuit board 70 detects the pressure of the writing end 11 of the pen tip 10 according to the deformation of the pressure sensing assembly 60, so as to control the line thickness of the writing end 11 according to the pressure of the writing end 11 of the pen tip 10.
In this embodiment, referring to fig. 2B, the stylus pen 100 further includes a plurality of electrodes, which may be, for example, a first transmitting electrode 41, a ground electrode 43, and a second transmitting electrode 42. The first emitter electrode 41, the ground electrode 43, and the second emitter electrode 42 are all electrically connected to the circuit board 70. The first transmitting electrode 41 may be located in the pen tip 10 and near the writing end 11, the circuit board 70 may be configured as a control board that may provide signals to the first transmitting electrode 41 and the second transmitting electrode 42, respectively, the first transmitting electrode 41 is used to transmit a first signal, and when the first transmitting electrode 41 is near the touch screen 201 of the electronic device 200, a coupling capacitance may be formed between the first transmitting electrode 41 and the touch screen 201 of the electronic device 200, so that the electronic device 200 may receive the first signal. The second transmitting electrode 42 is configured to transmit a second signal, and the electronic device 200 can determine the tilt angle of the stylus 100 according to the received second signal. In the embodiment of the present application, the second transmitting electrode 42 may be located on the inner wall of the barrel 20. In one example, the second emitter electrode 42 may also be located on the spindle assembly 50.
The ground electrode 43 may be located between the first and second emitter electrodes 41 and 42, or the ground electrode 43 may be located at the outer peripheries of the first and second emitter electrodes 41 and 42, the ground electrode 43 serving to reduce the coupling of the first and second emitter electrodes 41 and 42 to each other.
In the embodiment of the present application, referring to fig. 2B, the stylus 100 further includes: a battery assembly 80, the battery assembly 80 being used to provide power to the circuit board 70. When the battery assembly 80 includes a rechargeable battery, the stylus pen 100 can charge the battery in the battery assembly 80 in a wireless charging manner.
In one embodiment, as shown with reference to FIG. 4, wireless keyboard 300 may include a first portion 301 and a second portion 302. Illustratively, wireless keyboard 300 may include: keyboard main part and keyboard cover. The first portion 301 may be a keypad sleeve and the second portion 302 a keypad body. The first portion 301 is used for placing the electronic device 200, and the second portion 302 may be provided with keys, a touch pad, and the like for user operation. The first portion 301 comprises a first support 301a and a second support 301b, the first support 301a and the second support 301b are rotatably connected, and the first support 301a and the second support 301b can be used to support the electronic device 200 together when in use (refer to fig. 1). Alternatively, the first stand 301a provides support for the second stand 301b, and the second stand 301b supports the electronic device 200. Referring to fig. 4, the second bracket 301b is rotatably coupled to the first portion 301. Referring to fig. 4, the second portion 302 and the second bracket 301b are rotatably connected by a connecting portion 304, and the connecting portion 304 is provided with a receiving portion 303. The connecting portion 304 may be a rotating shaft.
Fig. 5A is a schematic view of the stylus pen 100 being accommodated in the accommodating portion 303, and fig. 5B is a schematic side view of the stylus pen 100 being accommodated in the accommodating portion 303 of the wireless keyboard 300. Referring to fig. 5B, the receiving portion 303 is a circular cavity, and an inner diameter of the receiving portion 303 is larger than an outer diameter of the stylus 100.
In order to prevent the stylus pen 100 from falling off when being placed in the receiving portion 303, a magnetic material may be disposed on an inner wall of the receiving portion 303, and the stylus pen 100 may be disposed therein. The stylus pen 100 is attracted to the housing 303 by magnetic attraction between magnetic materials. Of course, the stylus pen 100 and the storage portion 303 may be fixed by a snap-fit method.
Fig. 6 is a schematic diagram of a hardware structure of a stylus according to an embodiment of the present disclosure. Referring to fig. 6, a stylus 100 may have a processor 110. Processor 110 may include storage and processing circuitry to support the operation of stylus 100. Processing circuitry in processor 110 may be used to control the operation of stylus 100.
One or more sensors can be included in stylus 100. The sensors may also include inertial sensors 130. The sensors may also include additional sensors such as temperature sensors, ambient light sensors, light-based proximity sensors, contact sensors, magnetic sensors, pressure sensors, and/or other sensors.
A status indicator 140, such as a light emitting diode, and a button 150 may be included in stylus 100. Status indicator 140 is used to alert a user to the status of stylus 100. Buttons 150 may include mechanical and non-mechanical buttons, and buttons 150 may be used to collect button press information from a user.
In the embodiment of the present application, one or more electrodes 160 (refer to the description in fig. 2B in particular) may be included in the stylus 100, wherein one electrode 160 may be located at the writing end of the stylus 100, and one electrode 160 may be located in the pen tip 10, as described above.
Sensing circuitry 170 can be included in stylus 100. Sensing circuitry 170 can sense capacitive coupling between electrodes 160 and drive lines of a capacitive touch sensor panel interacting with stylus 100.
To support wireless communication of stylus 100 with electronic device 200, stylus 100 may include a wireless module. Fig. 6 illustrates an example in which the wireless module is a bluetooth module 180. The wireless module can also be a WI-FI hotspot module, a WI-FI point-to-point module and the like.
Stylus 100 may further include a charging module 190, and charging module 190 may support charging of stylus 100 to provide power to stylus 100.
The stylus pen 100 may further include a coil module for data interaction with a coil component of the electronic device 200 when the stylus pen 100 is attached to the electronic device 200 or when the stylus pen 100 is close to the electronic device 200.
Fig. 7 is a schematic structural diagram of an electronic device 200 according to an embodiment of the present disclosure. Referring to fig. 7, electronic device 200 may include multiple subsystems that cooperate to perform, coordinate, or monitor one or more operations or functions of electronic device 202. Electronic device 200 includes processor 210, input surface 220, coordination engine 230, power subsystem 240, power connector 250, wireless interface 260, and display 270.
Coordination engine 230 of electronic device 200 includes or is otherwise communicatively coupled to a sensor layer located below or integrated with input surface 220. In one embodiment, the input surface 220 may be referred to as a touch screen 201. The sensor layer may detect the presence of the tip 10 of the stylus 100 and/or the touch of a user's finger by monitoring changes in capacitance (e.g., mutual capacitance or self-capacitance) present at each capacitive sensing node. In many cases, coordination engine 230 may be configured to detect tip and ring signals received from stylus 100 through the sensor layer via capacitive coupling.
The processor 210 may use the stylus identity information to receive input from more than one stylus at the same time. In particular, the coordination engine 230 may be configured to transmit the position and/or angular position of each of the number of styli detected by the coordination engine 230 to the processor 210. In other cases, the coordination engine 230 may also transmit information to the processor 210 regarding the relative positions and/or relative angular positions of the plurality of styli detected by the coordination engine 230. For example, coordination engine 220 may notify processor 210 that a detected first stylus is located a distance from a detected second stylus.
The coordination engine 230 may forward the user identity information or stylus setting information (if detected and/or recoverable) to the processor 210. If the stylus setting information cannot be recovered from the tip signal and/or the ring signal, the coordination engine 230 may optionally indicate to the processor 210 that the stylus setting information is not available. The electronic device 200 can utilize the stylus to set information (or the absence of such information) in any suitable manner, including but not limited to: applying settings to the electronic device, applying settings to a program running on the electronic device, changing line thickness, color, patterns rendered by a graphics program of the electronic device, changing settings of a video game operating on the electronic device, and so forth.
Processor 210 may be implemented as any electronic device capable of processing, receiving, or transmitting data or instructions. For example, the processor may be a microprocessor, central processing unit, application specific integrated circuit, field programmable gate array, digital signal processor, analog circuit, digital circuit, or a combination of these devices. The processor may be a single threaded or a multi-threaded processor. The processor may be a single core or a multi-core processor.
During use, the processor 210 may be configured to access a memory having stored instructions. The instructions may be configured to cause the processor to perform, coordinate, or monitor one or more operations or functions of the electronic device 200. The memory may store electronic data that may be used by the stylus or the processor.
The electronic device 200 also includes a power subsystem 240. Power subsystem 240 may include a battery or other power source. The power subsystem 240 may be configured to provide power to the electronic device 200. The power subsystem 240 may also be coupled to a power connector 250. Power connector 250 can be used to transmit power stored within (or available to) power subsystem 240 to stylus 100.
Electronic device 200 also includes a wireless interface 260 to facilitate electronic communication between electronic device 200 and stylus 100.
The electronic device 200 may further include a bluetooth communication module, which may be a classic bluetooth (BR/EDR) module and a Bluetooth Low Energy (BLE) module. The bluetooth communication module may listen to signals, such as probe requests, broadcast data packets, etc., transmitted by other devices (e.g., stylus 100) so that the electronic device 200 may discover the other devices (e.g., stylus 100).
The bluetooth communication module may also transmit a signal, such as a broadcast BLE signal, so that other devices (e.g., stylus 100) may discover electronic device 200 and establish a wireless communication connection with other devices (e.g., stylus 100). Communicate with other devices, such as stylus 100, via bluetooth. The bluetooth communication module may be a bluetooth chip. The wireless communication function of the electronic device 200 may be implemented by an antenna, a bluetooth communication module, a modem processor, and the like.
The electronic device 200 also includes a display 270. The display 270 may be communicatively coupled to the processor 210. Processor 210 may present information to a user using display 270. The processor 210 uses the display 270 to present an interface with which the user may interact. In many cases, a user manipulates stylus 100 to interact with the interface.
It will be apparent to one skilled in the art that some of the specific details presented above with respect to the electronic device 200 may not be required to practice particular described embodiments or their equivalents. Similarly, other electronic devices may include a greater number of subsystems, modules, components, etc. Some sub-modules may be implemented as software or hardware, where appropriate. Accordingly, it should be understood that the above description is not intended to be exhaustive or to limit the disclosure to the precise form disclosed herein. On the contrary, many modifications and variations are possible in light of the above teaching, as would be apparent to those of ordinary skill in the art.
The electronic device in the embodiment of the present application may be, for example, a mobile terminal or a fixed terminal having a touch screen, such as a tablet computer (PAD), a Personal Digital Assistant (PDA), a handheld device having a wireless communication function, a computing device, a vehicle-mounted device, or a wearable device, a Virtual Reality (VR) terminal device, an Augmented Reality (AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in self driving (self driving), a wireless terminal in remote medical (remote medical), a wireless terminal in smart grid (smart grid), a wireless terminal in transportation safety (transportation safety), a wireless terminal in smart city (smart city), and a wireless terminal in smart home (smart home). The electronic equipment 200 related to this application can carry on Android, Harmony OS, iOS or other operating systems, this application does not restrict to this.
In some embodiments, other electronic devices with professional use functions, such as a stylus, a wireless keyboard, and a wireless sound box, are referred to as external devices for convenience of distinction and description. And for example, a tablet computer connected to the external device is called a central device. Generally, before data transmission is performed between the center device having the bluetooth function and the external device, a pairing connection must be performed. The above-mentioned center device and external device may also be collectively referred to as a bluetooth device. In order to enable interoperation between paired bluetooth devices, the bluetooth Specification (SIG) is established by the bluetooth special interest group.
The bluetooth specification includes two parts, a core protocol (protocol) and an application protocol (profile). The core protocol includes the lowest 4 layers (Layer) in the bluetooth protocol stack, a basic Service Discovery Protocol (SDP), and a basic Generic Access Profile (GAP) for all profiles. The core protocol is essential in the bluetooth protocol stack.
In addition to the core protocol, the bluetooth specification must contain some other application layer services and protocols, called profile, or application layer profile. The profile may include types of telephone directory access protocol (PBAP), hands-free-call protocol (HFP), object transfer protocol (OPP), and the like. Each type of profile may be understood as a protocol stack for implementing a type of application service. PBAP, for example, is a protocol stack for implementing address book synchronization. As another example, HFP is a protocol stack for implementing call control (e.g., answer, hang-up, reject, voice dialing, etc.).
In one embodiment, the central device and the external device are both provided with operating systems, and the operating systems can ensure the normal operation of the electronic device. In an operating system, two processes can call each other through Inter-Process Communication (IPC) to implement a service function. Multiple processes may be included in an operating system, with each process serving to implement one or more basic functions in the operating system. In general, multiple processes may be intermodulated to implement corresponding service functions.
The execution main body of the operating system provided by the application can be a device corresponding to the operating system, and the execution device can be an electronic device provided with the operating system. Meanwhile, the execution device may also be a Central Processing Unit (CPU) of the electronic device, or a control module for maintaining an operating system in the electronic device. In the embodiment of the present application, a connection method for a processor to execute an operating system is taken as an example, and the connection method for the operating system provided in the embodiment of the present application is described.
In the embodiment of the present application, a process in the operating system is used to support the operating system to process basic transactions such as managing and configuring a memory, controlling an input device and an output device, operating a network, and managing a file system. For example, the system key process may be SystemServer, SurfaceFinler, MediaServer, or the like.
In the embodiment of the present application, the central device (the first electronic device) and the external device (the second electronic device) are not specifically limited, and the central device is taken as a tablet computer, and the external device is taken as a stylus pen for example to perform the following description. The tablet computer and the touch pen both have the Bluetooth function, and in the actual use process, when the touch pen is adsorbed on the tablet computer for the first time, if the Bluetooth function is opened by the tablet computer, the tablet computer can respond to the user operation and open the Bluetooth of the tablet computer so as to scan the peripheral equipment with the opened Bluetooth. The tablet computer can display the identifier of the stylus pen found by scanning on the user interface, and when the identifier of the stylus pen needing to be paired is detected to be clicked on the user interface by the user, the identifier is paired with the stylus pen. After the tablet personal computer and the touch pen are matched, the tablet personal computer and the touch pen can be connected through Bluetooth, so that a user can conveniently perform subsequent use.
In specific implementation, the tablet computer may actively discover the stylus based on a broadcast message sent by the stylus, and display the paired popup frame when the stylus is discovered. The process of displaying the paired popup frame by the tablet computer may be as follows: when the touch pen is attached to the tablet computer, the touch pen broadcasts a message through a public channel of the Bluetooth, and the message comprises an MAC address of the touch pen. The tablet computer can scan the message broadcasted by the stylus through Bluetooth Low Energy (BLE), then the message is analyzed to obtain the MAC address of the stylus, and based on the MAC address of the stylus, the tablet computer displays a pairing popup frame to remind a user to pair and connect the stylus and the electronic device.
After the HID protocol connection between the tablet computer and the touch pen is successful, the tablet computer pulls up the accessory management service. When pulled up, the accessory management service assigns a first device tag (e.g., mdevice tobebconnect) managed by the accessory management service to the device identification of the stylus. The device identifier may be any identifier for identifying the identity of the device, for example: the name of the external device, such as a "stylus pen", a preset numerical value corresponding to the external device, an MAC address of the external device, a hardware number of the external device, or a system-generated character string, may be, for example, an International Mobile Equipment Identity (IMEI) of the device, a Mobile Equipment Identity (MEID), a Serial Number (SN) of the device, or the like.
Generally, the accessory management service can be pulled up when one of the conditions is met, and cannot be pulled up repeatedly after being pulled up:
the method comprises the following steps that the connection between the tablet computer and the HID protocol of the touch pen is successful, the tablet computer detects a suction event of the touch pen, the tablet computer detects a distance triggering event of the touch pen, and the tablet computer detects a port connection event of the touch pen. The distance triggering event is generated when the distance between the touch pen and the tablet computer is smaller than a preset distance threshold value, and the port connection event is generated when the touch pen is connected with the tablet computer through a connection port.
When the accessory management service is successfully pulled up through the HID protocol connection, a first device tag (mdevice to beconnect) in the accessory management service is assigned as a device identifier of the stylus. That is, the accessory management service will not assign a value to the first device tag (mdevice tobebconnect) unless it is successfully pulled up via the protocol connection.
In the embodiment of the application, the tablet computer and the touch pen follow a bluetooth protocol to realize bluetooth connection and information exchange. After the tablet personal computer and the touch pen are paired for the first time and the Bluetooth connection is established, the tablet personal computer can store the related information of the Bluetooth equipment, so that the subsequent tablet personal computer and the touch pen do not need to be paired when the connection is established again, and the direct automatic connection can be realized. The reconnection between the devices is called a loopback.
Since the accessory management service has been pulled up by the HID protocol connect successful condition before the callback, and the accessory management service has assigned a first device tag (mdviceToBeConnect) as the device identification of the stylus. Therefore, in the process of back connection between the tablet computer and the stylus, after the HID protocol connection between the tablet computer and the stylus can be completed, the tablet computer and the stylus are smoothly connected to a proprietary channel protocol (GATT), so as to be normally used.
For example, fig. 8 is a schematic flowchart of a process of connecting a tablet computer and a stylus pen back according to an embodiment of the present disclosure. Referring to fig. 8, the method specifically includes the following steps:
step S100: the accessory management service listens for a connectable broadcast sent by the stylus in response to a trigger event.
In some embodiments, after the stylus is attached to the tablet computer, the sensor reports a trigger event, such as an attachment event, to the accessory management service, which monitors connectable broadcasts sent by the stylus in response to the trigger event.
In specific implementation, based on the HOGP protocol, when the bluetooth of the tablet computer is in an on state, if it is detected that the coil assembly is adsorbed by a certain stylus or a certain stylus is inserted into the USB port, the accessory management service monitors connectable broadcasts sent by the stylus.
On the stylus side, when the stylus is attached to the tablet computer or inserted into the USB of the tablet computer, the stylus sends a connectable broadcast to the surroundings. When the tablet computer monitors the broadcast sent by the touch pen, the subsequent connection task with the touch pen can be automatically triggered. In specific implementation, fig. 11 is a schematic diagram of an external device sending a connectable broadcast according to an embodiment of the present application, and as shown in fig. 11, a stylus sends the connectable broadcast through a BLE component in an architecture. The BLE component comprises an upper command layer (bluetooth host) and a lower application layer (bluetooth chip). The Bluetooth host generates a command for sending the connectable broadcast and sends the command for sending the connectable broadcast to the Bluetooth chip, and the Bluetooth chip sends the connectable broadcast outwards according to the command for sending the broadcast. Furthermore, after the accessory management service monitors and receives connectable broadcast sent by the external equipment, the accessory management service triggers Bluetooth connection with the external equipment.
Step S101: the accessory management service establishes an HID protocol connection with the stylus in response to the connectable broadcast by the stylus.
The HID protocol connection is realized based on the architecture of a Bluetooth module or a Bluetooth chip in the tablet computer. The architecture of the bluetooth module or the bluetooth chip in the tablet computer can be divided into a bottom layer module (BT Controller), a bluetooth protocol Stack (Stack), a bluetooth APK and a UI layer from bottom to top. The bottom layer module (BT Controller) is used for receiving and sending data information and can be directly communicated with an external Bluetooth device; the Bluetooth protocol Stack (Stack) is used for processing the whole logic flow of the Bluetooth application, and comprises the steps of processing data reported by a bottom layer module (BT Controller); the Bluetooth APK is an intermediate layer of a Bluetooth module or a Bluetooth chip and is responsible for processing upper layer calling logic and processing data and information reported by a Bluetooth protocol Stack (Stack); the UI layer is an upper layer of the bluetooth module or the bluetooth chip, and is mainly responsible for displaying a related user interface in the bluetooth application, similar to an APK (android application package) of an application program.
In some embodiments, the process of HID protocol connection generally includes: the accessory management service sends a protocol connection instruction to the Bluetooth APK. And the Bluetooth APK receives the protocol connection instruction and sends the protocol connection instruction to the Bluetooth protocol stack. The Bluetooth protocol stack receives the protocol connection instruction and sends the protocol connection instruction to the bottom module. And the bottom layer module executes a connection task with the touch pen after receiving the protocol connection instruction, such as sending a connection request to the touch pen. After the connection task is completed, the generated connection state information is reported back to the Bluetooth APK through the Bluetooth protocol stack.
In the embodiment of the present application, fig. 10 is a schematic flowchart illustrating a process of establishing a protocol connection between a tablet computer and a stylus pen according to the embodiment of the present application. Referring to fig. 10, the process of establishing a protocol connection specifically includes the following steps:
step S200: the accessory management service sends a protocol connection instruction to the Bluetooth APK.
Step S201: the Bluetooth APK receives the protocol connection instruction and sends the protocol connection instruction to the Bluetooth protocol stack.
Step S202: the Bluetooth protocol stack receives the protocol connection instruction and sends the protocol connection instruction to the bottom module.
Step S203: the bottom layer module executes a connection task with the stylus to generate connection state information.
Step S204: and the bottom layer module reports the generated connection state information to the Bluetooth protocol stack.
Step S205: and the Bluetooth protocol stack receives the connection state information and reports the connection state information to the Bluetooth APK.
Step S206: and the Bluetooth APK receives the connection state information and reports the connection state information to the accessory management service so that the accessory management service can determine whether the protocol connection with the touch pen is successfully established according to the connection state information.
The connection state information comprises connection success information or connection failure information, and the connection success information is used for indicating that protocol connection is successfully established with the touch pen; the connection failure information is used for indicating the connection task failure and the definite failure reason, and the tablet personal computer and the touch pen are still in a disconnected state when the protocol connection is failed.
In some embodiments, when the tablet pc and the stylus successfully establish the protocol connection, that is, after the accessory management service receives the connection success information, the accessory management service responds to the connection success information and controls the user display interface in the UI layer to display a connection success prompt message, where the connection success prompt message is used to prompt the user that the tablet pc and the stylus have completed establishing the bluetooth connection, so as to improve user experience.
Step S102: and after the HID protocol connection is successfully established between the accessory management service and the touch pen, the accessory management service is connected with the GATT.
It should be noted that the implementation of the private channel protocol GATT as a private bluetooth data channel is realized by any software development except for a bluetooth data channel between a tablet computer and a Human Interface Device (HID), and needs to be set according to actual conditions. The accessory management service is connected with the private channel, and the tablet personal computer directly initiates connection of the touch pen, so that data interaction between the tablet personal computer and the touch pen is realized.
However, when the tablet pc is restarted with a stylus being attached, the accessory management service is pulled up by the sensor reporting the attachment event, and therefore, after the accessory management service is pulled up, the first device tag (mdviceToBeConnect) is not assigned, resulting in a NULL value NULL for the first device tag. After the accessory management service is pulled up, the tablet computer creates a monitoring process to monitor the HID protocol connection state of the tablet computer and the stylus. And after the monitoring process monitors that the connection between the tablet personal computer and the HID protocol of the touch pen is successful, assigning the second equipment label maintained by the monitoring process to be the equipment identifier of the touch pen, and feeding the second equipment label after assignment back to the accessory management service. After receiving the second device tag fed back by the monitoring process, the accessory management service compares whether the values of the first device tag and the second device tag are the same, if so, connects the private channel protocol GATT to realize data interaction between the stylus and the tablet computer, and if not, cannot connect the private channel protocol GATT.
Obviously, when the tablet computer is restarted under the condition that the touch pen is attracted, the attachment management service is pulled up by the attraction event reported by the sensor, so that the first device tag cannot be connected with the private channel protocol GATT due to the fact that the first device tag is not assigned and has a different value from the second device tag, the tablet computer further displays that the touch pen is connected, but when the touch pen performs input operation on the tablet computer, the touch pen does not go out of water, and the user experience is reduced.
In order to optimize the above problems, the application provides an electronic device connection method and an electronic device, and the method can be applied to a scene that a tablet computer is restarted after a stylus is adsorbed on the tablet computer, so that the phenomenon that the stylus is connected with the tablet computer after being displayed on a user display interface, but water cannot flow out when a user uses the stylus to perform input operation on the tablet computer is avoided. The problem that data interaction cannot be carried out between the tablet personal computer and the touch pen is solved, and the use experience of a user is improved.
Fig. 9 is a schematic flowchart of an electronic device connection method according to an embodiment of the present application. Next, with reference to fig. 9, steps of an electronic device connection method provided in an embodiment of the present application are specifically described. The method provided by the embodiment of the application can be applied to a scene that the central equipment is connected with the external equipment.
Take the external device as an absorption type touch pen and the central device as a tablet computer as an example. Referring to fig. 9, the method may be implemented by the following steps S300-S308:
step S300: the tablet computer pulls up the accessory management service in response to the trigger event.
The adsorption type touch control pen is internally provided with a coil assembly, and the frame of the tablet computer is also provided with the coil assembly. Through the coil assembly of the touch pen and the tablet computer, the touch pen can be adsorbed on the tablet computer, so that a user can conveniently carry the touch pen, and the touch pen is prevented from being lost. Meanwhile, the tablet personal computer can charge the touch pen by utilizing the coil assembly, and can transmit data with the touch pen to perform data interaction. When the user attaches the stylus to the tablet computer, the user is considered to want to use the tablet computer. Meanwhile, after the stylus is attached to the tablet computer, the sensor reports a trigger event, such as a coil component attachment event, to the tablet computer. The tablet computer pulls up an accessory management service in response to the trigger event, the accessory management service for managing the HID protocol connection of the tablet computer.
The trigger event includes, but is not limited to, the coil component adsorption event, and may also be a USB port insertion event, an event that a distance between the stylus and the tablet computer is less than a preset distance threshold, an event that the stylus touches a specific location of the tablet computer, and the like.
It should be noted that the triggering event indicates the user's intention. And the step of connecting the tablet computer with the touch pen is executed only when the touch pen is adsorbed on the tablet computer after the trigger event is received by the tablet computer, and the sensor reports the adsorption event to prove that the user wants to use the touch pen. For convenience of explanation, the following exemplary description will be made by taking a stylus pinching event as an example of the triggering event.
The tablet computer responds to a trigger event, and pulls up an accessory management service, wherein the accessory management service is a system key process (SystemServer) in the operating system. The accessory management service is used to implement one or more basic functions in the operating system. Under the scene of this application, accessory management service is used for realizing that panel computer and stylus carry out the function that the bluetooth is connected the communication. It should be noted that, in the operating system, the business function may be realized by calling a process. Of course, multiple processes may also be intermodulated to implement corresponding service functions.
It should be noted that, in a scenario where the tablet computer is restarted under the condition that the stylus is attached, during the process that the attachment event is reported by the sensor and the accessory management service is pulled up, the HID protocol connection between the tablet computer and the stylus is also performed synchronously. After the tablet computer is restarted, the Bluetooth APK in the Bluetooth module automatically executes the process of establishing the HID protocol connection between the tablet computer and the touch pen. And will not be described in detail herein.
In some embodiments, the tablet and stylus may establish a Bluetooth connection via Bluetooth technologies including classic Bluetooth BR/EDR (Basic Rate/Enhanced Data Rate) and Bluetooth Low Energy (BLE). The tablet personal computer and the touch pen can support BLE and/or BR/EDR, and can also support different versions of Bluetooth protocols and human interface device universal attribute communication protocols (HID Over GATT Profile, HOGP).
Step S301: under the condition that the HID protocol connection is successfully established between the tablet computer and the touch pen, the tablet computer establishes a monitoring process, and the accessory management service acquires the HID protocol connection state between the tablet computer and the touch pen from the monitoring process.
In an embodiment of the present application, the step of acquiring, by the tablet computer, the HID protocol connection state with the stylus from the monitoring process includes:
step S3011: the accessory management service sends a call request to the monitor process, wherein the call request is used for calling the monitor process to monitor the protocol connection state change.
Step S3012: the listening process recalls protocol connection status from the accessory management service in response to the call request.
In some embodiments, during the process of calling the listening process by the accessory management service, the accessory management service may send a call request to the listening process using the cross-process management interface as a binder interface to call the listening process. Similarly, the monitor process may also send a callback request to the accessory management service by calling the binder interface, so as to call the accessory management service. And after the accessory management service receives the callback request from the monitoring process, the accessory management service can also send a callback response request to the monitoring process by calling the binder interface so as to indicate that the accessory management service has received the callback request. When the listening process receives a callback response message from the accessory management service, the processor may determine that the accessory management service has completed the call with the listening process.
In the embodiment of the application, after the accessory management service sends the call request to the monitoring process through the call binder interface, the callback state information returned by the monitoring process is received, and the processor can determine that the accessory management service has completed the mutual call with the monitoring process. It should be noted that, within the preset time length after the accessory management service sends the callback request, the accessory management service needs to receive the callback response message from the monitoring process.
Illustratively, the protocol connection state called back by the listening process to the accessory management service includes an initial connection state, a connection-in-progress state, a connection-connected state, and a connected state of the tablet and the stylus. Wherein the connected state is a connection-stable state. Subsequent operations are performed after the protocol connection state of the tablet computer and the stylus is determined to be the connected state.
In some embodiments, the listening process may be provided in the operating system of the tablet computer and not integrated in the application program of the tablet computer. Meanwhile, the monitoring process can also be integrated in an application program of the tablet computer. The listening process can be invoked in different ways to listen to the protocol connection status depending on where the listening process is located. When the monitoring process is set in the operating system of the tablet computer and is not integrated in the application program of the tablet computer, the tablet computer can register the callback function after the monitoring process is created, and obtain callback monitored data.
In some embodiments, when the listening process is integrated in the application of the tablet computer, the tablet computer may directly invoke the bluetooth GATT through the listening process, so that the listening process may quickly acquire the protocol connection status connected with the stylus. It should be noted that, in the embodiment of the present application, the tablet computer only obtains the parameter for identifying the bluetooth connection state through the registered callback function, and a manner of determining the bluetooth connection state is taken as an example, which is not specifically limited, and may be set by itself according to an actual situation.
In some embodiments, the tablet may invoke the listening process in real-time to listen for a protocol connection status with the stylus. The protocol connection state connected with the touch pen can be monitored according to a certain period or preset time under the condition that the protocol connection state is stable, for example, the monitoring period is stored by self-defining configuration parameters, so that the monitoring is conveniently controlled. Or the protocol connection state with the touch pen can be monitored in a mode of storing a configuration file for reading and writing verification or sending a test data packet.
The specific process of acquiring the HID protocol connection state of the tablet personal computer and the touch pen after the accessory management service is pulled up is described above.
Step S302: when the HID protocol connection state of the tablet computer and the touch pen is a connected state, the accessory management service acquires a second equipment label from the monitoring process, wherein the second equipment label is used for representing the external equipment connected with the tablet computer.
Before the accessory management service obtains the second device tag from the listening process, the listening process needs to assign a value to the second device tag. Specifically, after the monitoring process monitors that the protocol connection between the tablet computer and the stylus HID is successful, the monitoring process assigns the second device tag maintained by the monitoring process to the device identifier of the stylus. And then returning the second device label with the assigned value to the accessory management service.
In some embodiments, before the listening process assigns the value to the second device tag, the listening process needs to obtain the device identifier of the external device. According to different product forms and specific connection modes of the external device and the central device, the mode for acquiring the identifier of the external device is different, and how the central device acquires the identifier of the external device is exemplarily described below by combining the specific external device and the central device.
For example, referring to fig. 12, the external device is an absorption stylus, and the central device is a tablet computer, for example. The adsorption type touch pen is internally provided with a coil assembly, and the frame of the tablet computer is also provided with the coil assembly. The tablet personal computer can transmit data with the touch pen by utilizing the coil assembly to perform data interaction. Therefore, after the external equipment is adsorbed on the central equipment, the central equipment can acquire the equipment identifier of the external equipment through the coil assembly.
Referring to fig. 14, when the external device is a plug-in stylus, the central device is a tablet computer, for example. The insertion stylus is provided with a connection joint, for example: USB joint, Micro USB joint, Type-c joint and Lightning joint etc.. The tablet personal computer is provided with an interface corresponding to the touch pen connecting joint. The connection between the touch control pen and the tablet computer can be established through the connecting joint and the interface. When the tablet computer detects that the touch pen connecting joint is inserted into the interface, the touch pen can send data such as equipment identification to the tablet computer through the connecting joint and the interface. Therefore, after the external device is connected with the central device through the connecting joint, the central device can acquire the device identifier of the external device through the connecting joint.
Referring to fig. 13, the external device is a wireless headset, and the central device is a mobile phone. Coil assemblies are arranged inside the wireless earphone and the mobile phone. When the mobile phone detects that the wireless earphone is close to the mobile phone and the distance between the wireless earphone and the mobile phone is smaller than the distance threshold, the mobile phone can be connected with the wireless earphone through the coil assembly. After connection, the wireless earphone can send data such as equipment identification to the mobile phone through the coil assembly. It can be seen that when the distance from the external device to the central device is less than the threshold value, the central device may identify the external device through the coil assembly.
Step S303: the accessory management service acquires a first device label stored in advance and judges whether the first device label is a null value.
Step S304: if the first device tag value is not null, the accessory management service determines whether the first device tag and the second device tag have the same value.
If the values of the first device tag and the second device tag are the same, step S308 is performed.
If the values of the first device tag and the second device tag are different, the accessory management service is not connected with the private channel protocol GATT, namely the accessory management service is not connected with the touch pen to establish a private channel GATT, and the data transmission function between the tablet personal computer and the touch pen cannot be realized.
By judging whether the first device tag value is the same as the second device tag value, whether the external device which establishes protocol connection with the tablet computer is a touch pen adsorbed on the tablet computer can be determined. If the external equipment is the same as the touch control pen, the external equipment which establishes the protocol connection with the tablet computer is the touch control pen which is adsorbed on the tablet computer. If the external equipment is different from the tablet computer, the external equipment establishing protocol connection with the tablet computer is not the touch pen adsorbed on the tablet computer but other equipment.
Step S305: if the first equipment label is a null value, the accessory management service acquires all the equipment identifiers of the external equipment successfully connected with the HID protocol of the tablet computer, and generates an HID connected equipment list. The device identification includes a supplier identification code VID and a product identification code PID.
The HID connected device list is an information list of all external devices that have established connection with the center device, and the list at least includes names of the external devices, and Vendor identification codes (Vendor IDs, VIDs) and Product identification codes (products IDs, PIDs) corresponding to the names of the external devices. Specifically, the HID connected device list may be obtained by the center device reading its memory. When the center device is connected to the external device, the center device may obtain information of the connected external device, such as a name, a VID, and a PID of the external device. And the central equipment generates an HID connected equipment list according to the acquired information of the external equipment and stores the HID connected equipment list in a memory.
Where VID and PID are device identification numbers. The tablet personal computer can distinguish different external devices through different VIDs and PIDs, and each supplier identification code and the product identification code consist of a plurality of bytes, wherein the supplier identification code is applied to the execution forum by suppliers, the supplier identification code of each supplier is unique, and the product identification code is determined by the suppliers. Different external equipment, different models of the same external equipment and different designs of the same external equipment all adopt different product identification codes. Therefore, according to the VID and the PID, the accessory management service can quickly search the touch pen from all the currently connected devices, so that the tablet computer is in communication connection with the touch pen.
Step S306: the accessory management service determines whether the VID and PID of the stylus are stored in the HID connected device list. If the VID and PID of the stylus pen are stored in the HID connected device list, step S308 is executed.
If the HID connected equipment list comprises a supplier identification code VID and a product identification code PID of the touch pen, the accessory management service determines that the HID connected equipment list comprises the touch pen; if the supplier identification code VID and the product identification code PID of the stylus are not included in the HID connected device list, the accessory management service determines that the stylus is not included in the HID connected device list.
Illustratively, when the tablet computer is connected to the bluetooth keyboard, the bluetooth headset and the stylus at the same time, if the VID and the PID corresponding to the stylus are stored in the HID connected device list, the accessory management service establishes a proprietary channel protocol GATT connection of the tablet computer stylus, so as to implement communication connection between the tablet computer and the stylus. On the contrary, if the VID and the PID corresponding to the stylus do not exist in the HID connected device list, the accessory management service does not establish the GATT connection of the tablet pc stylus, so the tablet pc does not communicate with the stylus.
In some embodiments, the HID connected device list may also include a device version number drn (device Release number). The central device distinguishes different external devices by different VIDs, PIDs and device version numbers drn (device Release number). For example, VID, PID, and device Release number drn (device Release number) in the HID connected device list all correspond to the external device, so that communication between the central device and the external device can be really realized.
Step S307: the accessory management service establishes a private channel protocol GATT connection between the tablet computer and the touch pen.
Therefore, when the tablet personal computer is restarted under the condition that the touch pen is attracted and the attachment event reported by the sensor is pulled up, even if the value of the first device label is different from that of the second device label due to the fact that the first device label is not assigned, the tablet personal computer can establish a connection private channel protocol GATT with the touch pen, and the data transmission function is achieved. Therefore, when a user uses the touch pen to perform input operation on the tablet personal computer, the touch pen cannot be out of water, and the user use experience is improved.
Fig. 15 is a schematic structural diagram of an electronic device connection apparatus according to an embodiment of the present application. In some embodiments, the electronic device may implement the corresponding functions by the hardware apparatus shown in fig. 15. As shown in fig. 15, the electronic device connecting apparatus includes: a memory 300 and a processor 301.
In some embodiments, processor 301 may include one or more processing units, such as: the processor 301 may include an applications processor, modem processor, graphics processor, image signal processor, controller, video codec, digital signal processor, baseband processor, and/or neural network processor, among others. Wherein, the different processing units may be independent devices or may be integrated in one or more processors. Memory 300 is coupled to processor 301 for storing various software programs and/or sets of computer program instructions, and memory 300 may include volatile memory and/or non-volatile memory.
The software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to perform the method steps of: after the accessory management service is pulled up, acquiring the HID protocol connection state of the first electronic equipment and the second electronic equipment; wherein: the accessory management service is used for managing the HID protocol connection of the first electronic device; the pull-up condition of the accessory management service includes at least any one of: the HID protocol connection between the first electronic device and the second electronic device is successful, and the first electronic device detects the adsorption event of the second electronic device; when the accessory management service is pulled up by the condition that the HID protocol connection between the first electronic device and the second electronic device is successful, a first device label in the accessory management service is assigned as a device identification of the second electronic device; if the HID protocol connection between the first electronic device and the second electronic device is successful, the accessory management service judges whether the first device label is a null value; if the first equipment label is a null value, the accessory management service acquires an HID connected equipment list of the first electronic equipment and judges whether the HID connected equipment list comprises second electronic equipment or not; if the HID connected device list includes the second electronic device, the accessory management service establishes a proprietary channel protocol GATT connection between the first electronic device and the second electronic device.
According to the technical scheme, the situation that the second electronic equipment is connected but the second electronic equipment and the first electronic equipment cannot realize a data transmission function when the first electronic equipment is restarted under the condition that the second electronic equipment is adsorbed is avoided, and user experience is improved.
In one implementation, the software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to implement the method steps of: the accessory management service acquires a second equipment label from the monitoring process; the monitoring process is used for assigning the device identification of the second electronic device to the second device label when the HID protocol connection between the first electronic device and the second electronic device is successful.
The listening process assigns a value to the second device tag before the accessory management service obtains the second device tag from the listening process. And then, after the monitoring process monitors that the HID protocol connection between the first electronic device and the second electronic device is successful, the second device label maintained by the monitoring process is assigned as the device identifier of the second electronic device. And then returning the second device label with the assigned value to the accessory management service. Therefore, the accessory management service can compare whether the values of the first equipment label and the second equipment label are the same or not by monitoring the second equipment label returned by the process, so that data interaction between the first electronic equipment and the second electronic equipment is realized, and the use experience of a user is improved.
In one implementation, the software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to implement the method steps of: after the HID protocols of the first electronic device and the second electronic device are successfully connected, the accessory management service acquires all device identifications of external devices successfully connected with the HID protocol of the first electronic device and generates an HID connected device list; the device identification includes a supplier identification code VID and a product identification code PID.
Therefore, by acquiring all the device identifiers of the external devices successfully connected with the HID protocol of the first electronic device, whether the external devices successfully connected with the HID protocol of the first electronic device comprise the second electronic device can be further judged. So that the data transmission function of the first electronic device and the second electronic device can be realized under the condition that the first device label is not assigned. The method further provides a mode that the first electronic device establishes the private channel protocol GATT connection with the second electronic device, and user experience is improved.
In one implementation, the software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to implement the method steps of: if the HID connected device list comprises the supplier identification code VID and the product identification code PID of the second electronic device, the accessory management service determines that the HID connected device list comprises the second electronic device; if the supplier identification code VID and the product identification code PID of the second electronic device are not included in the HID connected device list, the accessory management service determines that the second electronic device is not included in the HID connected device list.
In this way, even if the value of the first device tag is different from that of the second device tag because the first device tag is not assigned, by determining that the supplier identification code VID and the product identification code PID of the second electronic device are included in the HID connected device list, the data transmission function of the first electronic device and the second electronic device can be realized. The situation that the first electronic device displays that the second electronic device is connected but the second electronic device and the first electronic device cannot realize a data transmission function is avoided, and the use experience of a user is improved.
In one implementation, the software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to implement the method steps of: if the first equipment label is not a null value, the accessory management service judges whether the values of the first equipment label and the second equipment label are the same; if the values of the first device tag and the second device tag are the same, the accessory management service establishes a proprietary channel protocol GATT connection between the first electronic device and the second electronic device.
In this way, if the first device tag is already assigned, under the condition that the values of the first device tag and the second device tag are determined to be the same, the private channel protocol GATT connection between the first electronic device and the second electronic device is directly established, so as to realize the data transmission function between the first electronic device and the second electronic device. The use experience of the user is improved.
In one implementation, the pull-up condition of the accessory management service further includes the first electronic device detecting a port connection event of the second electronic device, the port connection event being generated when the second electronic device is connected to the first electronic device through the connection port.
In one implementation, the pull-up condition of the accessory management service further includes the first electronic device detecting a distance triggering event of the second electronic device, the distance triggering event being generated when the distance of the second electronic device from the first electronic device is less than a preset distance threshold.
In one implementation, the software program and/or sets of computer program instructions in the memory 300, when executed by the processor 301, cause the electronic device to implement the method steps of: if the second electronic device is not included in the HID connected device list, the accessory management service does not establish a proprietary channel protocol GATT connection between the first electronic device and the second electronic device.
An embodiment of the present application further provides an electronic device, including: a memory and a processor, the processor and the memory coupled; wherein the memory includes program instructions that, when executed by the processor, cause the electronic device to perform the methods as described in the aspects above.
Embodiments of the present application also provide a computer-readable storage medium, in which computer program instructions are stored, and when the computer program instructions are executed, the method implemented in the above aspects is implemented.
The term "plurality" herein means two or more. The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship; in the formula, the character "/" indicates that the preceding and following related objects are in a relationship of "division".
It is to be understood that the various numerical references referred to in the embodiments of the present application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of the present application. It should be understood that, in the embodiment of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.

Claims (11)

1. An electronic device connecting method is applied to a first electronic device, and comprises the following steps:
after the accessory management service is pulled up, acquiring the HID protocol connection state of the first electronic equipment and the second electronic equipment; wherein: the accessory management service is to manage an HID protocol connection of the first electronic device; the pull-up condition of the accessory management service includes at least any one of: the HID protocol connection between the first electronic device and the second electronic device is successful, and the first electronic device detects a clamping event of the second electronic device; when the accessory management service is pulled up by the condition that the HID protocol connection between the first electronic device and the second electronic device is successful, a first device label in the accessory management service is assigned as a device identification of the second electronic device;
if the HID protocol connection between the first electronic device and the second electronic device is successful, the accessory management service acquires a second device label from a monitoring process; the monitoring process is used for assigning the device identifier of the second electronic device to the second device label when the HID protocol connection between the first electronic device and the second electronic device is successful;
the accessory management service judges whether the first equipment label is a null value;
if the first equipment label is a null value, the accessory management service acquires an HID connected equipment list of the first electronic equipment and judges whether the HID connected equipment list comprises the second electronic equipment or not;
if the HID connected device list comprises the second electronic device, the accessory management service establishes a private channel protocol (GATT) connection between the first electronic device and the second electronic device;
if the first equipment label is not a null value, the accessory management service judges whether the values of the first equipment label and the second equipment label are the same;
if the values of the first device tag and the second device tag are the same, the accessory management service establishes a private channel protocol GATT connection between the first electronic device and the second electronic device.
2. The method of claim 1, further comprising:
after the HID protocol of the first electronic device and the HID protocol of the second electronic device are successfully connected, the accessory management service acquires all device identifiers of external devices which are successfully connected with the HID protocol of the first electronic device, and generates the HID connected device list; wherein the device identification includes a vendor identification code VID and a product identification code PID.
3. The method of claim 2, wherein the accessory management service determines that the HID is connected
Whether the second electronic device is included in the standby list or not comprises the following steps:
if the HID connected device list includes the vendor identification VID and the product identification PID of the second electronic device, the accessory management service determines that the HID connected device list includes the second electronic device;
the accessory management service determines that the second electronic device is not included in the HID connected device list if the vendor identification VID and the product identification PID of the second electronic device are not included in the HID connected device list.
4. The method of claim 1, wherein the pull-up condition of the accessory management service further comprises the accessory management service pulling up condition of the accessory management service
The method comprises the steps that a first electronic device detects a port connection event of a second electronic device, wherein the port connection event is generated when the second electronic device is connected with the first electronic device through a connection port.
5. The method of claim 1, wherein the pull-up condition of the accessory management service further comprises the accessory management service pulling up condition of the accessory management service
The method comprises the steps that a first electronic device detects a distance triggering event of a second electronic device, wherein the distance triggering event is generated when the distance between the second electronic device and the first electronic device is smaller than a preset distance threshold value.
6. The method of claim 1, further comprising:
if the second electronic device is not included in the HID connected device list, the accessory management service does not establish a proprietary channel protocol (GATT) connection between the first electronic device and the second electronic device.
7. The method of claim 1, further comprising:
the HID protocol connection between the first electronic device and the second electronic device is performed synchronously with the pull-up action of the accessory management service.
8. The method of claim 1, wherein the accessory management service obtains the second device tag from a listening process, comprising:
the accessory management service sends a calling request to the monitoring process, wherein the calling request is used for calling the monitoring process to monitor the HID protocol connection state of the first electronic device and the second electronic device;
and receiving the HID protocol connection state of the first electronic equipment and the second electronic equipment returned by the monitoring process.
9. The method of claim 1, further comprising:
if the values of the first device tag and the second device tag are not the same, the accessory management service does not establish a private channel protocol GATT connection between the first electronic device and the second electronic device.
10. An electronic device, comprising: a memory and a processor, the processor and the memory coupled; wherein the memory includes program instructions which, when executed by the processor, cause the electronic device to perform the electronic device connection method of any of claims 1-9.
11. A computer-readable storage medium, having computer program instructions stored therein, which when executed, implement the electronic device connection method of any one of claims 1-9.
CN202210159242.XA 2022-02-22 2022-02-22 Electronic equipment connection method and electronic equipment Active CN114217701B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210159242.XA CN114217701B (en) 2022-02-22 2022-02-22 Electronic equipment connection method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210159242.XA CN114217701B (en) 2022-02-22 2022-02-22 Electronic equipment connection method and electronic equipment

Publications (2)

Publication Number Publication Date
CN114217701A CN114217701A (en) 2022-03-22
CN114217701B true CN114217701B (en) 2022-07-12

Family

ID=80709093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210159242.XA Active CN114217701B (en) 2022-02-22 2022-02-22 Electronic equipment connection method and electronic equipment

Country Status (1)

Country Link
CN (1) CN114217701B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114844735B (en) * 2022-03-28 2023-10-27 海信视像科技股份有限公司 Display equipment and voice forwarding method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106075902A (en) * 2016-06-14 2016-11-09 广州小鸡快跑网络科技有限公司 Game paddle, the game control method connected based on BLE and device
CN113810884A (en) * 2021-09-15 2021-12-17 荣耀终端有限公司 Electronic equipment connection method and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105813227B (en) * 2016-04-29 2020-04-28 江苏惠通集团有限责任公司 BLE voice data transmission method and Bluetooth equipment
WO2018222024A1 (en) * 2017-06-02 2018-12-06 엘지전자(주) Method and apparatus for connecting devices using bluetooth le technology
CN113993109A (en) * 2020-07-27 2022-01-28 华为技术有限公司 Device pairing method, system, accessory device, and computer-readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106075902A (en) * 2016-06-14 2016-11-09 广州小鸡快跑网络科技有限公司 Game paddle, the game control method connected based on BLE and device
CN113810884A (en) * 2021-09-15 2021-12-17 荣耀终端有限公司 Electronic equipment connection method and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ESP32学习笔记(30)—BLE GATT服务端自定义服务和特征;Leung_ManWah;<<网页>>;20210707;正文第1-20页 *

Also Published As

Publication number Publication date
CN114217701A (en) 2022-03-22

Similar Documents

Publication Publication Date Title
US10834237B2 (en) Method, apparatus, and storage medium for controlling cooperation of multiple intelligent devices with social application platform
US8990438B2 (en) Receiver configured to pair to multiple wireless devices
US10666785B2 (en) Bluetooth communication method and device
WO2020248626A1 (en) Task execution method, apparatus, device and system, and storage medium
CN113490158B (en) Bluetooth device pairing connection method, electronic device, Bluetooth device and terminal system
CN111083684A (en) Method for controlling electronic equipment and electronic equipment
WO2014067256A1 (en) Remote control method, intelligent terminal and intelligent remote control system
KR102441850B1 (en) Service processing method and mobile communication terminal
WO2018040813A1 (en) Audio/video communication method, terminal, server, and storage medium
CN110944315A (en) Data processing method, terminal device, Bluetooth device and storage medium
US9883045B2 (en) Wireless docking system
CN114217701B (en) Electronic equipment connection method and electronic equipment
EP4274317A1 (en) Method for reducing power consumption of device, and electronic device
CN111414097A (en) Interaction method, interaction system and display equipment
KR101504654B1 (en) Method for Establishing Connection Between External Device and Mobile Terminal Docking Thereat
CN114143906B (en) Electronic equipment connection method and electronic equipment
WO2024041033A1 (en) Display device and device name processing method for display device
CN109992430B (en) Data transmission method, first terminal and second terminal
CN107153621A (en) device identification method and device
WO2020107177A1 (en) Audio resource invoking method and apparatus, and electronic device
CN111726848B (en) Equipment binding method, target starting device, fixed terminal and storage medium
CN114531741A (en) Method, device, equipment and storage medium for connecting external equipment and terminal
KR101485156B1 (en) Mobile terminal docking with external device and controlling method thereof
CN111163225A (en) Control method of electronic equipment and electronic equipment
JP2013069265A (en) Control method for usb terminal and device for executing the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant