Control method and system based on webpage browser interaction local device program upgrading

By introducing the local proxy service, the problem of difficulty in calling the host program by the browser is solved, the interaction between the browser and the host is realized, the development cost is reduced and the system stability is improved, and it is suitable for different system platforms.

CN118733085APending Publication Date: 2024-10-01WUHAN FRIENDCOM TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410833789.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

It is difficult for the browser to call the host program and it is difficult to interact between the two. Developers need to learn and master multiple languages ​​​​to upgrade the program, which is inefficient and costly.

Method used

By introducing the local proxy service, the web browser based on Node.js sends the upgrade request to the local proxy service, and uses tools such as HTTP Rustful API and J-Link emulator to realize the control and compilation of the host program by the web browser, reducing the cost It reduces the cost of developers learning multiple languages ​​and saves the maintenance costs of cloud servers and hardware servers.

Benefits of technology

It realizes the interaction between the browser and the host program, reduces the development cost, improves the reliability and stability of the system, reduces the repeated development and learning costs of developers, and is suitable for the operating environments of different system platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733085A_ABST
    Figure CN118733085A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for controlling program upgrading of interactive local equipment based on a web browser, relates to the technical field of program upgrading, and solves the technical problems that a browser is difficult to call a host machine program, the program upgrading operation efficiency is relatively low and the cost is relatively high. The control method comprises the following steps: a Node.js-based webpage browser sends a local equipment program upgrading request to a local proxy service; based on the HTTP Rustful API service provided by the local proxy service, the webpage browser controls a local device program and an interface of the host machine, and after the local device program and the interface are executed by the local proxy service, an execution result is returned to the webpage browser in an HTTP response mode; and the local proxy service integrates a J-Link simulator and a system environment variable required by local equipment program upgrading, calls a software program to complete file compiling, and performs program upgrading on the STM32 chip target board. According to the method, the interaction between the web browser and the host local program is realized by introducing the local proxy service, and the cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program upgrade, and in particular to a control method and system for upgrading a local device program based on web browser interaction. Background Art

[0002] A browser is an application used to retrieve, display, and transmit Web information resources. Web information resources are marked by Uniform Resource Identifiers (URIs), which are web pages, pictures, videos, or any content presented on the Web. Users can browse interrelated information through browsers with the help of hyperlinks.

[0003] Calling local applications in the browser is a common requirement, especially in modern web development, where users expect web pages to integrate seamlessly with their local devices and applications. This integration not only improves the user experience, but also promotes the functional expansion and performance optimization of web applications. To achieve this goal, developers need to understand and master some key technologies and methods. When choosing a method to call a local application, developers need to consider multiple factors, including compatibility of the target platform, user experience, security, and implementation complexity. Each method has its advantages and limitations, so choosing the most suitable method depends on the specific application scenario and requirements.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] It is difficult for browsers to call host programs, and it is difficult for the two to interact. Developers need to learn and master multiple languages ​​to perform program upgrades, which is inefficient and costly. Summary of the invention

[0006] The purpose of the present invention is to provide a control method and system for upgrading local device programs based on web browser interaction, so as to solve the technical problems in the prior art that it is difficult for browsers to call host programs, it is difficult for the two to interact, developers need to learn and master multiple languages ​​to upgrade host programs, and the efficiency is low and the cost is high. The many technical effects that can be produced by the preferred technical solutions among the many technical solutions provided by the present invention are described in detail below.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] The present invention provides a control method for upgrading a local device program based on a web browser interaction, comprising the following steps: S100: a web browser based on Node.js sends a request for upgrading a local device program to a local proxy service; S200: based on an HTTP Rustful API service provided by the local proxy service, the web browser manipulates the local device program and interface of a host machine, and after execution by the local proxy service, returns the execution result to the web browser in the form of an HTTP response; S300: the local proxy service integrates a J-Link emulator and system environment variables required for upgrading the local device program, calls a software program to complete the compilation of a file, and performs a program upgrade on an STM32 chip target board.

[0009] Preferably, the local proxy service is written in Java, C#, Python, C / C++, or developed based on Node.js, and runs on the host machine as an HTTP server.

[0010] Preferably, the version of Node.js is 16.20.1.

[0011] Preferably, the local proxy service is run through a MuCoOS Agent plug-in.

[0012] Preferably, the local proxy service is used to call Windows CLI instructions and Windows DOM instructions of the host machine.

[0013] Preferably, the web browser and the local proxy service interact with each other via HTTP protocol or WebSocket protocol.

