A hardware terminal control method and device based on middleware

By setting up the network interface layer, data processing layer and hardware calling layer in the middleware, the problem that the OCX control only supports IE core browsers is solved, hardware control on different browsers is realized, and the versatility and security are improved.

CN118041900BActive Publication Date: 2024-09-10JIANGXI DIGITAL NETWORK INFORMATION SECURITY TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410286777.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2024-09-10
Estimated Expiration
2044-03-13

AI Technical Summary

Technical Problem

In the existing technology, when using OCX control for hardware control, only browsers with IE core can support it, resulting in poor versatility.

Method used

By setting up middleware, including the network interface layer, data processing layer and hardware calling layer, the control request issued by the web application is obtained and converted into an easily identifiable data format, and the software development tool kit of the hardware terminal is called for control, providing different interface for hardware control on different browsers.

Benefits of technology

It realizes the control of hardware on different browsers, improves the versatility of hardware control, and improves the security of using hardware devices through the security verification mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118041900B
    Figure CN118041900B
Patent Text Reader

Abstract

The present invention discloses a method and device for controlling a hardware terminal based on a middleware, wherein the middleware at least comprises a network interface layer, a data processing layer and a hardware call layer which are mutually communicatively connected, and the method comprises: using the network interface layer to obtain a control request for controlling a hardware terminal issued by a Web application, and issuing the control request; receiving the issued control request through the data processing layer, and obtaining the request data contained in the control request to convert the request data into a preset data format that is easy to identify; obtaining the software development kit of the hardware terminal through the hardware call layer, and calling the corresponding target software development kit according to the control request to control the current hardware terminal. The present invention solves the problem of poor versatility in the prior art that only browsers with IE kernel can support OCX controls when using OCX controls for hardware control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and in particular to a hardware terminal control method and device based on middleware. Background Art

[0002] The Windows operating system is currently the most widely used PC graphical interface operating system. Under the B / S architecture, when a Web application running in a browser needs to control a hardware device, it is through an OCX control. The SDK provided by the hardware manufacturer contains an OCX control, which needs to be registered before use. After successful registration, the API provided by the OCX control can be loaded and called through JavaScript on the web page. However, only browsers with the IE kernel can support OCX controls. Mainstream browsers such as Google and Firefox are non-IE kernels, and Windows 10 no longer supports the IE browser.

[0003] Therefore, in the prior art solution, when controlling hardware devices, only the browser with IE kernel can support OCX controls, resulting in poor versatility. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a hardware terminal control method and device based on middleware, aiming to solve the problem of poor versatility caused by the fact that only browsers with IE kernel can support OCX controls when using OCX controls for hardware control in the prior art.

[0005] The embodiment of the present invention is implemented as follows:

[0006] A method for controlling a hardware terminal based on middleware, wherein the middleware at least comprises a network interface layer, a data processing layer and a hardware calling layer which are communicatively connected to each other, and the method comprises:

[0007] Using the network interface layer to obtain a control request for controlling a hardware terminal issued by a Web application, and issuing the control request;

[0008] Receiving the control request sent down through the data processing layer, and obtaining the request data contained in the control request to convert the request data into a preset data format that is easy to identify;

[0009] The software development kit of the hardware terminal is obtained through the hardware call layer, and the corresponding target software development kit is called according to the control request to control the current hardware terminal.

[0010] Furthermore, in the above-mentioned middleware-based hardware terminal control method, before the step of using the network interface layer to obtain a control request for controlling the hardware terminal issued by a Web application and issuing the control request, the method further includes:

[0011] Acquire the configuration properties of the network interface layer, determine the configuration file according to the configuration properties, and generate the code of the network interface layer and the corresponding interface interceptor through the configuration file;

[0012] The configuration attributes include at least interface type, interface array, interface file name, interface path prefix, whether to generate a corresponding interceptor for the interface, interface path, interface request method, request parameter type, and return result type.

