Device driving method and apparatus and electronic device

Through the mapping relationship between the functional class module and the functional submodule of the client application, the device category is identified and the corresponding terminal equipment is driven, which solves the problem of inconsistent hardware device interface standards, and realizes the compatibility of hardware devices and the satisfaction of user needs.

WO2025045157A1PCT designated stage expired Publication Date: 2025-03-06SHANGHAI GEWU ZHIYUAN NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/115599
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-29
Filing Date
2024-08-29
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

In the prior art, the interface standards of hardware devices are inconsistent, resulting in the inability to adapt to the upper-level functions of the network system on cloud warehouses or cloud quality inspection platforms, the inability to drive edge hardware devices, and the inability to meet user needs.

Method used

Through the client application, the mapping relationship between the functional class module and the functional submodule is used to identify the device category and drive the corresponding terminal device. The specific steps include receiving call parameters, finding the target function module and functional submodule, and sending driver instructions to the target device through the target function submodule.

Benefits of technology

It realizes compatibility of different hardware devices, and can drive various hardware devices on cloud warehouses or cloud quality inspection platforms to meet users' real-time monitoring and display needs and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024115599_06032025_PF_FP_ABST
    Figure CN2024115599_06032025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present invention are a device driving method and apparatus and an electronic device. The method is applied to a client, comprising a functional module, the functional module comprises at least one function sub-module, the functional module is used for identifying a device category, and the function sub-module is used for driving a specific terminal device. The method comprises: receiving call parameters, wherein the call parameters comprise a device identifier, a device category, and a driving instruction; on the basis of the device category and a preset first mapping relationship, searching at least one functional module for a target functional module matching the device category; using the target functional module to search at least one function sub-module for a target function sub-module on the basis of the device identifier and a second mapping relationship; and sending the driving instruction to a target device by means of the target function sub-module, so as to drive the target device to execute a task corresponding to the driving instruction.
Need to check novelty before this filing date? Find Prior Art

Description

Device driving method, device and electronic equipment

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed on August 29, 2023, with application number 202311102898.9 and invention name “A device driving method, device and electronic device”. The entire contents of the application are incorporated by reference into this application. Technical Field

[0003] The present invention relates to the field of driving technology, and in particular to a device driving method, device and electronic equipment. Background Art

[0004] In network application scenarios such as cloud warehouses and cloud quality inspection, it is necessary to monitor the logistics status of warehouses in real time through the network, or to display the quality, appearance, and other conditions of items. Therefore, the hardware devices that need to be driven have also become rich and diverse. For example, screen display requires cameras or lens modules to take pictures or record, and weighing the displayed items requires equipment such as balances or electronic scales.

[0005] Currently, when various hardware devices are connected, the interface standards are inconsistent and the parameters of the hardware devices are incompatible, resulting in the hardware devices in cloud warehouses and cloud quality inspection agencies being unable to adapt to the upper-layer functions of the network system, and even unable to drive edge hardware devices, and unable to meet the user needs of cloud warehouses and cloud quality inspections.

[0006] Summary of the Invention

[0007] To address the technical issues of inconsistent interface standards for different devices or inability to access existing cloud warehouses or cloud quality inspection platforms, the present invention provides a device driving method, apparatus, and electronic device. Specifically, the following technical solutions are disclosed:

[0008] In a first aspect, an embodiment of the present invention provides a device driver method, which uses a client, the client including at least one functional class module, each functional class module including at least one functional sub-module, and each functional class module is used to identify a device category of a device, each functional sub-module is used to drive a terminal device under its device category, and each functional sub-module drives a different terminal device. The device driver method includes:

[0009] Receive call parameters, wherein the call parameters include: a device identifier, a device category, and a driving instruction of a target device;

[0010] Searching for a target functional class module that matches the first device class in at least one functional class module according to the device class and a preset first mapping relationship, wherein the first mapping relationship is a relationship between the device class supported by the client and each functional class module;

[0011] Using the target functional class module, searching for the target functional submodule in at least one functional submodule according to the device identifier and a second mapping relationship, wherein the second mapping relationship is a relationship between each functional submodule under the target functional class module and different device identifiers;

[0012] The target function submodule sends a driving instruction to the target device, and the driving instruction is used to drive the target device to execute the task corresponding to the driving instruction.

[0013] In combination with the first aspect, in a possible implementation, searching for a target functional sub-module in the at least one functional sub-module according to the device identification and the second mapping relationship includes: searching for a functional sub-module that matches the device identification in the at least one functional sub-module according to the device identification as the target functional sub-module.

[0014] In combination with the first aspect, in another possible implementation method, the client also includes a host process, and before receiving the call parameters sent by the host process, it also includes: starting the host process; scanning the program directory of the host process to obtain at least one functional class module; loading at least one functional class module according to the interface specification, and establishing a first mapping relationship after loading.