[0014] Preferably, in step S200, the interface of the host machine is a USB interface, and the program is upgraded through the Stellar-M-EVA evaluation board.

[0015] Preferably, in step S300, the local proxy service compiles the C / C++ program code edited by the web browser to generate a hex file or a bin file of STM32.

[0016] Preferably, in step S300, the system environment variable is a temporary folder location and a system folder location of the operating system running environment specified in the operating system.

[0017] A system for upgrading local device programs based on browser interaction, used for running any of the above methods for upgrading local device programs based on browser interaction, comprising a web browser module, a local proxy service module, a host machine, and an evaluation board; the web browser module and the local proxy service module are communicatively connected, the local proxy service module and the host machine are communicatively connected, and the host machine and the evaluation board are connected via a USB serial port; the web browser module is used for editing the C / C++ program code required for upgrading the local device program and sending it to the local proxy service module; the local proxy service module runs on the host machine, and is used for editing the C / C++ program code required for upgrading the local device program, generating the file format required for upgrading the local device program, and using the integrated system environment variables and J-Link software to burn the program; the evaluation board is used for executing the local device program upgrade.

[0018] Implementing one of the above technical solutions of the present invention has the following advantages or beneficial effects:

[0019] The present invention introduces a local proxy service to help the web browser control operations that cannot be performed by the local machine, realizes the interaction between the web browser and the host's local program, and reduces the learning cost of developers who need to master multiple development languages. At the same time, by running the local program of the host machine, the web browser can save the company's cloud server maintenance, operation, hardware server and other costs, and is applicable to scenarios such as: cloud compilation, packaging, etc. The local proxy service helps solve problems in the operating environment of different system desktop platforms by integrating the program environment. In addition, in the event of an abnormal program failure, the system can still run stably, improving the reliability and stability of the system. Compared with the existing development method, it reduces the cost of repeated development and learning for developers, thereby enabling rapid iteration of the company's software products. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. It is obvious that the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0021] Figure 1 is a flowchart of a control method for upgrading a local device program based on browser interaction according to a first embodiment of the present invention;

[0022] Figure 2 It is a working schematic diagram of the Stellar-M-EVA evaluation board of the control method for upgrading the local device program based on browser interaction according to the first embodiment of the present invention;

[0023] Figure 3 1 is a working diagram of MuCoOSAgent of a control method for upgrading a local device program based on browser interaction according to a first embodiment of the present invention;

[0024] Figure 4 This is a flow chart of program burning through J-Link by a local proxy service of a method for upgrading a local device program based on browser interaction according to a first embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solutions and advantages of the present invention clearer, the various exemplary embodiments to be described below will refer to the corresponding drawings, which constitute a part of the exemplary embodiments, wherein various exemplary embodiments that may be used to implement the present invention are described. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation methods described in the following exemplary embodiments do not represent all implementation methods consistent with the present disclosure. It should be understood that they are only examples of processes, methods, devices, etc. that are consistent with some aspects of the present disclosure as detailed in the attached claims, and other embodiments may also be used, or the embodiments listed herein may be modified in structure and function without departing from the scope and essence of the present invention.

[0026] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", etc. indicate the orientation or positional relationship based on the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the elements referred to must have a specific orientation, be constructed and operated in a specific orientation. The terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. The term "multiple" means two or more. The terms "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, an integral connection, a mechanical connection, an electrical connection, a communication connection, a direct connection, an indirect connection through an intermediate medium, and can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more related listed items. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.

[0027] In order to illustrate the technical solution of the present invention, a specific embodiment is used below for description, and only the parts related to the embodiment of the present invention are shown.

[0028] Embodiment 1:

[0029] like Figure 1As shown, the present invention provides a control method for upgrading local device programs based on web browser interaction, including the following steps: S100: A web browser based on Node.js sends a request for upgrading the local device program to a local proxy service. Node.js is based on Chrome's V8 engine, and encapsulates and optimizes the V8 engine to make it more suitable for running on the server side. Therefore, the web browser is preferably Google Chrome. S200: Based on the HTTPRustful API service provided by the local proxy service, the web browser controls the local device program and interface of the host machine. After being executed by the local proxy service, the execution result is returned to the web browser in the form of HTTP response. The web browser can send HTTP normally, and the local proxy service of the host machine completes the corresponding function. At the same time, the host machine can run Windows 10 / 11, Linux (Ubuntu, Debian), and Mac OS systems, thereby improving the adaptability of the present invention. S300: The local proxy service integrates the J-Link emulator and system environment variables required for upgrading the local device program, calls the software program to complete the compilation of the file, and upgrades the program of the STM32 chip target board, thereby realizing the upgrade of the local device program. By integrating the system environment required by the program, it can help solve the difficult and complicated problems encountered when the host machine runs the local program. The present invention introduces a local proxy service to help the web browser control the operations that the local machine cannot perform, realizes the interaction between the web browser and the host native program, and reduces the learning cost of developers who need to master multiple development languages. At the same time, by running the local program of the host machine, the web browser can save the company's cloud server maintenance, operation, hardware server and other costs, and is applicable to scenarios such as: cloud compilation, packaging, etc. The local proxy service helps solve the problems of the operating environment of different system desktop platforms by integrating the program environment. In addition, in the event of an abnormal program failure, the system can still run stably, improving the reliability and stability of the system. Compared with the existing development method, it reduces the cost of repeated development and learning for developers, so that the company's software products can be quickly iterated.