[0013] Furthermore, the above-mentioned middleware-based hardware terminal control method, wherein the method further includes:

[0014] Signing the request parameters contained in the control request using a preset signature algorithm to obtain a request parameter signature value;

[0015] When the middleware receives the control request, it signs the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result;

[0016] When the verification signature result is consistent with the sign field parsed from the control request, and it is determined that the control request is not replayed, the verification between the Web application and the intermediate is passed.

[0017] Furthermore, in the above-mentioned middleware-based hardware terminal control method, the step of determining that the control request is not replayed comprises:

[0018] There is no sign in the cache and the interval between the current timestamp of the server and the timestamp in the request parameter does not exceed the preset time.

[0019] Furthermore, in the above-mentioned middleware-based hardware terminal control method, the step of signing the request parameters included in the control request by using a preset signature algorithm to obtain the request parameter signature value includes:

[0020] Arrange the request parameters in ascending alphabetical order according to the key value, traverse them one by one, take out the value corresponding to the key value, and then construct the request parameters into a string according to a preset format;

[0021] Ignore the preset fields, and concatenate the current timestamp and key information at the end of the string, then use the hash algorithm to calculate the hash value of the above string to obtain the request parameter signature value.

[0022] Furthermore, in the above-mentioned middleware-based hardware terminal control method, before the step of signing the request parameters included in the control request by using a preset signature algorithm to obtain the request parameter signature value, the step further includes:

[0023] Generate a unique identifier and key for the middleware, and record them in a configuration file of the middleware;

[0024] Establishing a middleware information table of the web application according to the unique identifier of the middleware and the key of the middleware;

[0025] A middleware user association table of the web application is established according to the unique identifier of the middleware, the unique identifier of the user, the middleware access address and the identification of whether the middleware is selected.

[0026] Furthermore, in the above-mentioned middleware-based hardware terminal control method, after the step of signing the request parameters included in the control request by using a preset signature algorithm to obtain the request parameter signature value, the step further includes:

[0027] Parse the control request to determine whether it contains the middleware unique identifier, request parameter signature sign, and timestamp field;

[0028] If yes, determine whether the unique identifier in the middleware configuration file is consistent with the identifier in the request parameter;

[0029] If so, obtain the middleware key from the middleware configuration file, and execute the step of signing the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result after the middleware receives the control request.

[0030] Another object of the present invention is to provide a hardware terminal control device based on middleware, wherein the middleware at least includes a network interface layer, a data processing layer and a hardware call layer that are communicatively connected to each other, and the device includes:

[0031] An acquisition module, used to acquire a control request for controlling a hardware terminal issued by a Web application by using the network interface layer, and to issue the control request;

[0032] A receiving module, configured to receive the control request sent by the data processing layer, and obtain request data included in the control request to convert the request data into a preset data format that is easy to identify;

[0033] The control module is used to obtain the software development kit of the hardware terminal through the hardware call layer, and call the corresponding target software development kit according to the control request to control the current hardware terminal.

[0034] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of any one of the methods described above.

[0035] Another object of the present invention is to provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0036] The present invention sets a middleware, which includes a network interface layer, a data processing layer and a hardware calling layer that are communicatively connected to each other. The network interface layer is used to obtain a control request for controlling a hardware terminal issued by a Web application, and the control request is issued; the issued control request is received by the data processing layer, and request data contained in the control request is obtained to convert the request data into a preset data format that is easy to identify; the software development kit of the hardware terminal is obtained by the hardware calling layer, and the corresponding target software development kit is called according to the control request to control the current hardware terminal, thereby realizing the control of the hardware terminal by the web application, and the hardware control is not performed by the OCX control included in the SDK provided by the hardware manufacturer, and the set middleware can provide different interfaces, thereby realizing the control of the hardware on different browsers, thereby solving the problem of poor versatility caused by the fact that only the browser with the IE kernel can support the OCX control when the OCX control is used to control the hardware in the prior art.

[0037] In addition, the present invention has at least the following beneficial effects:

[0038] The three-tier architecture is adopted through the middleware, with clear division of labor and structure at each level;

[0039] Automatically generate interfaces and interface interceptor codes by identifying configuration files, eliminating the need to write duplicate codes and improving development efficiency;

[0040] By defining interface pre-processing and post-processing logic, it is used to process the request data of the Web application and the response data of the execution process and results of the hardware device, and convert them into a data format that is easy for the underlying hardware device to recognize and the top-level Web application to read;

[0041] By adding a security verification mechanism to the middleware, Web application connection access verification is provided to confirm the identity of the Web application and prevent data from being tampered with or replayed during communication, thereby improving the security of hardware equipment during use. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic diagram of the structure of the middleware in the hardware terminal control method based on middleware provided in one embodiment of the present invention;

[0043] Figure 2 is a flow chart of a hardware terminal control method based on middleware in a first embodiment of the present invention;

[0044] Figure 3 A schematic diagram of a safety check process in a hardware terminal control method based on middleware in an embodiment of the present invention;

[0045] Figure 4 FIG. 4 is a structural block diagram of a hardware terminal control device based on middleware in a fourth embodiment of the present invention.

[0046] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0047] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0048] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0050] See also Figure 1 , which is a schematic diagram of the structure of the middleware in the hardware terminal control method based on middleware proposed in one embodiment of the present invention, and the following embodiments can be applied to Figure 1 The middleware shown controls the hardware terminal, wherein the middleware includes a network interface layer, a data processing layer, and a hardware call layer that are interconnected, wherein:

[0051] The network interface layer is used to provide HTTP or WebSocket interfaces for controlling different hardware terminals for Web applications to call. It receives requests from Web applications to control hardware devices and returns the execution process and result data of the hardware devices. If the Web application needs to receive the process data of the hardware device execution, the middleware provides a WebSocket interface.

[0052] The data processing layer is used to process the request data of the Web application and the response data of the hardware device execution process and results, and convert them into a data format that is easy for the underlying hardware device to recognize and the top-level Web application to read.

[0053] The hardware call layer is used to integrate the software development kit (SDK) of the hardware device to be operated, call the corresponding hardware terminal SDK according to the control request initiated by the Web application, and return the response data of the hardware device execution process and results.

[0054] It should be pointed out that Figure 1 The structure shown does not constitute a limitation on the middleware-based system. In other embodiments, the middleware may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0055] The following will describe in detail how to improve the limitations of hardware terminal control based on middleware in conjunction with specific embodiments and drawings.

[0056] Embodiment 1

[0057] See also Figure 2 , shown is a hardware terminal control method based on middleware in the first embodiment of the present invention, the middleware at least includes a network interface layer, a data processing layer and a hardware call layer that are interconnected for communication, and the method includes steps S10~S12.

[0058] Step S10: using the network interface layer to obtain a control request for controlling a hardware terminal issued by a Web application, and issuing the control request.

[0059] Among them, the network interface layer provides interfaces for controlling different hardware terminals, such as HTTP or WebSocket interfaces, for Web applications to call. When a Web application issues a control request to control a hardware terminal, it is obtained through the network interface layer.

[0060] Step S11: receiving the control request sent down through the data processing layer, and obtaining the request data contained in the control request to convert the request data into a preset data format that is easy to identify.

[0061] Specifically, the control request includes request data. The data processing layer receives the request data obtained by the network interface layer, and then processes the request data, converting it into a data format that is easy for the underlying hardware terminal to recognize and the top-level Web application to read.

[0062] Step S12, obtaining the software development kit of the hardware terminal through the hardware call layer, and calling the corresponding target software development kit according to the control request to control the current hardware terminal.

[0063] Specifically, the hardware call layer integrates software development kits provided by hardware manufacturers of different hardware terminals. According to the control request, the corresponding target software development kit is called to control the corresponding hardware terminal, thereby realizing the control of the hardware terminal. Among them, the software development tool generally provides dll and so files, which can support Windows and Linux operating systems.