[0015] Optionally, the interface specification is the websocket protocol interface specification.

[0016] In combination with the first aspect, in another possible implementation method, the client also includes a core daemon process, which starts the host process, including: determining whether there is a process with the same process name as the host process in the currently running process; if so, closing the running host process, finding the host process file, and starting the host process file; if not, finding and starting the host process file.

[0017] In combination with the first aspect, in yet another possible implementation, the method further includes: determining a functional submodule in each of the functional class modules, and loading each functional submodule.

[0018] Furthermore, the functional sub-modules in each of the functional class modules are determined, including: polling each functional sub-module, calling the export function, and obtaining the virtual function returned after the export function is called; judging whether the content in the virtual function is the same as the category of the current functional class module; if the same, determining that the current functional sub-module is a functional sub-module in the current functional class module.

[0019] In combination with the first aspect, in yet another possible implementation, the at least one functional module includes a camera module, a serial port module, and a software management module;

[0020] Sending a driving instruction to the target device through the target functional submodule to drive the target device to perform the task corresponding to the driving instruction includes:

[0021] When the target functional module is a camera module, a first driving instruction is sent to the camera through the target functional submodule, and the first driving instruction is used to drive the camera to take a photo or record a video;

[0022] When the target functional module is a serial port module, the second driving instruction is sent to the balance through the target functional submodule, and the first driving instruction is used to drive the balance to perform a measurement operation;

[0023] When the target functional module is a software management module, a third driving instruction is sent to the operating system through the target functional submodule, and the third driving instruction is used to start the management function of the software.

[0024] In combination with the first aspect, in another possible implementation, the method also includes: after starting the core daemon process, obtaining configuration information from the cloud; judging whether it is necessary to update the at least one functional class module and / or the at least one functional sub-module on the client based on the configuration information; if so, using the configuration information to update the at least one functional class module and / or the at least one functional sub-module.

[0025] In a second aspect, an embodiment of the present invention provides a device driver apparatus, the apparatus comprising:

[0026] A receiving unit, configured to receive call parameters, wherein the call parameters include: a device identifier, a device category, and a driving instruction of a target device;

[0027] a first searching unit configured to search, in the at least one functional module, for a target functional module that matches the device category based on the device category and a preset first mapping relationship, wherein the first mapping relationship is a relationship between the device category supported by the apparatus and each functional module;

[0028] a second searching unit, configured to use the target functional class module to search for a target functional submodule in the at least one functional submodule according to the device identifier and a second mapping relationship, wherein the second mapping relationship is a relationship between each functional submodule under the target functional submodule and different device identifiers;

[0029] A sending unit is configured to send the driving instruction to the target device through the target functional submodule, so as to drive the target device to execute the task corresponding to the driving instruction.

[0030] In a third aspect, the present invention provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected, the memory storing computer program instructions, and the processor executing the device driving method in the above-mentioned first aspect or any corresponding implementation thereof by executing the computer program instructions.

[0031] In addition, the present invention also provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to enable a computer to execute the device driving method in the above-mentioned first aspect or any corresponding implementation manner thereof.

[0032] The device driving method, apparatus and electronic device provided by the present invention provide access standards to the outside in a unified manner through the host process when the device is connected, and send the call parameters input by the user, such as the device name, device category and driving instructions, to the target function class module to be driven. The target function class module then finds the target function sub-module that can specifically drive the device based on these call parameters. Finally, the target function sub-module sends the driving instructions to the terminal device to which it is connected, thereby realizing the call to the target terminal device. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0034] FIG1 is an architecture diagram of a cloud quality inspection service scenario provided by an embodiment of the present invention;

[0035] FIG2 is a block diagram of a driver structure of a client provided by an embodiment of the present invention;

[0036] FIG3 is a flow chart of a device driving method provided by an embodiment of the present invention;

[0037] FIG4 is a signaling flow chart of a device driving method provided by an embodiment of the present invention;

[0038] 5 is a flowchart of loading various functional modules provided by an embodiment of the present invention;

[0039] FIG6 is a flowchart of another embodiment of the present invention provides for loading various functional modules;

[0040] 7 is a structural block diagram of a device driver provided by an embodiment of the present invention;

[0041] FIG8 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0043] First, the application scenarios of the technical solutions provided by the embodiments of the present invention are introduced.

[0044] The technical solution of the embodiment of the present invention is applied to a network service system for a cloud warehouse or cloud quality inspection agency. The network service system can provide services such as live display, weighing, quality inspection, and warehouse logistics monitoring for certain items to meet users' needs for real-time online monitoring and display.

