Mining gap equipment discovery method based on OpenHarmony
By writing shell scripts in node and calling the functions of OpenHarmony Device Connector application, the complexity and high cost of maintenance and discovery of mining Hongmeng equipment in the existing technology is solved, and an efficient and convenient equipment discovery and maintenance process is achieved.
Patent Information
- Application Number
- CN202411777468.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-21
AI Technical Summary
When maintaining and discovering mining Hongmeng equipment, the existing technology requires complex command line operations, which leads to high maintenance costs, high difficulty, and high learning costs, which affects work efficiency.
By writing shell scripts in node, calling the corresponding functions of the OpenHarmony Device Connector application, the discovery task of mining Hongmeng devices is realized, and complex commands are simplified into page display of computer desktop programs.
It greatly reduces the R&D test time and the difficulty of on-site operation and maintenance, improves work efficiency, reduces learning costs, and simplifies the operation process, avoiding the risk of input errors.
Smart Images

Figure CN119669086A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a mining Hongmeng device discovery method based on OpenHarmony. Background Art
[0002] With the continuous development of Internet technology, R&D workers and underground practitioners have higher and higher requirements for the real-time and convenience of maintenance work. In the original maintenance mode, R&D personnel need to connect the device, open the shell terminal tool, download the hdc.exe file, and execute the corresponding script commands in the program file through the shell to discover and maintain the device, which leads to high maintenance costs and difficulties.
[0003] The emergence of OpenHarmony Device Connector has facilitated the maintenance work of practitioners. OpenHarmony Device Connecto is a command-line tool for debugging released by Hongmeng, which can interact with real devices on the Windows system. Electron is the current mainstream Windows application development architecture, but the Hongmeng devices currently used are discovered at the computer terminal, and the device discovery is completed by calling OpenHarmony DeviceConnector through the command line. In the actual test and development environment, it greatly affects work efficiency and has a high learning cost when put into field use, which is not conducive to promotion and use. Summary of the invention
[0004] The purpose of the present invention is to solve the above problems and provide a mining Hongmeng device discovery method based on OpenHarmony, which uses node to call shell scripts to complete the use of Hongmeng's debugging tools in windows applications, and simplifies complex commands into page displays of computer desktop programs, greatly reducing the R&D testing time and the difficulty of on-site operation and maintenance.
[0005] In order to achieve the above object, the technical solution of the present invention is: A mining device discovery method based on OpenHarmony, comprising the following steps: S1. The rendering process uses IPC calls to send message data to the preload layer; S2. After receiving the message data, the pre-loaded layer calls the ipcRenderer.invoke module to send the message data to the main process; S3, the main process monitors the message data through the ipcMain.handle module and determines whether to execute the Ethernet discovery mode or the USB discovery mode according to the content of the message data; S4 When it is determined to execute the Ethernet discovery mode, the main process uses the execfile function in the child_process module to execute the netDiscover script. The netDiscover script calls the hdc.exe program file to execute the Ethernet device discovery program to discover the Hongmeng device information. S5. When it is determined that the USB discovery mode is to be executed, the main process uses the execfile function in the child_process module to execute the usbDiscover script; the usbDiscover script calls the hdc.exe program file, and the hdc.exe program file executes the USB device discovery program to discover Hongmeng device information; S6. The hdc.exe program file feeds back the discovered Hongmeng device information results to the main process; S7. In the main process, the ipcMain.handle module is used to monitor the Hongmeng device information results and send them to the preloading layer; S8. The rendering process listens to the Hongmeng device information results through the window.bridge module opened to the outside through the pre-loading layer, and processes and displays the received Hongmeng device information results to complete the Hongmeng device discovery service.
[0006] Furthermore, the netDiscover script and the usbDiscover script are shell command scripts.
[0007] Furthermore, the execfile function in the child_process module is created by the node node.
[0008] Compared with the prior art, the present invention has the following advantages and positive effects: The present invention completes the writing of shell scripts in the node, executes the corresponding functions in the OpenHarmonyDevice Connector application by calling the script information, and finally realizes the discovery task of Hongmeng devices for mining; it simplifies complex commands into page displays of computer desktop programs, greatly reducing the R&D testing time and the difficulty of on-site operation and maintenance, thereby improving the work efficiency of R&D testing operations and reducing the learning cost of on-site operation and maintenance operations; at the same time, it simplifies the operating process, avoids the occurrence of input errors that may exist during manual input, and effectively improves the operational convenience of discovering the Hongmeng debugging tool through the Windows application in actual scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0010] Figure 1 It is the framework logic diagram of the present invention. DETAILED DESCRIPTION
[0011] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work, any modifications, equivalent substitutions, improvements, etc., should be included in the protection scope of the present invention.
[0012] This embodiment discloses a mining Hongmeng device discovery method based on OpenHarmony, which is mainly used to complete the discovery of mining Hongmeng devices. It completes shell script writing in the node and executes the corresponding functions in the OpenHarmony Device Connector application by calling the script information; like Figure 1 As shown, the mining device discovery method based on OpenHarmony includes the following steps: S1. The rendering process uses IPC calls to send message data to the preload layer; S2. After receiving the message data, the pre-loaded layer calls the ipcRenderer.invoke module to send the message data to the main process; S3, the main process monitors the message data through the ipcMain.handle module and determines whether to execute the Ethernet discovery mode or the USB discovery mode according to the content of the message data; S4 When it is determined to execute the Ethernet discovery mode, the main process uses the execfile function in the child_process module to execute the netDiscover script. The netDiscover script calls the hdc.exe program file to execute the Ethernet device discovery program to discover the Hongmeng device information. S5. When it is determined that the USB discovery mode is to be executed, the main process uses the execfile function in the child_process module to execute the usbDiscover script; the usbDiscover script calls the hdc.exe program file, and the hdc.exe program file executes the USB device discovery program to discover Hongmeng device information; S6. The hdc.exe program file feeds back the discovered Hongmeng device information results to the main process; S7. In the main process, the ipcMain.handle module is used to monitor the Hongmeng device information results and send them to the preloading layer; S8. The rendering process listens to the Hongmeng device information results through the window.bridge module opened to the outside through the pre-loading layer, and processes and displays the received Hongmeng device information results to complete the Hongmeng device discovery service.
[0013] In fact, the present invention is similar in structure to the sending, receiving and executing operations of messages through a message sending module, a message monitoring module, a process processing module, a message returning module and an external program execution module; The effect of the message sending module is: the rendering process uses IPC to send messages to the preloading layer, and the preloading layer sends messages to the main process through ipcRenderer.invoke; The effect of the message monitoring module is: the main process listens to the messages sent by the preloaded layer by calling ipcMain.handle; The effect of the process processing module is: the main process determines which device discovery method to use, and then uses the execFile function in child_process to execute the corresponding shell command execution script and system command to complete device discovery; the shell command execution script is the netDiscover script and the usbDiscover script.
[0014] The effect of the external program execution module is: calling the hdc.exe program file, executing the corresponding shell script, and returning the execution result to the main program.
[0015] When the present invention performs a discovery operation on Hongmeng devices for mining, the pre-loaded layer of IPC calls different discovery modes to discover devices by calling ipc.Renderer.invoke(netDiscover) and ipc.Renderer.invoke(usbDiscover) methods, and the discovery modes are Ethernet discovery mode and USB discovery mode, respectively; in the main process, ipcMain.handle(netDiscover) and ipcMain.handl(usbDiscover) are used to listen to messages and execute the execFile function provided by the child_process of node to execute the corresponding script information. After the corresponding script information is executed in the hdc.exe file, the electron rendering process receives the device information and processes and displays it, displaying the IP information, serial number and other information of the discovered device.
[0016] The present invention completes the writing of shell scripts in the node, executes the corresponding functions in the OpenHarmonyDevice Connector application by calling the script information, and finally realizes the discovery task of Hongmeng devices for mining; it simplifies complex commands into page displays of computer desktop programs, greatly reducing the R&D testing time and the difficulty of on-site operation and maintenance, thereby improving the work efficiency of R&D testing operations and reducing the learning cost of on-site operation and maintenance operations; at the same time, it simplifies the operating process, avoids the occurrence of input errors that may exist during manual input, and effectively improves the operational convenience of discovering the Hongmeng debugging tool through the Windows application in actual scenarios.
Claims
1. A mining device discovery method based on OpenHarmony, characterized in that: The following steps are involved: S1. The rendering process uses IPC calls to send message data to the preload layer; S2. After receiving the message data, the pre-loaded layer calls the ipcRenderer.invoke module to send the message data to the main process; S3, the main process monitors the message data through the ipcMain.handle module and determines whether to execute the Ethernet discovery mode or the USB discovery mode according to the content of the message data; S4 When it is determined to execute the Ethernet discovery mode, the main process uses the execfile function in the child_process module to execute the netDiscover script. The netDiscover script calls the hdc.exe program file to execute the Ethernet device discovery program to discover the Hongmeng device information. S5. When it is determined that the USB discovery mode is to be executed, the main process uses the execfile function in the child_process module to execute the usbDiscover script; the usbDiscover script calls the hdc.exe program file, and the hdc.exe program file executes the USB device discovery program to discover Hongmeng device information; S6. The hdc.exe program file feeds back the discovered Hongmeng device information results to the main process; S7. In the main process, the ipcMain.handle module is used to monitor the Hongmeng device information results and send them to the preloading layer; S8. The rendering process listens to the Hongmeng device information results through the window.bridge module opened to the outside through the pre-loading layer, and processes and displays the received Hongmeng device information results to complete the Hongmeng device discovery service.
2. The method for discovering mining equipment based on OpenHarmony as claimed in claim 1, characterized in that: The netDiscover script and the usbDiscover script are shell command scripts.
3. The method for discovering mining equipment based on OpenHarmony as claimed in claim 1, characterized in that: The execfile function in the child_process module is created by the node node.