[0030] As an optional implementation, the local proxy service is written in Java, C#, Python, C / C++, so that it can replace the program code written in Node.js to control the host's local program. The local proxy service may be developed based on Node.js and run on the host as an HTTP server. When the host is started, the program helps to execute functions when the browser program needs to use the host's local program. Node.js is an open source, cross-platform JavaScript runtime environment for developing server-side and network applications. It allows JavaScript code to run on the server side, thereby realizing the use of JavaScript to develop the backend. Node.js uses an event-driven and non-blocking I / O model, which is lightweight and efficient. It is very suitable for building data-intensive real-time applications running on distributed devices. It is a popular tool that can be used for almost any project. The version of Node.js is 16.20.1, which is the current mainstream version of Node.js, so it can meet the needs of most scenarios.

[0031] As an optional implementation, the local proxy service runs through the MuCoOS Agent plug-in. After the MuCoOS Agent plug-in is installed on the host machine, it can be started when the host machine is turned on. The MuCoOS Agent plug-in facilitates the web browser to call the host machine interface through the local proxy service and burn the program. Figure 3 As shown in the figure: (1) The web page sends an HTTP request to the MuCoOS Agent (local proxy service) plug-in; (2) The MuCoOS Agent (local proxy service) plug-in calls the host computer serial port, filters out the Stellar-M-EVA device, and queries the device information; (3) The MuCoOS Agent (local proxy service) plug-in responds to the web page via HTTP. The process of the local proxy service burning the program through J-Link is shown in the figure. Figure 4 As shown in the figure: (1) The web page connects to the MuCoOS Agent (local agent service) plug-in through WebSocket and subscribes to messages from the MuCoOS Agent (local agent service) plug-in; (2) The web page sends a burning request, and the MuCoOSAgent (local agent service) plug-in comes with the environment required by J-Link, and will overwrite the host's environment variables before running; (3) Use the J-Link program for burning, and the MuCoOS Agent (local agent service) plug-in will push the executed console log to the web page through the WebSocket channel.

[0032] As an optional implementation, the local proxy service is used to call the Windows CLI instructions and Windows DOM instructions of the host machine, and the above two instructions facilitate program upgrades.

[0033] As an optional implementation method, the web browser and the local proxy service interact through the HTTP protocol or the WebSocket protocol. The above interaction method facilitates fast communication between the web browser and the local proxy service. If an exception occurs in the local proxy service, the exception message will be replied to the web program, which will be collected by the web program and reported to the background program to record the problem. The developer updates the local proxy service by pushing a new version. The HTTP protocol and the WebSocket protocol are both application layer protocols based on TCP reliable transmission. The WebSocket protocol is a two-way communication protocol that can send or receive information in both directions. HTTP is a connection initiated by the browser to the server. The server does not know this connection in advance, and the connection is stateless. The two interaction methods of the HTTP protocol and the WebSocket protocol can improve the adaptability of communication between web browsers and local proxy services.

[0034] As an optional implementation, in step S200, the interface of the host machine is a USB interface, which is universal and easy to operate, and is convenient for data transmission, debugging, etc., and also saves the trouble of interface conversion. Figure 2 As shown in the figure, the Stellar-M-EVA evaluation board can be connected to the host through the USB interface, so that the evaluation board can be operated through the MuCoOS Agent plug-in of the local proxy service. After the host sends instructions to the Stellar-M-EVA evaluation board, the Stellar-M-EVA evaluation board receives and executes the instructions, and the local device program can be upgraded. Therefore, the local proxy server can perform OTA and other operations on the device connected to the USB.