[0045] Referring to Figure 1, which illustrates the architecture of a cloud quality inspection service scenario provided by an embodiment of the present invention, the scenario includes a client 10, a camera 20, a scale 30, and a keyboard 40. The client 10 is connected to the other devices via USB cables. For example, the client 10 is connected to the camera 20 via USB cable 1, to the scale 30 via USB cable 2, and to the keyboard 40 via USB cable 3.

[0046] The client 10 may be a WMS (Warehouse Management System) or a terminal device. Specifically, the terminal device includes, but is not limited to, a smart terminal, a laptop, a tablet computer, a personal computer (PC), a personal digital assistant (PDA), a foldable terminal, a user equipment (UE), etc. The embodiments of this application do not limit the specific device form of the terminal device. In addition, the various terminal devices mentioned above are equipped with Android, Windows, etc.

[0047] The camera 20 has a photographic function and can take photos and videos of items to be displayed or monitored. The camera 20 includes, but is not limited to, a camera, a lens module, or a camera module. The scale 30 has a weighing function and can be used to measure the weight of objects. Optionally, the scale 30 can be a small electronic scale, a weight scale, etc. The keyboard 40 is an input device connected to the terminal device 10 via a USB cable 3 and is used to input commands to the terminal device 10.

[0048] It should be noted that the camera 20 , scale 30 and keyboard 40 mentioned above can be collectively referred to as another terminal device relative to the client 10 .

[0049] It should be understood that the number of devices in the above system can be one or more, such as multiple computers, laptops, two or more cameras, balances, etc., and this embodiment does not limit this. In addition, the above system or platform architecture can also include other hardware devices, such as display screens, smart screens, speakers, microphones, etc.

[0050] Due to the incompatibility of interface functions between the client 10 and other hardware devices in the above platform architecture, or different hardware access standards of different hardware devices, such as cameras, balance devices, etc., these terminal devices cannot quickly access the network service system / platform, resulting in the inability to drive various hardware devices to complete corresponding functions.

[0051] In order to solve this technical problem, the technical solution provided in this embodiment takes the client as the starting point and provides different hardware devices with functions such as automatic software upgrades, automatic daemon processes, pluggable plug-in interfaces, etc., and abstracts these functions into different devices and provides a unified interface to the outside world, thereby improving the compatibility between different hardware devices, meeting user needs, and improving user experience.

[0052] The technical solutions of the embodiments of the present invention are described in detail below.

[0053] See Figure 2, which is a block diagram of a driver structure of a client provided by this embodiment of the invention. The client is configured with a Windows operating system, including the following functional modules:

[0054] (1) The core daemon process is used to perform daemon operations for different processes based on one or more pre-set configuration items.

[0055] The core daemon process is the RunningService.exe process, which is a system process defined by the Windows operating system and is described as a service and controller application. Its main function is to run and terminate system services.

[0056] (2) The host process is used to load at least one functional module of the lower layer, automatically establish a WebSocket server, and provide an interface in a unified format to the outside world.

[0057] The WebSocket server is a TCP application that listens on any port on the server that follows a specific protocol. Because the host process provides a unified format interface that enables the plugging and unplugging of different hardware devices / plug-ins, it is also called a pluggable host process.

[0058] Optionally, the host process of the pluggable plug-in is DeviceZombie.exe.

[0059] (3) At least one functional module, each of which is responsible for identifying the device category of a device, connecting to one or more functional submodules, and calling one or more functional submodules. In addition, each functional module can also provide a unified interface to the host process.

[0060] As shown in FIG2 , at least one functional module of a client includes: a camera module (Camera Home.dll), a serial port module (comhome.dll), a software management module (SoftManager Home.dll), and a computer environment monitoring module (HardwareMonitor_Home.dll).

[0061] Among them, the camera class module is used to provide and connect to the camera sub-module. For example, in Figure 2, it is responsible for calling two camera function sub-modules, namely: camera sub-module 1 (CameraX.dll) and camera sub-module 2 (USB Camera.dll). These two camera sub-modules are respectively responsible for driving camera devices of different brands / models / names. For example, camera sub-module 1 is responsible for driving camera 1, such as a webcam; camera sub-module 2 is responsible for driving camera 2, such as a SLR camera.

[0062] (4) At least one functional submodule, used to drive a specific terminal device and control the terminal device to perform corresponding actions according to the caller's instructions.

[0063] The terminal device includes the camera 20, scale 30 and keyboard 40, etc., and may also include other devices or unit modules, such as a software module in an operating system, etc., which is not limited in this embodiment.

[0064] In the example shown in FIG. 2 , the at least one functional submodule includes: a camera submodule, a serial port submodule, a software management submodule, and a computer environment monitoring submodule.

[0065] The serial port module is used to connect to the serial port submodule (Comhome.dll), which can directly drive the balance device. The software management module is used to call the software management submodule (SoftManager.dll), which can be a functional module on the computer for managing software, such as a software master or management software. The computer environment monitoring module is used to call the computer environment detection submodule (HardWare Monitor_Home.dll). Optionally, this computer environment detection submodule includes, but is not limited to, some security guards or some scanning software.