[0064] The middleware-based hardware terminal control method proposed in the above embodiment of the present invention sets up middleware, which includes a network interface layer, a data processing layer and a hardware call layer that are interconnected. The network interface layer is used to obtain a control request for controlling the hardware terminal issued by a Web application, and the control request is issued; the data processing layer receives the issued control request, and obtains the request data contained in the control request to convert the request data into a preset data format that is easy to identify; the software development kit of the hardware terminal is obtained through the hardware call layer, and the corresponding target software development kit is called according to the control request to control the current hardware terminal, thereby realizing the control of the hardware terminal by the web application, and the hardware control is not performed through the OCX control included in the SDK provided by the hardware manufacturer, and the set middleware can provide different interfaces, thereby realizing the control of the hardware on different browsers, solving the problem of poor versatility caused by the fact that only browsers with IE kernel can support OCX control when using OCX control for hardware control in the prior art.

[0065] Embodiment 2

[0066] The embodiment of the invention also proposes a hardware terminal control method based on middleware. The difference between the hardware terminal control method based on middleware proposed in the embodiment of the invention and the hardware terminal control method based on middleware proposed in the first embodiment of the invention is that:

[0067] The process before step S10 includes:

[0068] Acquire the configuration properties of the network interface layer, determine the configuration file according to the configuration properties, and generate the code of the network interface layer and the corresponding interface interceptor through the configuration file;

[0069] The configuration attributes include at least interface type, interface array, interface file name, interface path prefix, whether to generate a corresponding interceptor for the interface, interface path, interface request method, request parameter type, and return result type.

[0070] Specifically, in practice, during the development of the network interface layer, an independent network interface will be defined for each independent hardware terminal, making the control logic of each hardware device clearer. In this process, there will be a large amount of repeated code. In order to improve development efficiency, the network interface layer is provided with the function of automatically generating interfaces and interface interceptor codes according to configuration files. The configuration file is determined according to the configuration properties, so as to automatically generate the code of the network interface layer and the interface interceptor. The configuration file can be a yml configuration file. Taking Java language as an example, the FreeMarker template engine can be used to generate the network interface layer and the interface interceptor code from the above yml configuration file.

[0071] More specifically, in order to explain in more detail how the embodiment of the present invention automatically generates interfaces and interface interceptor codes according to configuration files, taking a yml file as an example, the configuration is as follows:

[0072] middle-level:

[0073] http:

[0074] -

[0075] name: PrintController

[0076] path: / api / printer

[0077] interceptor: true

[0078] APIs:

[0079] -

[0080] comment: Start the printer

[0081] path: / open

[0082] method: post

[0083] params-type: String #Port number, JSON string

[0084] return-type: Byte # 0 indicates failure, 1 indicates success

[0085] -

[0086] comment: Print document

[0087] path: / print

[0088] method: post

[0089] params-type: Document # Document to be printed

[0090] return-type: Byte # 0 indicates failure, 1 indicates success

[0091] -

[0092] comment: Turn off the printer

[0093] path: / close

[0094] method: post

[0095] params-type: String #Port number, JSON string

[0096] return-type: Byte # 0 indicates failure, 1 indicates success

[0097] ws:

[0098] -

[0099] name: RfidWebSocketServer

[0100] path: / api / rfid / ws

[0101] APIs:

[0102] -

[0103] comment: Start real-time reading

[0104] cmd: 0x61

[0105] -

[0106] comment: Stop real-time reading

[0107] cmd: 0x62

[0108] -

[0109] comment: write tag

[0110] cmd: 0x63

[0111] params-type: String # The information to be written to the tag, JSON string