[0035] As an optional implementation, in step S300, the local proxy service compiles the C / C++ program code edited by the web browser. The C / C++ program code has good versatility and is convenient for program upgrades of the STM32 chip target board. It generates STM32 hex files or bin files. Both file formats can realize program upgrades and can be selected according to the usage scenario. Hex files are a common target file format compiled and output by microcontrollers and embedded engineering. When it is downloaded to the microcontroller through a burning tool, the program can run in the chip. When it is necessary to implement IAP remote upgrade of the chip firmware, the Bin file will be written to the internal Flash of the chip through the Bootloader program.

[0036] As an optional implementation, in step S300, the system environment variables are temporary folder locations and system folder locations that specify the operating system running environment in the operating system. By integrating the system variables, smooth upgrade of the program is facilitated.

[0037] The embodiment is only a specific example and does not represent only one implementation mode of the present invention.

[0038] Embodiment 2:

[0039] A system for upgrading local device programs based on browser interaction is used to run the method for upgrading local device programs based on browser interaction in Example 1, including a web browser module, a local proxy service module, a host machine, and an evaluation board. The web browser module and the local proxy service module are connected in communication, the local proxy service module and the host machine are connected in communication, and the host machine and the evaluation board are connected via a USB serial port; the web browser module is used to edit the C / C++ program code required for upgrading the local device program and send it to the local proxy service module; the local proxy service module runs on the host machine, and is used to edit the C / C++ program code required for upgrading the local device program, generate the file format required for upgrading the local device program, and use the integrated system environment variables and J-Link software to burn the program; the evaluation board is used to execute the local device program upgrade. The system of the present invention, by introducing a local proxy service, helps the web browser to control operations that cannot be performed by the local machine, realizes the interaction between the web browser and the host machine program, and reduces the learning cost of developers who need to master multiple development languages. At the same time, by running the local program of the host machine, the web browser can save the company's cloud server maintenance, operation, hardware server and other costs, and is applicable to scenarios such as cloud compilation and packaging. The local proxy service helps solve the problems of running environments on different system desktop platforms by integrating the program environment. In addition, in the case of abnormal program failures, the system can still run stably, improving the reliability and stability of the system. Compared with the existing development methods, it reduces the cost of repeated development and learning for developers, thereby enabling the rapid iteration of the company's software products.

[0040] The above description is only the preferred embodiment of the present invention. It is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application belong to the protection scope of the present invention.

Claims

1. A control method for upgrading a local device program based on a web browser interaction, characterized in that: The following steps are involved: S100: The Node.js-based web browser sends a request for upgrading the local device program to the local proxy service; S200: Based on the HTTP Rustful API service provided by the local proxy service, the web browser controls the local device program and interface of the host machine, and after being executed by the local proxy service, the execution result is returned to the web browser in the form of an HTTP response; S300: The local proxy service integrates the J-Link emulator and system environment variables required for local device program upgrades, calls the software program to complete file compilation, and upgrades the program of the STM32 chip target board.

2. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: The local proxy service is written in Java, C#, Python, C / C++, or developed based on Node.js, and runs on the host machine as an HTTP server.

3. The control method for upgrading a local device program based on a web browser interaction according to claim 2, characterized in that: The Node.js version is 16.20.

1.

4. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: The local agent service is run through the MuCoOS Agent plug-in.

5. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: The local proxy service is used to call Windows CLI instructions and Windows DOM instructions of the host machine.

6. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: Web browsers and local proxy services interact with each other via HTTP or WebSocket.

7. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: In the step S200, the interface of the host machine is a USB interface, and the program is upgraded through the Stellar-M-EVA evaluation board.

8. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: In step S300, the local proxy service compiles the C / C++ program code edited by the web browser to generate a hex file or a bin file of STM32.

9. The control method for upgrading a local device program based on a web browser interaction according to claim 1, characterized in that: In step S300, the system environment variable is a temporary folder location and a system folder location of the operating system running environment specified in the operating system.

10. A system for upgrading local device programs based on browser interaction, characterized in that: A method for running a local device program upgrade based on browser interaction as described in any one of claims 1 to 9, comprising a web browser module, a local proxy service module, a host machine, and an evaluation board; the web browser module and the local proxy service module are communicatively connected, the local proxy service module and the host machine are communicatively connected, and the host machine and the evaluation board are connected via a USB serial port; the web browser module is used to edit the C / C++ program code required for the local device program upgrade and send it to the local proxy service module; the local proxy service module runs on the host machine, is used to edit the C / C++ program code required for the local device program upgrade, generates the file format required for the local device program upgrade, and uses the integrated system environment variables and J-Link software to burn the program; the evaluation board is used to execute the local device program upgrade.