[0066] Optionally, the camera submodule 1 is used to dock with camera 1, and the camera submodule 2 is used to dock with camera 2. The at least one functional module docks with one or more multifunctional submodules, so that each submodule executes the user's (or caller's) instructions and controls the hardware to complete corresponding operations.

[0067] (4) An upgrade process, which is used to automatically detect update information and upgrade the files / software in the list. Optionally, a client upgrade process is clientUpgrade Program.exe.

[0068] In addition, the driver structure framework shown in FIG. 2 may further include other guarded process modules. These modules may be used to be responsible for other processes in the business layer, and this embodiment does not impose any limitation on this.

[0069] The method provided in this embodiment is described in detail below.

[0070] Referring to FIG3 , a device driver method is provided in this embodiment. The method can be applied to a client, which can be the client 10 shown in FIG1 . The client 10 includes a host process, at least one functional module, and at least one functional sub-module, etc. Specifically, the client structure can refer to the structural framework shown in FIG2 above.

[0071] The device driving method includes the following steps:

[0072] Step S101: receiving call parameters, wherein the call parameters include: device identification, device type and driving instructions of the target device.

[0073] Among them, the calling parameters can be generated by a series of instructions entered by the caller / user on the client. For example, the caller (user) needs to call a certain hardware device, such as calling camera 1 to perform a photo operation. In the configured calling parameters, the device identifier of the target device is camera 1, the device category is camera class camera, and the driving instruction can be to drive camera 1 to take a photo of the object in the current picture.

[0074] In addition, the device identification of the target device includes but is not limited to the device name, device ID or device brand, model, etc.

[0075] The device category is used to indicate the device category to which the target device belongs. For example, for camera 1, its device category is camera category; for a balance, its device category is serial port category; and for a certain management software, its device category may be software management category.

[0076] Step S102: searching for a target functional class module that matches the device category in at least one functional class module according to the device category and a preset first mapping relationship.

[0077] The first mapping relationship is the relationship between the device category supported by the client and each functional module. The first mapping relationship can be generated when the system is started and loaded.

[0078] The device classes supported by the client include, but are not limited to, the aforementioned camera class, serial port class, management software class, and other predefined device classes. The at least one functional class module shown in FIG2 includes a camera class module (Camera Home.dll), a serial port class module (comhome.dll), a software management class module (SoftManager Home.dll), and a computer environment monitoring class module (HardwareMonitor_Home.dll).

[0079] The first mapping relationship includes at least one of the following relationships:

[0080] The mapping relationship between the camera class module (Camera Home.dll) and the camera;

[0081] The mapping relationship between the serial port class module (comhome.dll) and the balance;

[0082] The mapping relationship between the software management class module (SoftManager Home.dll) and software management;

[0083] The mapping relationship between the computer environment monitoring module (HardwareMonitor_Home.dll) and the environment monitoring software.

[0084] It should be understood that if other terminal devices are included, such as microphones, speakers and other devices, the first mapping relationship may also include, for example, a mapping relationship between a serial port class module (comhome.dll) and a speaker / microphone.

[0085] The above step S102 specifically includes: if the first device category is camera, then searching the function class module associated with the "camera" category in the aforementioned first mapping relationship is "camera class module (Camera Home.dll)", and then determining that the first function class module is the camera class module (Camera Home.dll).

[0086] Step S103: using the target functional class module, searching for a target functional submodule in the at least one functional submodule according to the device identifier and the second mapping relationship.

[0087] The second mapping relationship is the relationship between each functional submodule under the target functional module and different device identifiers. For example, for a camera module, it includes camera submodule 1 and camera submodule 2, where camera submodule 1 can drive a webcam and camera submodule 2 can drive a DSLR camera. The second mapping relationship includes: camera submodule 1 - webcam; camera submodule 2 - DSLR camera.

[0088] Specifically, the target functional class module is used to search for a functional submodule matching the device identifier in at least one functional submodule as the target functional submodule.

[0089] For example, the camera class module (Camera Home.dll) searches for a camera submodule whose device name is "Camera 1" in the two camera function subclass modules it includes. After searching, it is determined that the function submodule having a second mapping relationship with Camera 1 is Camera Submodule 1, that is, it is determined that the target function submodule is Camera Submodule 1.

[0090] In this example, camera submodule 1 is the cameraX.dll module, which can be used to drive cameraX (camera X); camera submodule 2 is the USBCamera.dll module, which can be used to drive USBCamera.

[0091] Step S104: sending a driving instruction to the target device through the target functional submodule to drive the target device to execute the task corresponding to the driving instruction.