[0112] Among them, the http attribute and the ws attribute are used to distinguish whether the interface type is HTTP or WebSocket, and the attribute value represents multiple HTTP interfaces or an array of WebSocket interfaces; the name attribute represents the interface file name; the path attribute represents the interface path prefix; the interceptor attribute represents whether to generate a corresponding interceptor for the interface (if it does not exist, it means that no interceptor needs to be generated); apis represents an interface array, and a single interface attribute includes the interface path path, the interface request method method, the request parameter type params-type (if it does not exist, it means that there are no request parameters), and the return result type return-type (if it does not exist, it means that the return result type is void). In particular, for the WebSocket interface, the cmd attribute value is used to distinguish different interfaces.

[0113] In addition, the data processing layer can also define interface pre-processing logic preHandle() and post-processing logic postHandle() for the automatically generated interface interceptor (inheriting the HandlerInterceptor class), which is used to process the request data of the Web application and the response data of the hardware device execution process and results, and convert them into a data format that is easy for the underlying hardware device to recognize and the top-level Web application to read.

[0114] The middleware-based hardware terminal control method proposed in the above embodiment of the present invention sets up middleware, which includes a network interface layer, a data processing layer and a hardware call layer that are interconnected. The network interface layer is used to obtain a control request for controlling the hardware terminal issued by a Web application, and the control request is issued; the issued control request is received by the data processing layer, and the request data contained in the control request is obtained to convert the request data into a preset data format that is easy to identify; the software development kit of the hardware terminal is obtained by the hardware call layer, and the corresponding target software development kit is called according to the control request to control the current hardware terminal, thereby realizing the control of the hardware terminal by the web application, and the hardware control is not performed through the OCX control included in the SDK provided by the hardware manufacturer, and the set middleware can provide different interfaces, thereby realizing the control of the hardware on different browsers, solving the problem of poor versatility caused by the fact that only browsers with IE kernel can support OCX control when using OCX control for hardware control in the prior art.

[0115] Embodiment 3

[0116] The embodiment of the invention also proposes a hardware terminal control method based on middleware. The difference between the hardware terminal control method based on middleware proposed in the embodiment of the invention and the hardware terminal control method based on middleware proposed in the first embodiment of the invention is that:

[0117] The method further comprises:

[0118] Signing the request parameters contained in the control request using a preset signature algorithm to obtain a request parameter signature value;

[0119] When the middleware receives the control request, it signs the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result;

[0120] When the verification signature result is consistent with the sign field parsed from the control request, and it is determined that the control request is not replayed, the verification between the Web application and the intermediate is passed.

[0121] The request parameter signature value is used to confirm the identity of the Web application and prevent data from being tampered with or replayed during communication, thereby improving the security of hardware devices during use.

[0122] Specifically, the step of signing the request parameter included in the control request by using a preset signature algorithm to obtain a request parameter signature value includes:

[0123] Arrange the request parameters in ascending alphabetical order according to the key value, traverse them one by one, take out the value corresponding to the key value, and then construct the request parameters into a string according to a preset format;

[0124] Ignore the preset fields, and concatenate the current timestamp and key information at the end of the string, then use the hash algorithm to calculate the hash value of the above string to obtain the request parameter signature value.

[0125] Among them, the request parameters are arranged in ascending alphabetical order according to the key value, and then traversed one by one to take out the value value corresponding to the key value, and then the request parameters are constructed into a string in the format of "key1=value1&key2=value2&key3=value3...", ignoring the field with key=sign and the field with value value of null, empty string, or only space, and the current timestamp and key information are concatenated at the end of the string, such as: "key1=value1&key2=value2&key3=value3...×tamp=4619415134611&secret=xxxxxxxxx", and finally the SHA-256 hash algorithm is used to calculate the hash value of the above string as the request parameter signature sign value.

