Spring needle interface connection state detection method, combination device and electronic equipment
Patent Information
- Application Number
- CN202380076930.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-12-23
- Filing Date
- 2023-08-15
- Publication Date
- 2025-07-04
AI Technical Summary
In external devices connected using pogo pin interfaces, it is difficult for users to sense the device connection status in a timely and accurate manner, resulting in a poor user experience. Existing technology cannot effectively distinguish the reasons for physical connection disconnection and communication connection disconnection.
Sensors are set up in electronic devices to detect the physical connection status and communication connection status between external devices and electronic devices, obtain and prompt the user's connection status in real time, use sensors such as Hall sensors to detect physical connections, detect communication connections through communication interfaces, and combine display screen and audio output prompt information.
Users can accurately perceive the connection status of external devices in real time, optimizing the user experience, and reducing fault maintenance costs by troubleshooting specific communication interface abnormalities.
Smart Images

Figure CN120266003A_ABST
Abstract
Description
Spring pin interface connection status detection method, assembly device and electronic device
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on December 23, 2022, with application number 202211662608.1 and invention name “Spring pin interface connection status detection method, combination device and electronic device”, the entire contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the field of communication technology, and in particular to a method, a combination device and an electronic device for detecting the connection status of a spring pin interface. Background Art
[0003] As electronic devices like tablets and laptops gain more functionality, they are increasingly being used in peripherals connected via pogo pins. For example, a detachable keyboard uses pogo pins. The detachable keyboard's pogo pin interface connects to the electronic device's pogo pin interface to establish a physical connection. The detachable keyboard can then communicate with the electronic device by transferring data through the pogo pin interface.
[0004] When the user actually uses the detachable keyboard, the position of the detachable keyboard may be moved, causing the spring pin interface of the detachable keyboard to contact the spring pin interface of the electronic device and produce a position offset, causing the detachable keyboard to be disconnected from the electronic device and unable to communicate normally.
[0005] However, the user cannot accurately perceive the actual status of the detachable keyboard in a timely manner. When the user needs to use the keyboard, he will find that the detachable keyboard has been disconnected, and then he will manually reconnect it, resulting in a poor user experience.
[0006] Summary of the Invention
[0007] The present invention provides a pogo pin interface connection status detection method, assembly, and electronic device. The electronic device can obtain the physical and communication connection status of an external device in real time, allowing the user to promptly understand the connection status of a detachable keyboard, thereby optimizing the user experience. To achieve the above objectives, the present invention employs the following technical solutions.
[0008] In a first aspect, a method for detecting the connection status of a pogo pin interface is provided, which is applied to an electronic device, wherein the electronic device includes a pogo pin interface and a sensor, and the pogo pin interface includes a communication interface. The method includes:
[0009] The electronic device detects the distance between the external device and the electronic device through a sensor; if the distance is less than a preset threshold, the electronic device sends a first instruction to the external device through a communication interface; if the electronic device does not receive a first response within a first time period, the electronic device sends a first prompt message, and the first prompt message is used to prompt the user that the external device and the electronic device have not established a communication connection.
[0010] In the present application, the first instruction may be a test instruction, and the corresponding first response is a test response; the first instruction may also be a communication instruction, and the corresponding first response is a communication response. After the electronic device is physically connected to the external device, if the distance between the external device and the electronic device is less than a preset threshold, the electronic device sends the first instruction to the external device to detect the communication connection status between the external device and the electronic device.
[0011] In the present application, the electronic device can detect the distance between the external device and the electronic device, and when it is determined that the distance is less than a preset threshold, it is determined that the electronic device and the external device have established a physical connection. The electronic device thus detects the communication connection through the communication interface, and when no response is received from the external device, the electronic device issues a corresponding prompt message to remind the user that the communication connection between the external device and the electronic device is abnormal. The electronic device can obtain the physical connection status and the communication connection status between the external device and the electronic device in real time, and when it detects that the external device and the electronic device have not established a communication connection, it issues a prompt message to remind the user, which allows the user to accurately perceive the actual connection status of the external device in real time, without the user having to use the external device to confirm whether the connection between the external device and the electronic device is abnormal, thereby improving the user experience.
[0012] In conjunction with the first aspect, in one possible design, the electronic device sends a first instruction to the external device through the communication interface, including:
[0013] The electronic device sends a first instruction to the external device through the communication interface according to the first cycle.
[0014] In the present application, the first cycle may be a long cycle. The electronic device sending the first instruction may be a polling instruction within a long cycle. The electronic device sends the first instruction when it detects that the distance between the external device and the electronic device is less than a preset threshold, that is, the electronic device determines that the physical connection with the external device is normal. In this case, the first cycle may be a long cycle. By sending the polling instruction over a long period, the electronic device can obtain the actual connection status of the external device in real time.
[0015] In conjunction with the first aspect, in one possible design, before the electronic device issues the first prompt information, the method further includes:
[0016] The electronic device sends a second instruction to the external device through the communication interface according to a second period, and the electronic device does not receive a second response within a second time period; wherein the second period is shorter than the first period.
[0017] In the present application, the second cycle is different from the first cycle, and the second cycle is a short cycle. When the electronic device does not receive the first response, it determines that the communication connection with the external device is abnormal. In this case, the electronic device can quickly detect the external device. That is, when the electronic device determines that the external device and the electronic device have not established a communication connection, the electronic device can send a second instruction to the external device according to a certain short cycle to continuously detect the communication connection status with the external device. The second instruction can be a test instruction or a communication instruction. The electronic device can quickly confirm whether the communication connection with the external device is really disconnected by performing a short-cycle detection. When the second response is not received, the electronic device determines that the communication with the external device is abnormal and outputs a first prompt message, so that the connection status detection is more timely and accurate.
[0018] In combination with the first aspect, in one possible design, the method further includes:
[0019] The electronic device receives a second response through the communication interface within the second time period, and the electronic device does not receive the second response within the second time period.
[0020] In this application, during short-cycle detection, if the electronic device receives a second response within a second time period, it indicates that the communication connection between the electronic device and the external device is normal, and the electronic device can display the external device connection information on the display interface. By sending a second instruction and receiving the second response when the first response is not received, the randomness of the first response result is avoided, making the external device communication connection detection result more accurate.
[0021] In conjunction with the first aspect, in one possible design, the electronic device issues the first prompt information, including:
[0022] The electronic device displays the first prompt information; or, the electronic device plays the first prompt information.
[0023] In the present application, when the electronic device does not receive the first response and determines that the communication connection with the external device is disconnected, the electronic device can display the first prompt information on the display interface, for example, by displaying the first prompt information in the form of a pop-up window. Alternatively, the electronic device can also play the first prompt information through voice. Alternatively, the electronic device can also play the first reminder information through other audio output methods.
[0024] In combination with the first aspect, in one possible design, the method further includes:
[0025] If the electronic device receives the first response within the first time period, the electronic device displays external device connection information.
[0026] In the present application, the first duration is the time the electronic device waits to receive the first response from the external device, and the first duration can be determined based on the actual communication conditions. When the electronic device receives the first response within the first duration and determines that a communication connection has been established with the external device, the electronic device can display the external device connection information on the display interface. For example, a prompt message indicating that the external device is connected is displayed in a pop-up box on the display interface; or an external device icon is displayed in the status bar of the display interface to indicate that the external device is connected. In this way, the user can obtain the status of the external device being connected in a timely and intuitive manner, so that the user can use the external device normally.
[0027] In conjunction with the first aspect, in one possible design, the electronic device issues the first prompt information, including:
[0028] The electronic device stops displaying the external device connection information.
[0029] In the present application, when the electronic device does not receive the first response and determines that the communication connection with the external device is disconnected, the electronic device stops displaying the external device connection information. For example, the external device icon stops being displayed in the status bar of the display interface. Optionally, the electronic device may also stop displaying the external device icon in the status bar of the display interface while displaying the first prompt information in the form of a pop-up window on the display interface. The user can not only determine the communication connection status of the external device by whether the icon of the external device is displayed in the status bar, but also understand the connection status of the external device more intuitively through the pop-up window on the display interface, thereby optimizing the user experience.
[0030] In conjunction with the first aspect, in one possible design, the distance being less than a preset threshold includes:
[0031] The electronic device detects that the level of the sensor changes from high to low.
[0032] In the present application, the electronic device determines the distance from the external device by detecting the level of the sensor. When the external device is close to the electronic device, for example, the external device is physically connected to the electronic device, and the distance between the external device and the electronic device is less than a preset threshold, the electronic device detects that the level of the sensor will jump from a high level to a low level. Alternatively, when the distance between the external device and the electronic device is less than a preset threshold, the electronic device detects that the level of the sensor will jump from a low level to a high level. The principle of the high-low level jump of the specific sensor level can be determined according to actual conditions. In this way, the electronic device determines whether an external device is close to the electronic device through the change state of the sensor level, thereby determining the physical connection state of the external device and the electronic device, so that the detection result of the connection state is more accurate.
[0033] In conjunction with the first aspect, in a possible design, the high-low level jump of the sensor level includes:
[0034] The sensor level changes from high level to low level; or, the sensor level changes from low level to high level; or, the sensor level generates a high level interrupt when it is at a low level and then restores to a low level; or, the sensor level generates a low level interrupt when it is at a high level and then restores to a high level.
[0035] In this application, an electronic device can define a high-low level jump rule for a certain sensor level when the distance between the external device and the electronic device is less than a preset threshold. When it is detected that the high-low level jump of the sensor level meets the agreed rule, it is determined that the distance between the external device and the electronic device is less than the preset threshold, and it is determined that the external device and the electronic device are physically connected, thereby obtaining the physical connection status of the external device and the electronic device, and the determination scheme is simple.
[0036] In combination with the first aspect, in one possible design, the pogo pin interface further includes a power interface. After the electronic device detects a high-low level jump of the sensor level, the method further includes:
[0037] The electronic device controls the power supply interface to be powered on.
[0038] In this application, when it is detected that the high and low level jumps of the sensor level meet the agreed rules, it is determined that the distance between the external device and the electronic device is less than the preset threshold, and when it is determined that the external device is physically connected to the electronic device, the electronic device controls the power interface to power on, and the power interface of the electronic device supplies power to the power interface of the external device to establish a communication connection.
[0039] In conjunction with the first aspect, in one possible design, after the electronic device detects that the level of the sensor changes from high to low, the method further includes:
[0040] If the electronic device detects again that the level of the sensor changes from high to low, the electronic device sends a third instruction to the external device through the communication interface; if the electronic device does not receive a third response within a third time period, the electronic device controls the power interface to power off.
[0041] In this application, if the electronic device detects a high-low level jump in the sensor level within a period of time, but sends a third instruction to the external device and does not receive a third response within a third time period, the electronic device can determine that the sensor triggering may be due to an accidental touch, and there is actually no external device connected to the electronic device. In this case, the electronic device can promptly control the power interface to power off, avoiding the risk of a short circuit caused by controlling the power interface to power on. The third time period can be the time the electronic device waits to receive the third response from the external device, and the third time period can be determined based on the actual communication conditions.
[0042] In conjunction with the first aspect, in one possible design, before the electronic device issues the first prompt information, the method further includes:
[0043] The electronic device does not detect a high-low level jump of the sensor within a preset time period, and the electronic device sends a fourth instruction to the external device through the communication interface; the electronic device does not receive a fourth response within a fourth time period.
[0044] In the present application, if the electronic device detects that the level of the sensor changes from high to low within a period of time, the electronic device confirms that it has been physically connected to the external device and has not been disconnected. In this case, the electronic device sends a fourth instruction to the external device for detection. If the fourth response is received, the electronic device continues to display the external device connection information; if the fourth response is not received within the fourth time period, the electronic device sends a first reminder message to promptly remind the user that the communication connection has been disconnected. In the present application, the electronic device detects the level of the sensor within a preset time period, and further confirms the physical connection between the electronic device and the external device. Among them, the fourth time period is the time the electronic device waits to receive the fourth response from the external device, and the fourth time period can be determined according to the actual communication conditions.
[0045] In combination with the first aspect, in one possible design, the method further includes:
[0046] The electronic device sends a fifth instruction to the external device through the first communication interface; the first communication interface is any one of multiple communication interfaces; if the electronic device does not receive a fifth response through the first communication interface within a fifth time period, the electronic device displays a second prompt message; the second prompt message is used to indicate that the first communication interface is abnormal.
[0047] In the present application, in combination with the scenario where there are multiple communication interfaces between the electronic device and the external device, in one example, the electronic device sends a fifth instruction through the first communication interface. Under normal communication connection conditions, the electronic device will receive a fifth response through the first communication interface within the fifth time period. If the electronic device does not receive the fifth response through the first communication interface within the fifth time period, it is determined that the first communication interface is abnormal. By agreeing on the communication mode of each communication interface in the communication protocol between the electronic device and the external device, it is possible to determine that one or more communication interfaces with abnormalities exist during the communication process. Then, the electronic device can output information about the abnormality of the communication interface to the user, so that the user can maintain the communication interface in a timely manner, reducing the failure cost of the electronic device and the external device and optimizing the user experience. Among them, the fifth time period is the time that the electronic device waits to receive the fifth response from the external device, and the fifth time period can be determined based on the actual communication conditions.
[0048] In combination with the first aspect, in a possible design, the sensor is any one of a Hall sensor, an infrared sensor, a distance sensor, a pressure sensor, a proximity light sensor, and an ambient light sensor.
[0049] In the present application, the sensor can be any one of a Hall sensor, an infrared sensor, a distance sensor, a pressure sensor, a proximity light sensor, and an ambient light sensor. This not only realizes the detection of the physical connection between the external device and the electronic device, but also reduces the cost of the entire technical solution due to the production cost. Taking the Hall sensor as an example, when the magnet enters the detection area of the Hall sensor, the Hall sensor will be triggered to jump between high and low levels. In the present application, a magnet is set in the external device, and a Hall sensor is set in the electronic device. According to the distance between the magnet and the Hall sensor, for example, when the magnet enters the detection area of the Hall sensor and the distance between the magnet and the Hall sensor is less than a preset threshold, it is determined that the physical connection between the external device and the electronic device has been established. As a low-cost sensor, the Hall sensor is used in this solution to control production costs while realizing the detection of physical connection.
[0050] In a second aspect, a combination device of an electronic device and an external device is provided, the combination device comprising the electronic device and the external device;
[0051] The electronic device includes a processor, a sensor, and a spring pin interface; the spring pin interface includes a communication interface; the processor is used to execute any one of the methods provided in the first aspect; the external device includes a processor and a spring pin interface; the spring pin interface includes a communication interface; when the electronic device is physically connected to the external device, the position of the spring pin interface of the electronic device is aligned with the position of the spring pin interface of the external device.
[0052] In combination with the second aspect, in one possible design method, if the sensor of the electronic device is a Hall sensor, the external device also includes a first component; the first component is a magnet; when the electronic device is physically connected to the external device, the magnet is located within the detection area of the Hall sensor.
[0053] In a third aspect, an electronic device is provided, comprising a memory, a sensor, a pogo pin interface, a display screen, and one or more processors; the memory, the sensor, the pogo pin interface, and the display screen are coupled to the processor; the memory stores computer program code, the computer program code comprising computer instructions, which, when executed by the processor, causes the electronic device to perform a method as described in any one of the above-mentioned first aspects.
[0054] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on an electronic device, the electronic device can execute any one of the methods described in the first aspect.
[0055] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute any one of the methods described in the first aspect.
[0056] In a sixth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute a method as described in any one of the first aspects.
[0057] It can be understood that the beneficial effects that can be achieved by the combination device of the electronic device and the external device described in the second aspect, the electronic device described in the third aspect, the computer-readable storage medium described in the fourth aspect, the computer program product described in the fifth aspect, and the chip described in the sixth aspect can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] FIG1 is a schematic diagram of an application environment of a pogo pin interface connection status detection method provided by an embodiment of the present application;
[0059] FIG2 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0060] FIG3 is a software architecture diagram of an electronic device provided in an embodiment of the present application;
[0061] FIG4 is a schematic structural diagram of an external device provided in an embodiment of the present application;
[0062] FIG5 is a schematic diagram of a tablet computer connected to a detachable keyboard according to an embodiment of the present application;
[0063] FIG6 is a flow chart of an external device detection method provided in an embodiment of the present application;
[0064] FIG7 is a schematic diagram of a Hall sensor output level change of a tablet computer provided in an embodiment of the present application;
[0065] FIG8 is a schematic diagram of output level changes of a Hall sensor of another tablet computer provided in an embodiment of the present application;
[0066] FIG9 is a schematic diagram of output level changes of a Hall sensor of another tablet computer provided in an embodiment of the present application;
[0067] FIG10 is a schematic diagram of output level changes of a Hall sensor of another tablet computer provided in an embodiment of the present application;
[0068] FIG11 is a schematic diagram showing changes in the output level of a Hall sensor and the output level of a power interface of a tablet computer when the keyboard is attached to the tablet computer and communication is normal, provided by an embodiment of the present application;
[0069] FIG12 is a schematic diagram showing changes in the output level of the Hall sensor, the output level of the power interface, and the output level of the communication interface of the tablet computer when the keyboard is attached to the tablet computer and communication is normal, provided by an embodiment of the present application;
[0070] FIG13 is a schematic diagram of a keyboard icon displayed on a display interface of a tablet computer provided in an embodiment of the present application;
[0071] FIG14 is a schematic diagram of a display interface of a tablet computer provided in an embodiment of the present application showing a communication interface abnormality reminder;
[0072] FIG15 is a schematic diagram of another tablet computer provided in an embodiment of the present application showing a communication interface abnormality reminder on a display interface;
[0073] FIG16 is a schematic diagram of a display interface of a tablet computer provided by an embodiment of the present application showing a reconnection prompt message;
[0074] FIG17 is a flow chart of another external device detection method provided in an embodiment of the present application;
[0075] FIG18 is a schematic diagram of a display interface of a tablet computer provided in an embodiment of the present application showing a connection prompt message;
[0076] FIG19 is a schematic diagram of a display interface of a tablet computer provided by an embodiment of the present application stopping displaying a keyboard icon;
[0077] FIG20 is a schematic diagram showing changes in the output level of a Hall sensor, the output level of a power interface, and the output level of a communication interface of a tablet computer provided by an embodiment of the present application when the Hall sensor is falsely triggered;
[0078] FIG21 is a module structure diagram of an electronic device provided in an embodiment of the present application;
[0079] FIG22 is a module structure diagram of an external device provided in an embodiment of the present application;
[0080] Figure 23 is a structural diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: the situation where A exists alone, A and B exist at the same time, and B exists alone, wherein A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are a kind of "or" relationship.
[0082] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0083] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0084] As the functionality of electronic devices such as mobile phones, tablets, and laptops increases, the number of external devices connected via pogo pin interfaces is also increasing. Figure 1 shows a schematic diagram of an electronic device 100 and an external device 200 connected via a pogo pin interface. The pogo pin interface is a type of Pogo pin interface that allows communication between the electronic device 100 and the external device 200.
[0085] The electronic device 100 involved in this application can be a mobile phone, tablet computer, projector, laptop computer, or other device with a pogo pin interface; the external device involved in this application can be a keyboard, drawing tablet, speaker device, camera, printer, external display, scanner, or other device with a pogo pin interface. Optionally, the external device can also be a smart headset, watch, bracelet, or other device with a pogo pin interface, and the electronic device can be a headset case that provides power to the external device, a watch charger, a bracelet charger, a wireless charging device, or other device with a pogo pin interface.
[0086] A pogo pin is a spring-loaded probe made of three basic components: a pin shaft, a spring, and a pin tube, which are then pre-stressed by riveting with precision instruments. The probe enables power to the device or circuit conduction between devices for communication. In actual production, a pogo pin interface is provided on the surface of an external device, and a pogo pin interface is provided on the surface of an electronic device; one is a male socket and the other is a female socket. The pogo pin interface of the external device is connected to the pogo pin interface of the electronic device, achieving the effect of a physical and communication connection between the external device and the electronic device through the pogo pin. Generally, the pogo pin interface of the external device is a male socket, and the pogo pin interface of the electronic device is a female socket.
[0087] Due to the structural design of the spring pin, during the connection process between the spring pin interface of the external device and the spring pin interface of the electronic device, the relative position of the external device and the electronic device may move, resulting in the position of the spring pin interface and the spring pin interface being offset, causing the external device and the electronic device to be disconnected and unable to communicate normally. For example, when the user is using an external device, the position of the external device is moved, and the spring pin interface of the external device is misaligned with the spring pin interface of the electronic device, resulting in the external device and the electronic device being disconnected and unable to communicate normally. In this case, the user often needs to use the external device to confirm whether the disconnection has occurred. The user cannot accurately perceive the actual status of the external device in a timely manner, resulting in a poor user experience.
[0088] For example, if the external device is a keyboard and the electronic device is a tablet, the keyboard connects to the tablet's pogo pin interface via a pogo pin interface, achieving physical adhesion and communication between the keyboard and tablet. While the user is using the keyboard, if the keyboard moves, causing the keyboard's pogo pin interface to shift relative to the tablet's pogo pin interface, the keyboard and tablet may lose communication. The user can only determine whether the keyboard and tablet are disconnected by using the keyboard, which prevents the user from timely determining the keyboard's actual connection status, resulting in a poor user experience.
[0089] There are also existing methods for monitoring the connection status of external devices by communicating between the processor of the electronic device and the processor of the external device. For example, a microcontroller unit (MCU) is set in the electronic device and the external device. The electronic device uses the MCU to detect whether there is a signal loop in the spring pin interface to determine whether the electronic device is connected to the external device. This solution requires the installation of MCUs in both the electronic device and the external device, which results in high hardware costs. Moreover, when the electronic device and the external device are disconnected, it is impossible to distinguish whether the disconnection was caused by the user manually or by accident. In other words, this solution also cannot allow the user to accurately perceive the actual status of the external device.
[0090] An embodiment of the present application provides a method for detecting an external device. By setting a matching physical connection sensing device in the electronic device and the external device, the physical connection status of the external device and the electronic device can be determined through the physical connection sensing device. The communication connection status of the external device and the electronic device is determined through the communication data of the spring pin interface between the electronic device and the external device. Based on the physical connection status and the communication connection status, the actual connection status of the external device can be continuously obtained. In this way, the electronic device can prompt the user that the external device is connected or disconnected by outputting a prompt message on the display screen or outputting audio information, which can enable the user to accurately perceive the actual connection status of the external device in real time, thereby improving the user experience.
[0091] The electronic device 100 and the external device 200 involved in this application have the same number of spring pin interfaces. Exemplarily, the spring pin interfaces of the electronic device and the external device may include a power interface, a ground interface, and at least one communication interface. Optionally, when there are multiple communication interfaces, the roles of different communication interfaces in the communication process can be agreed upon. It should be noted that the electronic device and the external device involved in this application are supporting devices, that is, the electronic device and the external device involved in this application have agreed upon a communication protocol. Among them, the communication protocol stipulates the communication message format, the transmission direction and transmission content of each communication interface, etc.
[0092] Please refer to Figure 2, which shows a block diagram of an electronic device (such as electronic device 100) provided in an embodiment of the present application. Among them, electronic device 100 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, a communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, a button 390, a motor 391, an indicator 392, a camera 393, a display 394 and a pogo pin interface 399.
[0093] The sensor module 380 may include a pressure sensor 380A, a gyroscope sensor 380B, an air pressure sensor 380C, a magnetic sensor 380D, a distance sensor 380F, a proximity light sensor 380G, a fingerprint sensor 380H, a temperature sensor 380J, a touch sensor 380K, an ambient light sensor 380L, etc.
[0094] The structure shown in the embodiment of the present invention does not limit the electronic device 100. The electronic device 100 may include more or fewer components than shown, or some components may be combined or separated, or arranged differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0095] The processor 310 may include one or more processing units. For example, the processor 310 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0096] The controller is the decision-maker that directs the various components of electronic device 100 to coordinate operations according to instructions. It serves as the nerve center and command center of electronic device 100. Based on instruction opcodes and timing signals, the controller generates operational control signals to control instruction fetching and execution.
[0097] Processor 310 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 310 is a high-speed cache memory that can store instructions or data that have just been used or are being recycled by processor 310. If processor 310 needs to use the same instruction or data again, it can directly access the memory. This avoids repeated accesses, reduces processor 310 latency, and thus improves system efficiency.
[0098] In some embodiments, the processor 310 may include an interface. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and / or a USB interface.
[0099] The interface connection relationship between the modules shown in the embodiment of the present invention is for illustrative purposes only and does not limit the structure of the electronic device 100. The electronic device 100 may adopt different interface connection methods or a combination of multiple interface connection methods in the embodiment of the present invention.
[0100] The charging management module 340 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 can receive charging input from the wired charger via the USB interface 330. In some wireless charging embodiments, the charging management module 340 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 342, the charging management module 340 can also provide power to the electronic device 100 via the power management module 341.
[0101] The power management module 341 is used to connect the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340 and provides power to the processor 310, the internal memory 321, the external memory interface 320, the display 394, the camera 393, and the communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some embodiments, the power management module 341 can also be provided in the processor 310. In some embodiments, the power management module 341 and the charging management module 340 can also be provided in the same device.
[0102] In this embodiment, the power management module 341 can also provide power to the power interface in the pogo pin interface 399. For example, when the processor determines that a physical connection has been established between the external device and the electronic device, the processor can control the power management module to provide power to the power interface in the pogo pin interface 399. When the processor determines that the physical connection has been disconnected between the external device and the electronic device, the processor can control the power management module to power off the power interface in the pogo pin interface 399.
[0103] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the communication module 360, the modem and the baseband processor.
[0104] The communication module 360 can provide a communication processing module for wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc., which are applied to the electronic device 100. The communication module 360 can be one or more devices that integrate at least one communication processing module. The communication module 360 receives electromagnetic waves via the antenna 1, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 310. The communication module 360 can also receive the signal to be sent from the processor 310, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 1.
[0105] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the communication module 360 so that the electronic device 100 can communicate with a network and other devices via wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include satellite-based augmentation systems (SBAS), global navigation satellite systems (GLONASS), BeiDou navigation satellite system (BDS), Quasi-Zenith satellite system (QZSS), and / or satellite-based augmentation systems (SBAS).
[0106] Electronic device 100 implements display functionality through a GPU, display screen 394, and an application processor. A GPU is a microprocessor for image processing that connects display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 310 may include one or more GPUs that execute program instructions to generate or modify display information.
[0107] The display screen 394 is used to display images, videos, etc. For example, the display screen 394 can display the real-time connection status of the external device. For example, a small keyboard icon is displayed in the status bar of the display screen to indicate that the current external device (keyboard) is connected. In an embodiment of the present application, when the electronic device 100 detects that the keyboard is connected, it can display a small keyboard icon in the status bar of the display screen, or output a prompt message that the keyboard is connected in the current display interface of the display screen; if it is detected that the keyboard is disconnected, the small keyboard icon displayed in the status bar of the display screen disappears, that is, the small keyboard icon is not displayed. If the keyboard is detected to be disconnected during use, a reminder pop-up window can also be output in the current interface displayed on the display screen, and the pop-up window content is used to remind the user to adjust the keyboard position so that the keyboard connection is restored to normal. Optionally, the processor can also display abnormal communication interface information on the display screen when it detects that there is no data communication between the keyboard and the electronic device and determines that there is an abnormality in the communication interface, to remind the user to perform maintenance on the communication interface in a timely manner.
[0108] Display screen 394 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 can include one or N display screens 394, where N is a positive integer greater than 1.
[0109] The electronic device 100 can implement a shooting function through an ISP, a camera 393, a video codec, a GPU, a display screen, and an application processor.
[0110] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 310 via the external memory interface 320 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0111] The internal memory 321 can be used to store computer executable program codes, which include instructions. The processor 310 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 321. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, other volatile solid-state storage devices, a universal flash storage (UFS), etc.
[0112] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 370 , the speaker 370A, the receiver 370B, the microphone 370C, the headphone jack 370D, and the application processor.
[0113] The audio module 370 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 370 can also be used to encode and decode audio signals. In some embodiments, the audio module 370 can be provided in the processor 310, or some functional modules of the audio module 370 can be provided in the processor 310.
[0114] The speaker 370A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 370A.
[0115] The receiver 370B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 370B close to the ear to hear the voice.
[0116] The microphone 370C, also known as a "microphone" or "microphone", is used to convert sound signals into audio electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 370C to input the sound signal into the microphone 370C. The electronic device 100 can be provided with at least one microphone 370C. In some embodiments, the electronic device 100 can be provided with two microphones 370C, which can not only collect sound signals but also realize noise reduction function. In some embodiments, the electronic device 100 can also be provided with three, four or more microphones 370C to realize sound signal collection, noise reduction, and identification of sound sources, and realize directional recording function, etc.
[0117] The headphone jack 370D is used to connect a wired headphone. The headphone jack 370D can be a USB interface 330, or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0118] The pogo pin interface 399 is used to establish both a physical and a communication connection with an external device. The physical connection refers to the attachment connection between the external device and the electronic device. The communication connection refers to the data communication connection between the external device and the electronic device. The pogo pin interface includes a power interface, a ground interface, and at least one communication interface. The power interface is used to provide power to the external device when the electronic device determines that a physical connection has been established with the external device. The at least one communication interface is used to transmit data during and after the connection is established. The electronic device and the external device adhere to the same communication protocol, for example, the same public communication protocol or an agreed-upon private communication protocol. The communication protocol may specify the communication message format, the transmission direction, and the transmission content of each communication interface. For example, if there is only one communication interface, the communication protocol between the electronic device and the external device may stipulate that the communication interface can only transmit data in one direction within a given time period. For example, while the communication interface of the electronic device is receiving communication data from an external device, it cannot send communication data to the external device. While the communication interface of an external device is sending communication data to the electronic device, it cannot receive communication data sent by the external device. Alternatively, if there are two communication interfaces, the communication protocol between the electronic device and the external device may stipulate that the communication mode of the communication interfaces is such that communication interface 1 of the electronic device is only used to send communication data to the external device, and communication interface 2 is only used to receive communication data sent by the external device. Accordingly, communication interface 1 of the external device is only used to receive communication data sent by the electronic device, and communication interface 2 is only used to send communication data to the electronic device. Alternatively, the communication interface 1 between the electronic device and the external device may be used for sending and receiving communication data, while communication interface 2 between the electronic device and the external device is a backup interface. For example, under normal circumstances, the electronic device and the external device transmit data through communication interface 1. If the electronic device cannot receive communication data from communication interface 1, the electronic device may send a request to the external device to transmit data through communication interface 2, so that the external device can transmit data through communication interface 2. Optionally, the communication interface 1 and communication interface 2 may be stipulated to transmit different types of communication data. For example, communication interface 1 between the electronic device and the external device is used to transmit normal communication data, while communication interface 2 between the electronic device and the external device is used to transmit test data, etc. The function of the communication interface of the pogo pin interface can be agreed upon in the communication protocol according to the actual usage scenario.
[0119] The pressure sensor 380A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 380A can be provided on the display screen 394. There are many types of pressure sensors 380A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device comprising at least two parallel plates having a conductive material. When a force acts on the pressure sensor, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 394, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 380A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 380A.
[0120] In some embodiments, the processor or SOC of the electronic device can detect whether the external device has established a physical connection with the electronic device through a pressure sensor. For example, if the pressure value obtained by the processor or SOC of the electronic device through the pressure sensor is less than a pressure threshold, it is determined that the external device is connected and is in a position state. If the pressure value obtained by the processor or SOC of the electronic device through the pressure sensor is greater than a pressure threshold, it is determined that the external device is disconnected and is in a positionless state. Optionally, when the processor or SOC of the electronic device detects that the external device is connected through the pressure sensor, it can also combine with the gyroscope sensor to obtain the current posture of the electronic device to further confirm the physical connection status between the electronic device and the external device.
[0121] The gyroscope sensor 380B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 380B. The gyroscope sensor 380B can be used for shooting anti-shake. For example, when the shutter is pressed, the gyroscope sensor 380B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 380B can also be used for navigation and somatosensory game scenes.
[0122] Hall effect sensor 380C is a magnetic field sensor based on the Hall effect. When a magnet enters its detection area, the sensor is triggered, and its output level is interrupted. The Hall effect sensor can be used to detect the physical connection between an external device and an electronic device. In other words, the Hall effect sensor can detect the distance between the external device and the electronic device. Optionally, the electronic device may also include other magnetic field sensors.
[0123] In some embodiments, the Hall sensor is a magnetic field sensor made based on the Hall effect. When a magnet approaches or moves away from the detection area of the Hall sensor, the magnet triggers a change in the magnetic field of the Hall sensor. When the Hall sensor in the electronic device does not detect a magnet in the detection area, it maintains a certain output level. For example, when the Hall sensor does not detect a magnet in the detection area, the output level of the Hall sensor is low. When a magnet enters the detection area of the Hall sensor, the magnetic field triggering the Hall sensor changes, and the output level of the Hall sensor also changes. Exemplarily, the output level of the Hall sensor can change from a low level to a high level. Alternatively, when the Hall sensor detects the approach of the magnet, the output level of the Hall sensor generates an adsorption interrupt. When the magnet leaves the detection area of the Hall sensor, the magnetic field triggering the Hall sensor changes, and the output level of the Hall sensor also changes. Exemplarily, the output level of the Hall sensor can change from a high level to a low level. Alternatively, when the Hall sensor detects the departure of the magnet from the detection area, the output level of the Hall sensor generates an adsorption interrupt.
[0124] In some embodiments, the processor or system on chip (SOC) of the electronic device 100 generates an adsorption interrupt when detecting that the output level of the Hall sensor changes from a low level to a high level, or when detecting that the output level of the Hall sensor is at a low level, and determines that the magnet has entered the detection area of the Hall sensor. That is, it is determined that the external device is in a physically connected state with the electronic device 100 and that the external device is in a position state. The processor or SOC of the electronic device 100 generates an adsorption interrupt when detecting that the output level of the Hall sensor can change from a high level to a low level, or when detecting that the output level of the Hall sensor is at a high level, and determines that the magnet has left the detection area of the Hall sensor. That is, it is determined that the external device is in a separated state with the electronic device 100 and that the external device is not in a position state.
[0125] The distance sensor 380F is used to measure distance. The electronic device 100 can measure distance by infrared or laser.
[0126] In some embodiments, the processor or SOC of the electronic device can detect whether the external device has established a physical connection with the electronic device through a distance sensor. For example, if the distance value obtained by the processor or SOC of the electronic device through the infrared sensor is less than a first distance threshold, it is determined that the external device is connected and is in a position state. If the distance value obtained by the processor or SOC of the electronic device through the infrared sensor is greater than a second distance threshold, it is determined that the external device is disconnected and is in a non-position state. Optionally, when the processor or SOC of the electronic device detects that the external device is connected through the distance sensor, it can also combine with the gyroscope sensor to obtain the current posture of the electronic device to further confirm the physical connection status between the electronic device and the external device.
[0127] The proximity light sensor 380G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. Infrared light is emitted outward through the light emitting diode. A photodiode is used to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, it can be determined that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 380G to detect when the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 380G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0128] Ambient light sensor 380L is used to sense ambient light brightness. Electronic device 100 can adaptively adjust display brightness based on the perceived ambient light. Ambient light sensor 380L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 380L can also work with proximity light sensor 380G to detect whether electronic device 100 is in a pocket to prevent accidental touches.
[0129] In some embodiments, the processor or SOC of the electronic device can detect whether the external device has established a physical connection with the electronic device through the ambient light sensor. For example, if the brightness value obtained by the processor or SOC of the electronic device through the ambient light sensor is less than the brightness threshold, it is determined that the external device is connected and is in the in-place state. If the brightness value obtained by the processor or SOC of the electronic device through the infrared sensor is greater than the brightness threshold, it is determined that the external device is disconnected and is in the out-of-place state. Optionally, when the processor or SOC of the electronic device detects that the external device is connected through the ambient light sensor, it can also combine with the gyroscope sensor to obtain the current posture of the electronic device to further confirm the physical connection status between the electronic device and the external device.
[0130] Temperature sensor 380J is used to detect temperature. Electronic device 100 uses the temperature detected by temperature sensor 380J to implement a temperature management strategy. For example, when the temperature reported by temperature sensor 380J exceeds a threshold, electronic device 100 reduces the performance of a processor located near temperature sensor 380J to reduce power consumption and implement thermal protection.
[0131] Touch sensor 380K, also known as a "touch panel," may be provided on display screen 394 to detect touch operations applied to or near it. The detected touch operations may be communicated to an application processor to determine the type of touch event and provide corresponding visual output via display screen 394.
[0132] Keys 390 include a power button, a volume button, and the like. Keys 390 may be mechanical keys or touch-sensitive keys. Electronic device 100 receives input from keys 390 and generates key signal input related to user settings and function control of electronic device 100.
[0133] Motor 391 can generate vibration prompts. Motor 391 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Touch operations acting on different areas of the display screen 394 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0134] Indicator 392 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0135] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.
[0136] Figure 3 is a block diagram of the operating system software structure of electronic device 100 according to an embodiment of the present invention. A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other via software interfaces. In some embodiments, the operating system is divided into four layers: the application layer, the application framework layer, the system runtime and system libraries layer, and the kernel layer.
[0137] The application layer can include a series of application packages.
[0138] As shown in FIG3 , the application package may include applications such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, and short message.
[0139] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0140] As shown in FIG3 , the application framework layer may include a detection module, a window manager, a content provider, a view system, a telephony manager, a resource manager, and a notification manager.
[0141] In some embodiments, the detection module is configured to continuously monitor the connection status of an external device in real time. Upon detecting that an external device has established a connection with the electronic device, the detection module may output a connection message on the electronic device's display interface via the visualization system, and display an icon for the external device in the status bar of the display interface. Upon detecting that an external device has disconnected from the electronic device, the detection module may output a reconnection message on the electronic device's display interface via the visualization system. Upon detecting an abnormality in the communication interface, the detection module may output information regarding the abnormality on the electronic device's display interface via the visualization system.
[0142] The window manager manages windowed applications. It can obtain the display size, determine whether a status bar is present, lock the screen, and take screenshots. Content providers store and retrieve data and make it accessible to applications. This data can include video, images, audio, incoming and outgoing calls, browsing history and bookmarks, and the phone book. The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views.
[0143] The phone manager is used to provide communication functions for the electronic device 100. For example, the management of call status (including answering, hanging up, etc.). The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to inform the completion of downloads, message reminders, etc. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, the electronic device vibrates, the indicator light flashes, etc.
[0144] The system runtime consists of a core library and a virtual machine. The system runtime is responsible for scheduling and managing the operating system. The core library consists of two parts: one for the Java language's callable functions and the other for the operating system's core library.
[0145] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0146] The system library can include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0147] The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of various common audio and video formats, as well as static image files. The media library supports a variety of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D drawing.
[0148] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0149] In some embodiments, the sensor is a Hall sensor. When a magnet enters the detection area of the Hall sensor, the Hall sensor is triggered, and the sensor driver transmits the output level of the Hall sensor to the detection module. The detection module controls the power supply interface to be powered on or off according to the change in the output level of the Hall sensor. In addition, the detection module determines the connection status between the external device and the electronic device according to the change in the output level of the Hall sensor and the change in the output level of the detected communication interface, and displays the corresponding content in the display interface of the display screen by controlling the display driver. For example, when the detection module determines that the electronic device has established a communication connection with the external device, the detection module controls the display driver to display a keyboard icon in the display interface of the display screen; when the detection module determines that the communication connection between the electronic device and the external device is disconnected, the detection module controls the display driver to stop displaying the keyboard icon in the display interface of the display screen, and so on.
[0150] Please refer to Figure 4, which shows a block diagram of an external device (such as external device 200) provided in an embodiment of the present application. The external device 200 may include a processor 410, a pogo pin interface 420, a communication module 430, an indicator 450, a button 460, an audio module 470, a speaker 470A, a receiver 470B, a microphone 470C, and an earphone interface 470D.
[0151] The structure illustrated in the embodiment of the present invention does not constitute a limitation on the external device 200. It may include more or fewer components than shown, or some components may be combined or separated, or arranged differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0152] The processor 410 may include one or more processing units. For example, the processor 410 may include an application processor (AP), a microcontroller unit (MCU), a modem processor, a controller, a memory, a video codec, a digital signal processor (DSP), and / or a baseband processor. The different processing units may be independent devices or integrated into one or more processors.
[0153] The controller is the decision-maker that directs the various components of external device 200 to coordinate operations according to instructions. It serves as the nerve center and command center of external device 200. Based on instruction opcodes and timing signals, the controller generates operational control signals to control instruction fetching and execution.
[0154] Processor 410 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 410 is a high-speed cache memory that can store instructions or data that have just been used or are being recycled by processor 410. If processor 410 needs to use the same instruction or data again, it can directly access the memory. This avoids repeated accesses, reduces processor 410's latency, and thus improves system efficiency.
[0155] In some embodiments, the processor 410 may include an interface. The interface may include an integrated circuit I2C interface, an integrated circuit internal audio I2S interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general purpose input / output (GPIO) interface, and / or a USB interface.
[0156] The interface connection relationship between the modules shown in the embodiment of the present invention is for illustrative purposes only and does not limit the structure of the external device 200. The external device 200 may adopt different interface connection methods or a combination of multiple interface connection methods in the embodiment of the present invention.
[0157] The internal memory 421 can be used to store computer executable program codes, which include instructions. The processor 410 executes various functional applications and data processing of the external device 200 by running the instructions stored in the internal memory 421. The internal memory 421 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the external device 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 421 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, other volatile solid-state storage devices, a universal flash storage (UFS), etc.
[0158] The wireless communication function of the external device 200 can be implemented through the antenna 1, the communication module 430 and the baseband processor.
[0159] The communication module 430 can provide a communication processing module for wireless communication solutions applied to the communication module 360, including wireless local area network WLAN (such as Wi-Fi network), Bluetooth BT, global navigation satellite system GNSS, frequency modulation FM, short-range wireless communication technology NFC, infrared technology IR, etc. The communication module 430 can be one or more devices integrating at least one communication processing module. The communication module 430 receives electromagnetic waves via antenna 1, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 410. The communication module 430 can also receive signals to be transmitted from the processor 410, frequency modulate them, amplify them, and convert them into electromagnetic waves for radiation via antenna 1.
[0160] The electronic device 100 can implement audio functions, such as playing prompt sounds, through the audio module 470 , the speaker 470A, the receiver 470B, the microphone 470C, the headphone jack 470D, and the application processor.
[0161] The audio module 470 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 470 can also be used to encode and decode audio signals. In some embodiments, the audio module 470 can be provided in the processor 410, or some functional modules of the audio module 470 can be provided in the processor 410.
[0162] Speaker 470A, also known as a "horn," is used to convert audio electrical signals into sound signals. External device 200 can play a prompt tone through speaker 470A. In some embodiments, if a communication connection is established between the external device and the electronic device, upon receiving a communication connection establishment signal from electronic device 100, processor 410 can control speaker 470A to output a "beep" prompt tone to notify the user that a connection has been established with the electronic device.
[0163] The receiver 470B, also called the "earpiece", is used to convert the audio electrical signal into a sound signal.
[0164] Microphone 470C, also known as a "microphone" or "microphone," is used to convert sound signals into electrical audio signals. External device 200 may be equipped with two microphones 470C, which not only collect sound signals but also implement noise reduction. In some embodiments, electronic device 100 may also be equipped with three, four, or more microphones 470C to collect sound signals, reduce noise, identify sound sources, and implement directional recording.
[0165] The headphone jack 470D is used to connect a wired headphone and can be a USB interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface or a CTIA standard interface.
[0166] The spring pin interface 420 is used to establish a physical connection and a communication connection with the electronic device 100. The spring pin interface includes a power interface, a ground interface and at least one communication interface. Among them, the power interface is used to provide power to the external device when establishing a physical connection with the electronic device. At least one communication interface is used to transmit data during the process of establishing a connection between the electronic device and the external device and after the connection is established. The electronic device and the external device agree on a communication protocol. Among them, the communication protocol can stipulate the communication message format, the transmission direction and transmission content of each communication interface, etc. For example, if there is only one communication interface, the communication protocol between the electronic device and the external device can stipulate that the communication interface can only transmit data in one direction within the same time period. For example, when the communication interface of the electronic device receives communication data sent by the external device, it cannot send communication data to the external device. When the communication interface of the external device sends communication data to the electronic device, it cannot receive communication data sent by the external device. Alternatively, if there are two communication interfaces, the communication protocol between the electronic device and the external device may stipulate that the communication modes of the communication interfaces are as follows: communication interface 1 of the electronic device is used only to send communication data to the external device, and communication interface 2 is used only to receive communication data sent by the external device; accordingly, communication interface 1 of the external device is used only to receive communication data sent by the electronic device, and communication interface 2 is used only to send communication data to the electronic device. Alternatively, the communication interface 1 between the electronic device and the external device may be used for sending and receiving communication data, while communication interface 2 between the electronic device and the external device is a backup interface. For example, under normal circumstances, the electronic device and the external device transmit data through communication interface 1. If the electronic device cannot receive communication data from communication interface 1, the electronic device may send a request to the external device to transmit data through communication interface 2, allowing the external device to transmit data through communication interface 2. Optionally, the communication interface 1 and communication interface 2 may be used to transmit different types of communication data. For example, communication interface 1 between the electronic device and the external device is used to transmit normal communication data, while communication interface 2 between the electronic device and the external device is used to transmit test data, etc. The role of the communication interface can be stipulated in the communication protocol based on the actual usage scenario.
[0167] The position of the pogo pin interface on the electronic device 100 corresponds to the position of the pogo pin interface on the external device 200. When the electronic device 100 and the external device 200 are attached, the female pogo pin sockets on the electronic device 100 mate with the male pogo pin sockets on the external device 200. This embodiment does not limit the specific position of the pogo pin interface on the electronic device.
[0168] Optionally, when the sensor of the electronic device 100 is a Hall sensor or other magnetic sensors, the external device 200 includes a first component 440 .
[0169] The first component 440 is a component that matches the sensor in the electronic device 100. The electronic device 100 can detect the presence of the external device 200 based on the sensor and the first component. For example, if the sensor in the electronic device 100 is a Hall effect sensor, the first component 440 of the external device 200 can be a magnet. When the external device establishes a physical connection with the electronic device, the magnet enters or leaves the detection area of the Hall effect sensor, triggering a change in the output level of the Hall effect sensor. The electronic device 100 can determine the connection status of the external device based on this level change.
[0170] In some embodiments, the sensor in the electronic device 100 and the first component in the external device 200 constitute a sensing device for the physical connection between the electronic device and the external device.
[0171] The position of the sensor of the electronic device 100 corresponds to the position of the first component 440 of the external device 200. This embodiment does not limit the positions of the sensor of the electronic device 100 and the first component 440 of the external device 200.
[0172] Indicator 450 may be an indicator light, which may be used to indicate charging status, power level changes, messages, notifications, etc.
[0173] In the case where the external device is a keyboard, the key 460 includes keyboard keys, etc. The key 460 can be a mechanical key or a touch key. The external device 200 receives input from the key 460 and generates key signal input related to data input and function control of the electronic device 100.
[0174] Existing electronic devices and external devices communicate with each other by attaching them together so that the pogo pin interface of the electronic device fits in with the pogo pin interface of the external device. If the pogo pin interface of the electronic device and the pogo pin interface of the external device are offset, the pogo pin interface offset may cause the pogo pin interface to be unable to communicate. In other words, even if the external device is still attached to the electronic device, the electronic device and the external device may still be disconnected.
[0175] The present application provides a method for detecting the connection status of a spring pin interface, in which a sensor is provided on an electronic device, and a component corresponding to the sensor is provided on an external device, to detect the physical connection status between the electronic device and the external device. In the case where the communication between the electronic device and the external device is disconnected, the physical connection status between the electronic device and the external device can be further determined. Optionally, the detection of the communication connection between the electronic device and the external device can also be achieved when the sensor determines that the physical connection between the electronic device and the external device is normal. In combination with the physical connection status between the electronic device and the external device, the connection status (communication connection status) of the spring pin interface between the electronic device and the external device is detected, and the detection result obtained is more accurate. This solves the problem that the prior art cannot distinguish whether the communication connection between the electronic device and the external device is disconnected due to the physical disconnection, or whether the communication connection between the electronic device and the external device is only disconnected. This avoids interference with the communication connection status detection result caused by the physical disconnection between the electronic device and the external device.
[0176] The pogo pin interface connection status detection method provided in the present application can be applied to Figure 5, which shows an example of an electronic device and an external device. In Figure 5, the electronic device is a tablet computer, and the external device is a detachable keyboard (hereinafter referred to as keyboard). Both the tablet computer and the detachable keyboard are provided with three pogo pin interfaces, wherein the three pogo pin interfaces include a power interface, a ground interface, and a communication interface. In Figure 5, the sensor provided in the tablet computer for detecting physical position connection is a Hall sensor, and correspondingly, the component provided in the keyboard for detecting physical position connection is a magnet. In Figure 5, the position of the pogo pin interface of the tablet computer corresponds to the position of the pogo pin interface of the keyboard. When the tablet computer and the keyboard are normally adsorbed, the position of the pogo pin interface of the tablet computer and the position of the pogo pin interface of the keyboard are aligned. In Figure 5, the pogo pin interface of the tablet computer and the pogo pin interface of the keyboard are correspondingly arranged on the left side of the device. The Hall sensor in the tablet computer corresponds to the position of the magnet of the keyboard. When the tablet computer and the keyboard are normally adsorbed, the magnet of the keyboard should be within the detection area of the Hall sensor of the tablet computer. In Figure 5, the Hall sensor in the tablet computer and the magnet of the keyboard are correspondingly arranged on the right side of the device. When the spring pin interface of the tablet computer and the spring pin interface of the keyboard are attracted, the magnet of the keyboard enters the detection area of the Hall sensor of the tablet computer, triggering a change in the output level of the Hall sensor. The SOC of the tablet computer detects the change in the output level of the Hall sensor, controls the power interface to power on, and sends a command to the keyboard through the communication interface. If the SOC receives a response from the keyboard, it determines that the keyboard and the tablet computer have established a communication connection. If during the keyboard connection process, the SOC sends a command to the keyboard and does not receive a corresponding response, the SOC determines that the output level of the Hall sensor has not changed, that is, the keyboard has not been removed from the tablet computer by the user. The spring pin interface may be offset, resulting in a failure to communicate. In this case, the electronic device sends a prompt message to remind the user to reconnect the keyboard to restore the connection. In one example, the reminder message is output on the display interface of the display screen.
[0177] In conjunction with the example given in FIG5 , the SOC of the electronic device in this embodiment is the execution subject of the external device detection method. Referring to FIG6 , an external device detection method is provided, which includes:
[0178] S101. Align the pogo pin connector on the tablet with the pogo pin connector on the keyboard.
[0179] In some embodiments, the keyboard can be a magnetic keyboard. To connect the keyboard to the tablet, the user can place the tablet in the keyboard's magnetic slot to achieve magnetic attraction between the tablet and the keyboard. Optionally, the keyboard's pogo pin interface can be positioned within the magnetic slot, while the tablet's pogo pin interface can be positioned on a surface that attracts the keyboard's magnetic slot. When the tablet is placed in the keyboard's magnetic slot and is in an attracted state, the tablet's pogo pin interface and the keyboard's pogo pin interface are aligned and in contact.
[0180] When the tablet and keyboard are connected, the magnet in the keyboard enters the detection area of the tablet's Hall effect sensor. The magnet's proximity to the Hall effect sensor causes the sensor's output level to change. The tablet's SOC monitors the Hall effect sensor's output level to determine whether the keyboard and tablet are connected.
[0181] S102 , the SOC detects a change in the output level of the Hall sensor, and the SOC controls the power supply interface to be powered on.
[0182] In some embodiments, the Hall sensor in the tablet computer can maintain a certain output level before being triggered by a magnet. For example, the output level of the Hall sensor remains low before being triggered by a magnet. Alternatively, the output level of the Hall sensor remains high before being triggered by a magnet. The SOC can obtain the output level of the Hall sensor through the sensor driver at a certain detection frequency. For example, the SOC can continuously monitor the output level of the Hall sensor through the sensor driver; alternatively, the SOC can obtain and record the output level of the Hall sensor through the sensor driver every second. The SOC can then compare the currently obtained output level with the historically obtained output level to determine whether the output level of the Hall sensor has changed over time.
[0183] In this embodiment, the user attaches the keyboard to the tablet computer by suction. After the tablet computer is physically connected to the keyboard via the pogo pin interface, the distance between the keyboard's magnet and the tablet computer's Hall effect sensor falls below a preset threshold. The tablet computer detects that the magnet has entered the Hall effect sensor's detection area, triggering the sensor and causing its output level to change.
[0184] In one possible approach, as shown in Figure 7, the Hall sensor output level is low before being triggered. When the keyboard and tablet are attached, the Hall sensor detects a magnet within the detection area, and the output level of the Hall sensor changes to high. In this case, the SOC can determine whether the output level of the Hall sensor has changed from low to high based on the output level of the Hall sensor obtained over a period of time. If the output level of the Hall sensor changes from low to high, the SOC powers on the tablet by controlling the power interface.
[0185] In one possible approach, as shown in Figure 8, the Hall sensor output level is high before being triggered. When the keyboard and tablet are attached, the Hall sensor detects a magnet within the detection area, and the output level of the Hall sensor changes to low. In this case, the SOC can determine whether the output level of the Hall sensor has changed from high to low based on the Hall sensor output level obtained over a period of time. If the output level of the Hall sensor changes from high to low, the SOC powers on the tablet by controlling the power interface.
[0186] In one possible approach, as shown in Figure 9, the Hall sensor output level is high before being triggered. When the keyboard and tablet are attached, the Hall sensor detects a magnet within the detection area, and the Hall sensor output level generates a low-level attachment interrupt. In this case, the SOC can determine whether an attachment interrupt has occurred based on the Hall sensor output level obtained over a period of time. If the SOC detects that the Hall sensor output level is high for a period of time, an attachment interrupt is generated, and the SOC controls the tablet's power supply interface to power on.
[0187] In one possible approach, as shown in Figure 10, the Hall sensor output level is low before being triggered. When the keyboard and tablet are attached, the Hall sensor detects a magnet within the detection area, and the Hall sensor output level generates a high-level attachment interrupt. In this case, the SOC can determine whether an attachment interrupt exists based on the Hall sensor output level obtained over a period of time. If the SOC detects that the Hall sensor output level is low for a period of time, an attachment interrupt is generated, and the SOC powers on the tablet by controlling the power interface. Optionally, the size of the Hall sensor's detection area is determined by the sensor's factory parameters.
[0188] In some embodiments, the SOC controls the tablet's power interface to power on when it determines that the Hall sensor is triggered by a magnet, that is, when it determines that the keyboard is attached to the tablet. The output level of the power interface can be seen in FIG11 , where the initial output level of the Hall sensor is high. When the keyboard's magnet approaches the tablet's Hall sensor, the magnet enters the Hall sensor's detection area, triggering the Hall sensor's output level to interrupt attachment, causing the Hall sensor's output level to change from high to low. After detecting a change in the Hall sensor's output level, the SOC controls the power interface to power on, changing the output level of the power interface from an unpowered state (low level) to a powered state (high level). In other words, if there is a problem with the power interface, or if the tablet cannot properly power the power interface, the signal from the power interface remains low after the Hall sensor is triggered by the magnet. The SOC can also determine whether there is an abnormality in the power interface based on the output level of the power interface. If there is an abnormality in the power interface, the SOC can also output information about the abnormality on the display interface, reminding the user to perform maintenance on the power interface in a timely manner.
[0189] Optionally, in some embodiments, after the SOC detects that the output level of the Hall effect sensor has changed from a high level to a low level and controls the power interface to power on, the pogo pin interface of the keyboard and the pogo pin interface of the tablet establish a communication connection. The tablet's communication interface transmits communication data, and the output level of the communication interface changes with the transmission of the communication data. See Figure 12 for an example. A communication connection is established between the keyboard and the tablet. Under normal communication conditions, the keyboard and tablet transmit communication instructions through the communication interface, and the output level of the communication interface changes regularly in accordance with the communication protocol. Optionally, a change in the output level of the communication interface indicates that data is being transmitted between the communication interfaces. If the transmitted data is abnormal, the change pattern of the output level of the communication interface does not conform to the change pattern specified in the communication protocol. Based on this, if the output level of the communication interface changes, the SOC can further verify whether the transmitted data is abnormal. If the SOC determines that the transmitted data is abnormal, that is, the level change pattern does not conform to the communication protocol, the communication interface is considered to have an abnormal communication connection. The communication instructions carry the communication data, and the format of the communication data between the keyboard and the tablet can be specified in the communication protocol.
[0190] S103: The SOC sends a first instruction to the keyboard via the communication interface. If the SOC receives a first response, it determines to establish a communication connection with the keyboard and executes S104. If the SOC does not receive the first response within the first time period, it executes S106.
[0191] The first instruction is used to test whether the communication connection between the tablet computer and the keyboard is normal. Optionally, the first instruction can be a test instruction, which can carry test data, and the test data and the communication data can have the same data format.
[0192] In some embodiments, when the keyboard is normally connected to the tablet computer, the SOC may send a first instruction to the keyboard at a first period. The first period may be a long period, for example, 10 seconds or 15 seconds. The first instruction may be a polling instruction under normal connection.
[0193] In some embodiments, the first instruction may be a test instruction. The data format of the test instruction and the communication instruction may be the same or different. A specific bit in the data format may be designated as a test flag. If the value of the test flag is a first value, the command is a test instruction; if the value of the test flag is a second value, the command is a communication instruction. The first value may be 0, and the second value may be 1, without limitation. The data formats of the test instruction and the communication instruction may also be different. For example, a test instruction may be 32-bit data, while a communication instruction may be 64-bit data. After the communication protocol is agreed upon, the external device may distinguish whether the currently received instruction is a test instruction or a communication instruction based on the agreed data format. This embodiment does not impose any restrictions on the data formats of the test instruction or the communication instruction. Regarding the test flag, after receiving the test instruction, the keyboard analyzes the test instruction, reads the test flag, and returns a test response corresponding to the test instruction to the tablet computer. If the SOC does not receive the test response from the keyboard within a preset time period, it indicates that the keyboard and the tablet computer have not established a communication connection. The test response from the keyboard is received within the preset time period to account for the keyboard's processing time. If the communication connection is normal, the test response returned by the keyboard should be completed in a short time. For example, the preset time period may be 30 milliseconds.
[0194] Alternatively, in some embodiments, the first instruction may be a communication instruction. In the case of a normal communication connection, after receiving the communication instruction, the keyboard returns a corresponding communication response to the tablet computer based on the communication data carried in the communication instruction. The communication response carries response data corresponding to the communication data. If the SOC receives the communication response within a preset time period, it determines that a communication connection has been established with the keyboard. If the SOC does not receive the communication response within the preset time period, or if the SOC receives a response from the keyboard within the preset time period and the response does not carry response data corresponding to the communication data, it determines that a communication connection has not been established between the keyboard and the tablet computer.
[0195] Optionally, if the tablet computer includes one communication interface, the SOC sends the first instruction through the one communication interface; if the tablet computer includes multiple communication interfaces, the SOC may send the first instruction through one or more communication interfaces according to the communication protocol.
[0196] In some embodiments, if the keyboard and tablet computer have only one communication interface 1 between the pogo pin interfaces, the SOC sends a first command to the keyboard via communication interface 1. If the SOC receives a first response from the keyboard via communication interface 1, then both the keyboard and tablet computer communication interfaces 1 are normal, and a communication connection is established between the keyboard and tablet computer. If the SOC does not receive a first response from the keyboard within a preset time period, then it is determined that at least one of the keyboard and tablet computer communication interfaces 1 is abnormal, and a communication connection is not established between the keyboard and tablet computer.
[0197] In some embodiments, if both the keyboard and tablet computer's pogo pin interfaces include two communication interfaces, the communication protocol stipulates that communication interface 1 is the primary communication interface. For example, the keyboard's communication interface 1 is responsible for receiving or sending communication data and test data to and from the tablet computer. Communication interface 2 is the backup interface. For example, if the keyboard cannot transmit data through communication interface 1, it can switch to communication interface 2 for data transmission. In this case, the SOC sends a first command to the keyboard's communication interface 1 via communication interface 1. During normal communication, the keyboard receives the first command via communication interface 1 and returns a first response corresponding to the first command to the tablet computer's communication interface 1 via communication interface 1. If the keyboard receives the first command via communication interface 1 but cannot transmit the first response via communication interface 1, the keyboard switches to communication interface 2 to return the first response. In other words, the keyboard returns the first response to the tablet computer's communication interface 2 via communication interface 2. If the SOC receives the first response via communication interface 1, it determines that the keyboard's communication interface 1 is functioning properly and the communication connection between the keyboard and the tablet computer is functioning properly. If the SOC does not receive the first response via communication interface 1 but receives the first response via communication interface 2, it determines that the keyboard's communication interface 1 is abnormal and the keyboard's communication interface 2 is functioning properly. Alternatively, the tablet computer may switch to communication interface 2 for subsequent data transmission when communication interface 1 is abnormal and communication interface 2 is normal. If the SOC does not receive a first response returned through any communication interface within a preset time period, it determines that the keyboard and the tablet computer have not established a communication connection.
[0198] In some embodiments, if the SOC receives a first response from the keyboard, it determines that a communication connection has been established between the tablet computer and the keyboard. In this case, the SOC can control the tablet computer's display screen to output a prompt to the user on the display interface indicating that a communication connection has been established between the tablet computer and the keyboard, thereby executing S105. If the SOC does not receive a first response from the keyboard, it determines that a communication connection has not been established between the tablet computer and the keyboard. In this case, the SOC can further determine whether the failure to receive the first response from the keyboard is an accidental event. The SOC can send a second command to the keyboard multiple times to further determine whether a communication connection has not been established between the tablet computer and the keyboard, thereby executing S106.
[0199] S104. The SOC controls the display screen to display a keyboard icon in the display interface.
[0200] In some embodiments, the SOC determines that a communication connection has been established between the tablet computer and the keyboard. In this case, the SOC can output a prompt message on the display interface that a communication connection has been established between the tablet computer and the keyboard by controlling the tablet computer display screen. For example, the SOC can display a prompt message on the main interface of the tablet computer that a communication connection has been established between the tablet computer and the keyboard. Referring to Figure 13, the SOC displays a small keyboard icon 130 in the status bar of the main interface of the display screen, indicating that a communication connection has been established between the tablet computer and the keyboard. The main interface includes multiple application icons and multiple function controls. The status bar also includes a battery usage icon for the tablet computer.
[0201] S105 . After the keyboard establishes a communication connection with the tablet computer, the SOC sends a first instruction to the keyboard through the communication interface, and executes a corresponding operation according to whether the keyboard returns a corresponding first response.
[0202] In some embodiments, the SOC determines, based on S101-104 above, that the keyboard and tablet computer have established a communication connection. After the keyboard and tablet computer have established a communication connection, the SOC may periodically poll the keyboard's communication connection status to promptly detect the connection status. Here, the SOC may periodically send a first command to the keyboard to continuously detect the connection status of the keyboard and tablet computer in real time. It should be noted that when the physical connection and communication connection between the keyboard and tablet computer are normal, the SOC periodically sends the first command to the keyboard. This constitutes polling under normal communication conditions. This polling cycle does not need to be frequent, and the first cycle is a long cycle. For example, the first cycle may be 10 seconds, 15 seconds, or the like. For example, sending the first command to the keyboard every 10 or 15 seconds can minimize power consumption caused by frequent SOC transmission of test commands and prevent frequent transmission of the first command from impacting normal communication between the keyboard and tablet computer. The first command may be a test command. If the SOC receives a first response from the keyboard in response to the test command, it determines that the keyboard and tablet computer are communicating properly. If the SOC does not receive a first response from the keyboard within the first time period, it determines that the keyboard and tablet computer have not established a communication connection. The method for determining the communication connection status between the keyboard and the tablet computer according to whether the keyboard returns a corresponding first response may refer to S104.
[0203] S106. The SOC sends a second instruction to the keyboard through the communication interface. If a second response is received, S104 is executed; if no second response is received within the second time period, S107 is executed.
[0204] In this embodiment, the SOC does not receive a second response from the keyboard within a preset time period. In this case, the SOC may send a second instruction to the keyboard via the communication interface at a second period. Alternatively, the tablet computer may also send communication instructions to the keyboard. The first instruction may be the same as or different from the second instruction. The second duration in S1015 may be the same as the first duration in S106, and the second duration and the first duration are determined based on the actual instruction transmission and reception rate.
[0205] The first cycle in this embodiment is different from the first cycle in S105. The first cycle in the above-mentioned S105 is a polling in which the SOC determines that the communication connection between the keyboard and the tablet is normal. The second cycle in this embodiment is an abnormal test in which the SOC determines that the communication connection between the keyboard and the tablet is abnormal. The SOC needs to determine whether a communication connection is established between the keyboard and the tablet within a relatively short period of time. Based on this, the second cycle in this embodiment is a short cycle. Exemplarily, the second cycle can be 20 milliseconds, 30 milliseconds, etc. Optionally, in order to further avoid the possibility that the SOC does not receive a test response from the keyboard. The SOC can send a second instruction multiple times within the second cycle to determine whether the communication connection between the keyboard and the tablet is normal. Exemplarily, the SOC can send the second instruction to the keyboard three times in a row within a period of 30 milliseconds. Based on whether the keyboard returns a second response, it is determined whether a communication connection is established between the keyboard and the tablet.
[0206] If the SOC receives at least one second response from the keyboard via the communication interface, it determines that the tablet computer's communication interface is aligned with the keyboard's communication interface, and that the tablet computer and keyboard are communicating normally. The SOC can then transmit data via the communication interface. In this case, the SOC executes S104, controlling the display screen to display a keyboard icon on the display interface. If the SOC fails to receive a second response from the keyboard multiple times in a row, it determines that the tablet computer and keyboard have not established a communication connection, and the SOC executes S107. At least one of the tablet computer's communication interface and the keyboard's communication interface is in an abnormal state, and the SOC cannot transmit data via the communication interface.
[0207] In some embodiments, when the tablet computer and the keyboard have only one communication interface, the SOC sends the second instruction through one communication interface by default. If the SOC does not receive the second response returned by the keyboard through one communication interface, it is determined that the communication interface between the tablet computer and the keyboard is abnormal and the keyboard and the tablet computer have not established a communication connection.
[0208] In some embodiments, if the tablet computer and the keyboard include two communication interfaces, their communication protocol may stipulate that communication data transmission is performed via communication interface 1, and test data transmission is performed via communication interface 2. The SOC sends a second command to the keyboard's communication interface 2 via communication interface 2. If the SOC does not receive a second response from the keyboard, it determines that communication interface 2 between the tablet computer and the keyboard is abnormal, and that a communication connection between the keyboard and the tablet computer has not been established.
[0209] In some embodiments, the tablet computer and the keyboard include two communication interfaces, both of which can receive and send data. For example, the communication interface 1 of the keyboard is responsible for receiving or sending communication data and test data with the tablet computer. Communication interface 2 is a backup interface. The communication protocol stipulates that the tablet computer's communication interface 1 corresponds to the keyboard's communication interface 1 for data transmission by default. When communication interface 1 is unable to transmit data, other communication interfaces can be switched for data transmission. In this case, when the SOC sends a second instruction through communication interface 1, during normal communication, the keyboard receives the second instruction through communication interface 1 and returns a test response corresponding to the second instruction to the tablet computer's communication interface 1 through communication interface 1. If the keyboard receives the test instruction through communication interface 1 but is unable to transmit the second response through communication interface 1, the keyboard switches to communication interface 2 to return the second response, that is, the keyboard returns the second response to the tablet computer's communication interface 2 through communication interface 2. If the SOC receives the second response through communication interface 1, it is determined that the keyboard's communication interface 1 is normal and the communication connection between the keyboard and the tablet computer is normal. If the SOC does not receive the second response through communication interface 1 but receives the second response through communication interface 2, it determines that the keyboard's communication interface 1 is abnormal, the keyboard's communication interface 2 is normal, and the keyboard and tablet computer communication connection is normal. Optionally, the SOC can output abnormality information 140 of the keyboard's communication interface 1 to the user to further locate the abnormal communication interface, allowing the user to perform timely maintenance on the abnormal communication interface. See Figure 14.
[0210] If the SOC does not receive the second response returned by the keyboard for multiple consecutive times, the SOC determines, based on the communication protocol agreement, that there are abnormalities in both the communication interface 1 and the communication interface 2 of the keyboard, and the keyboard and the tablet computer have not established a communication connection. The cause of the abnormality may be that the keyboard and the tablet computer are not in good contact, that is, the communication interface of the keyboard and the communication interface of the tablet computer are not in the aligned position. Alternatively, there may be a hardware abnormality in the communication interface 1 and the communication interface 2 of the keyboard. Optionally, when the SOC determines that there is a hardware abnormality in the communication interface 1 and the communication interface 2 of the keyboard, information 150 of the abnormal communication interface can also be output on the display screen to remind the user to maintain the abnormal communication interface in time. Refer to Figure 15.
[0211] S107 . The SOC stops displaying the keyboard icon on the display screen and displays a reminder message on the display screen.
[0212] When the SOC continuously sends the second instruction to the keyboard within the second cycle, but does not receive the second response returned by the keyboard, it is determined that the keyboard and the tablet computer have not established a communication connection, and the SOC can stop displaying the keyboard icon on the display screen. Optionally, the SOC can also display a prompt message on the display screen to remind the user that the keyboard and the tablet computer have not established a communication connection; or, the SOC can play a prompt message through voice to remind the user that the keyboard and the tablet computer have not established a communication connection. Accordingly, in order to avoid anomalies caused by the communication interface of the keyboard and the communication interface of the tablet computer not being in an aligned position, the SOC can also output a reminder message 160 on the current display interface of the display screen to remind the user to reconnect the keyboard. For example, with reference to Figure 16, the SOC displays a reminder message 160 on the current display interface (main interface) of the display screen in a pop-up window to remind the user to reconnect the keyboard.
[0213] In some embodiments, after the tablet computer's SOC does not receive the first response returned by the keyboard, that is, after the SOC determines that the tablet computer and the keyboard have not established a communication connection, the SOC can also determine whether the physical connection between the tablet computer and the keyboard is disconnected by detecting the output level of the Hall sensor, so as to provide accuracy in keyboard detection. For example, if the magnet leaves the detection area of the Hall sensor and the output level of the Hall sensor changes, it is determined that the physical connection between the tablet computer and the keyboard is disconnected. There may be a situation where the user manually disassembles the keyboard. For example, if the magnet is always in the detection area of the Hall sensor and the output level of the Hall sensor does not change, it is determined that the physical connection between the tablet computer and the keyboard is normal. There may be a situation where the communication interface of the keyboard is not aligned with the communication interface of the tablet computer, resulting in the failure to establish a communication connection between the tablet computer and the keyboard. Referring to Figure 17, when executing the above S101 to S103, if the SOC does not receive the first response returned by the keyboard, the SOC executes S108, which specifically includes:
[0214] S108 , the SOC determines whether the output level of the Hall sensor has changed. If the output level of the Hall sensor has changed, S109 is executed; if the output level of the Hall sensor has not changed, S111 is executed.
[0215] In some embodiments, if the SOC does not receive the first response returned by the keyboard, the SOC can further determine whether the keyboard was removed manually, that is, the keyboard and tablet computer are completely disconnected; or the keyboard and tablet computer are disconnected due to relative position displacement.
[0216] In this embodiment, the SOC can obtain the signal state of the output level of the Hall sensor within a preset time length. Refer to the method for determining the output level of the Hall sensor described in S102 above. If the SOC determines that the output level of the Hall sensor has changed within the most recent preset time length, for example, taking Figure 8 as an example, after the Hall sensor is triggered by a magnet, the output level changes from an initial high level to a low level. Within the most recent preset time length, such as within 1 minute before the current moment, the output level of the Hall sensor changes from a low level to a high level, and remains at a high level. This indicates that the magnet has left the detection area of the Hall sensor, causing the output level of the Hall sensor to change, that is, the current keyboard and tablet computer are physically separated, and the magnet of the keyboard is no longer within the detection area of the Hall sensor of the tablet computer. In this case, in order to further confirm whether the keyboard and tablet computer are completely disconnected, the SOC executes S109 and then sends a third instruction to the keyboard for a response test.
[0217] Alternatively, the SOC may determine that the output level of the Hall effect sensor has changed within a recent preset period of time when the keyboard and tablet computer are first connected. That is, after the tablet computer and keyboard have been separated for a period of time, when the tablet computer and keyboard are reconnected, the magnet enters the detection area of the Hall effect sensor, triggering a change in the output level of the tablet computer's Hall effect sensor, causing the output level of the Hall effect sensor to change from a high level to a low level. However, when the keyboard and tablet computer are physically connected, the communication interfaces may be misaligned, causing the SOC to fail to receive the first response from the keyboard. In this case, the SOC also needs to execute S109 and then send a third instruction to the keyboard for a response test.
[0218] Still using Figure 7 as an example, after the Hall sensor is triggered by the magnet, its output level changes from an initial high level to a low level. For a preset duration, such as 30 seconds before the current moment, the Hall sensor's output level remains low. The SOC determines that the keyboard and tablet are currently in contact and the keyboard's magnet is still within the tablet's Hall sensor detection area. In this case, the SOC executes S111 and then sends a fourth instruction to the keyboard for a response test. This fourth instruction can be the same as the second instruction.
[0219] It should be noted that the result of the SOC sending the fourth instruction to the keyboard for testing in S111 is different from the result of the SOC sending the third instruction to the keyboard for testing in S109. The content of the fourth instruction and the third instruction may be the same.
[0220] S109. The SOC sends a third instruction to the keyboard through the communication interface. If a third response is received, S104 is executed. If no third response is received within a third time period, the SOC executes S110 to control the power interface to power off.
[0221] In this embodiment, the SOC determines that the output level of the Hall sensor has changed. In this case, the SOC can send a third instruction to the keyboard in a third cycle. The third instruction here is a query under abnormal circumstances. In order to confirm the connection status of the keyboard and the tablet computer as quickly as possible, the third cycle is a short cycle. For example, the third cycle can be 20 milliseconds, 30 milliseconds, etc. For example, the third instruction is sent three times continuously within 30 milliseconds, and the third instruction is sent multiple times within the third cycle to avoid the accidental problem of not receiving the third response once. Optionally, the third instruction can be the same as the second instruction, the third instruction can be a test instruction, or the third instruction can be a communication instruction.
[0222] In this embodiment, the SOC determines that the output level of the Hall sensor has changed within the most recent preset time period. If the SOC receives a third response returned by the keyboard within the third time period, it is possible that the keyboard and the tablet computer are connected for the first time after being completely disconnected. Complete disconnection refers to manually separating the keyboard from the tablet computer, so that the keyboard and the tablet computer are disconnected in terms of both physical location and communication connection. In this case, the SOC executes S104, and controls the display screen to display a small keyboard icon in the status bar of the display interface. At the same time, the SOC can also display information on the current interface (main interface) of the display screen that the tablet computer and the keyboard have established a communication connection. For example, referring to Figure 18, the SOC displays a prompt message 180 indicating that the keyboard is connected in a pop-up window on the current interface of the display screen. The prompt message can also include an icon for indicating that the tablet computer is connected to the keyboard, so that the user can more intuitively understand that the tablet computer and the keyboard have established a communication connection.
[0223] In some embodiments, the SOC determines that the output level of the Hall sensor has changed within a recent preset time period. If the SOC does not receive a third response from the keyboard within a third time period, it indicates that the keyboard and tablet computer have been completely disconnected. The third time period can be determined based on the actual rate of sending and receiving commands.
[0224] There are two possible scenarios. For example, one possible scenario is that the magnet leaves the Hall sensor's detection area. This means the user has manually disconnected the keyboard from the tablet, physically and communicating with it. In this case, the SOC controls the display to stop displaying the keyboard icon in the status bar, indicating that the keyboard is disconnected and no external keyboard is currently available. See Figure 19 for more information.
[0225] Another scenario may be that there is no physical connection between the keyboard and the tablet computer, and another magnet enters the detection area of the tablet computer's Hall sensor, causing the output level of the Hall sensor to change, resulting in a false trigger. Referring to Figure 20, Figure 20 shows an example. When a magnet enters the detection area of the Hall sensor, the SOC detects that the output level of the Hall sensor changes from an initial high level to a low level, controls the power interface to power on, and the output level of the power interface changes from an initial low level to a high level. However, for a period of time, the SOC does not receive a third response from the keyboard, that is, the SOC detects that the output level of the communication interface remains low. In this case, the false trigger may be caused by another magnet entering the detection area of the tablet computer's Hall sensor. The SOC controls the power interface to power off to avoid the risk of a short circuit caused by the port being powered. At the same time, the keyboard icon does not appear on the display interface. Optionally, there are other scenarios. For example, when a magnet enters the detection area of the Hall sensor, the SOC detects that the output level of the Hall sensor changes from an initial high level to a low level, controls the power interface to power on, and the output level of the power interface changes from an initial low level to a high level. The SOC receives the third response returned by the keyboard, and the output level of the communication interface changes. However, the SOC verifies the data carried in the third response, and the data carried in the third response is abnormal. Accordingly, the change pattern of the output level of the communication interface does not conform to the change pattern agreed upon in the communication protocol. At this time, the SOC determines that the communication connection of the communication interface is abnormal. In order to avoid the risk of short circuit caused by the port being energized, the SOC also needs to control the power supply interface to power off in this case.
[0226] S111: The SOC sends a fourth instruction to the keyboard via the communication interface. If a fourth response is received, S104 is executed, and the SOC controls the display screen to display a keyboard icon on the display interface. If no fourth response is received within a fourth time period, S107 is executed, and the SOC stops displaying the keyboard icon on the display screen and displays a reminder message on the display screen.
[0227] Among them, the fourth instruction may be the same as the second instruction. The fourth instruction may be a test instruction or a communication instruction. Among them, if the SOC receives the fourth response returned by the keyboard within the fourth time length, the keyboard icon is displayed. Refer to the method provided in the S104 embodiment, which will not be described in detail in this embodiment. If the SOC does not receive the fourth response returned by the keyboard within the fourth time length, a reminder message is displayed, refer to the method provided in the S107 embodiment, which will not be described in detail in this embodiment. Among them, the fourth time length may be the same as the third time length, and the fourth time length can be determined according to the actual rate of sending and receiving instructions.
[0228] An embodiment of the present application provides a method for detecting an external device. By setting a matching physical connection sensing device in the electronic device and the external device, the physical connection status of the external device and the electronic device can be determined by the physical connection sensing device. The communication connection status of the external device and the electronic device is determined by the communication data of the spring pin interface between the electronic device and the external device. Based on the physical connection status and the communication connection status, the actual connection status of the external device can be continuously obtained, and the electronic device can prompt the user that the external device has established a communication connection or has not established a communication connection by outputting a prompt message on the display screen or outputting audio information, which can enable the user to accurately perceive the actual connection status of the external device in real time and optimize the user experience.
[0229] In this embodiment, further, in the scenario where multiple communication interfaces are communicating, in accordance with the communication protocol, the electronic device can also check and lock one or more communication interfaces with specific abnormalities when it determines that the physical connection between the external device and the electronic device is normal and no communication connection is established, thereby outputting information about the abnormality of the communication interface, making it convenient for the user to check and maintain the communication interface in a timely manner, providing the user with more accurate abnormality resolution reminder information, and greatly optimizing the user experience.
[0230] The above embodiments are described using a tablet computer with a display as an example. In some embodiments, for electronic devices without a display, for example, when the electronic device is a wireless headset and the external device is a headset charger, the wireless headset can output audio to prompt the user to adjust the position when it detects that the headset charger is disconnected. For example, a beep or voice prompt message can be played. The external device detection method provided in the above embodiments is applicable to all electronic devices and external devices with a pogo pin interface.
[0231] The above embodiment uses an example of an electronic device sensing the presence of an external device through a Hall effect sensor and a magnet of the external device. Alternatively, in some embodiments, the electronic device may sense the presence of an external device through other sensors. For example, the electronic device may sense whether the external device is physically connected to the electronic device through a light sensor, a distance sensor, a pressure sensor, an electrical sensor, or other magnetic sensor, although this embodiment does not limit this.
[0232] When the connection status of an external device changes, the electronic device can output relevant information through voice output or prompt sound. For example, when the electronic device detects that the external device is connected, the voice output is "external device connected"; if the electronic device detects that the external device is disconnected, the voice output is "external device disconnected". This allows users to directly obtain the connection status of the external device while using the external device, improving the user experience.
[0233] In some embodiments, as shown in FIG21 , a schematic diagram of the structure of an electronic device 1000 is provided. The electronic device includes a processor 1001 , a display screen 1002 , a communication module 1003 , a storage module 1004 , and a sensor 1005 .
[0234] Among them, the processor 1001 can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, transistor logic device, hardware component or any combination thereof. The processor may include an application processor and a baseband processor. It can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication module 1003 may be a transceiver, a transceiver circuit, etc. The storage module may be a memory.
[0235] For example, the processor 1001 may be the processor 310 as shown in Figure 2, and the communication module 1003 includes a radio frequency module (the radio frequency module 350 as shown in Figure 2). The communication module may include communication modules such as a Wi-Fi module, a Bluetooth module, and a pogo pin communication module (the communication module 360 as shown in Figure 2). The communication module storage module may be a memory (the internal memory 321 as shown in Figure 2). The display screen 1002 may be a display screen 394 as shown in Figure 2, and the display screen 394 may be a touch screen in which a display panel and a touch panel may be integrated. The sensor may be a Hall sensor 380C, a pressure sensor 380A, a distance sensor 380F, a proximity light sensor 380G, an ambient light sensor 380L, etc. as shown in Figure 2. The terminal provided in the embodiment of the present application may be the electronic device 100 shown in Figure 2. Wherein, the above-mentioned processor and display screen, communication module, memory, and sensor, etc. may be connected together, for example, via a bus connection.
[0236] In some embodiments, as shown in FIG22 , a schematic diagram of the structure of an external device 2000 is provided. The electronic device includes a processor 2001 , a communication module 2002 , a first component 2003 , and a storage module 2004 .
[0237] The processor 2001 may be a CPU, DSP, ASIC, FPGA, microcontroller unit (MCU), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. The processor may include an application processor and a baseband processor. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication module 2003 may be a transceiver, a transceiver circuit, or the like. The storage module may be a memory.
[0238] For example, the processor 2001 may also be the processor 410 shown in FIG4. The communication module 2002 may include a Wi-Fi module, a Bluetooth module, a Pogo pin communication module, and other communication modules (as shown in FIG4 communication module 430). The storage module may be a memory (as shown in FIG4 internal memory 421).
[0239] The first component 2002 can be a component that is compatible with a sensor in an electronic device. For example, if the electronic device 1000 includes a Hall sensor 380E, the first component can be a magnet that is compatible with the Hall sensor 380E. The processor, the first component, the communication module, and the memory provided in the embodiments of the present application can be connected together, for example, via a bus.
[0240] An embodiment of the present application also provides a chip system (e.g., a system on a chip (SoC)). As shown in Figure 23, the chip system includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 can be interconnected via lines. For example, the interface circuit 702 can be used to receive signals from other devices (e.g., a memory of an electronic device). For another example, the interface circuit 702 can be used to send signals to other devices (e.g., a processor 701 or a camera of an electronic device). Exemplarily, the interface circuit 702 can read instructions stored in the memory and send the instructions to the processor 701. When the instructions are executed by the processor 701, the electronic device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete components, which is not specifically limited in the embodiment of the present application.
[0241] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes the various functions or steps executed by the electronic device 100 in the above-mentioned method embodiment.
[0242] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the external device 200 executes the various functions or steps executed by the external device in the above-mentioned method embodiment.
[0243] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the electronic device 100 in the above method embodiment. For example, the computer may be the above electronic device 100.
[0244] The embodiment of the present application further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the functions or steps executed by the external device 200 in the above method embodiment.
[0245] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0246] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0247] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0248] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0249] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0250] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for detecting the connection status of a pogo pin interface, characterized in that: Applied to an electronic device, the electronic device includes a pogo pin interface and a sensor, the pogo pin interface includes a communication interface, and the method includes: The electronic device detects the distance between the external device and the electronic device through the sensor; If the distance is less than a preset threshold, the electronic device sends a first instruction to the external device through the communication interface; If the electronic device does not receive the first response within the first time period, the electronic device sends a first prompt message, where the first prompt message is used to prompt the user that the external device and the electronic device have not established a communication connection.
2. The method according to claim 1, characterized in that The electronic device sending a first instruction to the external device through the communication interface includes: The electronic device sends the first instruction to the external device through the communication interface according to a first period.
3. The method according to claim 2, characterized in that Before the electronic device issues the first prompt information, the method further includes: The electronic device sends a second instruction to the external device through the communication interface according to a second cycle; the second cycle is shorter than the first cycle; The electronic device does not receive a second response within a second time period.
4. The method according to claim 3, characterized in that The method further comprises: The electronic device receives the second response through the communication interface within a second time period, and the electronic device displays external device connection information.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If the electronic device receives the first response within the first time period, the electronic device displays external device connection information.
6. The method according to any one of claims 1 to 5, characterized in that The electronic device issues a first prompt message, including: The electronic device stops displaying the external device connection information; Alternatively, the electronic device displays the first prompt information on a display interface; Alternatively, the electronic device plays the first prompt information.
7. The method according to any one of claims 1 to 6, characterized in that The distance is less than a preset threshold, including: The electronic device detects that the level of the sensor changes from high to low.
8. The method according to claim 7, characterized in that The high-low level jump of the sensor level includes: The level of the sensor changes from high level to low level; Alternatively, the level of the sensor changes from a low level to a high level; Alternatively, the level of the sensor generates a high-level interrupt when it is at a low level and then returns to a low level; Alternatively, the level of the sensor generates a low level interrupt when it is at a high level and then returns to a high level.
9. The method according to claim 7, characterized in that The pogo pin interface further includes a power supply interface. After the electronic device detects that the level of the sensor changes from high to low, the method further includes: The electronic device controls the power interface to power on.
10. The method according to claim 9, characterized in that After the electronic device detects that the level of the sensor changes from high to low, the method further includes: If the electronic device detects again that the level of the sensor changes from high to low, the electronic device sends a third instruction to the external device through the communication interface; If the electronic device does not receive a third response within a third time period, the electronic device controls the power interface to power off.
11. The method according to any one of claims 1 to 10, characterized in that Before the electronic device issues the first prompt information, the method further includes: If the electronic device does not detect a high-low level jump of the sensor level within a preset time period, the electronic device sends a fourth instruction to the external device through the communication interface; The electronic device does not receive a fourth response within a fourth time period.
12. The method according to any one of claims 1 to 11, characterized in that The method further comprises: The electronic device sends a fifth instruction to the external device through the first communication interface; the first communication interface is any one of the plurality of communication interfaces; If the electronic device does not receive a fifth response through the first communication interface within a fifth time period, the electronic device displays a second prompt message; the second prompt message is used to prompt that the first communication interface is abnormal.
13. The method according to any one of claims 1 to 12, characterized in that The sensor is any one of a Hall sensor, an infrared sensor, a distance sensor, a pressure sensor, a proximity light sensor, and an ambient light sensor.
14. A combination device of an electronic device and an external device, characterized in that: The combined device includes an electronic device and an external device; The electronic device comprises a processor, a sensor, and a pogo pin interface; the pogo pin interface comprises a communication interface; the processor is configured to execute the method according to any one of claims 1 to 13; The external device includes a processor and a pogo pin interface; the pogo pin interface includes a communication interface; When the electronic device is physically connected to the external device, the position of the pogo pin interface of the electronic device is aligned with the position of the pogo pin interface of the external device.
15. The combination device according to claim 14, characterized in that If the sensor of the electronic device is a Hall sensor, the external device further includes a first component; the first component is a magnet; When the electronic device is physically connected to the external device, the magnet is located within the detection area of the Hall sensor.
16. An electronic device, characterized in that: The electronic device includes a memory, a sensor, a pogo pin interface, a display screen, and one or more processors; the memory, the sensor, the pogo pin interface, and the display screen are coupled to the processor; the memory stores computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the method according to any one of claims 1 to 13.
17. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 13.