[0092] The driving instruction can be generated by the above step S101 and transmitted to the target function sub-module through the host process and the target function class module. After receiving the driving instruction, the target function sub-module drives the corresponding device to start and execute the cloud warehouse inspection operation, and returns the operation result to the client.

[0093] Specifically, when the target functional module is a camera module, the target functional submodule sends a first drive instruction to the camera. This first drive instruction is used to drive the camera to take a photo or record a video. In this example, camera submodule 1 drives camera X to take a photo of the object in the current image and transmits the captured photo back to the client, thereby driving and controlling camera X.

[0094] Alternatively, when the target functional module is a serial port module, a second driving instruction is sent to the balance through the target functional submodule, and the first driving instruction is used to drive the balance to perform a measurement operation.

[0095] Alternatively, when the target functional module is a software management module, a third driving instruction is sent to the operating system through the target functional submodule, where the third driving instruction is used to start the management function of the software.

[0096] The method provided in this embodiment provides access standards to the outside world uniformly through the host process when the device is connected, and sends the calling parameters input by the user, such as the device name, device category and driving instructions, to the target function class module to be driven. The target function class module then finds the target function sub-module that can specifically drive the device based on these calling parameters. Finally, the target function sub-module sends the driving instructions to the terminal device to which it is connected, and realizes the call to the target terminal device. This method solves the device compatibility problem, realizes the driver call of the edge device, and meets the user's calling needs in the cloud warehouse or cloud quality inspection agency.

[0097] 4 is a signaling flow chart of a device driving method based on the above embodiment. The method includes:

[0098] After the client is started, the core daemon module (RunningService.exe) starts the host process.

[0099] Step S101: When receiving a click operation from the caller on the client, the custom software (eg, WMS storage client) is used to send the call parameters to the host process through the preset port.

[0100] The specific process refers to step S101 of the aforementioned embodiment and will not be described again here.

[0101] Step S102-1: The host process receives the call parameter and searches for the target functional module in the pre-configured first mapping relationship according to the device type in the call parameter. For the specific search process, please refer to the description of step S102 in the above embodiment.

[0102] The calling parameters include driving instructions, which are used to drive the target device to perform warehouse inspection operations, such as taking pictures, weighing, scanning and monitoring.

[0103] Step S102-2: The host process sends the device identification and driving instructions to the target functional module.

[0104] Step S103: After receiving the target functional class module, the target functional submodule is determined in at least one functional submodule according to the device identification, and a second mapping relationship exists between the target functional submodule and the device identification of the target device.

[0105] For example, the camera class module (camera Home.dll) searches the second mapping relationship for the function submodule camera submodule 1 (camera X.dll) based on the device name camera X. The specific search process is described in step S103 of the above embodiment.

[0106] Step S104: The target functional module sends a driving instruction to the target functional submodule, wherein the driving instruction includes an action instruction and a device identifier, such as a USB identifier, USB1, etc.

[0107] Step S105: After receiving the driving instruction, the target functional submodule drives the target device to perform a corresponding operation.

[0108] Step S106: The target function submodule returns the result of the target device execution to the target function class module, and the target function class module returns the execution result to the host process, and finally feeds back to the caller / user, and displays the execution result on the client's display interface, such as photos taken, weight measured by a balance, and software operation status monitored after the management software is started.

[0109] Optionally, in some embodiments, before the above step S101, receiving the call parameters sent by the host process, the method also includes: starting the host process; scanning the program directory of the host process to obtain at least one functional class module; loading the at least one functional class module according to the interface specification, and establishing the first mapping relationship after loading.

[0110] The interface specification is a websocket protocol interface specification, under which a websocket server is used to monitor and load at least one functional module.

[0111] As shown in Figure 5, the core daemon process starts the host process. After the core daemon process is installed, it first obtains the opportunity to run and registers itself as a service, running with SYSTEM privileges. Specifically:

[0112] Step S201: After the host process is started, the dll files in the same directory are traversed, that is, the dll module files (such as functional modules) in the directory (first-level directory) where the program is located are scanned.

[0113] Step S202: The host process loads according to the interface specification, and loads at least one functional module, including the aforementioned camera module (Camera Home.dll), serial port module (comhome.dll), software management module (SoftManager Home.dll), etc.

[0114] Step S203: After loading, after obtaining the device category (or device category name), a cache route is established between each device category and each functional module, which is equivalent to establishing at least one first mapping relationship.

[0115] The cache routing includes a mapping relationship between a target functional module and a device category of a target device.

[0116] Furthermore, as shown in FIG6 , in the process of starting the host process, the Runningservice.exe thread is pulled up, and a maintenance thread is established according to at least one pre-set configuration item, such as the runsetting.int content, through built-in parameters, including: path, file name process, and each process (thread 1 to thread N) is first closed to close the same process name to avoid leftover processes, and then the startup operation is performed with the configured permissions, such as monitoring and guarding through the process handle to start the host process.

