Device disconnection detection method and apparatus, terminal device, and storage medium
Patent Information
- Application Number
- CN202310477877.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-04-26
AI Technical Summary
但是,在级联设备后,TV无法检测到CEC二级级联设备拔出时发出的plugout电平信号,从而造成UI(User Interface,用户界面)无法及时更新,设备列表无法及时刷新的问题
[0029]本发明实施例提出的一种设备断联检测方法、装置、终端设备以及计算机可读存储介质,所述方法应用于第一电子设备,所述第一电子设备通过高清多媒体接口连接至少一台第二电子设备,该方法通过在消费类电子控制协议栈中的各控制指令中确定心跳检测指令;在所述第二电子设备为消费类电子控制总线上的二级级联设备时,发送所述心跳检测指令至所述第二电子设备;若检测到所述消费类电子控制协议栈未在预设时间内接收到所述第二电子设备根据所述心跳检测指令返回的电源状态指令,则确定所述第二电子设备与所述第一电子设备断联。
Smart Images

Figure CN116418716B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of equipment testing technology, and particularly relates to a method, apparatus, terminal equipment, and computer-readable storage medium for detecting equipment disconnection. Background Technology
[0002] With the rapid development of science and technology, the development of equipment testing technology is also facing greater challenges.
[0003] Currently, the existing HDMI (High Definition Multimedia Interface) - CEC (Consumer Electronics Control) protocol stack supports up to 14 devices as CEC device entities, abstracting these 14 devices within the stack. However, most televisions currently have only 2-3 HDMI ports, necessitating cascading functionality. This involves connecting multiple CEC secondary cascade devices to a single CEC switch device (usually an amplifier) to achieve multi-device connection to the TV. However, after cascading, the TV cannot detect the plugout level signal emitted when a CEC secondary cascade device is unplugged, causing the UI (User Interface) to fail to update promptly, and the device list to fail to refresh in a timely manner.
[0004] In summary, how to detect in real time whether the secondary cascaded devices on the CEC bus are disconnected has become a technical problem that urgently needs to be solved in the field of equipment testing technology. Summary of the Invention
[0005] The main objective of this invention is to provide a method, apparatus, terminal device, and computer-readable storage medium for detecting device disconnection. It aims to achieve real-time detection of whether a second-level cascaded device on a CEC bus is disconnected.
[0006] To achieve the above objectives, the present invention provides a device disconnection detection method, which is applied to a first electronic device, the first electronic device being connected to at least one second electronic device via a high-definition multimedia interface, the device disconnection detection method comprising:
[0007] The heartbeat detection instruction is identified from the various control instructions in the consumer electronics control protocol stack.
[0008] When the second electronic device is a second-level cascaded device on a consumer electronics control bus, the heartbeat detection command is sent to the second electronic device;
[0009] If the consumer electronics control protocol stack fails to receive the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device is disconnected from the first electronic device.
[0010] Optionally, the heartbeat detection command is the device power status request command among the control commands.
[0011] Optionally, the method further includes:
[0012] The first physical address corresponding to the second electronic device is detected through the consumer electronics control protocol stack.
[0013] When the first physical address is a secondary physical address, the second electronic device is determined to be a secondary cascaded device.
[0014] Optionally, after the step of sending the heartbeat detection command to the second electronic device, the method further includes:
[0015] If the consumer electronics control protocol stack detects that it receives a power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device has not lost connection with the first electronic device.
[0016] Optionally, after determining that the second electronic device is disconnected from the first electronic device, the method further includes:
[0017] Remove the second electronic device from the consumer electronics control bus and detect whether the second electronic device reissues a connection request.
[0018] Optionally, the first electronic device is also connected to a third electronic device via the high-definition multimedia interface, wherein the third electronic device is located at the next level or the next layer below the second electronic device on the consumer electronics control bus.
[0019] Optionally, after the step of removing the second electronic device from the consumer electronics control bus, the method further includes:
[0020] Detect the second physical address corresponding to the third electronic device;
[0021] When the second physical address belongs to the secondary physical address, the third electronic device is determined to be a secondary cascaded device, and the heartbeat detection command is sent to the third electronic device;
[0022] If the consumer electronics control protocol stack fails to receive the power status command returned by the third electronic device according to the heartbeat detection command within the preset time, it is determined that the third electronic device is disconnected from the first electronic device.
[0023] Furthermore, to achieve the above objectives, the present invention also provides a device disconnection detection device, which is applied to a first electronic device, the first electronic device being connected to a second electronic device via a high-definition multimedia interface, and the device disconnection detection device comprising:
[0024] The heartbeat detection instruction module determines the heartbeat detection instruction from among the various control instructions in the consumer electronics control protocol stack.
[0025] The instruction sending module sends the heartbeat detection instruction to the second electronic device when the second electronic device is a secondary cascaded device on a consumer electronics control bus;
[0026] If the disconnection judgment module detects that the consumer electronics control protocol stack has not received the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it determines that the second electronic device is disconnected from the first electronic device.
[0027] In addition, to achieve the above objectives, the present invention also provides a terminal device, the terminal device comprising: a memory, a processor, and a device disconnection detection program stored in the memory and executable on the processor, wherein when the device disconnection detection program of the terminal device is executed by the processor, it implements the steps of the device disconnection detection method as described above.
[0028] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a device disconnection detection program, which, when executed by a processor, implements the steps of the device disconnection detection method described above.
[0029] This invention discloses a device disconnection detection method, apparatus, terminal device, and computer-readable storage medium. The method is applied to a first electronic device, which is connected to at least one second electronic device via a high-definition multimedia interface. The method determines a heartbeat detection instruction from the control instructions in the consumer electronics control protocol stack. When the second electronic device is a secondary cascaded device on the consumer electronics control bus, the heartbeat detection instruction is sent to the second electronic device. If the consumer electronics control protocol stack does not receive a power status instruction returned by the second electronic device according to the heartbeat detection instruction within a preset time, it is determined that the second electronic device is disconnected from the first electronic device.
[0030] This invention determines a heartbeat detection command based on the compatibility of each control command in the consumer electronics control protocol stack. Then, when the second electronic device is an earphone cascaded device on the consumer electronics control bus, the heartbeat detection command is sent to the second electronic device through the consumer electronics control protocol stack. It detects whether the consumer electronics control protocol stack receives a power status command returned by the second electronic device within a preset time. If the consumer electronics control protocol stack does not receive a power status command returned by the second electronic device based on the heartbeat detection command within the preset time, it is determined that the second electronic device is disconnected from the first electronic device. Compared with existing TVs that cannot detect the disconnection information of secondary cascaded devices, this invention realizes real-time detection of whether secondary cascaded devices on the CEC bus are disconnected. Attached Figure Description
[0031] Figure 1 This is a schematic diagram of the device structure of the terminal device hardware operating environment involved in the embodiments of the present invention;
[0032] Figure 2 This is a schematic flowchart of the first embodiment of the device disconnection detection method of the present invention;
[0033] Figure 3 This is a schematic diagram illustrating an application scenario of an embodiment of the device disconnection detection method of the present invention;
[0034] Figure 4 This is a schematic diagram of the CEC system structure involved in an embodiment of the device disconnection detection method of the present invention;
[0035] Figure 5 This is a schematic diagram of the equipment disconnection detection process according to an embodiment of the equipment disconnection detection method of the present invention;
[0036] Figure 6 This is a schematic diagram of the functional modules of an embodiment of the device disconnection detection device of the present invention.
[0037] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0038] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. (See also...) Figure 1 , Figure 1 This is a schematic diagram of the hardware operating environment of the terminal device involved in the embodiment of the present invention.
[0039] The terminal device in this embodiment of the invention can be a first electronic device applied in the field of equipment testing technology. The first electronic device is connected to at least one second electronic device via a high-definition multimedia interface. Specifically, such as... Figure 3As shown, the first electronic device includes multiple HDMI ports, each of which can connect to a second electronic device. It should be noted that n represents the number of the HDMI port and the second electronic device, and n is greater than or equal to 0. Furthermore, the first electronic device can be a smartphone, PC (Personal Computer), tablet computer, laptop computer, etc.
[0040] like Figure 1 As shown, the terminal device may include: a processor 1001, such as a CPU; a communication bus 1002; a user interface 1003; a network interface 1004; and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0041] Those skilled in the art will understand that Figure 1 The terminal device structure shown does not constitute a limitation on the terminal device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0042] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device disconnection detection program.
[0043] exist Figure 1 In the terminal shown, network interface 1004 is mainly used to connect to the backend server and communicate data with it; user interface 1003 is mainly used to connect to the client and communicate data with it; and processor 1001 can be used to call the device disconnection detection program stored in memory 1005 and perform the following operations:
[0044] The heartbeat detection instruction is identified from the various control instructions in the consumer electronics control protocol stack.
[0045] When the second electronic device is a second-level cascaded device on a consumer electronics control bus, the heartbeat detection command is sent to the second electronic device;
[0046] If the consumer electronics control protocol stack fails to receive the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device is disconnected from the first electronic device.
[0047] Optionally, the heartbeat detection command is the device power status request command in each of the control commands.
[0048] Optionally, the processor 1001 can also be used to call the device disconnection detection program stored in the memory 1005, and perform the following operations:
[0049] The first physical address corresponding to the second electronic device is detected through the consumer electronics control protocol stack.
[0050] When the first physical address is a secondary physical address, the second electronic device is determined to be a secondary cascaded device.
[0051] Optionally, the processor 1001 can also be used to call the device disconnection detection program stored in the memory 1005, and after the step of sending the heartbeat detection command to the second electronic device, perform the following operations:
[0052] If the consumer electronics control protocol stack detects that it receives a power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device has not lost connection with the first electronic device.
[0053] Optionally, the processor 1001 can also be used to call the device disconnection detection program stored in the memory 1005, and after the step of determining that the second electronic device is disconnected from the first electronic device, perform the following operations:
[0054] Remove the second electronic device from the consumer electronics control bus and detect whether the second electronic device reissues a connection request.
[0055] Optionally, the first electronic device is also connected to a third electronic device via a high-definition multimedia interface, the third electronic device being located at the next level or layer below the second electronic device on the consumer electronics control bus.
[0056] Optionally, the processor 1001 can also be used to call the device disconnection detection program stored in the memory 1005, and after the step of removing the second electronic device from the consumer electronics control bus, perform the following operations:
[0057] Detect the second physical address corresponding to the third electronic device;
[0058] When the second physical address belongs to the secondary physical address, the third electronic device is determined to be a secondary cascaded device, and the heartbeat detection command is sent to the third electronic device;
[0059] If the consumer electronics control protocol stack fails to receive the power status command returned by the third electronic device according to the heartbeat detection command within the preset time, it is determined that the third electronic device is disconnected from the first electronic device.
[0060] Based on the aforementioned terminal devices, various embodiments of the device disconnection detection method of the present invention are proposed.
[0061] Currently, the existing HDMI-CEC protocol stack supports up to 14 devices as CEC device entities, abstracting these 14 devices within the stack. However, most TVs currently have only 2-3 HDMI ports, necessitating cascading functionality. This involves connecting multiple CEC secondary cascade devices to a single CEC Switch device (typically an amplifier) to achieve multi-device connection to the TV. However, after cascading, the TV cannot detect the plugout level signal emitted when a CEC secondary cascade device is unplugged, causing issues such as the UI failing to update promptly and the device list not refreshing in a timely manner.
[0062] To address the aforementioned issues, this invention proposes a device disconnection detection method. This method determines a heartbeat detection command based on the compatibility of each control command in the Consumer Electronics Control Protocol (CEC) stack. Then, the CEC stack sends the heartbeat detection command to the secondary cascaded devices on the CEC bus. It detects whether the CEC stack receives a power status command returned by the secondary cascaded devices within a preset time, obtaining the corresponding detection result. Finally, based on this detection result, it determines whether the secondary cascaded devices are disconnected from the CEC bus. Compared to existing TVs that cannot detect the disconnection information of secondary cascaded devices, this invention achieves real-time detection of whether secondary cascaded devices on the CEC bus are disconnected.
[0063] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the device disconnection detection method of the present invention. It should be noted that although the logical order is shown in the flowchart, in some cases, the device disconnection detection method of the present invention may execute the steps shown or described in a different order than that shown here. For ease of description, the execution details are omitted below.
[0064] In a first embodiment of the device disconnection detection method of the present invention, the method is applied to a first electronic device, which is connected to at least one second electronic device via a high-definition multimedia interface. The method includes:
[0065] Step S10: Determine the heartbeat detection instruction from the various control instructions in the consumer electronics control protocol stack;
[0066] In this embodiment, the control instruction used as the heartbeat detection instruction is determined based on the compatibility of each control instruction in the consumer electronics control protocol stack.
[0067] For example, through continuous experimentation and comparison, it was found that only by using control commands with strong compatibility as heartbeat detection commands can information exchange be carried out with different types of secondary cascaded devices, thereby detecting the connection status of the secondary cascaded devices and the CEC bus.
[0068] Furthermore, in one feasible embodiment, the aforementioned heartbeat detection command is a device power status request command among the various control commands.
[0069] It should be noted that "Give Device Power Status" 0x8F is a control command in the CEC protocol used to request the current power-on status of the target device. This command is used to detect whether the CEC device is active to ensure normal communication between devices. When the device receives this command, it replies with the "Report Power Status" command to indicate its current power status. If the device does not reply with the "Report Power Status" command, it means that the device may have been shut down or malfunctioned.
[0070] Step S20: When the second electronic device is a secondary cascaded device on a consumer electronics control bus, the heartbeat detection command is sent to the second electronic device;
[0071] In this embodiment, when the second electronic device is not a secondary cascaded device on the consumer electronics control bus, a heartbeat detection command is sent to the second electronic device through the consumer electronics control protocol stack.
[0072] For example, the "Give Device Power Status" command is sent to the second-level cascaded device connected to the CEC bus via the CEC protocol stack.
[0073] Step S30: If it is detected that the consumer electronics control protocol stack does not receive the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, then it is determined that the second electronic device is disconnected from the first electronic device.
[0074] In this embodiment, it is detected whether the consumer electronics control protocol stack receives a power status command returned by the second-level cascaded device within a preset time. If it is detected that the consumer electronics control protocol stack does not receive a power status command returned by the second-level cascaded device within the preset time, it is determined that the second electronic device is disconnected from the first electronic device.
[0075] For example, after the CEC protocol stack sends the "Give Device Power Status" command to the secondary cascaded device, the secondary cascaded device can return a "Report Power Status" command based on the received "Give Device Power Status" command. The "Report Power Status" command is used to reply with the device's current power-on status. The terminal device detects whether the CEC protocol stack receives the power status command returned by the secondary cascaded device within a preset time, obtaining a detection result. This result can include whether the CEC protocol stack received the power status command returned by the secondary cascaded device within the preset time, or whether the CEC protocol stack did not receive the power status command returned by the secondary cascaded device within the preset time. If the CEC protocol stack does not receive the "Report Power Status" command from the secondary cascaded device within 10 seconds after sending the "Give Device Power Status" command to it, then it can be determined that the secondary cascaded device is disconnected from the CEC bus.
[0076] It should be noted that the preset time in the two-level cascaded device disconnection method of the present invention is set to 10 seconds. It should be understood that, based on different design needs of actual applications, the preset time can be set to any time length that meets the actual needs in different feasible implementation methods. The present invention does not limit the length of the preset time.
[0077] Furthermore, in a feasible embodiment, after step S20 described above, the following may also be included:
[0078] Step A10: If the consumer electronics control protocol stack detects that it receives a power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device has not lost connection with the first electronic device.
[0079] In this embodiment, if the consumer electronics control protocol stack detects that it receives a power status command returned by the second electronic device based on the heartbeat detection command within a preset time, it is determined that the second electronic device has not lost connection with the first electronic device.
[0080] For example, when the CEC protocol stack sends the "Give Device Power Status" command to the secondary cascaded device, the secondary cascaded device timer is started. The fixed time interval set by the secondary cascaded device timer is a preset time. If the CEC protocol stack receives the "Report Power Status" command from the secondary cascaded device within 10 seconds of the preset time, it can be determined that the secondary cascaded device has not been disconnected from the CEC bus.
[0081] It should be noted that the present invention is capable of responding to<Give Device Power Status> The protocol requirement for the instruction is HDMI Version 1.2a-1.4 (1.2a and 1.3 do not support CEC Switch). Some devices with Version 1.3 and earlier may respond with a "Feature Abort" message. Although it is not a "Report Power Status" message, it still responds with a heartbeat. Therefore, if the CEC protocol stack receives a "Feature Abort" signal from a secondary cascaded device within a preset time of 10 seconds, it can be determined that the secondary cascaded device has not lost connection with the CEC bus.
[0082] Furthermore, in a feasible embodiment, after step S402 above, the device disconnection detection method of the present invention may further include:
[0083] Step B10: Remove the second electronic device from the consumer electronics control bus and detect whether the second electronic device re-issues a connection request.
[0084] In this embodiment, the second electronic device, which is disconnected from the first electronic device, is removed from the consumer electronics control bus, and the system continues to detect whether the second electronic device re-issues a connection request.
[0085] For example, if the CEC protocol stack does not receive a response message from the secondary cascaded device within a preset time of 10 seconds, it determines that the secondary cascaded device is lost, removes the device information of the secondary cascaded device from the CEC device tree, and waits for the secondary cascaded device to be added again.
[0086] In this embodiment, the device disconnection detection method of the present invention determines the control instruction as the heartbeat detection instruction based on the compatibility of each control instruction in the consumer electronics control protocol stack. The heartbeat detection instruction is a device power status request instruction in the consumer electronics control protocol stack. When the second electronic device is not a secondary cascaded device on the consumer electronics control bus, the heartbeat detection instruction is sent to the second electronic device through the consumer electronics control protocol stack. The method detects whether the consumer electronics control protocol stack receives a power status instruction returned by the secondary cascaded device within a preset time. If the consumer electronics control protocol stack does not receive a power status instruction returned by the secondary cascaded device within the preset time, it determines that the second electronic device is disconnected from the first electronic device. If the consumer electronics control protocol stack receives a power status instruction returned by the second electronic device according to the heartbeat detection instruction within the preset time, it determines that the second electronic device is not disconnected from the first electronic device. The second electronic device, which is disconnected from the first electronic device, is removed from the consumer electronics control bus, and the method continues to detect whether the second electronic device re-issues a connection request.
[0087] Thus, this embodiment of the invention determines the heartbeat detection command based on the compatibility of each control command in the consumer electronics control protocol stack. Then, when the second electronic device is an earphone cascaded device on the consumer electronics control bus, the heartbeat detection command is sent to the second electronic device through the consumer electronics control protocol stack. It detects whether the consumer electronics control protocol stack receives a power status command returned by the second electronic device within a preset time. If it is detected that the consumer electronics control protocol stack does not receive a power status command returned by the second electronic device based on the heartbeat detection command within the preset time, it is determined that the second electronic device is disconnected from the first electronic device. Compared with existing TVs that cannot detect the disconnection information of secondary cascaded devices, this invention realizes real-time detection of whether secondary cascaded devices on the CEC bus are disconnected.
[0088] Furthermore, based on the first embodiment of the device disconnection detection method of the present invention described above, a second embodiment of the device disconnection detection method of the present invention is proposed.
[0089] In this embodiment, before step S20, the device disconnection detection method of the present invention may further include:
[0090] Step C10: Detect the first physical address corresponding to the second electronic device through the consumer electronics control protocol stack;
[0091] In this embodiment, the physical address corresponding to the second electronic device (hereinafter referred to as the first physical address for distinction) is detected by the consumer electronics control protocol stack.
[0092] It's important to note that the CEC protocol's physical address allocation principle is that, in order for CEC to address specific physical devices and control switches, every device must have a physical address. A physical address can be understood as the location of an HDMI device in the circuit hardware. Therefore, the physical address of the TV is 0.0.0.0, the physical address of the device connected to HDMI1 is 1.0.0.0, and the physical address of the device connected to HDMI2 is...
[0093] 2.0.0.0. The cascading rule is: the physical addresses of devices connected to the next level after 2.0.0.0 are assigned starting from 2.*.0.0, where "*" represents parameters from 0 to F. Therefore, up to 15 more devices can be connected to the next level. And so on.
[0094] Step C20: When the first physical address belongs to a second-level physical address, determine that the second electronic device is a second-level cascaded device.
[0095] In this embodiment, when the first physical address is detected to be a secondary physical address, the second electronic device is determined to be a secondary cascaded device on a consumer electronics control bus.
[0096] It should be noted that the CEC protocol stack detects the physical addresses of each level of interconnected devices on the CEC bus in a hierarchical, layer-by-layer manner, such as... Figure 4 As shown in the schematic diagram of the CEC system architecture, the CEC protocol stack first detects the physical address corresponding to the first-level cascaded device connected to the two HDMI interfaces of the TV, and in the first-level cascaded device, physical address 1.0.0.0 is detected first.
[0097] For example, if the physical address of the first cascaded device is detected to be 2.1.0.0, and the physical address 2.1.0.0 is a second-level physical address, then the second electronic device can be determined to be a second-level cascaded device.
[0098] Furthermore, in one feasible embodiment, the first electronic device is also connected to a third electronic device via a high-definition multimedia interface, the third electronic device being located at the next level or layer below the second electronic device on the consumer electronics control bus.
[0099] Furthermore, in a feasible embodiment, after step A10, the device disconnection detection method of the present invention may further include:
[0100] Step D10: Detect the second physical address corresponding to the third electronic device;
[0101] In this embodiment, the second physical address corresponding to the next cascaded device connected to the consumer electronics control bus, i.e., the third electronic device, is detected through the consumer electronics control protocol stack.
[0102] It should be noted that when the first physical address is 2.1.0.0, the second physical address is 2.2.0.0; when the first physical address is 2.3.0.0, the second physical address is 2.3.1.0.
[0103] Step D20: When the second physical address belongs to the secondary physical address, determine that the third electronic device is a secondary cascaded device, and send the heartbeat detection command to the third electronic device;
[0104] Step D30: If the consumer electronics control protocol stack fails to receive the power status command returned by the third electronic device according to the heartbeat detection command within the preset time, it is determined that the third electronic device is disconnected from the first electronic device.
[0105] In this embodiment, when the second physical address belongs to a secondary physical address, the third electronic device is determined to be a secondary cascaded device, and a heartbeat detection command is sent to the third electronic device. If the consumer electronics control protocol stack does not receive the power status command returned by the third electronic device according to the heartbeat detection command within a preset time, it is determined that the third electronic device is disconnected from the first electronic device.
[0106] For example, such as Figure 5 As shown in the diagram, the device disconnection detection process is as follows: When the second physical address is 2.2.0.0, the third electronic device is determined to be a second-level cascaded device. Therefore, a heartbeat detection command is sent to the current second-level cascaded device through the CEC protocol stack. Then, a preset time of 10 seconds is waited. If the CEC protocol stack receives a signal returned by the current second-level cascaded device within 10 seconds, it is determined that the current second-level cascaded device is not disconnected from the CEC bus. If the CEC protocol stack does not receive a signal returned by the current second-level cascaded device within 10 seconds, it is determined that the current second-level cascaded device is disconnected from the CEC bus, and the device information of the current second-level cascaded device is deleted from the CEC device tree. Then, it continues to detect whether the cascaded device at the next level or the next layer below the current second-level cascaded device is a second-level cascaded device, until the next detected cascaded device is not a second-level cascaded device. At this point, the second-level cascaded device timer is turned off, and the detection of the second-level cascaded device disconnection is stopped.
[0107] In this embodiment, the device disconnection detection method of the present invention detects the first physical address corresponding to the second electronic device through the consumer electronics control protocol stack. When the first physical address is detected to be a secondary physical address, the second electronic device is determined to be a secondary cascaded device on the consumer electronics control bus. The method also detects the second physical address corresponding to the third electronic device connected to the consumer electronics control bus through the consumer electronics control protocol stack, wherein the third electronic device is located at the next level or next layer below the second electronic device on the consumer electronics control bus. When the second physical address is a secondary physical address, the third electronic device is determined to be a secondary cascaded device, and a heartbeat detection command is sent to the third electronic device. If the consumer electronics control protocol stack does not receive the power status command returned by the third electronic device according to the heartbeat detection command within a preset time, the third electronic device is determined to be disconnected from the first electronic device.
[0108] In this way, the physical address of each cascaded device is detected sequentially according to the cascaded position of each cascaded device by the CEC protocol stack to determine the cascaded position of the current cascaded device. When the current cascaded device is a headphone device and it is determined that the current cascaded device is disconnected, the current cascaded device is deleted from the CEC bus, thus realizing the polling system for detecting two-level cascaded devices.
[0109] In addition, this embodiment of the invention also provides a device disconnection detection device, which is applied to a first electronic device, the first electronic device being connected to at least one second electronic device via a high-definition multimedia interface.
[0110] Please refer to Figure 6 , Figure 6 This is a functional module diagram of an embodiment of the device disconnection detection device of the present invention, as shown below. Figure 6 As shown, the device disconnection detection device of the present invention includes:
[0111] Heartbeat detection instruction module 10 is used to determine the heartbeat detection instruction among the various control instructions in the consumer electronics control protocol stack;
[0112] The instruction sending module 20 is used to send the heartbeat detection instruction to the second electronic device when the second electronic device is a secondary cascaded device on a consumer electronics control bus;
[0113] The disconnection judgment module 30 is used to determine that the second electronic device is disconnected from the first electronic device if the consumer electronics control protocol stack does not receive the power status instruction returned by the second electronic device according to the heartbeat detection instruction within a preset time.
[0114] Optionally, the heartbeat detection command is the device power status request command in each of the control commands.
[0115] Optionally, the device disconnection detection device of the present invention further includes:
[0116] The first physical address module is used to detect the first physical address corresponding to the first cascaded device connected to the second electronic device through the consumer electronics control protocol stack;
[0117] The first cascaded device module is used to determine that the second electronic device is a second-level cascaded device when the first physical address belongs to a second-level physical address.
[0118] Optionally, the device disconnection detection device of the present invention further includes:
[0119] The "not disconnected" unit is used to determine that the second electronic device is not disconnected from the first electronic device if the consumer electronics control protocol stack receives a power status command returned by the second electronic device according to the heartbeat detection command within a preset time.
[0120] Optionally, the device disconnection detection device of the present invention further includes:
[0121] The device removal module is used to remove the second electronic device from the consumer electronics control bus and detect whether the second electronic device re-issues a connection request.
[0122] Optionally, the first electronic device is also connected to a third electronic device via a high-definition multimedia interface, the third electronic device being located at the next level or layer below the second electronic device on the consumer electronics control bus.
[0123] Optionally, the device disconnection detection device of the present invention further includes:
[0124] The second physical address module is used to detect the second physical address corresponding to the third electronic device;
[0125] The third electronic device module is used to determine that the third electronic device is a second-level cascaded device when the second physical address belongs to the second-level physical address, and to send the heartbeat detection command to the third electronic device;
[0126] The third electronic device disconnection module is used to determine that the third electronic device is disconnected from the first electronic device if the consumer electronics control protocol stack does not receive the power status command returned by the third electronic device according to the heartbeat detection command within the preset time.
[0127] The present invention also provides a computer storage medium storing a device disconnection detection program, wherein when the device disconnection detection program is executed by a processor, the steps of the device disconnection detection program method as described in any of the above embodiments are implemented.
[0128] The specific embodiments of the computer storage medium of the present invention are basically the same as the embodiments of the device disconnection detection program method of the present invention described above, and will not be repeated here.
[0129] The present invention also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps of the device disconnection detection method of the present invention as described in any of the above embodiments, which will not be repeated here.
[0130] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0131] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (such as TWS earphones, etc.) to execute the methods described in the various embodiments of the present invention.
[0133] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for detecting equipment disconnection, characterized in that, The device disconnection detection method is applied to a first electronic device, which is connected to at least one second electronic device via a high-definition multimedia interface. The device disconnection detection method includes: A heartbeat detection instruction is determined among the control instructions in the consumer electronics control protocol stack, wherein the heartbeat detection instruction is the device power status request instruction in each of the control instructions; When the second electronic device is a second-level cascaded device on a consumer electronics control bus, the heartbeat detection command is sent to the second electronic device; If the consumer electronics control protocol stack fails to receive the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device is disconnected from the first electronic device.
2. The equipment disconnection detection method as described in claim 1, characterized in that, The method further includes: The first physical address corresponding to the second electronic device is detected through the consumer electronics control protocol stack. When the first physical address is a secondary physical address, the second electronic device is determined to be a secondary cascaded device.
3. The equipment disconnection detection method as described in claim 1, characterized in that, After the step of sending the heartbeat detection command to the second electronic device, the method further includes: If the consumer electronics control protocol stack detects that it receives a power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it is determined that the second electronic device has not lost connection with the first electronic device.
4. The equipment disconnection detection method as described in claim 3, characterized in that, After determining that the second electronic device is disconnected from the first electronic device, the method further includes: Remove the second electronic device from the consumer electronics control bus and detect whether the second electronic device reissues a connection request.
5. The equipment disconnection detection method as described in claim 4, characterized in that, The first electronic device is also connected to a third electronic device via the high-definition multimedia interface, and the third electronic device is located at the next level or the next layer below the second electronic device on the consumer electronics control bus.
6. The equipment disconnection detection method as described in claim 5, characterized in that, After the step of removing the second electronic device from the consumer electronics control bus, the method further includes: Detect the second physical address corresponding to the third electronic device; When the second physical address belongs to a secondary physical address, the third electronic device is determined to be a secondary cascaded device, and the heartbeat detection command is sent to the third electronic device; If the consumer electronics control protocol stack fails to receive the power status command returned by the third electronic device according to the heartbeat detection command within the preset time, it is determined that the third electronic device is disconnected from the first electronic device.
7. A device for detecting equipment disconnection, characterized in that, The device disconnection detection device is applied to a first electronic device, which is connected to at least one second electronic device via a high-definition multimedia interface. The device disconnection detection device includes: The heartbeat detection instruction module determines the heartbeat detection instruction from each control instruction in the consumer electronics control protocol stack, wherein the heartbeat detection instruction is the device power status request instruction in each of the control instructions; The instruction sending module sends the heartbeat detection instruction to the second electronic device when the second electronic device is a secondary cascaded device on a consumer electronics control bus; If the disconnection judgment module detects that the consumer electronics control protocol stack has not received the power status command returned by the second electronic device according to the heartbeat detection command within a preset time, it determines that the second electronic device is disconnected from the first electronic device.
8. A terminal device, characterized in that, The terminal device includes: a memory, a processor, and a device disconnection detection program stored in the memory and executable on the processor. When the device disconnection detection program is executed by the processor, it implements the steps of the device disconnection detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a device disconnection detection program, which, when executed by a processor, implements the steps of the device disconnection detection method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Information collection apparatus, method, and program
CN101546180A