[0126] In addition, in order to obtain the unique identifier of the middleware, the middleware secret key and other information, set the middleware configuration file, where the unique identifier id generated for the middleware can be a 36-bit Universally Unique Identifier (UUID), and the secret key can be a 32-bit UUID (remove the 4-bit "-" in the UUID), which are recorded in the middleware configuration file. The web application creates a middleware information table (t_middleware) and a middleware user association table (t_middleware_user). The middleware information table (t_middleware) records the basic information of the middleware. The core fields include: the middleware unique identifier id, which distinguishes different middleware platforms; the middleware secret key, which generates a signature for the request parameters of the web application to the middleware, verifies the identity of the web application, and prevents data from being tampered with or replayed during the communication process; the middleware user association table (t_middleware_user) records the association information between the middleware and the user. The core fields include: the middleware unique identifier id, the user unique identifier user_id, the middleware access address url and the selected identifier is_selected. Since a user can log in on multiple PCs, there is a many-to-many relationship between users and middleware. In addition, the combination of user unique identifier and access path under the same middleware cannot be repeated.

[0127] In addition, after the signature consistency check, a replay check is performed. Specifically, it is determined whether the sign exists in the cache. If so, the request is suspected of replay and the request is rejected. If not, the current timestamp of the server is obtained and compared with the timestamp in the request parameters. If the interval exceeds 60 seconds, the request is suspected of replay and the request is rejected. If not, the sign is cached and the validity period is set to 60 seconds, and the signature check passes. At the same time, before making a signature consistency judgment, a preliminary identity verification is performed. Specifically, the request is parsed to determine whether it contains the middleware unique identifier middleId, the request parameter signature sign, and the timestamp field. If not, the request parameters are incorrect; if they exist, determine whether the id in the middleware configuration file and the middleId in the request parameters are consistent. If not, it means that the middleware information configured in the Web application is incorrect and the middleware refuses to respond. If they are consistent, obtain the middleware key from the middleware configuration file; and, at the beginning of the verification, the request is filtered, that is, the signatures that meet the requirements are filtered. Among them, the middleware defines a signature verification filter ApiFilter, which performs signature verification on requests with " / api" as the URL prefix, POST as the request method, and "application / json" as the Content-Type.

[0128] In addition, in an optional embodiment of the present invention, a connection check can also be performed before the signature check. Specifically, when a Web application establishes a WebSocket connection to a middleware platform, the middleware needs to first perform a connection check. First, it is determined whether the connection request url carries a parameter middleId (middleware unique identifier id), such as: / api / rfid / ws?middleId=xxxxxxxxxxx. If middleId does not exist, the connection is rejected. If it exists, the Web application and the middleware platform are allowed to establish a connection.

[0129] Define the hash table pathAndWsMap, the data type is Map<String, Session> , records the mapping relationship between the WebSocket connection path and the WebSocket instance, where the key value is the path of the WebSocket connection, the value value is the WebSocket instance, and the WebSocket instance established later will overwrite the previously established WebSocket instance.

[0130] After the connection is successfully established, the signature verification process of the communication data is the same as the signature verification process mentioned above.

[0131] For a further detailed description of the complete security verification in the embodiment of the present invention, please refer to Figure 3First, determine whether the request needs to be parsed and verified, such as whether it contains the corresponding prefix and request method, and then parse it to make parameter judgments in turn, obtain the secret key for signature authentication and replay judgment.

[0132] The middleware-based hardware terminal control method proposed in the above embodiment of the present invention sets up middleware, which includes a network interface layer, a data processing layer and a hardware call layer that are interconnected. The network interface layer is used to obtain a control request for controlling the hardware terminal issued by a Web application, and the control request is issued; the issued control request is received by the data processing layer, and the request data contained in the control request is obtained to convert the request data into a preset data format that is easy to identify; the software development kit of the hardware terminal is obtained by the hardware call layer, and the corresponding target software development kit is called according to the control request to control the current hardware terminal, thereby realizing the control of the hardware terminal by the web application, and the hardware control is not performed through the OCX control included in the SDK provided by the hardware manufacturer, and the set middleware can provide different interfaces, thereby realizing the control of the hardware on different browsers, solving the problem of poor versatility caused by the fact that only browsers with IE kernel can support OCX control when using OCX control for hardware control in the prior art.

[0133] Embodiment 4