[0117] Threads 1 to N include a host process. Taking the host process as an example, the startup process specifically includes:

[0118] Step 1: Determine whether there is a process with the same process name as the host process (DeviceZombie) among the currently running processes;

[0119] Step 2: If yes (the same process name exists), then the running host process DeviceZombie.exe is closed, and the host process DeviceZombie.exe file is found and started.

[0120] Step 3: If no (does not exist), then find and start the host process DeviceZombie.exe file, and then start the host process.

[0121] After startup, the host process DeviceZombie.exe is monitored. If the host process is detected to have finished running, the program jumps to the above "Step 1" to continue to start and monitor the host process.

[0122] Furthermore, one implementation involves establishing a WebSocket server and using it to monitor the host process. Specifically, the caller sends a WebSocket message in a fixed format. Based on the cache routing established in step S203 for the device type, instructions are issued to each functional module, causing each functional module to be loaded. The host process is monitored via a preset port (e.g., port 17888) on the WebSocket server, and steps S101 to S104 are executed.

[0123] In addition, the above step S202 further includes: determining the functional sub-modules in each of the functional modules, and loading each of the functional sub-modules.

[0124] Specifically, one implementation involves polling each functional submodule, calling an export function, and obtaining the virtual function returned by the export function. For example, when a functional class module is called through an export function, a class information is returned. The method then determines whether the class information contains a virtual function for the class, i.e., whether the content of the virtual function is the same as the class identified by the current functional class module. If so, the current functional submodule is determined to be a functional submodule within the current functional class module. If not, the current functional submodule is determined not to be a functional submodule within the current functional class module.

[0125] The export function called is the CreateInstance export function, and the class information returned by calling the CreateInstance export function is the object address, that is, the address of the functional class module.

[0126] Furthermore, if the class contains virtual functions, it is determined whether the string returned by the virtual function of the class (i.e., the device category) is empty. If not, it is determined whether it is the same type as the current class loader (e.g., the camera class module). If the same, it is determined that the current functional submodule is a submodule of the current functional class module; for example, it is determined that camera submodule 1 (cameraX.dll) is a submodule of the camera class module (Camera Home.dll). Similarly, the functional submodules corresponding to other functional class modules are also found according to this method. After polling all functional class modules, the host process writes all device categories and object addresses (of each functional class module) supported by the client into the map mapping table to generate the first mapping relationship.

[0127] In this embodiment, the host process is loaded by pulling up the core daemon process, and the scanning of at least one functional module in the directory where the host process program is located is started, thereby establishing a mapping relationship between each functional module and the device category, and providing access standards to the outside world in a unified manner through the host process, such as using port 17888 to load each functional module, thereby realizing the call of each functional sub-module at the lower level.

[0128] This method dynamically loads the currently connected terminal device through a pluggable host process during system startup. Once the terminal device module is loaded, it can be connected to the cloud warehouse and cloud quality inspection system. Furthermore, once the terminal device is connected, the core daemon process, RunningService, guards the hardware device process, ensuring that the device process can be quickly reset in the event of an abnormal operation.

[0129] In another embodiment, the method further includes: upgrading the process. Specifically, the method includes: after launching the core daemon process, obtaining configuration information from the cloud, detecting the updated configuration in the cloud, and determining, based on the configuration information, whether it is necessary to update the at least one functional module and / or at least one functional sub-module on the client side. If so, i.e., if the detection indicates that an update is required, then using the configuration information to update the at least one functional module and / or the at least one functional sub-module.

[0130] Specifically, the core daemon is started at a preset time, such as every 30 minutes (configurable), and checks the cloud update configuration after startup. If an update is found to be needed, the update action is executed.

[0131] After the update is complete, a window cannot be displayed under SYSTEM privileges, so a pop-up window is displayed in a privilege-reduced manner, asking the user whether to restart. After the user selects "yes", the message is sent back to the SYSTEM process through a pipeline. If the user selects "yes", the core daemon process is reset, and then all processes in the entire driver are reset.

[0132] Optionally, the above results also include other guarded processes, which are started and guarded by the core daemon process and determined by the client's business layer and actual scenario, and this embodiment does not limit this.

[0133] In this embodiment, a device driver is also provided, which is used to implement the above-mentioned embodiments and optional implementations. Details that have already been described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0134] As shown in Figure 7, the device driver apparatus includes: a receiving unit 710, a first searching unit 720, a second searching unit 730, and a sending unit 740. In addition, the device driver apparatus may further include more or fewer other units and modules.

[0135] Specifically, the receiving unit 710 is configured to receive calling parameters, where the calling parameters include: a device identifier, a device type, and a driving instruction of a target device.

