Data communication method, device, storage medium and computer device
By providing a unified communication interface through middleware software, the problem of incompatibility between communication protocols and data formats of different terminal devices and business systems is solved, and efficient data transmission and system compatibility between terminal devices and business systems are achieved.
Patent Information
- Application Number
- CN202410663119.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-05-27
AI Technical Summary
Different types of terminal devices and business systems have different technical architectures, programming languages and database systems, resulting in different communication protocols and data formats. Existing technologies require system integration for new terminal devices to ensure compatibility with their communication protocols and data formats.
Middleware software provides a unified communication interface, which receives transmission signals from terminal devices or business systems, performs format conversion and storage, and realizes data communication between terminal devices and business systems, including uploading device status data and managing operation commands.
It improved the compatibility of business systems, achieved seamless integration and efficient data transmission between terminal devices and business systems, reduced system integration pressure, and improved the efficiency and stability of data communication.
Smart Images

Figure CN118488121B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a data communication method and device, a storage medium and a computer device. BACKGROUND
[0002] With the acceleration of informationization construction in China, the types and quantities of terminal devices associated with business systems in various fields are increasing, such as attendance devices, access control devices and consumption devices in enterprises, which makes the complexity and interactivity of business systems increasingly enhanced.
[0003] However, different types of terminal devices and business systems are developed based on different technical architectures, programming languages, database systems and the like, resulting in different communication protocols and data formats therebetween. Therefore, when a new terminal device is connected with a business system, the business system needs to integrate the system for the terminal device to be compatible with the communication protocol and data format thereof. SUMMARY
[0004] The present application aims to at least solve one of the above technical defects, particularly the technical defect that when a new terminal device is connected with a business system, the business system needs to integrate the system for the terminal device to be compatible with the communication protocol and data format thereof in the prior art.
[0005] The present application provides a data communication method applied to middleware software arranged in a business system, and the method comprises the following steps:
[0006] receiving a transmission signal sent by a terminal device or a business system, and determining transmission content carried by the transmission signal;
[0007] when the transmission content is device initial data sent by the terminal device in real time, performing format conversion on the device initial data to obtain device state data, and storing the device state data into an upload data queue;
[0008] when the transmission content is a data request sent by the business system, obtaining device state data corresponding to the data request from the upload data queue, and returning the device state data as target data to the business system;
[0009] when the transmission content is an operation command issued by the business system, storing the operation command into a device command queue;
[0010] When the transmission content is a command request sent by the terminal device, an operation command corresponding to the command request is extracted from the device command queue and returned to the terminal device as a target command, and after the terminal device executes the target command to obtain an execution result, the execution result is sent to the service system.
[0011] Optionally, the format conversion on the device initial data obtains device state data, and the format conversion includes:
[0012] The device initial data is preprocessed, and state analysis is performed according to the preprocessed device initial data to obtain a device state of the terminal device and a state type of the device state.
[0013] The data receiving format of the service system and the device code of the terminal device are determined, and the device state, the state type and the device code are data encoded based on the data receiving format to generate device state data.
[0014] Optionally, the device state data corresponding to the data request is obtained from the upload data queue and returned to the service system as target data, and the obtaining includes:
[0015] The data request is information decoded to obtain a first decoding result, and the device code and the state type corresponding to the data request are determined according to the first decoding result.
[0016] The device code and the state type are searched in the upload data queue, and the device state data searched is returned to the service system as target data.
[0017] The device state data stored in the upload data queue carries the device code and the state type of the corresponding terminal device.
[0018] Optionally, the operation command corresponding to the command request is extracted from the device command queue and returned to the terminal device as a target command, and the extracting includes:
[0019] The command request is information decoded to obtain a second decoding result, and the device code corresponding to the command request is determined according to the second decoding result.
[0020] The operation command corresponding to the device code is extracted from the device command queue according to a preset extraction number, and the operation command is returned to the terminal device as a target command.
[0021] The operation command stored in the device command queue carries the device code of the terminal device to be executed.
[0022] Optionally, the extracting the operation command corresponding to the device code from the device command queue according to the preset extraction number comprises:
[0023] retrieving the operation commands corresponding to the device code from the device command queue to obtain a retrieval result, wherein each operation command corresponds to a priority;
[0024] determining the number of operation commands in the retrieval result and judging whether the number of operation commands is greater than the preset extraction number;
[0025] if yes, extracting the operation commands corresponding to the preset extraction number from the retrieval result in the order from high to low priority;
[0026] if no, extracting each operation command in the retrieval result.
[0027] Optionally, the sending the execution result to the service system comprises:
[0028] determining the data receiving format of the service system and sending the execution result to the service system after format conversion according to the data receiving format.
[0029] Optionally, the method further comprises:
[0030] determining the data object type of the terminal device and the data receiving format of the data object type before returning the target command to the terminal device;
[0031] format-converting the target command according to the data receiving format and sending the converted target data to the terminal device.
[0032] The application further provides a data communication device, comprising:
[0033] a signal receiving module, configured to receive a transmission signal sent by a terminal device or a service system and determine transmission content carried by the transmission signal;
[0034] a first storage module, configured to, when the transmission content is device initial data sent by the terminal device in real time, format-convert the device initial data to obtain device state data and store the device state data to an upload data queue;
[0035] a first communication module, configured to, when the transmission content is a data request sent by the service system, acquire device state data corresponding to the data request from the upload data queue and return the device state data to the service system as target data;
[0036] The second storage module is configured to store the operation command into a device command queue when the transmission content is the operation command issued by the service system.
[0037] The second communication module is configured to extract the operation command corresponding to the command request from the device command queue when the transmission content is the command request sent by the terminal device, and return the operation command as a target command to the terminal device, and send the execution result to the service system after the terminal device executes the target command to obtain the execution result.
[0038] The application further provides a storage medium, wherein the storage medium stores computer readable instructions, and the computer readable instructions are executed by one or more processors to enable the one or more processors to perform the steps of the data communication method according to any one of the above embodiments.
[0039] The application further provides a computer device, which comprises one or more processors and a memory.
[0040] The memory stores computer readable instructions, and the computer readable instructions are executed by the one or more processors to perform the steps of the data communication method according to any one of the above embodiments.
[0041] From the above technical solutions, it can be seen that the embodiments of the application have the following advantages:
[0042] The data communication method, device, storage medium and computer device provided in the application are applied to middleware software arranged in a service system. After receiving a transmission signal sent by a terminal device or the service system, the middleware software can determine transmission content carried by the transmission signal, so that the transmission content can be uniformly converted in format, the compatibility of the service system is improved, and data transmission between the terminal device and the service system is quickly realized. For example, when receiving device initial data sent by the terminal device in real time, the device initial data can be converted in format to obtain device state data, and the device state data is stored in an upload data queue. When receiving a data request sent by the service system, the device state data corresponding to the data request can be obtained from the upload data queue and returned to the service system as target data. When receiving an operation command sent by the service system, the operation command is stored in a device command queue. When receiving a command request sent by the terminal device, the operation command corresponding to the command request is extracted from the device command queue and returned to the terminal device as a target command. After the terminal device executes the target command to obtain an execution result, the execution result is sent to the service system. Through the middleware software, the application can provide a unified communication interface to isolate the underlying details of the communication protocol, support data communication of various types of terminal devices, and improve the compatibility of the service system. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of these drawings.
[0044] Figure 1 A flowchart of a data communication method provided by an embodiment of the present application;
[0045] Figure 2 An interaction diagram of a data communication process provided by an embodiment of the present application;
[0046] Figure 3 A structural diagram of a data communication device provided by an embodiment of the present application;
[0047] Figure 4 An internal structural diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] Different types of terminal devices and business systems are developed based on different technical architectures, programming languages, database systems, etc., resulting in different communication protocols and data formats between them. Therefore, when a new terminal device connects to a business system, the business system needs to perform system integration for that terminal device to ensure compatibility with its communication protocols and data formats.
[0050] Based on this, this application proposes the following technical solution, as detailed below:
[0051] In one embodiment, such as Figure 1 As shown, Figure 1 This is a flowchart illustrating a data communication method provided in an embodiment of this application. This application provides a data communication method applied to middleware software installed in a business system, specifically including the following:
[0052] S110: Receives transmission signals sent by terminal equipment or business systems and determines the transmission content carried by the transmission signals.
[0053] In this embodiment, users can use middleware software to connect terminal devices and business systems, responsible for receiving data and commands sent by various terminal devices and business systems, and then forwarding the data. Upon receiving a transmission signal from a terminal device or business system, the middleware software can first determine the content carried by the transmission signal and then perform corresponding processing operations. This isolates the underlying details of the communication protocols used by various types of data, improving the compatibility of the business system.
[0054] It is understood that the business system in this application can connect to different types of terminal devices, thereby enabling data communication between these devices. In one application scenario, the terminal devices include, but are not limited to, attendance devices, access control devices, and payment devices. Furthermore, each type of terminal device can be categorized into multiple interaction types, such as facial recognition, card swiping recognition, and fingerprint recognition.
[0055] It should be noted that, due to the bottom design of various terminal devices, the implementation functions are different, the communication interfaces adopted are different, each interface has its specific communication protocol and specification. Based on this, the application can adopt middleware software to realize the data communication between each terminal device and the business system, avoid the direct connection of the business system and each communication interface, and the middleware software can provide a unified API interface to encapsulate the bottom details of the communication with the terminal device, including various communication protocols and interfaces, so that the business system does not need to care about the specific communication protocol used by the terminal device, and does not need to deeply understand the complexity and specificity of the terminal device, thereby reducing the communication compatibility pressure of the business system.
[0056] Specifically, after receiving the transmission signal sent by the terminal device or the business system, the middleware software can analyze the transmission signal to obtain the transmission content carried by the transmission signal. The transmission content here can be related data reported by the terminal device to the business system, or related commands issued by the business system to the related device, which is not limited here. When the terminal device and the business system need to interact with data, the related data or commands need to be converted into a data format that the other party can receive through the middleware software, and then sent to the corresponding device or system, so as to avoid the incompatibility of the communication protocol.
[0057] Further, when the terminal device is connected to the business system for the first time through the middleware software, the middleware software can receive the device code, device type, supported communication protocol and other related device data provided by the terminal device, and then the middleware system can verify the device data and add it to the device management list after verification to communicate between the terminal device and the business system. In addition, the middleware software can also monitor the connection state of the connected terminal device. In detail, the terminal device will send a heartbeat data every 5 seconds, and the middleware software will monitor the heartbeat data of each terminal device through threads. If the time length of the monitoring heartbeat data exceeds the preset time length, the middleware software will update the connection state of the corresponding terminal device to offline.
[0058] S120: When the transmission content is the device initial data sent by the terminal device in real time, the device initial data is format-converted to obtain device state data, and the device state data is stored in the upload data queue.
[0059] In this embodiment, after the transmission content obtained by step S110 is analyzed, if the transmission content is the device initial data sent by the terminal device in real time, the middleware software can format-convert the device initial data to obtain device state data, and then the device state data can be stored in the upload data queue, so as to quickly respond when the business system needs to obtain the device state data of the terminal device.
[0060] The uploading data queue refers to a mechanism for temporarily storing to-be-sent data, so as to realize asynchronous processing of the device initial data, improve the corresponding capability and throughput of the terminal device, and further serve as a buffer to allow data to accumulate for a period of time without loss when the data generation speed exceeds the processing or sending speed, thereby improving the smoothness and stability of data communication.
[0061] Specifically, after receiving the device initial data sent by the terminal device in real time, the middleware software can analyze the device initial data to obtain the state result of the terminal device at the current time, and then convert the data format of the analyzed state result into a data format that can be received by the business system, so that the business system can quickly respond when it needs to obtain the device state data of the terminal device.
[0062] For example, the device initial data sent by the terminal device is binary data, and at this time, the middleware software can analyze the actual state represented by the binary data and then convert it into a text format that can be received and understood by the business system.
[0063] S130: When the transmission content is a data request sent by the business system, the device state data corresponding to the data request is obtained from the uploading data queue and returned to the business system as target data.
[0064] In this embodiment, after analyzing the transmission content obtained by step S110, if the transmission content is a data request sent by the business system, the middleware software can obtain the device state data corresponding to the data request from the uploading data queue and return it to the business system as target data, thereby improving the efficiency of data communication.
[0065] It can be understood that when the middleware software is deployed in the business system, the middleware software can be connected to the business system through an ESB (Enterprise Service Bus) after publishing the API interface. The ESB refers to a standard integration method between loosely coupled services and applications, which provides the most basic connection hub in the network and can solve the integration problem between enterprise application systems. Therefore, the middleware software can realize seamless integration and efficient data exchange between the terminal device and the business system through the ESB.
[0066] Specifically, when the business system requests data from the middleware software through the API interface, the API interface can be forwarded through the ESB. Further, the path format of the API interface includes two types of GET and POST, wherein the GET request is used to query data, and the POST request is used to submit data. Through the API interface, the business system can realize data communication with the terminal device.
[0067] S140: When the transmission content is an operation command issued by the service system, the operation command is stored in the device command queue.
[0068] In this embodiment, after the transmission content obtained by step S110 is analyzed, if the transmission content is an operation command issued by the service system, the middleware software can store the operation command in the device command queue, so that the terminal device can quickly obtain the operation command of the service system and execute it.
[0069] The device command queue refers to a data structure for storing and managing commands to be sent to the terminal device, which can ensure that the commands are processed and executed in a specific order, such as first-in-first-out, priority, etc., to avoid command conflicts or ensure that the dependent relationship of the commands is correctly processed. In addition, when the terminal device cannot temporarily process more commands, the device command queue can act as a buffer to avoid data loss or system crash, achieve data flow control and load balancing.
[0070] For example, when the user needs to manage the relevant data in the terminal device, the service system can generate the corresponding operation command, such as adding, deleting, querying or modifying the personnel information of the registered personnel in the terminal device, and then the service system can send the operation command to the middleware software in the form of a transmission signal, so that the middleware software stores it in the device command queue.
[0071] S150: When the transmission content is a command request sent by the terminal device, the operation command corresponding to the command request is extracted from the device command queue and returned to the terminal device as a target command, and after the terminal device executes the target command and obtains the execution result, the execution result is sent to the service system.
[0072] In this embodiment, after the transmission content obtained by step S110 is analyzed, if the transmission content is a command request sent by the terminal device, the middleware software can extract the operation command corresponding to the command request from the device command queue and return it to the terminal device as a target command, and after the terminal device executes the target command and obtains the execution result, the execution result can be sent to the service system.
[0073] Specifically, after the terminal device is online and a communication connection is established with the middleware software, the terminal device can send a command request to the middleware software at a preset frequency to obtain operation commands issued by the business system in a timely manner, so as to realize synchronization of data communication. When the middleware software forwards the operation commands to the terminal device, the middleware software can convert the operation commands to a data format that can be received by the terminal device based on the device information of the terminal device stored in the device management queue, and then forwards the operation commands to the terminal device. Then, the terminal device can execute the obtained operation commands, such as adding, deleting, querying, or modifying the personnel information of the registered personnel in the personnel management list, and generates corresponding execution results after the execution of the operation commands is completed, and returns the execution results to the business system through the middleware software.
[0074] In the above embodiment, after receiving the transmission signal sent by the terminal device or the business system, the middleware software can determine the transmission content carried by the transmission signal, so that the transmission content can be uniformly converted in format, the compatibility of the business system is improved, and the data transmission between the terminal device and the business system is quickly realized. For example, when the device initial data sent by the terminal device in real time is received, the device initial data can be converted in format to obtain device state data, and the device state data is stored in the upload data queue, so that when the data request sent by the business system is received, the device state data corresponding to the data request can be obtained from the upload data queue and returned to the business system as target data; and when the operation command issued by the business system is received, the operation command is stored in the device command queue, so that when the command request sent by the terminal device is received, the operation command corresponding to the command request can be extracted from the device command queue and returned to the terminal device as a target command, and after the terminal device executes the target command to obtain the execution result, the execution result is sent to the business system. Through the middleware software, the application can provide a unified communication interface to isolate the underlying details of the communication protocol to support data communication of various types of terminal devices and improve the compatibility of the business system.
[0075] In one embodiment, the format conversion of the device initial data in step S120 to obtain the device state data can include:
[0076] S121: performing a preprocessing operation on the device initial data, and performing state analysis based on the preprocessed device initial data to obtain a device state of the terminal device and a state type of the device state.
[0077] S122: determining a data receiving format of the business system and a device code of the terminal device, and performing data coding on the device state, the state type, and the device code based on the data receiving format to generate the device state data.
[0078] In this embodiment, when the middleware software performs format conversion on the device initial data, the middleware software can first perform a preprocessing operation on the device initial data, and perform state analysis on the preprocessed device initial data to obtain the device state of the terminal device and the state type of the device state. Then, the data receiving format of the business system and the device code of the terminal device can be determined, and the device state, the state type, and the device code are encoded based on the data receiving format to generate device state data that can be received by the business system, thereby improving the data communication efficiency.
[0079] The preprocessing operation includes but is not limited to noise removal, data cleaning, feature extraction and dimension reduction, and data normalization. In detail, the noise removal refers to removing noise and interference in the device initial data to improve the quality and availability of the data; the data cleaning refers to removing outliers, supplementing missing values, and smoothing the data to improve the accuracy and integrity of the data; the feature extraction and dimension reduction refer to extracting effective information from the device initial data and converting the extracted effective information into a low-dimensional vectorized form to facilitate subsequent mathematical operations and analysis; and the data normalization refers to normalizing the device initial data to ensure that the weights of different features are the same, thereby avoiding data bias and error.
[0080] Specifically, when determining the data receiving format of the business system, the middleware software can first obtain the business requirements of the business system, such as the expected data type, data structure, field name, and format, and then select the data receiving format supported by the business system, such as JSON, XML, CSV, etc., based on these business requirements. These data receiving formats have wide compatibility and are easy to parse and generate. Then, the middleware software can query the device code corresponding to the terminal device from the device management list, and then encode the device state and state type obtained by analyzing the device initial data and the device code based on the selected data receiving format to generate device state data that can be received by the business system.
[0081] It can be understood that the device initial data reported by the terminal device to the business system includes at least one state type, such as a door magnetic state, a relay state, or an alarm state. Therefore, the middleware system can analyze the device state of each state type in the device initial data, such as no door magnet or door magnet for the door magnetic state, and closing and opening for the relay state.
[0082] For example, the device initial data uploaded by the terminal device is binary data. In the device initial data uploaded by a door access device, Sensor represents the device type of a door magnetic state, each door occupies two binary bits, AA represents 1-4 doors, BB represents 5-8 doors, 1 door occupies the 1st and 2nd bits of the first byte, and so on, 0b00 represents that the current door magnetic has no door magnetic, 0b01 represents that the current door has a door magnetic and is closed, and 0b10 represents that the current door has a door magnetic and is opened; Relay represents the device type of a relay state, each door occupies one binary bit, 0b0 represents that the relay is attracted, 0b1 represents that the relay is disconnected, the first bit is the 1st door relay state, and so on; Alarm represents the device type of an alarm state, each 1 door occupies one byte, and a maximum of 8 alarms can be expressed, DD is the 1st door alarm state, and so on, wherein the alarm type can include an unexpected door opening event, a tamper alarm, a coercion password alarm, a coercion fingerprint alarm, a door magnetic timeout alarm, and the like.
[0083] In one embodiment, the step S130 of obtaining the device state data corresponding to the data request from the uploaded data queue and returning the device state data as target data to the business system can include:
[0084] S131: decoding information of the data request to obtain a first decoding result, and determining the device code and the state type corresponding to the data request according to the first decoding result.
[0085] S132: searching the device code and the state type in the uploaded data queue, and returning the searched device state data as target data to the business system.
[0086] In the embodiment, after receiving the data request of the business system, the middleware software can decode information of the data request to obtain a first decoding result, and determine the device code and the state type corresponding to the data request according to the first decoding result, so as to search the device code and the state type in the uploaded data queue, and return the searched device state data as target data to the business system, so as to realize quick response to the data request.
[0087] For example, in order to ensure the accuracy of the device state of the access control device displayed in the business system, the business system can send a data request of the access control device to the API interface of the middleware software every 5 seconds. Since the device state data stored in the upload data queue carries the device code and state type of the corresponding terminal device, after receiving the data request of the business system, the middleware software can obtain the device code and state type of the data request by analysis, retrieve the device state data of the access control device corresponding to the device code from the upload data queue, and then filter the device state data of the state type, such as the door magnetic state, the relay state, and the alarm state, from the retrieved device state data, and finally return the filtered device state data as target data to the business system.
[0088] In one embodiment, the step S150 of extracting the operation command corresponding to the command request from the device command queue and returning the operation command as a target command to the terminal device in step S150 can include:
[0089] S151: decoding the command request to obtain a second decoding result, and determining the device code corresponding to the command request according to the second decoding result.
[0090] S152: extracting the operation command corresponding to the device code from the device command queue according to the preset extraction number, and returning the operation command as a target command to the terminal device.
[0091] In this embodiment, after receiving the command request of the business system, the middleware software can decode the command request to obtain a second decoding result, determine the device code corresponding to the command request according to the second decoding result, and then extract the operation command corresponding to the device code from the device command queue according to the preset extraction number, and return the operation command as a target command to the terminal device.
[0092] It can be understood that since the operation commands stored in the device command queue carry the device code of the terminal device to be executed, after receiving the command request of the business system, the middleware software can obtain the device code of the command request by analysis, and then retrieve the operation command corresponding to the device code from the device command queue, which represents the operation command to be executed by the terminal device corresponding to the device code. Finally, the middleware software can extract the operation command consistent with the preset extraction number from the retrieved operation command as a target command and send it to the terminal device, so that the terminal device performs the operation on the target command.
[0093] It should be noted that the business system can simultaneously issue multiple operation commands to the same terminal device. To avoid the situation that the terminal device cannot simultaneously process more operation commands, causing communication congestion, the middleware software can send operation commands to the terminal device according to the preset extraction number, so as to realize data flow limiting and load balancing.
[0094] In one embodiment, the step S152 of extracting the operation commands corresponding to the device code from the device command queue according to the preset extraction number can include:
[0095] S1521: retrieving multiple operation commands corresponding to the device code in the device command queue to obtain a retrieval result; wherein each operation command corresponds to a priority.
[0096] S1522: determining the number of operation commands in the retrieval result, and judging whether the number of operation commands is greater than the preset extraction number.
[0097] S1523: if yes, extracting the operation commands corresponding to the preset extraction number from the retrieval result in the order from high to low priority.
[0098] S1524: if no, extracting each operation command in the retrieval result.
[0099] In this embodiment, after the middleware software decodes the device code of the command request, it can retrieve multiple operation commands corresponding to the device code in the device command queue to obtain a retrieval result. Then, the middleware software can determine the number of operation commands in the retrieval result, and judge whether the number of operation commands is greater than the preset extraction number, and then can perform corresponding extraction operation according to the judgment result.
[0100] Specifically, each operation command stored in the device command queue is associated with a priority. When the number of operation commands is greater than the preset extraction number, it means that the number of operation commands to be executed by the terminal device exceeds the number of operation commands that can be simultaneously executed by the terminal device. Therefore, the middleware software needs to perform data flow limiting, that is, extracting the operation commands corresponding to the preset extraction number from the retrieval result in the order from high to low priority, and sending the extracted operation commands to the terminal device as operation commands; when the number of operation commands is not greater than the preset extraction number, it means that the terminal device can simultaneously process the operation commands to be executed in the retrieval result. Therefore, the middleware software can extract each operation command in the retrieval result, and send the extracted operation commands to the terminal device as operation commands.
[0101] For example, the operation commands stored in the device command queue to be executed by the access control device are divided into emergency commands and non-emergency commands, wherein the priority of the emergency commands is higher than the priority of the non-emergency commands. Therefore, when the access control device requests its corresponding operation command from the middleware software, the middleware software can preferentially extract the emergency command from the device command queue and send it to the terminal device.
[0102] In one embodiment, the sending of the execution result to the business system in step S150 can include:
[0103] S153: determining the data receiving format of the business system, and sending the execution result to the business system after format conversion according to the data receiving format.
[0104] In this embodiment, after receiving the execution result returned by the terminal device, the middleware software can select a data receiving format, such as JSON, XML, CSV, etc., from a plurality of data receiving formats supported by the business system according to the business requirements of the business system; then the middleware software can format convert the execution result according to the selected data receiving format, and send the format converted execution result to the business system using a corresponding communication protocol, such as HTTP, HTTPS, SOAP, RESTful, etc., thereby improving the communication efficiency between the terminal device and the business system.
[0105] In one embodiment, the method can further include:
[0106] S160: before returning the target command to the terminal device, determining the data object type of the terminal device and the data receiving format of the data object type.
[0107] S170: format converting the target command according to the data receiving format, and sending the converted target data to the terminal device.
[0108] In this embodiment, before returning the target command to the terminal device, the middleware software can first determine the data object type of the terminal device and the data receiving format of the data object type, then format convert the target command according to the data receiving format, and send the converted target data to the terminal device.
[0109] It can be understood that various data object types in the terminal device are collected in the middleware software, and only data identical to these data object types can be received by the corresponding terminal device. Further, different terminal devices of different device types have different understandings of data object types, and therefore the middleware software can format convert the target command into a data receiving format corresponding to the data object type, so as to eliminate the inconsistency of the terminal device in understanding data.
[0110] In order to better explain the text matching method of the present application, the following will be further described by taking Figure 2 as an example, as shown in Figure 2 , Figure 2 is an interaction diagram of a data communication process provided by an embodiment of the present application.
[0111] Figure 2 In the embodiment, the terminal device can send real-time data or send a command request to request a command to the middleware software Adms, at this time, the middleware software Adms can store the real-time data into the database Redis, or obtain an operation command corresponding to the command request from the database Redis and return the operation command to the terminal device. Similarly, the business system can also send an operation command or a data request to the middleware software Adms to request data of the terminal device, at this time, the middleware software Adms can store the operation command into the database Redis, or obtain real-time data corresponding to the data request from the database Redis and return the real-time data to the business system; but different from the terminal device, the data communication between the business system and the middleware software Adms is all forwarded through the ESB.
[0112] The data communication device provided by the embodiment of the present application is described below, and the data communication device described below can be correspondingly referred to the data communication method described above.
[0113] In one embodiment, as shown in Figure 3 , Figure 3 is a structure diagram of a data communication device provided by an embodiment of the present application; the present application also provides a data communication device, which comprises a signal receiving module 210, a first storage module 220, a first communication module 230, a second storage module 240 and a second communication module 250, and specifically comprises the following:
[0114] The signal receiving module 210 is used for receiving a transmission signal sent by a terminal device or a business system, and determining transmission content carried by the transmission signal.
[0115] The first storage module 220 is used for, when the transmission content is device initial data sent by the terminal device in real time, performing format conversion on the device initial data to obtain device state data, and storing the device state data into an upload data queue.
[0116] The first communication module 230 is used for, when the transmission content is a data request sent by the business system, obtaining device state data corresponding to the data request from the upload data queue, and returning the device state data as target data to the business system.
[0117] The second storage module 240 is used for, when the transmission content is an operation command issued by the business system, storing the operation command into a device command queue.
[0118] The second communication module 250 is configured to extract an operation command corresponding to the command request from the device command queue and return the operation command to the terminal device as a target command when the transmission content is a command request sent by the terminal device, and send an execution result to the service system after the terminal device executes the target command to obtain the execution result.
[0119] In the above embodiment, after receiving the transmission signal sent by the terminal device or the service system, the middleware software can determine the transmission content carried by the transmission signal, so that the transmission content can be uniformly converted in format, the compatibility of the service system is improved, and the data transmission between the terminal device and the service system is quickly realized. For example, when receiving the device initial data sent by the terminal device in real time, the device initial data can be converted in format to obtain device state data, and the device state data is stored in the upload data queue, so that when receiving the data request sent by the service system, the device state data corresponding to the data request can be obtained from the upload data queue and returned to the service system as target data; and when receiving the operation command issued by the service system, the operation command is stored in the device command queue, so that when receiving the command request sent by the terminal device, the operation command corresponding to the command request is extracted from the device command queue and returned to the terminal device as a target command, and the execution result is sent to the service system after the terminal device executes the target command to obtain the execution result. Through the middleware software, a unified communication interface can be provided to isolate the underlying details of the communication protocol to support data communication of various types of terminal devices and improve the compatibility of the service system.
[0120] In one embodiment, the first storage module 220 can include:
[0121] The state analysis submodule is configured to perform a preprocessing operation on the device initial data, and perform state analysis according to the preprocessed device initial data to obtain a device state of the terminal device and a state type of the device state.
[0122] The data encoding submodule is configured to determine a data receiving format of the service system and a device code of the terminal device, and perform data encoding on the device state, the state type and the device code based on the data receiving format to generate device state data.
[0123] In one embodiment, the first communication module 230 can include:
[0124] The data decoding submodule is configured to perform information decoding on the data request to obtain a first decoding result, and determine the device code and the state type corresponding to the data request according to the first decoding result.
[0125] The data retrieval submodule is configured to retrieve the device code and the state type in the uploading data queue and return the retrieved device state data as the target data to the service system.
[0126] In one embodiment, the second communication module 250 can include:
[0127] The command decoding submodule is configured to decode the command request to obtain a second decoding result and determine the device code corresponding to the command request according to the second decoding result.
[0128] The command transmission submodule is configured to extract the operation command corresponding to the device code from the device command queue according to a preset extraction number and return the extracted operation command as the target command to the terminal device.
[0129] In one embodiment, the command transmission submodule can include:
[0130] The command retrieval unit is configured to retrieve a plurality of operation commands corresponding to the device code in the device command queue to obtain a retrieval result, wherein each operation command corresponds to a priority.
[0131] The number judgment unit is configured to determine the number of operation commands in the retrieval result and judge whether the number of operation commands is greater than the preset extraction number.
[0132] The first extraction unit is configured to extract the operation command corresponding to the preset extraction number from the retrieval result in descending order of priority when the number of operation commands is greater than the preset extraction number.
[0133] The second extraction unit is configured to extract each operation command in the retrieval result when the number of operation commands is not greater than the preset extraction number.
[0134] In one embodiment, the second communication module 250 can further include:
[0135] The format conversion submodule is configured to determine the data receiving format of the service system and send the execution result to the service system after format conversion according to the data receiving format.
[0136] In one embodiment, the device can further include:
[0137] The format determination module is configured to determine the data object type of the terminal device and the data receiving format of the data object type before returning the target command to the terminal device.
[0138] The format conversion module is configured to convert the target command according to the data receiving format and send the converted target data to the terminal device.
[0139] In an embodiment, the present application also provides a storage medium having computer readable instructions stored therein, which when executed by one or more processors, cause the one or more processors to perform the steps of the data communication method of any of the above embodiments.
[0140] In an embodiment, the present application also provides a computer device having computer readable instructions stored therein, which when executed by one or more processors, cause the one or more processors to perform the steps of the data communication method of any of the above embodiments.
[0141] As shown in Figure 4 , Figure 4 Fig. 3 is a schematic diagram of an internal structure of a computer device according to an embodiment of the present application. The computer device 300 can be provided as a server. As shown in Figure 4 , the computer device 300 includes a processing component 302, further including one or more processors, and a memory resource represented by the memory 301, for storing instructions executable by the processing component 302, such as an application program. The application program stored in the memory 301 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute the instructions to perform the data communication method of any of the above embodiments.
[0142] The computer device 300 can also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input output (I / O) interface 305. The computer device 300 can operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM or the like.
[0143] Those skilled in the art can understand Figure 4 that the structure shown in the above embodiment is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or less components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0144] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and are not intended to denote the presence of any such actual relationship or order. Moreover, the terms "include", "have", or any other variant thereof are intended to encompass non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise a list of elements are not required to comprise only those elements in the list, but can include other elements not expressly listed, or also include elements inherent in such processes, methods, articles, or apparatuses. Without additional restrictions, an element preceded by "comprises... a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the stated element.
[0145] The various embodiments in the specification are described in progressive order with each embodiment building on one or more of the previous embodiments, however the order of the embodiments described is not intended to be construed as a requirement or limitation for these embodiments. Any one or more of the embodiments described with reference to a particular set of one or more other embodiments are optionally employable together with one or more other embodiments and / or in any appropriate combination.
[0146] The above description of disclosed embodiments is intended to enable those skilled in the art to make or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data communication method applied to middleware software provided in a service system, characterized by, The method comprises: receiving a transmission signal sent by a terminal device or a service system, and determining transmission content carried by the transmission signal; when the transmission content is device initial data sent by the terminal device in real time, performing format conversion on the device initial data to obtain device state data, and storing the device state data to an upload data queue; when the transmission content is a data request sent by the service system, obtaining device state data corresponding to the data request from the upload data queue, and returning the device state data as target data to the service system; when the transmission content is an operation command issued by the service system, storing the operation command to a device command queue; when the transmission content is a command request sent by the terminal device, extracting an operation command corresponding to the command request from the device command queue, and returning the operation command as target command to the terminal device, and after the terminal device executes the target command to obtain an execution result, sending the execution result to the service system; wherein, when the operation command is extracted, a plurality of operation commands corresponding to the device code are searched in the device command queue to obtain a search result; wherein each operation command corresponds to a priority; determining the number of operation commands of the search result, and judging whether the number of operation commands is greater than a preset extraction number; if yes, extracting the operation commands corresponding to the preset extraction number from the search result in the order from high to low of the priority; if no, extracting each operation command in the search result; before returning the target command to the terminal device, determining the data object type of the terminal device and the data receiving format of the data object type; performing format conversion on the target command according to the data receiving format, and sending the converted target data to the terminal device; wherein, the format conversion on the device initial data to obtain device state data comprises: performing preprocessing operation on the device initial data, and performing state analysis according to the preprocessed device initial data to obtain the device state of the terminal device and the state type of the device state; determining the data receiving format of the service system and the device code of the terminal device, and performing data encoding on the device state, the state type and the device code based on the data receiving format to generate device state data.
2. The data communication method according to claim 1, characterized by, the obtaining of device state data corresponding to the data request from the upload data queue and the returning of the device state data as target data to the service system comprises: performing information decoding on the data request to obtain a first decoding result, and determining the device code and the state type corresponding to the data request according to the first decoding result; searching the device code and the state type in the upload data queue, and returning the searched device state data as target data to the service system; wherein, the device state data stored in the upload data queue all carry the device code and the state type of the corresponding terminal device.
3. The data communication method according to claim 1, characterized by, The operation command corresponding to the command request is extracted from the device command queue as a target command and returned to the terminal device, including: information decoding is performed on the command request to obtain a second decoding result, and a device code corresponding to the command request is determined according to the second decoding result; operation commands corresponding to the device code are extracted from the device command queue according to a preset extraction number, and are returned to the terminal device as target commands; The operation commands stored in the device command queue all carry a device code of a terminal device to be executed.
4. The data communication method according to claim 1, characterized by, The execution result is sent to the business system, including: determining the data receiving format of the business system, and sending the execution result to the business system after format conversion according to the data receiving format.
5. A data communication device, characterized by including: The signal receiving module is configured to receive a transmission signal sent by a terminal device or a business system, and determine transmission content carried by the transmission signal. The first storage module is configured to, when the transmission content is device initial data sent by the terminal device in real time, perform format conversion on the device initial data to obtain device state data, and store the device state data in an upload data queue. The first communication module is configured to, when the transmission content is a data request sent by the business system, obtain device state data corresponding to the data request from the upload data queue, and return the device state data to the business system as target data. The second storage module is configured to, when the transmission content is an operation command issued by the business system, store the operation command in a device command queue. The second communication module is configured to, when the transmission content is a command request sent by the terminal device, extract an operation command corresponding to the command request from the device command queue, and return the operation command to the terminal device as a target command, and send an execution result to the business system after the terminal device executes the target command. In the operation command extraction, a plurality of operation commands corresponding to the device code are searched in the device command queue to obtain a search result; each operation command corresponds to a priority. The number of operation commands in the search result is determined, and it is judged whether the number of operation commands is greater than a preset extraction number. If yes, the operation commands corresponding to the preset extraction number are extracted from the search result in order from high to low priority. If not, each operation command in the search result is extracted. The format determination module is configured to, before returning the target command to the terminal device, determine a data object type of the terminal device and a data receiving format of the data object type. The format conversion submodule is configured to perform format conversion on the target command according to the data receiving format, and send the converted target data to the terminal device. The first storage module includes: The device initial data is preprocessed, and state analysis is performed on the preprocessed device initial data to obtain a device state of the terminal device and a state type of the device state. Determine a data receiving format of the business system and a device code of the terminal device, and encode the device status, the status type and the device code based on the data receiving format to generate device status data.
6. A storage medium characterized by: The storage medium has computer readable instructions stored therein, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the data communication method of any one of claims 1 to 4.
7. A computer device, comprising: Comprise: one or more processors, and a memory; The memory has computer readable instructions stored therein, and the computer readable instructions, when executed by the one or more processors, perform the steps of the data communication method of any one of claims 1 to 4.
Citation Information
Patent Citations
Method and system for improving concurrent data processing efficiency
CN110351270A
Business request processing method and device, computer equipment and storage medium
CN110740103A