Method for interaction between WEB application and equipment based on WASM
By using WASM technology in WEB applications, managing hardware device libraries and providing unified interface libraries and driver conversion libraries, the problems of high integration costs and low efficiency in interaction between WEB applications and hardware devices are solved, and more efficient integration and user experience is achieved.
Patent Information
- Application Number
- CN202510105559.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the interaction between WEB applications and hardware devices requires the use of intermediate layers such as WebSocket and Http, resulting in high integration costs and low efficiency.
Through the visual IDE integration tool, the hardware device library is managed, the unified interface library and driver conversion library is provided, the hardware device's driver service conversion is configured to form WASM, and the WASM is integrated into the unified interface layer to realize the interaction between WEB applications and hardware devices.
It reduces the integration cost of WEB applications and hardware devices, improves integration efficiency and user experience, supports native language driver code compilation into WASM, and supports installed native driver calls through WASM.
Smart Images

Figure CN119987907A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method for WEB application and device interaction based on WASM, and relates to the application field of Internet of Things (IoT). Background Art
[0002] WEB applications interact with hardware, such as Bluetooth, USB, serial, camera, microphone and other devices, and sometimes need to use WebSocket, Http and other intermediate layers to interact with other devices. Currently, except for modern smart devices for ordinary consumer scenarios that natively provide Bluetooth, http and other services, most devices do not provide Bluetooth, http, websocket services. Drivers need to be developed specifically for them, and http or WebSocket services need to be provided in the driver to have the ability to interact with WEB, which increases the integration cost of WEB applications and hardware devices, and the integration efficiency is low. Summary of the invention
[0003] In view of the problems of the prior art, the present invention provides a method for WEB application and device interaction based on WASM, which has the characteristics of strong versatility and simple implementation, and has broad application prospects.
[0004] The specific scheme proposed by the present invention is:
[0005] The present invention provides a method for WEB application and device interaction based on WASM, comprising:
[0006] Through the visual IDE integration tool, use the tool to manage the hardware device library that supports integration in the visual interface.
[0007] Manage unified interface library: Provide unified access interface and JS interaction through unified interface library, and provide defined unified interface to connect with hardware devices.
[0008] Manage driver conversion library: Use the driver conversion library to configure the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface.
[0009] Collect hardware drivers provided by various hardware device manufacturers and manage hardware device drivers.
[0010] Configure the conversion of the driver service of each hardware device to a unified service, compile it into WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device.
[0011] Furthermore, in the method for WEB application and device interaction based on WASM, when managing the hardware device library that supports integration, the hardware device type and hardware device details used for integration are recorded in the hardware device library.
[0012] Furthermore, in the method for WEB application and device interaction based on WASM, when configuring the conversion of the driver service of each hardware device to a unified service, driver conversion is provided, and a WASM interface declaration is provided through the hardware device interface, and the actual driver method is called in the interface.
[0013] Furthermore, the method for interacting a WEB application with a device based on WASM releases the compiled WASM, including: supporting the generation of a WASM driver file package, packaging the uploaded native driver package, and an interface document package.
[0014] The present invention also provides a WASM-based WEB application and device interaction device, including a management module and a visualization tool module.
[0015] The visualization tool module integrates tools through the visualization IDE, and the management module uses tools to manage the hardware device library that supports integration in the visualization interface.
[0016] Management module manages unified interface library: provides unified access interface and JS interaction through unified interface library, and provides defined unified interface to connect with hardware devices.
[0017] The management module manages the driver conversion library: the driver conversion library configures the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface.
[0018] The management module collects hardware drivers provided by various hardware device manufacturers and manages hardware device drivers.
[0019] Configure the conversion of the driver service of each hardware device to a unified service, compile it into WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device.
[0020] Furthermore, when the management module of the WASM-based WEB application and device interaction apparatus manages the hardware device library that supports integration, the hardware device type and hardware device details used for integration are recorded in the hardware device library.
[0021] Furthermore, when the management module of the device for interacting with a WASM-based WEB application and a device configures the conversion of the driver service of each hardware device to a unified service, it provides driver conversion, provides a WASM interface declaration through the hardware device interface, and implements the actual driver method call in the interface.
[0022] Furthermore, the management module of the device for interacting with a WASM-based WEB application and a device releases the compiled WASM, including: supporting the generation of a WASM driver file package, packaging the uploaded native driver package, and an interface document package.
[0023] The benefits of the present invention are:
[0024] The present invention enables WEB applications to call hardware drivers through the exchange of JS and WASM, fully reusing the old, reusing the existing integration, and supporting the provision of WASM driver integration. It supports the compilation of native language driver code into WASM, and supports the calling of installed native drivers through WASM. It reduces the integration cost of WEB applications and hardware devices, and improves the integration efficiency and expected experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the device library in the visual interface.
[0026] Figure 2 It is a schematic diagram of the unified interface library in the visual interface.
[0027] Figure 3 It is a schematic diagram of driver integration in the visual interface.
[0028] Figure 4 It is a schematic diagram of the drive conversion in the visual interface.
[0029] Figure 5 It is a schematic diagram of compilation and release in the visual interface. DETAILED DESCRIPTION
[0030] WebAssembly, or WASM for short, is a virtual instruction set architecture that uses an assembly-like language with a compact binary format and can run in modern browsers with near-native performance. It supports languages such as C / C++, C#, and Rust to be compiled into WebAssembly to run on the Web, and is designed to coexist with JavaScript, allowing the two to work together, so that code written in various languages can run efficiently on the Web, expanding the performance and functionality of Web applications.
[0031] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0032] Example 1
[0033] The present invention provides a method for WEB application and device interaction based on WASM, comprising:
[0034] Through the visual IDE integration tool, use the tool to manage the hardware device library that supports integration in the visual interface. When managing the hardware device library that supports integration, record the hardware device type and hardware device details used for integration in the hardware device library.
[0035] Manage unified interface library: Provide unified access interface and JS interaction through unified interface library, and provide defined unified interface to connect with hardware devices.
[0036] Manage driver conversion library: Use the driver conversion library to configure the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface.
[0037] Collect hardware drivers provided by various hardware device manufacturers and manage hardware device drivers.
[0038] Configure the conversion of the driver service of each hardware device to a unified service, compile to form WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device. When configuring the conversion of the driver service of each hardware device to a unified service, provide driver conversion, provide WASM interface declaration through the hardware device interface, and implement the actual driver method call in the interface.
[0039] Release compiled WASM, including: support for generating WASM driver file packages, packaging uploaded native driver packages, and interface document packages.
[0040] Example 2
[0041] The present invention also provides a WASM-based WEB application and device interaction device, including a management module and a visualization tool module.
[0042] The visualization tool module integrates tools through the visualization IDE, and the management module uses tools to manage the hardware device library that supports integration in the visualization interface.
[0043] Management module manages unified interface library: provides unified access interface and JS interaction through unified interface library, and provides defined unified interface to connect with hardware devices.
[0044] The management module manages the driver conversion library: the driver conversion library configures the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface.
[0045] The management module collects hardware drivers provided by various hardware device manufacturers and manages hardware device drivers.
[0046] Configure the conversion of the driver service of each hardware device to a unified service, compile it into WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device.
[0047] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0048] Similarly, the device of the present invention enables WEB applications to call hardware drivers through the exchange of JS and WASM, making full use of old, reusing existing integration, and supporting the provision of WASM driver integration. It supports the compilation of native language driver code into WASM, and supports the calling of installed native drivers through WASM. It reduces the integration cost of WEB applications and hardware devices, and improves integration efficiency and expected experience.
[0049] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0050] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for WEB application and device interaction based on WASM, characterized by include: Through the visual IDE integration tool, use the tool to manage the hardware device library that supports integration in the visual interface. Manage unified interface library: Provide unified access interface and JS interaction through unified interface library, and provide defined unified interface to connect with hardware devices. Manage driver conversion library: Use the driver conversion library to configure the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface. Collect hardware drivers provided by various hardware device manufacturers and manage hardware device drivers. Configure the conversion of the driver service of each hardware device to a unified service, compile it into WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device.
2. According to a method for WEB application and device interaction based on WASM according to claim 1, it is characterized by When managing a hardware device library that supports integration, the hardware device type and hardware device details used for integration are recorded in the hardware device library.
3. According to a method for WEB application and device interaction based on WASM in claim 1, it is characterized in that when configuring the conversion of the driver service of each hardware device to a unified service, a driver conversion is provided, a WASM interface declaration is provided through the hardware device interface, and the actual driver method is called in the interface.
4. According to a method for WEB application and device interaction based on WASM according to claim 1, it is characterized by Release compiled WASM, including: support for generating WASM driver file packages, packaging uploaded native driver packages, and interface document packages.
5. A device for interacting with a WASM-based WEB application and a device, characterized in that Including management module and visualization tool module, The visualization tool module integrates tools through the visualization IDE, and the management module uses tools to manage the hardware device library that supports integration in the visualization interface. Management module manages unified interface library: provides unified access interface and JS interaction through unified interface library, and provides defined unified interface to connect with hardware devices. The management module manages the driver conversion library: the driver conversion library configures the mapping between the unified interface and the actual driver interface so that the driver responds to the unified interface. The management module collects hardware drivers provided by various hardware device manufacturers and manages hardware device drivers. Configure the conversion of the driver service of each hardware device to a unified service, compile it into WASM, integrate a unified interface layer based on WASM, and call the hardware device interface through the unified interface to interact with the hardware device.
6. The device for interacting with a WASM-based WEB application and a device according to claim 5, characterized in that When the management module manages the hardware device library that supports integration, the management module records the hardware device type and hardware device details used for integration in the hardware device library.
7. A WASM-based WEB application and device interaction device according to claim 5, characterized in that When the management module configures the conversion of the driver service of each hardware device to a unified service, it provides driver conversion, provides the WASM interface declaration through the hardware device interface, and implements the actual driver method call in the interface.
8. The device for interacting with a WASM-based WEB application and a device according to claim 5, characterized in that The management module releases compiled WASM, including: supporting the generation of WASM driver file packages, packaging uploaded native driver packages, and interface document packages.