[0136] The first search unit 720 is used to search for a target functional class module that matches the device category in the at least one functional class module based on the device category and a preset first mapping relationship, wherein the first mapping relationship is the relationship between the device category supported by the device and each functional class module.

[0137] The second search unit 730 is used to use the target function class module to search for the target function submodule in at least one function submodule according to the device identifier and the second mapping relationship, wherein the second mapping relationship is the relationship between each function submodule under the target function class module and different device identifiers.

[0138] The sending unit 740 is configured to send the driving instruction to the target device through the target functional submodule to drive the target device to execute the task corresponding to the driving instruction.

[0139] Optionally, in a specific implementation, the second searching unit 730 is specifically configured to search, according to the device identification, for a functional submodule that matches the device identification in the at least one functional submodule as the target functional submodule.

[0140] Optionally, in another specific embodiment, the above-mentioned device also includes a processing unit, which is not shown in Figure 7. The processing unit is used to start the host process, scan the program directory of the host process, obtain the at least one functional class module; and load the at least one functional class module according to the interface specification to establish the first mapping relationship.

[0141] Optionally, in another specific embodiment, the above-mentioned device also includes a core guard unit, which is used to determine whether there is a process with the same process name as the host process in the currently running process; if so, the running host process is closed, and the host process file is found and started; if not, the host process file is found and started.

[0142] Optionally, in another specific embodiment, the above-mentioned processing unit is also used to poll each of the functional sub-modules; call the export function and obtain the virtual function returned after the export function is called; determine whether the content in the virtual function is the same as the category recognized by the current functional class module; if the same, determine that the current functional sub-module is a functional sub-module in the current functional class module.

[0143] Optionally, the above device further includes an updating unit, which is not shown in FIG7 . The updating unit is an upgrading process module (ClientUpgrade Program.exe).

[0144] The receiving unit 710 is further configured to obtain configuration information from the cloud; the processing unit is further configured to determine whether the at least one functional module and / or the at least one functional sub-module needs to be updated on the client based on the configuration information; and the updating unit is configured to update the at least one functional module and / or the at least one functional sub-module using the configuration information.

[0145] It should be noted that the functions of the above-mentioned receiving unit 710, first search unit 720, second search unit 730 and sending unit 740 can be implemented through the core daemon process, host process, at least one functional class module and at least one functional sub-module as shown in Figure 2.

[0146] The device provided in this embodiment has the following beneficial effects:

[0147] First, when the device is connected, the host process module uniformly provides access standards to the outside world, and sends the calling parameters entered by the user, such as device name, device category and driving instructions, to the target function class module to be driven. The target function class module then finds the target function sub-module that can drive the specific device based on these calling parameters. Finally, the target function sub-module sends the driving instructions to the terminal device to which it is connected, realizing the call to the target terminal device and meeting the user's calling needs in the cloud warehouse or cloud quality inspection agency.

[0148] Second, when the system starts, the host process dynamically loads the device connected to the current machine. After the device module is inserted, it can be connected to the cloud warehouse, cloud quality inspection agency and other system environments.

[0149] Third, after the device is connected, the core daemon process is used to protect the device process, ensuring that the device process can be quickly reset in the event of abnormal operation.

[0150] It should be understood that the device driver in this embodiment is presented in the form of a functional module, where the module refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0151] An embodiment of the present invention further provides an electronic device having the device driving apparatus shown in FIG. 7 , wherein the electronic device may be the client of the aforementioned embodiment.

[0152] Please refer to Figure 8, which is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present application. As shown in Figure 8, the electronic device includes: one or more processors 110, memory 120, and communication interfaces 130 for connecting various components, including high-speed interfaces and low-speed interfaces. The various components communicate with each other using different buses and can be installed on a common motherboard or in other ways as needed.

[0153] The processor 110 may be a central processing unit (CPU), a network processor (NPU), or a combination thereof. The processor 110 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device (PLD) may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a general purpose array logic (GAL), or any combination thereof. The memory 120 stores instructions executable by at least one processor 110, causing the at least one processor 110 to execute the device driver method described in the above embodiment.

[0154] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 120 may optionally include a memory remotely located relative to the processor 110, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0155] The memory 120 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 120 may also include a combination of the above types of memory.

[0156] In addition, the communication interface 130 of the electronic device is used to communicate with other devices or a communication network.

[0157] In this embodiment, the electronic device may be a terminal device, such as a PC, a notebook computer, a mobile phone terminal, etc.

[0158] In addition, this application also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, it may include some or all of the steps of each embodiment of the device driver method provided in this application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0159] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0160] The computer program product includes one or more computer instructions. When the computer loads and executes the computer program, it generates, in whole or in part, the processes or functions described in the various embodiments of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0161] The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one network device, computer, server or data center to another device, computer or server via wired or wireless means.

[0162] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the embodiment of a device interconnection apparatus, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