[0134] See also Figure 4 , shown is a hardware terminal control device based on middleware proposed in the fourth embodiment of the present invention, the middleware at least includes a network interface layer, a data processing layer and a hardware call layer that are communicatively connected to each other, and the device includes:

[0135] The acquisition module 100 is used to acquire the control request for controlling the hardware terminal issued by the Web application by using the network interface layer, and issue the control request;

[0136] The receiving module 200 is used to receive the control request sent by the data processing layer, and obtain the request data included in the control request to convert the request data into a preset data format that is easy to identify;

[0137] The control module 300 is used to obtain the software development kit of the hardware terminal through the hardware call layer, and call the corresponding target software development kit according to the control request to control the current hardware terminal.

[0138] Furthermore, the above-mentioned middleware-based hardware terminal control device comprises:

[0139] A configuration module, used to obtain configuration properties of the network interface layer, determine a configuration file according to the configuration properties, and generate the code of the network interface layer and the corresponding interface interceptor through the configuration file;

[0140] The configuration attributes include at least interface type, interface array, interface file name, interface path prefix, whether to generate a corresponding interceptor for the interface, interface path, interface request method, request parameter type, and return result type.

[0141] Furthermore, the above-mentioned middleware-based hardware terminal control device, wherein the device also includes:

[0142] A signature module, used to sign the request parameters contained in the control request using a preset signature algorithm to obtain a request parameter signature value;

[0143] A verification module, configured to sign the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result after the middleware receives the control request;

[0144] The parsing module is used to verify that when the verification signature result is consistent with the sign field parsed in the control request and it is determined that the control request has not been replayed, the verification between the Web application and the intermediate is passed.

[0145] Further, in the above-mentioned middleware-based hardware terminal control device, the step of determining that the control request is not replayed comprises:

[0146] There is no sign in the cache and the interval between the current timestamp of the server and the timestamp in the request parameter does not exceed the preset time.

[0147] Furthermore, in the above-mentioned middleware-based hardware terminal control device, the signature module is specifically used for:

[0148] Arrange the request parameters in ascending alphabetical order according to the key value, traverse them one by one, take out the value corresponding to the key value, and then construct the request parameters into a string according to a preset format;

[0149] Ignore the preset fields, and concatenate the current timestamp and key information at the end of the string, then use the hash algorithm to calculate the hash value of the above string to obtain the request parameter signature value.

[0150] Furthermore, in some optional embodiments of the present invention, the device further includes:

[0151] A recording module, used to generate a unique identifier and a key for the middleware, and record them in a configuration file of the middleware;

[0152] An establishment module, used to establish a middleware information table of the web application according to the unique identifier of the middleware and the key of the middleware;

[0153] The association module is used to establish a middleware user association table of the web application according to the unique identifier of the middleware, the unique identifier of the user, the middleware access address and the identification of whether the middleware is selected.

[0154] Furthermore, the above-mentioned middleware-based hardware terminal control device, wherein the device also includes:

[0155] A judgment module, used to parse the control request and determine whether it contains a middleware unique identifier, a request parameter signature sign, and a timestamp field;

[0156] If yes, determine whether the unique identifier in the middleware configuration file is consistent with the identifier in the request parameter;

[0157] If so, obtain the middleware key from the middleware configuration file, and execute the step of signing the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result after the middleware receives the control request.

[0158] The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and will not be repeated here.

[0159] Embodiment 5

[0160] Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of any of the methods described in embodiments one to three above are implemented.

[0161] Embodiment 6

[0162] Another aspect of the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the methods described in embodiments one to three above when executing the program.

