Equipment control methods and apparatus, terminal equipment and readable storage media
By generating event forwarding files and performing programming language adaptation and batch conversion, the problem of excessively long response time in remote synchronous control is solved, enabling fast response and synchronous control of the receiving device.
Patent Information
- Application Number
- CN202110442719.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-23
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2041-05-31
AI Technical Summary
Existing remote synchronous control technology cannot effectively achieve the synchronous control effect of equipment as expected by users, and cannot respond to complex user operation in a timely manner, resulting in excessively long response time.
By generating an event forwarding file on the sending device and performing programming language adaptation and batch conversion on the receiving device, the target input event is directly injected into the corresponding device node, reducing individual event instantiation operations and improving processing timeliness.
It enables the receiving device to respond quickly to the user's remote control operations, ensures the synchronous control effect of the equipment, reduces response time, and improves the synchronization of equipment control.
Smart Images

Figure CN115237414B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of remote device control technology, and more specifically, to a device control method and apparatus, a terminal device, and a readable storage medium. Background Technology
[0002] With the continuous development of science and technology, remote device control technology has gradually matured. However, as user control needs change, this technology has also undergone various adjustments. One important branch of remote device control technology is remote synchronous control. This branch requires that when a user performs remote control operations on their local device (e.g., single-finger or multi-finger swipes on the local device's touchscreen, or pressing volume buttons on the local device), the remote device must synchronously execute the corresponding functional operations to display the desired effect on the remote device. However, current remote synchronous control technology is not yet mature enough to achieve the synchronous device control effect expected by users. Summary of the Invention
[0003] This application provides a device control method and apparatus, a terminal device, and a readable storage medium, which can effectively reduce the response time of the receiving device to the user's remote control operation and ensure that the device synchronous control effect is achieved.
[0004] In this case, the technical solution adopted in the embodiments of this application may include the following:
[0005] In a first aspect, this application provides a device control method, the method comprising:
[0006] The transmitting device responds to the user's remote control operation, generates a matching event forwarding file, and sends the event forwarding file to the receiving device. The event forwarding file includes at least two remote control input events generated at at least one device node of the transmitting device that match the user's remote control operation.
[0007] The receiving device parses and adjusts the received event forwarding file to obtain an event execution file adapted to a programming language, wherein the event execution file includes a target input event obtained by adjusting at least two of the remote control input events respectively;
[0008] The receiving device calls the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0009] The receiving device drives its own device node to perform a matching response operation based on the injected target input event.
[0010] In an optional implementation, the step of generating a matching event forwarding file includes:
[0011] The event record timing of each remote control input event is obtained from the node event file of each device node in the transmitting device. The remote control input event is generated by the device node on the transmitting device that responds to the user's remote control operation and is written into the node event file of the device node that responds to the user's remote control operation by the system kernel of the transmitting device.
[0012] Based on the first event time resolution of the transmitting device and the event recording sequence of each remote control input event, the event recording time point of each remote control input event at the transmitting device is determined;
[0013] At least two of the remote control input events and their corresponding event recording timestamps are written into a blank program file at the sending device in chronological order to obtain the event forwarding file.
[0014] In an optional implementation, the step of the receiving device parsing and adjusting the received event forwarding file to obtain an event execution file adapted to the programming language includes:
[0015] The event forwarding file is parsed and converted using the target programming language adapted to the receiving device to obtain the injection file implemented by the target programming language, wherein the injection file includes injection events corresponding to at least two of the remote control input events;
[0016] For each event to be injected in the file to be injected, the hardware device parameters of the device node targeted by the event to be injected in the receiving device are used to perform parameter debugging on the event to be injected, so as to obtain a target input event adapted to the receiving device. The node type of the device node targeted by the event to be injected in the receiving device is the same as the node type of the device node that generates the corresponding remote control input event in the sending device.
[0017] Based on the second event time resolution of the receiving device, the event recording time point of each remote control input event in the event forwarding file is time-calibrated to obtain the event injection time point of each target input event at the receiving device;
[0018] At least two target input events and their corresponding event injection timestamps are written into a blank program file at the receiving device in chronological order to obtain the event execution file.
[0019] In an optional implementation, the step of the receiving device invoking the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device includes:
[0020] The device driver's ioctl function is invoked to read each target input event from the event execution file one by one;
[0021] For each target input event read, the target input event is written to the node event file of the device node corresponding to the target input event in the receiving device.
[0022] Secondly, this application provides a device control method applied to a receiving device communicatively connected to a transmitting device, the method comprising:
[0023] Receive an event forwarding file from the transmitting device that matches the user's remote control operation, wherein the event forwarding file includes at least two remote control input events generated at at least one device node of the transmitting device that match the user's remote control operation;
[0024] The received event forwarding file is parsed and adjusted to obtain an event execution file adapted to the programming language, wherein the event execution file includes a target input event that is adjusted from at least two of the remote control input events respectively;
[0025] The device driver is invoked to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0026] The driver's own device node executes a matching response operation based on the injected target input event.
[0027] In an optional implementation, the event forwarding file further includes the event recording time point of each remote control input event at the sending device, and the step of parsing and adjusting the received event forwarding file to obtain an event execution file adapted to the programming language includes:
[0028] The event forwarding file is parsed and converted using the target programming language adapted to the receiving device to obtain the injection file implemented by the target programming language, wherein the injection file includes injection events corresponding to at least two of the remote control input events;
[0029] For each event to be injected in the file to be injected, the hardware device parameters of the device node targeted by the event to be injected in the receiving device are used to perform parameter debugging on the event to be injected, so as to obtain a target input event adapted to the receiving device. The node type of the device node targeted by the event to be injected in the receiving device is the same as the node type of the device node that generates the corresponding remote control input event in the sending device.
[0030] Based on the second event time resolution of the receiving device, the event recording time point of each remote control input event in the event forwarding file is time-calibrated to obtain the event injection time point of each target input event at the receiving device;
[0031] At least two target input events and their corresponding event injection timestamps are written into a blank program file at the receiving device in chronological order to obtain the event execution file.
[0032] In an optional implementation, the step of invoking the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device includes:
[0033] The device driver's ioctl function is invoked to read each target input event from the event execution file one by one;
[0034] For each target input event read, the target input event is written to the node event file of the device node corresponding to the target input event in the receiving device.
[0035] Thirdly, this application provides a device control apparatus for use in a receiving device that is communicatively connected to a transmitting device, the apparatus comprising:
[0036] The file receiving module is used to receive an event forwarding file from the sending end device that matches the user's remote control operation, wherein the event forwarding file includes at least two remote control input events generated at at least one device node of the sending end device that match the user's remote control operation;
[0037] The file conversion module is used to parse and adjust the received event forwarding file to obtain an event execution file adapted to a programming language, wherein the event execution file includes a target input event obtained by adjusting at least two of the remote control input events respectively;
[0038] The event injection module is used to call the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0039] The operation response module is used to drive its own device node to execute a matching response operation based on the injected target input event.
[0040] Fourthly, this application provides a terminal device, including a processor and a memory, wherein the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the device control method described in any of the foregoing embodiments.
[0041] Fifthly, this application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the device control method described in any of the foregoing embodiments.
[0042] Therefore, the beneficial effects of the embodiments of this application can include the following:
[0043] This application sends at least two remote control input events matching the user's remote control operation to a receiving device via a sending device. The receiving device then performs batch language adaptation conversion on the received remote control input events, ensuring that the converted target input events are directly compatible with the receiving device's programming language. This allows the receiving device to directly inject each target input event into its corresponding device node. The corresponding device node then executes a matching response operation based on the injected target input events. This batch language adaptation conversion improves the receiving device's timeliness in processing remote control input events and allows for the injection of a large number of language-adapted target input events into the corresponding device nodes in a short time. Consequently, it effectively reduces the response time of the receiving device to the user's remote control operation, ensuring that the synchronous control effect of the devices can be achieved normally.
[0044] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram of device interaction between the transmitting end device and the receiving end device provided in an embodiment of this application;
[0047] Figure 2 This is a schematic diagram of the composition of the terminal device provided in the embodiments of this application;
[0048] Figure 3 A flowchart illustrating the first device control method provided in this application embodiment;
[0049] Figure 4 for Figure 3 A flowchart illustrating the sub-steps included in step S210;
[0050] Figure 5 for Figure 3 A flowchart illustrating the sub-steps included in step S220;
[0051] Figure 6 for Figure 3 A flowchart illustrating the sub-steps included in step S230;
[0052] Figure 7 A flowchart illustrating the second device control method provided in this application embodiment;
[0053] Figure 8 for Figure 7 A flowchart illustrating the sub-steps included in step S320;
[0054] Figure 9 for Figure 7 A flowchart illustrating the sub-steps included in step S330;
[0055] Figure 10 This is a schematic diagram of the composition of the device control apparatus provided in the embodiments of this application.
[0056] Icons: 10-Sender device; 20-Receiver device; 100-Terminal device; 110-Memory; 120-Processor; 130-Communication unit; 140-Control input unit; 150-Function output unit; 400-Device control device; 410-File receiving module; 420-File conversion module; 430-Event injection module; 440-Operation response module. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0058] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0059] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0060] In the description of this application, it should be understood that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. Those skilled in the art will understand the specific meaning of the above terms in this application based on the specific circumstances.
[0061] Through diligent research, the applicant discovered that existing remote synchronous control solutions, in practice, require a sending device to receive user-initiated operations, generate input events matching these operations, and then send these input events to a receiving device. The receiving device then sequentially performs event instantiation and event injection operations for each received input event, based on the event generation sequence, enabling it to execute the corresponding functional operation for each input event. Specifically, the event instantiation operation creates a programming language-matched instantiated event for each input event at a programming language level on the receiving device. The event injection operation injects the instantiated event into the event-receiving hardware on the receiving device, corresponding to the operation-receiving hardware that generated the corresponding input event. The operation-receiving hardware and the event-receiving hardware are of the same device type.
[0062] Alternatively, please refer to Figure 1 , Figure 1 This is a schematic diagram illustrating the device interaction between the transmitting end device 10 and the receiving end device 20 according to an embodiment of this application. In this embodiment, Figure 1The transmitting device 10 and receiving device 20 shown are communicatively connected, allowing a user to remotely control the receiving device 20 from the transmitting device 10. The operating systems used by the transmitting device 10 and the receiving device 20 can be, but are not limited to, Android, iOS, Linux, HarmonyOS, etc.; the transmitting device 10 can be, but is not limited to, any of a smartphone, tablet, smart TV, or other electronic device; and the receiving device 20 can be, but is not limited to, any of a smartphone, tablet, smart TV, multi-screen in-vehicle device, or other electronic device.
[0063] The above-described remote synchronization control scheme is illustrated below using the sending device 10 and the receiving device 20, both equipped with the Android operating system.
[0064] Assumption Figure 1 The transmitting device 10 shown has a touch screen, volume buttons, and other hardware units that can be used as operating receiving hardware. Figure 1 The receiving device 20 shown also has a screen structure (including at least one touch screen or display screen), volume buttons, and other hardware units that can serve as event receiving hardware, which are matched with the sending device 10. At this time, TeamViewer client or InjectInput Client can be installed on the sending device 10 and the receiving device 20 respectively, so as to transmit input events corresponding to user operation between the sending device 10 and the receiving device 20 through TeamViewer client or InjectInput Client.
[0065] If a user performs a user control operation (click operation, single-finger swipe operation, or multi-finger swipe operation) on the touch screen of the sending device 10, the sending device 10 will respond to the user control operation by generating at least one corresponding input event, and then transmit the generated at least one input event to the receiving device 20 through the TeamViewer client or the InjectInput Client client.
[0066] At this time, the receiving device 20 can sequentially inject each received input event into the InputManagerService thread according to the order of input event generation. The InputManagerService thread then instantiates a Java class instance event corresponding to the input event at the Java layer. Subsequently, the InputManagerService thread injects the Java class instance event into the InputDispatcher thread of the receiving device 20 at its own screen structure by calling the InjectInputEvent function. The InputDispatcher thread then dispatches the Java class instance event to the appropriate application window for response, thereby realizing the remote control function of the device.
[0067] Alternatively, the receiving device 20 can sequentially handle each received input event according to the order in which the input events are generated. This is achieved by calling the Sendevent command, which is made using a shell script, under the Android Debug Bridge (ADB). In this way, a Java class instance event corresponding to the input event is instantiated in the Java layer, and the Java class instance event is injected into the device node file of the receiving device 20 at its own screen structure. Then, the InputManagerService thread calls the InputReader thread to read the injected Java class instance event from the device node file of the screen structure, and the InputDispatcher thread calls the InputDispatcher thread to dispatch the read Java class instance event to the appropriate application window for response, thereby realizing the remote control function of the device.
[0068] It is important to note that when dealing with complex user operations, the receiving device needs to inject a large number of input events within a very short time to ensure synchronized control. However, the aforementioned remote synchronization control scheme requires a separate event instantiation operation for each injected event, making it impossible to respond promptly to each input event corresponding to the same user operation. This prevents real-time response to each input event and thus hinders effective synchronized control.
[0069] In this context, to effectively reduce the response time of the receiving device to the user's remote control operation and ensure that the synchronous control effect of the device can be achieved normally, this application embodiment provides a device control method and apparatus, a terminal device and a readable storage medium to achieve the aforementioned functions.
[0070] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0071] In this application, to ensure the effective implementation of device synchronization control, a suitable hardware environment is required for the device synchronization control operation. In this case, this embodiment provides a terminal device to act as either the transmitting device 10 or the receiving device 20, ensuring that the functions of each device can be performed normally.
[0072] Alternatively, please refer to Figure 2 , Figure 2 This is a schematic diagram illustrating the composition of a terminal device 100 provided in an embodiment of this application. In this embodiment, the terminal device 100 may include a memory 110, a processor 120, a communication unit 130, a control input unit 140, and a function output unit 150. The memory 110, processor 120, communication unit 130, control input unit 140, and function output unit 150 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these components may be electrically connected via one or more communication buses or signal lines.
[0073] In this embodiment, the memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The memory 110 is used to store computer programs, and the processor 120 can execute the computer programs accordingly after receiving execution instructions.
[0074] The memory 110 can also store the recognition standards of the terminal device 100 for various user operations, such as recognition standards for specific gesture recognition operations of single / multi-finger swipe operations on the touch screen, and recognition standards for command recognition operations of user pressing volume buttons. Furthermore, the memory 110 can also store the function execution strategies of the terminal device 100 in response to various user commands. For example, for an S-shaped swipe gesture applied by the user on the touch screen, the touch screen can switch the content of the current display screen, or trigger the speaker to adjust the volume, or directly trigger access to a specific application.
[0075] In this embodiment, the processor 120 can be an integrated circuit chip with signal processing capabilities. The processor 120 can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0076] In this embodiment, the communication unit 130 is used to establish a communication connection between the terminal device 100 and other electronic devices through a network, and to send and receive data through the network, wherein the network includes wired communication networks and wireless communication networks. For example, when the terminal device 100 acts as a transmitting device 10, it can communicate with an electronic device through the communication unit 130, and use the connected electronic device as a receiving device 20, thereby achieving device synchronization control by cooperating with the receiving device 20.
[0077] In this embodiment, the control input unit 140 is used to provide the user with an input channel for control operations, so that the user can issue control commands to the terminal device 100 or an electronic device communicatively connected to the terminal device 100. The control input unit 140 may be, but is not limited to, a touchscreen, mouse, keyboard, volume buttons, gamepad, remote control, etc.
[0078] In this embodiment, the function output unit 150 is used to output functional effects to the user that match various control commands, such as providing the user with volume up / down effects, game screen switching effects, and application page switching effects. The function output unit 150 can be, but is not limited to, a touchscreen, speaker, microphone, heat sink, or ventilation module. Optionally, the control input unit 140 and the function output unit 150 can be integrated under certain specific conditions, allowing the same electronic device to simultaneously possess the functions of both the control input unit 140 and the function output unit 150, such as a touchscreen.
[0079] Understandable, Figure 2 The block diagram shown is a schematic diagram of one possible composition of the terminal device 100 described above. The terminal device 100 may also include... Figure 2 The diagram shows more or fewer components, or has the same... Figure 2 The different device configurations are shown. Among them, Figure 2 The components shown can be implemented using hardware, software, or a combination thereof.
[0080] In this application, to ensure that the receiving device 20 accurately senses the user's remote control operations and effectively reduces the response time of the receiving device 20 to the user's remote control operations, while ensuring that the receiving device 20 can execute the functional operations expected by the user's operation, so as to ensure that the device synchronization control effect can be achieved normally, this application embodiment achieves the aforementioned objective by providing a device control method directly applied to the aforementioned transmitting device 10 and the aforementioned receiving device 20. The device control method is described in detail below.
[0081] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating the first device control method provided in this application embodiment. In this application embodiment, Figure 3 The device control method shown can be directly applied to the transmitting end device 10 and the receiving end device 20 that communicate with each other. Figure 3 The device control method shown may include steps S210 to S240.
[0082] In step S210, the sending device responds to the user's remote control operation, generates a matching event forwarding file, and sends the event forwarding file to the receiving device.
[0083] In this embodiment, the event forwarding file includes at least two remote control input events generated at at least one device node of the transmitting device 10 that match the user's remote control operation, wherein the device node is used to represent an electronic device on the transmitting device 10 that acts as a control input unit 140, and the remote control input event is used to represent an input event generated on the transmitting device 10 that acts on the receiving device 20.
[0084] When a user performs a remote control operation on one or more device nodes of the transmitting device 10, the transmitting device 10 will correspondingly call the device node to which the user remote control operation was performed to respond to the user remote control operation. Referring to the first event time resolution of the transmitting device 10, at least two consecutive remote control input events are generated for the user remote control operation. Then, the transmitting device 10 calls its own system kernel to sequentially write the generated at least two remote control input events into the node event file of the device node that responded to the user remote control operation, according to the event generation sequence, in order to classify and save the input events on the transmitting device 10. Here, the first event time resolution represents the preset event generation interval when the transmitting device 10 generates at least two consecutive events, and the node event file is used to record the input events associated with the corresponding device node.
[0085] Then, the transmitting device 10 obtains at least two remote control input events matching the user's remote control operation from the node event files of each device node, and writes them in a specific order into a blank program file adapted to the programming language of the transmitting device 10, thus obtaining an event forwarding file for accurately sensing the user's remote control operation. At this time, the transmitting device 10 sends the obtained event forwarding file to the receiving device 20, enabling the receiving device 20 to accurately sense the user's remote control operation.
[0086] Alternatively, please refer to Figure 4 , Figure 4 yes Figure 3 A flowchart illustrating the sub-steps included in step S210 is provided. In this embodiment, to ensure that the receiving device 20 can effectively respond to user control operations, it is necessary to ensure that the event forwarding file can effectively characterize the implementation process of the user control operation. (Refer to...) Figure 4 The step S210 shown includes sub-steps S211 to S213, which generate such an event forwarding event.
[0087] Sub-step S211: Obtain the event record timing of each remote control input event from the node event file of each device node in the sending device.
[0088] In this embodiment, after generating an input event, the transmitting device 10 calls the system kernel to write the input event to the node event file of the device node that generated the input event. Therefore, the transmitting device 10 can determine the event recording sequence of each remote control input event corresponding to the user's operation by monitoring the event changes recorded in the node event files of each device node in real time. In one implementation of this embodiment, the monitoring of event changes recorded in the node event files can be accomplished by calling the getevent function.
[0089] Sub-step S212: Determine the event recording time point of each remote control input event at the transmitting device based on the first event time resolution of the transmitting device and the event recording timing of each remote control input event.
[0090] In this embodiment, after obtaining the event record timing of each remote control input event in the corresponding node event file, the transmitting device 10 performs data calibration on the time points corresponding to the event record timing of each remote control input event according to the first event time resolution of the transmitting device 10, thereby determining the true and valid event record time point of each remote control input event at the transmitting device 10. The difference between the event record time points corresponding to two adjacent remote control input events is the first event time resolution.
[0091] Sub-step S213: Write at least two remote control input events and their corresponding event recording timestamps into a blank program file at the sending device in chronological order to obtain an event forwarding file.
[0092] Therefore, by executing the above sub-steps S211 to S213, the sending device 10 can accurately perceive the user's control operation, ensuring that the generated event forwarding file can effectively characterize the specific implementation process of the user's control operation, so that the receiving device 20 can correctly execute the functional operation that matches the user's control operation and meet the user's control needs.
[0093] Please refer to this again. Figure 3 In step S220, the receiving device parses and adjusts the received event forwarding file to obtain an event execution file adapted to the programming language.
[0094] In this embodiment, the event execution file includes target input events adjusted from at least two of the remote control input events. After receiving the event forwarding file from the sending device 10, the receiving device 20 performs batch language adaptation conversion on the at least two remote control input events included in the event forwarding file using a programming language adapted to the receiving device 20. This ensures that each target input event is directly adapted to the receiving device 20 in terms of programming language, thereby avoiding the need to perform event instantiation operations for individual input events to a certain extent. This improves the timeliness of the receiving device 20's processing of remote control input events and reduces the response time of the receiving device 20 to user remote control operations. Furthermore, the parsing and adjustment operation performed by the receiving device 20 on the event forwarding file can match the final event execution file with the second event time resolution of the receiving device 20, where the second event time resolution represents the preset event generation interval when the receiving device 20 continuously generates at least two events.
[0095] Alternatively, please refer to Figure 5 , Figure 5 yes Figure 3 A flowchart illustrating the sub-steps included in step S220 is provided. In this embodiment, to ensure that the adjusted event execution file truly matches the receiving device 20, so that the receiving device 20 can directly utilize the target input events included in the event execution file to output the user's expected functional effects, and to achieve the best possible device synchronization control effect, the following can be referred to... Figure 5 The step S220 shown includes sub-steps S221 to S224, which generate a suitable event execution file.
[0096] Sub-step S221 involves using the target programming language adapted by the receiving device to perform language parsing and conversion on the event forwarding file, resulting in the injection file implemented in the target programming language.
[0097] In this embodiment, the target programming language is a basic programming language that the operating system of the receiving device 20 can directly recognize and process, such as C or C++. The file to be injected includes at least two remote control input events corresponding to each of the remote control input events, wherein each remote control input event is converted from a remote control input event using the target programming language.
[0098] Sub-step S222: For each event to be injected in the file to be injected, the hardware device parameters of the device node to which the event to be injected is used to perform parameter debugging on the event to be injected, so as to obtain the target input event that is compatible with the receiving device.
[0099] In this embodiment, the device node at the receiving device 20 represents the electronic device on the receiving device 20 that acts as the control input unit 140. The device node targeted by the event to be injected in the receiving device 20 is the device node in the receiving device 20 that needs to be injected with event content corresponding to the user's control operation. For a set of events to be injected and remote control input events that have a corresponding relationship, the node type of the device node targeted by the event to be injected in the receiving device 20 is the same as the node type of the device node in the transmitting device 10 that generated the remote control input event.
[0100] It is important to note that even if both the sending device 10 and the receiving device 20 have device nodes of the same node type, these same node types may not necessarily have the same hardware parameters. Therefore, if the event content (including event type, event location, etc.) of the input event generated by the sending device 10 is directly applied to the receiving device 20, the response of the receiving device 20 to the input event may not actually match the user's operation.
[0101] Therefore, the receiving device 20 needs to use the hardware device parameters of the device node corresponding to each event to be injected to determine the parameter adjustment of the event to be injected, so as to ensure that the target input event obtained by adjustment is matched with the corresponding device node in the receiving device 20. When at least two target input events are responded to on the corresponding device node, the user's expected function operation can be realized.
[0102] Taking the remote control input event generated by the touch screen of the transmitting device 10 as an example, the device node targeted by the event to be injected corresponding to the remote control input event in the receiving device 20 is the screen structure of the receiving device 20. Then, the hardware device parameters such as the maximum screen display size, screen display resolution, and screen curvature of the screen structure of the receiving device 20 can be used to adjust the parameters of the event to be injected, so that the target input event obtained by the adjustment is compatible with the screen structure of the receiving device 20.
[0103] Sub-step S223: Time calibration is performed on the event recording time point of each remote control input event in the event forwarding file according to the second event time resolution of the receiving device to obtain the event injection time point of each target input event at the receiving device.
[0104] In this embodiment, the event injection time point represents the time when the corresponding target input event is injected into the matching device node in the receiving device 20. The receiving device 20, under its own clock system, uses the time point of receiving the event forwarding file as a reference, determines the response order of each remote control input event based on the event record time point of each remote control input event in the event forwarding file, and then uses the second event time resolution to define the event injection time point of each target input event at the receiving device 20. The event injection interval between two target input events with adjacent event injection time points is equal to the second event time resolution.
[0105] Sub-step S224: Write at least two target input events and their corresponding event injection timestamps into a blank program file at the receiving device in chronological order to obtain an event execution file.
[0106] In this embodiment, the blank program file at the receiving device 20 is generated using a target programming language. The receiving device 20 writes at least two target input events and their corresponding event injection timestamps into the blank program file in chronological order. This ensures that the final generated event execution file is directly compatible with the programming language of the receiving device 20 and truly matches the electronic components of the receiving device 20. The generated event execution file also effectively characterizes the specific implementation process of the user's control operation, enabling the receiving device 20 to correctly execute the functional operations that match the user's control operation and meet the user's control requirements.
[0107] Therefore, by executing the above sub-steps S221 to S224, this application can achieve batch language adaptation and conversion of at least two remote control input events corresponding to the user's operation, and ensure that the converted target input events are truly matched with the electronic components of the receiving device 20. The generated event execution file can also effectively characterize the specific implementation process of the user's operation, so that the receiving device 20 can directly use the target input events included in the event execution file to output the user's expected functional effect, thereby achieving the effect of synchronous device control as much as possible.
[0108] In step S230, the receiving device calls the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0109] In this embodiment, after determining the event execution file that corresponds to the user's operation, the receiving device 20 can directly call the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device 20 through local transmission. This improves the event injection efficiency and allows a large number of target input events adapted to the programming language to be injected into the corresponding device node in a short time, reducing the response time of the receiving device 20 to the user's remote control operation. At the same time, the device node in the receiving device 20 that has been injected with the target input event can also effectively respond to the target input event and call the electronic components that act as the function output unit 150 that match the target input event to implement the corresponding function operation, thereby achieving the effect of synchronous device control.
[0110] Alternatively, please refer to Figure 6 , Figure 6 yes Figure 3 A flowchart illustrating the sub-steps included in step S230. In this embodiment, step S230 may include sub-steps S231 to S232 to ensure that the response process of the receiving device 20 to each target input event substantially matches the specific implementation process of the user's control operation, so that the receiving device 20 correctly executes the functional operation that matches the user's control operation and meets the user's control requirements.
[0111] Sub-step S231 calls the ioctl function included in the device driver to read each target input event one by one from the event execution file.
[0112] Sub-step S232: For each target input event read, write the target input event to the node event file of the device node corresponding to the target input event in the receiving device.
[0113] The ioctl function, located in the device driver, manages the I / O channels of the receiving device 20. It can control certain device characteristics to improve the event injection efficiency of each target input event. Furthermore, the sequential reading of each target input event ensures that the response process of the receiving device 20 to each target input event substantially matches the specific implementation process of the user's operation.
[0114] In step S240, the receiving device drives its own device node to perform a matching response operation based on the injected target input event.
[0115] In this embodiment, when the receiving device 20 injects a target input event into a device node, it will correspondingly drive the device node to call the electronic components acting as the function output unit 150 in the receiving device 20 to perform the function operation corresponding to the target input event, thereby achieving the effect of device synchronization control. In one implementation of this embodiment, the InputManagerService thread can be controlled to call the InputReader thread to read the injected target input event from the node event file of the device node into which the target input event was injected, and the InputDispatcher thread can be called to distribute the read target input event to the electronic components capable of performing the function operation corresponding to the target input event for response.
[0116] Therefore, by executing the above steps S210 to S240, this application can ensure that the receiving device 20 accurately senses the user's remote control operation, effectively reduce the response time of the receiving device 20 to the user's remote control operation, and at the same time ensure that the receiving device 20 can perform the functional operation expected by the user's operation, thereby achieving the effect of synchronous control of the device.
[0117] Furthermore, in this application, embodiments may also provide a device control method directly applied to a receiving device 20 that is communicatively connected to the transmitting device 10, so as to effectively reduce the response time of the receiving device 20 to the user's remote control operation on the receiving device 20 side, so that the receiving device 20 can achieve the effect of device synchronization control under the action of the transmitting device 10.
[0118] Alternatively, please refer to Figure 7 , Figure 7 This is a flowchart illustrating the second device control method provided in this application embodiment. In this application embodiment, Figure 7 The device control method shown can be directly applied to the receiving device 20, which is communicatively connected to the transmitting device 10. Figure 7 The device control method shown may include steps S310 to S340.
[0119] Step S310: Receive an event forwarding file from the sending device that matches the user's remote control operation.
[0120] The event forwarding file includes at least two remote control input events generated at at least one device node of the sending device 10 that match the user's remote control operation.
[0121] Step S320: Parse and adjust the received event forwarding file to obtain an event execution file adapted to the programming language.
[0122] In this embodiment, the event execution file includes target input events adjusted from at least two of the remote control input events. The parsing and adjustment operation in step S230 can perform batch language adaptation conversion on the at least two remote control input events included in the event forwarding file, so that each target input event obtained by conversion is directly adapted to the receiving device 20 in terms of programming language. This avoids, to a certain extent, performing event instantiation operations separately for a single input event, improving the timeliness of the receiving device 20 in processing remote control input events, reducing the response time of the receiving device 20 to user remote control operations, and ensuring that the converted target input events are truly matched with the electronic components of the receiving device 20. The generated event execution file can also effectively characterize the specific implementation process of the user control operation.
[0123] Alternatively, please refer to Figure 8 , Figure 8 yes Figure 7 A flowchart illustrating the sub-steps included in step S320. In this embodiment, step S320 may include sub-steps S321 to S324.
[0124] Sub-step S321 involves using the target programming language adapted by the receiving device to perform language parsing and conversion on the event forwarding file, resulting in the injection file implemented in the target programming language.
[0125] Each file to be injected includes at least two remote control input events corresponding to each of the aforementioned remote control input events, wherein each remote control input event is obtained by converting a remote control input event into a target programming language.
[0126] Sub-step S322: For each event to be injected in the file to be injected, the hardware device parameters of the device node to which the event to be injected is used to perform parameter debugging on the event to be injected, so as to obtain a target input event that is compatible with the receiving device.
[0127] For a set of events to be injected and remote control input events that have a corresponding relationship, the node type of the device node targeted by the event to be injected in the receiving device 20 is the same as the node type of the device node that generated the remote control input event in the sending device 10.
[0128] Sub-step S323: Time calibration is performed on the event recording time point of each remote control input event in the event forwarding file according to the second event time resolution of the receiving device to obtain the event injection time point of each target input event at the receiving device.
[0129] Sub-step S324: Write at least two target input events and their corresponding event injection timestamps into a blank program file at the receiving device in chronological order to obtain an event execution file.
[0130] It is understandable that the specific execution process of the above sub-steps S321 to S324 can be referred to the detailed description of sub-steps S221 to S224 above, and will not be repeated here.
[0131] This application can achieve batch language adaptation and conversion of at least two remote control input events corresponding to user operation by executing the above sub-steps S321 to S324, and ensure that the converted target input events are truly matched with the electronic components of the receiving device 20. The generated event execution file can also effectively characterize the specific implementation process of the user operation, so that the receiving device 20 can directly use the target input events included in the event execution file to output the expected functional effect of the user, and achieve the effect of synchronous control of the device as much as possible.
[0132] Step S330: Call the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0133] In this embodiment, each target input event in the event execution file can be injected into the corresponding device node in the receiving device 20 via local transmission by calling the device driver. This improves the event injection efficiency and allows a large number of target input events adapted to the programming language to be injected into the corresponding device node in a short time, reducing the response time of the receiving device 20 to the user's remote control operation. At the same time, the device node in the receiving device 20 injected with the target input event can also effectively respond to the target input event and call the electronic device that acts as the function output unit 150 matching the target input event to implement the corresponding function operation, thereby achieving the effect of synchronous device control.
[0134] Alternatively, please refer to Figure 9 , Figure 9 yes Figure 7 A flowchart illustrating the sub-steps included in step S330. In this embodiment, step 330 may include sub-steps S331 to S332.
[0135] Sub-step S331 calls the ioctl function included in the device driver to read each target input event one by one from the event execution file.
[0136] Sub-step S332: For each target input event read, write the target input event into the node event file of the device node corresponding to the target input event in the receiving device.
[0137] The method of reading each target input event one by one ensures that the response process of the receiving device 20 to each target input event is substantially matched with the specific implementation process of the user's operation, so that the receiving device 20 correctly executes the functional operation that matches the user's operation and meets the user's control needs.
[0138] Step S340: Drive its own device node to perform a matching response operation based on the injected target input event.
[0139] In this embodiment, when the receiving device 20 injects a target input event into a device node, it will correspondingly drive the device node to call the electronic components that serve as the function output unit 150 in the receiving device 20 to perform the function operation corresponding to the target input event, thereby achieving the effect of device synchronous control.
[0140] Therefore, by executing the above steps S310 to S340, this application can effectively reduce the response time of the receiving device 20 to the user's remote control operation on the receiving device 20 side, so that the receiving device 20 can achieve the effect of device synchronization control under the action of the transmitting device 10.
[0141] In this application, embodiments of this application provide a device control device applied to the aforementioned receiving device 20, so as to execute [the necessary functions] through the device control device. Figure 7 The device control method shown herein includes at least one software function module stored in the storage unit or operating system of the receiving device 20 in the form of software or firmware. The processing unit of the receiving device 20 executes the software function module and computer program included in the device control device. The specific composition of the device control device provided in this application is described below.
[0142] Please refer to Figure 10 , Figure 10 This is a schematic diagram of the device control device 400 provided in an embodiment of this application. In this embodiment, the device control device 400 is applied to the receiving device 20, and the device control device 400 may include a file receiving module 410, a file conversion module 420, an event injection module 430, and an operation response module 440.
[0143] The file receiving module 410 is used to receive an event forwarding file from the sending device that matches the user's remote control operation, wherein the event forwarding file includes at least two remote control input events generated at at least one device node of the sending device that match the user's remote control operation.
[0144] The file conversion module 420 is used to parse and adjust the received event forwarding file to obtain an event execution file adapted to the programming language. The event execution file includes target input events that are adjusted by at least two remote control input events respectively.
[0145] The event injection module 430 is used to call the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device.
[0146] The operation response module 440 is used to drive its own device node to perform a matching response operation based on the injected target input event.
[0147] It should be noted that the basic principle and technical effects of the device control device 400 provided in this application embodiment are the same as those described above. Figure 7 The device control method shown is the same. For brevity, any parts not mentioned in this embodiment can be referred to the above-described methods. Figure 7 The description of the device control method shown.
[0148] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of the apparatus, methods, and computer program products according to embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0149] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part. If the function is implemented as a software functional module 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 this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned readable storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0150] In summary, in the device control method and apparatus, terminal device, and readable storage medium provided in this application, the present application sends at least two remote control input events matching the user's remote control operation to the receiving device via the transmitting device. The receiving device then performs batch language adaptation conversion on the received at least two remote control input events, ensuring that the converted target input events are directly adapted to the receiving device in terms of programming language. This allows the receiving device to directly inject each target input event into the corresponding device node, which then executes a matching response operation based on the injected target input events. This batch language adaptation conversion improves the timeliness of the receiving device's processing of remote control input events and allows for the injection of a large number of language-adapted target input events into the corresponding device nodes in a short time. This effectively reduces the response time of the receiving device to the user's remote control operation, ensuring that the device synchronization control effect can be achieved normally.
[0151] The above descriptions are merely various embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A device control method, characterized in that, The method includes: The sending device responds to the user's remote control operation, generates a matching event forwarding file, and sends the event forwarding file to the receiving device. The event forwarding file includes at least two remote control input events generated at at least one device node of the sending device that match the user's remote control operation. The event forwarding file is a file containing timing information, which is formed by the sending device by batch packaging the at least two remote control input events into a file based on the device's event time resolution and event recording timing. The event forwarding file is parsed and converted using the target programming language adapted to the receiving device to obtain at least two remote control input events corresponding to each of the two events to be injected. For each event to be injected in the file to be injected, the hardware device parameters of the device node targeted by the event to be injected in the receiving device are used to perform parameter debugging on the event to be injected, so as to obtain a target input event adapted to the receiving device. The node type of the device node targeted by the event to be injected in the receiving device is the same as the node type of the device node that generates the corresponding remote control input event in the sending device. Based on the second event time resolution of the receiving device, the event recording time point of each remote control input event in the event forwarding file is time-calibrated to obtain the event injection time point of each target input event at the receiving device; At least two target input events and their corresponding event injection timestamps are written into a blank program file at the receiving device in chronological order to obtain an event execution file. The receiving device calls the ioctl function included in the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device. The receiving device drives its own device node to perform a matching response operation based on the injected target input event.
2. The method according to claim 1, characterized in that, The step of generating a matching event forwarding file includes: The event record timing of each remote control input event is obtained from the node event file of each device node in the transmitting device. The remote control input event is generated by the device node on the transmitting device that responds to the user's remote control operation and is written into the node event file of the device node that responds to the user's remote control operation by the system kernel of the transmitting device. Based on the first event time resolution of the transmitting device and the event recording sequence of each remote control input event, the event recording time point of each remote control input event at the transmitting device is determined; At least two of the remote control input events and their corresponding event recording timestamps are written into a blank program file at the sending device in chronological order to obtain the event forwarding file.
3. The method according to claim 1, characterized in that, The receiving device calls the ioctl function included in the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device, including: The device driver's ioctl function is invoked to read each target input event from the event execution file one by one; For each target input event read, the target input event is written to the node event file of the device node corresponding to the target input event in the receiving device.
4. A device control method, characterized in that, The method, applied to a receiving device that is communicatively connected to a transmitting device, includes: The system receives an event forwarding file from the transmitting device that matches the user's remote control operation. The event forwarding file includes at least two remote control input events generated at at least one device node of the transmitting device that match the user's remote control operation. The event forwarding file is a file containing timing information, which is formed by the transmitting device by batch packaging the at least two remote control input events into a file based on the device's event time resolution and event recording timing. The event forwarding file is parsed and converted using an adapted target programming language to obtain at least two remote control input events corresponding to each of the two events to be injected. For each event to be injected in the file to be injected, the hardware device parameters of the device node targeted by the event to be injected in the receiving device are used to perform parameter debugging on the event to be injected, so as to obtain a target input event adapted to the receiving device. The node type of the device node targeted by the event to be injected in the receiving device is the same as the node type of the device node that generates the corresponding remote control input event in the sending device. Based on the second event time resolution of the receiving device, the event recording time point of each remote control input event in the event forwarding file is time-calibrated to obtain the event injection time point of each target input event at the receiving device; At least two target input events and their corresponding event injection timestamps are written into a blank program file at the receiving device in chronological order to obtain an event execution file. The ioctl function included in the device driver is called to inject each target input event in the event execution file into the corresponding device node in the receiving device. The driver's own device node executes a matching response operation based on the injected target input event.
5. The method according to claim 4, characterized in that, The ioctl function included in the device driver call injects each target input event in the event execution file into the corresponding device node in the receiving device, including: The device driver's ioctl function is invoked to read each target input event from the event execution file one by one; For each target input event read, the target input event is written to the node event file of the device node corresponding to the target input event in the receiving device.
6. A device control apparatus, characterized in that, The apparatus is used in a receiving device that is communicatively connected to a transmitting device, the apparatus comprising: The file receiving module is used to receive an event forwarding file from the sending end device that matches the user's remote control operation. The event forwarding file includes at least two remote control input events generated at at least one device node of the sending end device that match the user's remote control operation. The event forwarding file is a file containing timing information that is formed by the sending end by batch packaging the at least two remote control input events into a file based on the device's event time resolution and event recording timing. The file conversion module is used to perform language parsing and conversion on the event forwarding file using an adapted target programming language to obtain at least two remote control input events corresponding to each of them; for each event to be injected in the file, the hardware device parameters of the device node to which the event to be injected is used to perform parameter debugging on the event to be injected, so as to obtain a target input event adapted to the receiving device, wherein the node type of the device node to which the event to be injected is applied in the receiving device is the same as the node type of the device node that generated the corresponding remote control input event in the sending device; the event recording time point of each remote control input event in the event forwarding file is time-calibrated according to the second event time resolution of the receiving device to obtain the event injection time point of each target input event at the receiving device; and the at least two target input events and their corresponding event injection time points are written into a blank program file at the receiving device in chronological order to obtain an event execution file. The event injection module is used to call the ioctl function included in the device driver to inject each target input event in the event execution file into the corresponding device node in the receiving device. The operation response module is used to drive its own device node to execute a matching response operation based on the injected target input event.
7. A terminal device, characterized in that, It includes a processor and a memory, the memory storing a computer program that can be executed by the processor to implement the device control method according to any one of claims 1-5.
8. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the device control method according to any one of claims 1-5.
Citation Information
Patent Citations
Task scheduling method of event injection engine based on multilevel feedback queue
CN103970603A
Multi-queue event injection device with time sequence control function and method
CN106201689A