[0163] Those skilled in the art can clearly understand that the technology in the embodiments of the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solutions in the embodiments of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application or certain parts of the embodiments.

[0164] In addition, in the description of this application, unless otherwise specified, "plurality" refers to two or more than two. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit differences.

[0165] Although the embodiments of the present application have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present application, and such modifications and variations shall fall within the scope defined by the appended claims.

Claims

1. A device driving method, wherein: The method applies a client, the client includes at least one function class module, each of the function class modules includes at least one function sub-module, and each of the function class modules is used to identify a device category of a device, each of the function sub-modules is used to drive a terminal device under the device category to which it belongs, and each of the function sub-modules drives a different terminal device, and the method includes: Receive calling parameters, wherein the calling parameters include: a device identification, a device category and a driving instruction of a target device; According to the device category and a preset first mapping relationship, searching for a target function class module matching the device category in the at least one function class module, wherein the first mapping relationship is a relationship between the device category supported by the client and each function class module; Using the target function class module, searching for a target function submodule in the at least one function submodule according to the device identifier and the second mapping relationship, wherein the second mapping relationship is a relationship between each function submodule under the target function class module and different device identifiers; The driving instruction is sent to the target device through the target function submodule to drive the target device to execute the task corresponding to the driving instruction.

2. The method according to claim 1, wherein: Searching for a target functional submodule in the at least one functional submodule according to the device identifier and the second mapping relationship includes: According to the device identification, a functional submodule matching the device identification is searched in the at least one functional submodule as the target functional submodule.

3. The method according to claim 1, wherein: The client also includes a host process, and before receiving the call parameter, it also includes: Starting the host process; Scan the program directory of the host process to obtain the at least one functional module; The at least one functional class module is loaded according to the interface specification to establish the first mapping relationship, wherein the interface specification is a websocket protocol interface specification.

4. The method according to claim 3, wherein: The client also includes a core daemon process, and starting the host process includes: Determine whether there is a process with the same process name as the host process among the currently running processes; If yes, then close the running host process, find the host process file, and start the host process file; If not, then the host process file is found and started.

5. The method according to claim 3, wherein: The method further comprises: determining a functional submodule in each of the functional class modules, and loading each of the functional submodules; The determining of the functional submodules in each functional class module comprises: Polling each of the functional submodules; Calling the export function and obtaining the virtual function returned after the export function is called; Determine whether the content in the virtual function is the same as the category identified by the current functional class module; If they are the same, it is determined that the current functional sub-module is a functional sub-module in the current functional class module.

6. The method according to any one of claims 1 to 5, wherein: The at least one functional module includes a camera module, a serial port module and a software management module; Sending the driving instruction to the target device through the target function submodule to drive the target device to perform the task corresponding to the driving instruction includes: When the target function module is a camera module, a first driving instruction is sent to the camera through the target function submodule, wherein the first driving instruction is used to drive the camera to take a photo or record a video; When the target functional module is a serial port module, a second driving instruction is sent to the balance through the target functional submodule, wherein the first driving instruction is used to drive the balance to perform a measurement operation; When the target function module is a software management module, a third driving instruction is sent to the operating system through the target function submodule, and the third driving instruction is used to start the management function of the software.

7. The method according to any one of claims 1 to 5, wherein: The method further comprises: Get configuration information from the cloud; Determining whether it is necessary to update the at least one functional module and / or the at least one functional sub-module on the client according to the configuration information; If yes, the at least one functional module and / or the at least one functional sub-module is updated using the configuration information.

8. A device driver, wherein: The device comprises: A receiving unit, used for receiving calling parameters, wherein the calling parameters include: a device identification, a device category and a driving instruction of a target device; A first search unit, configured to search for a target functional class module matching the device category in at least one functional class module according to the device category and a preset first mapping relationship, wherein the first mapping relationship is a relationship between the device category supported by the apparatus and each functional class module; A second search unit is used to use the target function class module to search for a target function submodule in the at least one function submodule according to the device identifier and the second mapping relationship, wherein the second mapping relationship is a relationship between each function submodule under the target function class module and different device identifiers; A sending unit is used to send the driving instruction to the target device through the target functional submodule to drive the target device to execute the task corresponding to the driving instruction.

9. An electronic device, wherein: comprising a memory and a processor, wherein the memory and the processor are connected; The memory stores computer program instructions; When the computer program instructions are executed by the processor, the device driving method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, wherein: The computer readable storage medium has computer instructions stored thereon; The computer instructions are used to enable a computer to execute the device driving method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • USB equipment mapping and interaction methods, apparatuses, cloud terminal, and cloud server

    CN105100157A

  • Switching system and method compatible with USRP and electronic equipment

    CN116232343A

  • Remote memory ring buffers in a cluster of data processing nodes

    US20150039840A1

  • Drive system and method for embedded device

    WO2022126930A1