[0163] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0164] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0165] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0166] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0167] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0168] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A hardware terminal control method based on middleware, It is characterized in that The middleware at least includes a network interface layer, a data processing layer, and a hardware call layer that are communicatively connected to each other, and the method includes: Using the network interface layer to obtain a control request for controlling a hardware terminal issued by a Web application, and issuing the control request; Receiving the control request sent down through the data processing layer, and obtaining the request data contained in the control request to convert the request data into a preset data format that is easy to identify; Acquire the software development kit of the hardware terminal through the hardware call layer, and call the corresponding target software development kit according to the control request to control the current hardware terminal; The method further comprises: Signing the request parameters contained in the control request using a preset signature algorithm to obtain a request parameter signature value; When the middleware receives the control request, it signs the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result; When the verification signature result is consistent with the sign field parsed from the control request, and it is determined that the control request is not replayed, the verification between the Web application and the middleware is passed; Before the step of signing the request parameters included in the control request by using a preset signature algorithm to obtain the request parameter signature value, the step further includes: Generate a unique identifier and key for the middleware, and record them in a configuration file of the middleware; Establishing a middleware information table of the web application according to the unique identifier of the middleware and the key of the middleware; Establishing a middleware user association table of the web application according to the unique identifier of the middleware, the unique identifier of the user, the middleware access address and the identification of whether the middleware is selected; After the step of signing the request parameters included in the control request by using a preset signature algorithm to obtain a request parameter signature value, the step further includes: Parse the control request to determine whether it contains the middleware unique identifier, request parameter signature sign, and timestamp field; If yes, determine whether the unique identifier in the middleware configuration file is consistent with the identifier in the request parameter; If so, obtain the middleware key from the middleware configuration file, and execute the step of signing the request parameters using the middleware key and the timestamp in the control request according to the preset signature algorithm to obtain a verification signature result after the middleware receives the control request.

2. The hardware terminal control method based on middleware according to claim 1, It is characterized in that Before the step of using the network interface layer to obtain a control request for controlling a hardware terminal issued by a Web application and issuing the control request, the step further includes: Acquire the configuration properties of the network interface layer, determine the configuration file according to the configuration properties, and generate the code of the network interface layer and the corresponding interface interceptor through the configuration file; The configuration attributes include at least interface type, interface array, interface file name, interface path prefix, whether to generate a corresponding interceptor for the interface, interface path, interface request method, request parameter type, and return result type.

3. The hardware terminal control method based on middleware according to claim 1, It is characterized in that The step of determining that the control request is not replayed comprises: There is no sign in the cache and the interval between the current timestamp of the server and the timestamp in the request parameter does not exceed the preset time.

4. The hardware terminal control method based on middleware according to claim 1, It is characterized in that The step of signing the request parameter included in the control request by using a preset signature algorithm to obtain a request parameter signature value includes: Arrange the request parameters in ascending alphabetical order according to the key value, traverse them one by one, take out the value corresponding to the key value, and then construct the request parameters into a string according to a preset format; Ignore the preset fields, and concatenate the current timestamp and key information at the end of the string, then use the hash algorithm to calculate the hash value of the above string to obtain the request parameter signature value.

5. A hardware terminal control device based on middleware, It is characterized in that Used to implement the hardware terminal control method according to any one of claims 1 to 4, the middleware at least includes a network interface layer, a data processing layer and a hardware call layer that are interconnected, and the device includes: An acquisition module, used to acquire a control request for controlling a hardware terminal issued by a Web application by using the network interface layer, and to issue the control request; A receiving module, configured to receive the control request sent by the data processing layer, and obtain request data included in the control request to convert the request data into a preset data format that is easy to identify; The control module is used to obtain the software development kit of the hardware terminal through the hardware call layer, and call the corresponding target software development kit according to the control request to control the current hardware terminal.

6. A readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

7. An electronic device, It is characterized in that The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the methods of claims 1 to 4 when executing the program.

Citation Information

Patent Citations

  • Data acquisition method and system based on acquisition service middleware and medium

    CN111580986A

  • Message authentication method and system based on HMAC control, and medium

    CN114362920A

  • Interface calling method and device, electronic equipment and storage medium

    CN114942855A

  • Communication middleware, communication method, electronic equipment and storage medium

    CN115834688A

  • Framework device of mobile terminal and method for providing interoperability between components

    US20100229183A1