Data processing methods, analysis services and IoT platforms
By determining the target protocol of the data packet in the parsing service of the IoT platform and using the corresponding codec processor for format conversion, the problem of insufficient flexibility in IoT data processing in the prior art is solved, and flexible adaptation and efficient data processing are achieved for different protocols.
Patent Information
- Application Number
- CN202211304440.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-24
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-10-24
AI Technical Summary
In the prior art, the flexibility of IoT data processing is poor, and it is impossible to effectively deal with the multiple communication and data protocols supported by different communication modules and IoT terminals, resulting in inflexible data acquisition and conversion processes.
By implementing a data processing method in the parsing service, the target gateway communicates with the communication module and the IoT terminal, determines the target protocol of the data packet, and determines the corresponding target codec processor according to the protocol, and converts the data packet format to obtain the target data.
It realizes flexible processing of any type of data packet, improves the reliability and flexibility of data processing, can adapt to changes in different communications and data protocols, and meets the high requirements of IoT platforms for data processing.
Smart Images

Figure CN115665287B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and more specifically, to a data processing method, a parsing service, a computer-readable storage medium, and an Internet of Things platform. Background Art
[0002] Currently, a large number of IoT (Internet of Things, IoT for short) terminals are connected to the IoT platform through different communication modules. That is, the IoT terminal communicates with the server (the server corresponding to the IoT platform) through the communication module, and then realizes the processing of related business and the realization of related functions.
[0003] Since different communication modules support different communication protocols, and different IoT terminals support different data protocols, the collection and conversion of IoT data need to be oriented to different types of communication protocols and IoT terminals. At the same time, with the development of IoT-related technologies and the increase in application scenarios, the types of communication protocols that IoT platforms need to support are also increasing. In some usage scenarios, communication protocols are frequently changed, which places high demands on the reliability and flexibility of the server's communication data processing and the ease of use. However, the traditional server protocol access and parsing methods cannot meet the current requirements for reliability and flexibility in data processing.
[0004] Therefore, there is an urgent need for a method that can process data more flexibly. Summary of the invention
[0005] The main purpose of this application is to provide a data processing method, analysis service, computer-readable storage medium and Internet of Things platform to solve the problem of poor flexibility in data processing in the prior art.
[0006] According to one aspect of an embodiment of the present invention, a data processing method is provided, the processing method is applied in a resolution service, the resolution service communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, the processing method comprising: in a case where the received data packet sent by the target gateway is an uplink data packet, determining a target protocol of the data packet, the target protocol comprising at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol for describing the data of the IoT terminal; determining a corresponding target codec processor at least according to the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet; performing format conversion on the data packet at least according to the target codec processor to obtain target data.
[0007] Optionally, the data packet carries a channel unique identifier and a module identifier, the channel unique identifier is a globally unique identifier of the connection established between the communication module and the target gateway, and the module identifier is a unique identifier of the target gateway. When the received data packet sent by the target gateway is an uplink data packet, determining the target protocol of the data packet includes: when the corresponding target protocol can be determined based on the channel unique identifier of the data packet, determining the target protocol based on the channel unique identifier of the data packet; when the corresponding target protocol cannot be determined based on the channel unique identifier of the data packet, determining the target protocol of the data packet at least based on the module identifier carried by the data packet.
[0008] Optionally, the target protocol of the data packet is determined at least based on the module identifier carried by the data packet, including: determining the communication protocol based on the module identifier of the data packet; searching for a corresponding product identifier in a communication module table based on the module identifier of the data packet, the communication module table including at least the module identifier and the product identifier, the product identifier being an identifier of a product consisting of the communication protocol and the data protocol; determining the data protocol of the corresponding data packet based on the communication protocol and the product identifier.
[0009] Optionally, determining a corresponding target codec processor at least based on the target protocol of the data packet includes: when the codec processor corresponding to the data packet is found in the protocol item table according to the protocol identifier, determining the found codec processor as the corresponding target codec processor, the protocol identifier is the identifier of the target protocol of the data packet, and the protocol item table includes at least the protocol identifier and the codec processor corresponding to the protocol identifier; when the codec processor corresponding to the data packet is not found in the protocol item table according to the protocol identifier, determining a preset codec processor as the corresponding target codec processor.
[0010] Optionally, the processing method further includes: when the target protocol of the data packet is not determined at least according to the module identifier of the target gateway carried by the data packet, determining a preset codec processor as the corresponding target codec processor.
[0011] Optionally, at least according to the target codec processor, the data packet is format converted to obtain target data, including: according to the target codec processor and the corresponding data item of the target protocol, the corresponding data packet is format converted to obtain the target data, and the data item is used to mark the position of the transmission value of the communication protocol or the data protocol.
[0012] Optionally, after performing format conversion on the corresponding data packet according to the target codec processor and the corresponding data item of the target protocol to obtain the target data, the processing method further includes: determining whether there is a sub-protocol identifier in the data packet, the sub-protocol identifier being the protocol identifier of the sub-protocol, and the sub-protocol being the communication protocol or the data protocol; in case the sub-protocol identifier exists in the data packet, determining whether the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier, the protocol item table at least including the protocol identifier and the codec processor corresponding to the protocol identifier; in case the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier, determining the codec processor as the target codec processor of the corresponding data packet, and in case the corresponding codec processor is not found in the protocol item table based on the sub-protocol identifier, determining a preset codec processor as the target codec processor of the corresponding data packet; performing format conversion on the data packet based on the target codec processor to obtain the corresponding target data.
[0013] According to another aspect of an embodiment of the present invention, a parsing service is also provided, wherein the parsing service communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, and the parsing service includes: a first determination unit, for determining the target protocol of the data packet when the received data packet sent by the target gateway is an uplink data packet, the target protocol including at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol describing the data of the IoT terminal; a second determination unit, for determining a corresponding target codec processor at least based on the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet; a first conversion unit, for performing format conversion on the data packet at least based on the target codec processor to obtain target data.
[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein the program executes any one of the data processing methods.
[0015] According to another aspect of an embodiment of the present invention, an Internet of Things platform is also provided, including: an access service, the access service including multiple target gateways, the target gateways being used to send data packets received from IoT terminals to a resolution service; the resolution service, the resolution service communicating with the access service, the resolution service being used to execute any one of the data processing methods described; and a business service, the business service communicating with the resolution service, being used to obtain the target data converted by the resolution service.
[0016] In an embodiment of the present invention, in the data processing method, first, after receiving a data packet sent by a target gateway, determine whether the received data packet is an uplink data packet, and in the case where the data packet is the uplink data packet, determine the target protocol of the data packet, that is, determine the communication protocol and data protocol of the data packet; then, at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol, determine the corresponding target codec processor; finally, at least according to the target codec processor, perform format conversion on the data packet to obtain target data, that is, convert the data packet into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as an arbitrary nesting of the communication protocol and the data protocol. In the case where the received data packet is an uplink data packet, determine the communication protocol and data protocol of the data packet, and determine the corresponding target codec processor according to the communication protocol and / or the data protocol of the data packet, and at least according to the target codec processor, perform format conversion on the corresponding data packet to obtain the target data, so as to achieve a relatively simple format conversion of the valid data carried by the data packet. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 A flow chart showing a method for processing data according to an embodiment of the present application is shown;
[0019] Figure 2 A schematic diagram showing the structure of a data packet of an embodiment of the present application is shown;
[0020] Figure 3 A schematic diagram showing the structure of a communication protocol payload of an embodiment of the present application is shown;
[0021] Figure 4 A schematic diagram showing the structure of a communication protocol payload of another embodiment of the present application is shown;
[0022] Figure 5 A schematic diagram showing the structure of a resolution service according to an embodiment of the present application is shown;
[0023] Figure 6 A schematic diagram of the architecture of an Internet of Things platform according to an embodiment of the present application is shown;
[0024] Figure 7 A flow chart showing a data processing scheme according to an embodiment of the present application.
[0025] The above drawings include the following reference numerals:
[0026] 100. Data packet; 101. Communication protocol header; 102. Data protocol part; 103. Check tail; 104. Communication protocol payload; 105. First data protocol; 106. First transmission data; 107. Second transmission data; 108. Embedded sub-protocol; 109. Sub-protocol data; 110. Transmission check tail; 111. First data payload; 112. Second data protocol; 113. Second data payload; 114. IoT terminal; 115. Communication module; 116. Access service; 117. Resolution service; 118. Business service; 119. Target gateway. DETAILED DESCRIPTION
[0027] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0031] Communications protocol: refers to the rules and agreements that two entities must follow to complete communication or services. In computer communications, communication protocols are used to implement the standards between computers and network connections. If the network does not have a unified communication protocol, the information transmitted between computers cannot be recognized. Communication protocols refer to the communication rules predetermined by the communicating parties in advance.
[0032] Data protocol: refers to the data format used by two entities to complete data interaction.
[0033] As mentioned in the background technology, the flexibility of data processing in the prior art is relatively poor. In order to solve the above problem, in a typical implementation of the present application, a data processing method, a parsing service, a computer-readable storage medium and an Internet of Things platform are provided.
[0034] According to an embodiment of the present application, a method for processing data is provided.
[0035] Figure 1 The processing method is applied in a resolution service (a server), the resolution service communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, such as Figure 1 As shown, the processing method includes the following steps:
[0036] Step S101, when the received data packet sent by the target gateway is an uplink data packet, determine the target protocol of the data packet, the target protocol includes at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol for describing the data of the IoT terminal;
[0037] Step S102, determining a corresponding target codec processor at least according to the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet;
[0038] Step S103, performing format conversion on the data packet at least according to the target codec processor to obtain target data.
[0039] In the above data processing method, first, after receiving the data packet sent by the target gateway, it is determined whether the received data packet is an uplink data packet. In the case that the data packet is the uplink data packet, the target protocol of the data packet is determined, that is, the communication protocol and data protocol of the data packet are determined; then, at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol, the corresponding target codec processor is determined; finally, at least according to the target codec processor, the data packet is format-converted to obtain the target data, that is, the data packet is converted into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as an arbitrary nesting of the communication protocol and the data protocol. In the case that the received data packet is an uplink data packet, the communication protocol and data protocol of the data packet are determined, and the corresponding target codec processor is determined according to the communication protocol and / or the data protocol of the data packet, and at least according to the target codec processor, the corresponding data packet is format-converted to obtain the target data, so that the format conversion of the valid data carried by the data packet is realized in a relatively simple manner. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0040] Specifically, the data transmission process of the above-mentioned uplink data packet (also referred to as an upload data packet) is as follows: the IoT terminal sends the initial data packet (the initial data packet at this time does not carry the communication protocol) to the communication module; the communication module performs protocol encapsulation on the received initial data packet based on its own communication protocol to obtain a preset data packet, and sends the preset data packet to the corresponding target gateway. When the target gateway receives the preset data packet sent by the communication module, it adds a channel unique identifier and a module identifier to the preset data packet to obtain a data packet. The target gateway then puts the data packet into a message queue (such as an MQ message queue) and waits until the resolution service consumes it to convert the format of the data packet to obtain the target data. In the actual application process, the data packet sent by the resolution service to the target gateway, and then sent by the target gateway to the communication module, and thus sent to the IoT terminal can be called a downlink data packet (or a downlink data packet).
[0041] Specifically, the above-mentioned data packet can also be the data packet obtained after the target gateway carries out the packet processing by the data stream or datagram sent by the communication module. After the target gateway receives the data packet, the target gateway sends the data packet to the resolution service. Wherein, in the case where the above-mentioned target gateway has the identity authentication function, the above-mentioned target gateway can also carry out identity authentication by the data packet, so that the subsequent data packet sent to the resolution service can carry the channel unique identification (i.e. the global unique identification of Socket). Of course, the gateway message unique identification, the data type of the data packet, the original data encoding format, the communication data (package / frame), the communication time, and the extended data (for example, the IP (Internet Protocol Address, Internet Protocol Address, referred to as IP) address of the data packet source, the service level and the will, etc.) can also be carried.
[0042] In a specific embodiment of the present application, the number of target codec processors for format conversion of a data packet can be one or more. That is to say, when format conversion is performed on a data packet, the number of target codec processors used can be determined based on the data in the valid data portion of the data packet. For example, for a data packet, if the first byte of its valid data carries a temperature value, a target codec processor can be used to perform format conversion on the first byte to obtain the temperature value after format conversion; if the second byte to the fifth byte of its valid data carries fault information, another target codec processor can be used to perform format conversion on the second byte to the fifth byte to obtain the fault information after format conversion. Of course, in the actual application process, the target codec processor can also be adjusted and set according to the data type, encoding format, etc. of the valid data in the data packet, and is not limited to the target codec processor mentioned in the above example.
[0043] In the actual application process, the communication module adds the communication protocol to the initial data packet received from the IoT terminal to obtain a preset data packet. After the communication module can send the preset data packet to the target gateway in the form of a data stream or a datagram, the target gateway needs to subpacketize the received data stream or datagram to convert the data stream or datagram into an independent data packet. A data packet is essentially an independent packet or frame of data. It may carry a data packet header, a data packet payload, a data packet checksum or a data packet tail, etc. In the processing method of the present application, the protocol used by the data packet is divided into two parts: a communication protocol and a data protocol, so that the data packets received by the target gateway are nested communication protocols and data protocols with no limit on the level. Specifically, if Figure 2 As shown, for example, data packet 100 includes a communication protocol header 101 and a communication protocol payload 104, and communication protocol payload 104 includes an embedded data protocol portion 102 and a check tail 103. Figure 3 As shown, the communication protocol payload 104 may also include the first data protocol 105, the first data payload 111 and the transmission check tail 110 (in the actual application process, the communication protocol payload 104 may not include the transmission check tail 110), and the first data payload 111 may also have the first transmission data 106 and the second transmission data 107 embedded therein, and may also have the sub-protocol 108 and the sub-protocol data 109 (i.e., the valid data part of the sub-protocol) embedded therein. Figure 4 As shown, the communication protocol payload 104 may further include a second data protocol 112 and a second data payload 113, wherein the second data payload 113 may further embed a plurality of transmission data.
[0044] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0045] In one embodiment of the present application, the above-mentioned data packet carries a channel unique identifier and a module identifier, the above-mentioned channel unique identifier is a globally unique identifier of the connection established between the above-mentioned communication module and the above-mentioned target gateway, and the above-mentioned module identifier is a unique identifier of the above-mentioned target gateway. When the received data packet sent by the above-mentioned target gateway is an uplink data packet, the target protocol of the above-mentioned data packet is determined, including: when the corresponding above-mentioned target protocol can be determined based on the above-mentioned channel unique identifier of the above-mentioned data packet, the above-mentioned target protocol is determined based on the above-mentioned channel unique identifier of the above-mentioned data packet; when the corresponding above-mentioned target protocol cannot be determined based on the above-mentioned channel unique identifier of the above-mentioned data packet, the above-mentioned target protocol of the above-mentioned data packet is determined at least according to the above-mentioned module identifier carried by the above-mentioned data packet, thereby ensuring that the resolution service can relatively easily determine the communication protocol and the data protocol of the data packet, and ensuring that the calculation amount of the resolution service is small.
[0046] In order to more simply determine the communication protocol and data protocol used by the data packet, in another embodiment of the present application, the target protocol of the data packet is determined at least according to the module identifier carried by the data packet, including: determining the communication protocol according to the module identifier of the data packet; searching for the corresponding product identifier in the communication module table according to the module identifier of the data packet, the communication module table at least including the module identifier and the product identifier, the product identifier being the identifier of the product composed of the communication protocol and the data protocol; determining the corresponding data protocol of the data packet according to the communication protocol and the product identifier. That is, according to the module identifier of the target gateway, the outer communication protocol of the data packet can be obtained, and then based on the pre-stored communication module table, the product identifier corresponding to the communication protocol is obtained, and the data protocol corresponding to the data packet is obtained, further determining the data protocol and communication protocol corresponding to the data packet relatively simply and accurately, further realizing that the processing method of the present application can convert the format of any type of data packet, further solving the problem of poor flexibility of data processing in the prior art.
[0047] Specifically, in the actual application process, the communication module table is pre-set in the resolution service. The communication module table has a module identification column, a product identification column and a communication protocol identification column. Among them, there are multiple products in the product identification column. The above products are composed of different communication protocols and data protocols. In a specific embodiment of the present application, communication protocol A and data protocol A constitute a product, communication protocol A and data protocol B constitute another product, and so on.
[0048] In order to more easily determine the target codec processor corresponding to the data packet, in another embodiment of the present application, the corresponding target codec processor is determined at least according to the above-mentioned target protocol of the above-mentioned data packet, including: when the codec processor corresponding to the above-mentioned data packet is found in the protocol item table according to the protocol identifier, the found codec processor is determined as the corresponding above-mentioned target codec processor, the above-mentioned protocol identifier is the identifier of the above-mentioned target protocol of the above-mentioned data packet, and the above-mentioned protocol item table at least includes the above-mentioned protocol identifier and the above-mentioned codec processor corresponding to the above-mentioned protocol identifier; when the codec processor corresponding to the above-mentioned data packet is not found in the above-mentioned protocol item table according to the above-mentioned protocol identifier, the preset codec processor is determined as the corresponding above-mentioned target codec processor, so that the processing method of the present application can use the preset codec processor to perform preliminary processing on the data even if the communication protocol and data protocol corresponding to the data packet are not known.
[0049] In a specific embodiment of the present application, the protocol item table may further include a protocol item identifier, a data index, a data type, and an extended data segment. The data type includes an integer, a floating point number, a string, a sub-protocol type, and a function code type. The extended data segment may store the required information corresponding to the data type. For example, when the data type is a sub-protocol type tag, the protocol identifier of the sub-protocol is stored in the extended data segment.
[0050] Specifically, in the actual application process, the product table, protocol table, and device table can also be pre-stored in the server. Among them, the product table includes a product identification column, a communication protocol identification column, and a data protocol identification column. The protocol table includes a protocol identification column, a protocol type class, and a protocol device type column. The device table includes a device identification column, a product identification column, and a data protocol identification column.
[0051] In another embodiment of the present application, the above-mentioned processing method further includes: when the above-mentioned target protocol of the above-mentioned data packet is not determined at least according to the module identifier of the above-mentioned target gateway carried by the above-mentioned data packet, the preset codec processor is determined as the corresponding above-mentioned target codec processor. In this embodiment, when the communication protocol and data protocol of the data packet cannot be determined, the preset codec processor is determined as the target codec processor for the data packet, so that the processing method of the present application can use the preset codec processor to perform preliminary processing on the data without knowing the communication protocol and data protocol corresponding to the data packet, further ensuring that the processing method of the present application can more flexibly convert the format of the data packet.
[0052] In order to further obtain the target data more accurately, in another embodiment of the present application, the above-mentioned data packet is format-converted at least according to the above-mentioned target codec processor to obtain the target data, including: according to the above-mentioned target codec processor and the corresponding data items of the above-mentioned target protocol, the corresponding data packet is format-converted to obtain the above-mentioned target data, and the above-mentioned data items are used to mark the position of the transmission value of the above-mentioned communication protocol or the above-mentioned data protocol.
[0053] In a specific embodiment of the present application, for the communication protocol part of the data packet and the valid data part of the data protocol, its data items can be described in the following forms: 1. Offset n bytes, length m bytes, byte order big end (i.e. high address) / little end (i.e. low address), which is the transmission value of the data item; 2. Offset n bytes, offset m bits, byte order big end / little end, which is the transmission value of the data item; 3. Offset n bytes, offset m bits, total k bits length, byte order big end / little end, which is the transmission value of the data item; 4. The data item matching the field name (such as JSON) is the transmission value of the data item; 5. The nth element (which can be a bit, byte, character Word, or a string separated by a fixed format), the byte order is big endian / little endian, which is the transmission value of the data item; 6. The nth element (can be a bit, byte, word, or a string separated by a fixed format), m elements long, the byte order is big endian / little endian, which is the transmission value of the data item; 7. The numbered nth element (can be a bit, byte, word, or a string separated by a fixed format), the byte order is big endian / little endian, which is the transmission value of the data item; 8. The numbered nth element (can be a bit, byte, word, or a string separated by a fixed format), m elements long, the byte order is big endian / little endian, which is the transmission value of the data item. After obtaining the actual transmission value, the codec processor specified by the data packet cooperates with the relevant parameters of the transmission value in the data item to convert the transmission value into a common data type (integer, floating point number, string, enumeration string, etc.) that can be directly used within the system.
[0054] Since the data packet is regarded as a nesting of communication protocols and data protocols of unlimited levels, the data packet can also contain embedded protocols. In order to obtain the target data more accurately, in one embodiment of the present application, after the corresponding data packet is format-converted according to the target codec processor and the corresponding data item of the target protocol to obtain the target data, the processing method further includes: determining whether there is a sub-protocol identifier in the data packet, the sub-protocol identifier being the protocol identifier of the sub-protocol, and the sub-protocol being the communication protocol or the data protocol; if the sub-protocol identifier exists in the data packet, determining whether the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier, the protocol item table at least including the protocol identifier and the codec processor corresponding to the protocol identifier; if the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier, determining the codec processor as the target codec processor of the corresponding data packet; if the corresponding codec processor is not found in the protocol item table based on the sub-protocol identifier, determining a preset codec processor as the target codec processor of the corresponding data packet; format-converting the data packet based on the target codec processor to obtain the corresponding target data.
[0055] In a specific embodiment of the present application, after determining the preset codec processor as the target codec processor and using the target codec processor to perform format conversion on the corresponding data packet, the processing method of the present application may also include: updating the communication protocol and data protocol corresponding to the data packet, and the corresponding target codec processor in the protocol item table, to facilitate subsequent format conversion of such data packets.
[0056] The embodiment of the present application also provides a resolution service. It should be noted that the resolution service of the embodiment of the present application can be used to execute the data processing method provided by the embodiment of the present application. The resolution service provided by the embodiment of the present application is introduced below.
[0057] Figure 5 Schematic diagram of the structure of the resolution service according to the embodiment of the present application. The resolution service communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, such as Figure 5 As shown, the analysis service includes:
[0058] The first determining unit 10 is used to determine the target protocol of the data packet when the received data packet sent by the target gateway is an uplink data packet, and the target protocol includes at least one of the following: a communication protocol and a data protocol, wherein the data protocol is a protocol for describing the data of the IoT terminal;
[0059] A second determining unit 20 is used to determine a corresponding target codec processor at least according to the target protocol of the data packet, and the target codec processor is used to perform format conversion on the corresponding data packet;
[0060] The first conversion unit 30 is used to perform format conversion on the data packet at least according to the target codec processor to obtain target data.
[0061] In the above-mentioned resolution service, after receiving the data packet sent by the target gateway, the first determination unit determines whether the received data packet is an uplink data packet. In the case that the data packet is the uplink data packet, the target protocol of the data packet is determined, that is, the communication protocol and data protocol of the data packet are determined; the second determination unit is used to determine the corresponding target codec processor at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol; the first conversion unit is used to perform format conversion on the data packet at least according to the target codec processor to obtain target data, that is, convert the data packet into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as an arbitrary nesting of the communication protocol and the data protocol. In the case that the received data packet is an uplink data packet, the communication protocol and data protocol of the data packet are determined, and the corresponding target codec processor is determined according to the communication protocol and / or the data protocol of the data packet, and the corresponding data packet is format converted at least according to the target codec processor to obtain the target data, thereby realizing a relatively simple format conversion of the valid data carried by the data packet. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0062] Specifically, the data transmission process of the above-mentioned uplink data packet (also referred to as an upload data packet) is as follows: the IoT terminal sends the initial data packet (the initial data packet at this time does not carry the communication protocol) to the communication module; the communication module performs protocol encapsulation on the received initial data packet based on its own communication protocol to obtain a preset data packet, and sends the preset data packet to the corresponding target gateway. When the target gateway receives the preset data packet sent by the communication module, it adds a channel unique identifier and a module identifier to the preset data packet to obtain a data packet. The target gateway then puts the data packet into a message queue (such as an MQ message queue) and waits until the resolution service consumes it to convert the format of the data packet to obtain the target data. In the actual application process, the data packet sent by the resolution service to the target gateway, and then sent by the target gateway to the communication module, and thus sent to the IoT terminal can be called a downlink data packet (or a downlink data packet).
[0063] Specifically, the above-mentioned data packet can also be the data packet obtained after the target gateway carries out the packet processing by the data stream or datagram sent by the communication module. After the target gateway receives the data packet, the target gateway sends the data packet to the resolution service. Wherein, in the case where the above-mentioned target gateway has the identity authentication function, the above-mentioned target gateway can also carry out identity authentication by the data packet, so that the subsequent data packet sent to the resolution service can carry the channel unique identification (i.e. the global unique identification of Socket). Of course, the gateway message unique identification, the data type of the data packet, the original data encoding format, the communication data (package / frame), the communication time, and the extended data (for example, the IP (Internet Protocol Address, Internet Protocol Address, referred to as IP) address of the data packet source, the service level and the will, etc.) can also be carried.
[0064] In a specific embodiment of the present application, the number of target codec processors for format conversion of a data packet can be one or more. That is to say, when format conversion is performed on a data packet, the number of target codec processors used can be determined based on the data in the valid data portion of the data packet. For example, for a data packet, if the first byte of its valid data carries a temperature value, a target codec processor can be used to perform format conversion on the first byte to obtain the temperature value after format conversion; if the second byte to the fifth byte of its valid data carries fault information, another target codec processor can be used to perform format conversion on the second byte to the fifth byte to obtain the fault information after format conversion. Of course, in the actual application process, the target codec processor can also be adjusted and set according to the data type, encoding format, etc. of the valid data in the data packet, and is not limited to the target codec processor mentioned in the above example.
[0065] In the actual application process, the communication module adds the communication protocol to the initial data packet received from the IoT terminal to obtain a preset data packet. After the communication module can send the preset data packet to the target gateway in the form of a data stream or a datagram, the target gateway needs to subpacketize the received data stream or datagram to convert the data stream or datagram into an independent data packet. A data packet is essentially an independent packet or frame of data. It may carry a data packet header, a data packet payload, a data packet checksum or a data packet tail, etc. In the processing method of the present application, the protocol used by the data packet is divided into two parts: a communication protocol and a data protocol, so that the data packets received by the target gateway are nested communication protocols and data protocols with no limit on the level. Specifically, if Figure 2 As shown, for example, data packet 100 includes a communication protocol header 101 and a communication protocol payload 104, and communication protocol payload 104 includes an embedded data protocol portion 102 and a check tail 103. Figure 3 As shown, the communication protocol payload 104 may also include the first data protocol 105, the first data payload 111 and the transmission check tail 110 (in the actual application process, the communication protocol payload 104 may not include the transmission check tail 110), and the first data payload 111 may also have the first transmission data 106 and the second transmission data 107 embedded therein, and may also have the sub-protocol 108 and the sub-protocol data 109 (i.e., the valid data part of the sub-protocol) embedded therein. Figure 4 As shown, the communication protocol payload 104 may further include a second data protocol 112 and a second data payload 113, wherein the second data payload 113 may further embed a plurality of transmission data.
[0066] In one embodiment of the present application, the above-mentioned data packet carries a channel unique identifier and a module identifier, the above-mentioned channel unique identifier is a globally unique identifier of the connection established between the above-mentioned communication module and the above-mentioned target gateway, and the above-mentioned module identifier is a unique identifier of the above-mentioned target gateway. The above-mentioned first determination unit includes a first determination module and a second determination module, wherein the above-mentioned first determination module is used to determine the above-mentioned target protocol based on the above-mentioned channel unique identifier of the above-mentioned data packet when the corresponding above-mentioned target protocol can be determined based on the above-mentioned channel unique identifier of the above-mentioned data packet; the above-mentioned second determination module is used to determine the above-mentioned target protocol of the above-mentioned data packet based on at least the above-mentioned module identifier carried by the above-mentioned data packet when the corresponding above-mentioned target protocol cannot be determined based on the above-mentioned channel unique identifier of the above-mentioned data packet, thereby ensuring that the resolution service can relatively easily determine the communication protocol and data protocol of the data packet, and ensuring that the calculation amount of the resolution service is small.
[0067] In order to more simply determine the communication protocol and data protocol used by the data packet, in another embodiment of the present application, the second determination module includes a first determination submodule, a search submodule and a second determination submodule, wherein the first determination submodule is used to determine the communication protocol according to the module identifier of the data packet; the search submodule is used to search the corresponding product identifier in the communication module table according to the module identifier of the data packet, the communication module table at least includes the module identifier and the product identifier, and the product identifier is the identifier of the product composed of the communication protocol and the data protocol; the second determination submodule is used to determine the corresponding data protocol of the data packet according to the communication protocol and the product identifier. That is to say, according to the module identifier of the target gateway, the outer communication protocol of the data packet can be obtained, and then based on the pre-stored communication module table, the product identifier corresponding to the communication protocol is obtained, and the data protocol corresponding to the data packet is obtained, and the data protocol and communication protocol corresponding to the data packet are further determined more simply and accurately, and the processing method of the present application can convert the format of any type of data packet, and further solve the problem of poor flexibility of data processing in the prior art.
[0068] Specifically, in the actual application process, the communication module table is pre-set in the resolution service. The communication module table has a module identification column, a product identification column and a communication protocol identification column. Among them, there are multiple products in the product identification column. The above products are composed of different communication protocols and data protocols. In a specific embodiment of the present application, communication protocol A and data protocol A constitute a product, communication protocol A and data protocol B constitute another product, and so on.
[0069] In order to more easily determine the target codec processor corresponding to the data packet, in another embodiment of the present application, the above-mentioned second determination unit includes a third determination module and a fourth determination module, wherein the above-mentioned third determination module is used to determine the above-mentioned codec processor found as the corresponding above-mentioned target codec processor when the codec processor corresponding to the above-mentioned data packet is found in the protocol item table according to the protocol identifier, the above-mentioned protocol identifier is the identifier of the above-mentioned communication protocol and / or the above-mentioned data protocol of the above-mentioned data packet, and the above-mentioned protocol item table at least includes the above-mentioned protocol identifier and the above-mentioned codec processor corresponding to the above-mentioned protocol identifier; the above-mentioned fourth determination module is used to determine the preset codec processor as the corresponding above-mentioned target codec processor when the codec processor corresponding to the above-mentioned data packet is not found in the above-mentioned protocol item table according to the above-mentioned protocol identifier, so that the processing method of the present application can use the preset codec processor to perform preliminary processing on the data without knowing the communication protocol and data protocol corresponding to the data packet.
[0070] In a specific embodiment of the present application, the protocol item table may further include a protocol item identifier, a data index, a data type, and an extended data segment. The data type includes an integer, a floating point number, a string, a sub-protocol type, and a function code type. The extended data segment may store the corresponding required information in conjunction with the data type. For example, when the data type is a sub-protocol type tag, the extended data segment stores the protocol identifier of the sub-protocol.
[0071] In another embodiment of the present application, the above-mentioned resolution service also includes a third determination unit, which is used to determine the preset codec processor as the corresponding above-mentioned target codec processor when the above-mentioned target protocol of the above-mentioned data packet is not determined at least according to the module identifier of the above-mentioned target gateway carried by the above-mentioned data packet. In this embodiment, when the communication protocol and data protocol of the data packet cannot be determined, the preset codec processor is determined as the target codec processor for the data packet, so that the processing method of the present application can use the preset codec processor to perform preliminary processing on the data without knowing the communication protocol and data protocol corresponding to the data packet, further ensuring that the processing method of the present application can convert the format of the data packet more flexibly.
[0072] In order to further obtain the target data more accurately, in another embodiment of the present application, the first conversion unit includes a conversion module, which is used to perform format conversion on the corresponding data packet according to the above-mentioned target codec processor and the corresponding data items of the above-mentioned target protocol to obtain the above-mentioned target data, and the above-mentioned data items are used to mark the position of the transmission value of the above-mentioned communication protocol or the above-mentioned data protocol.
[0073] In a specific embodiment of the present application, for the communication protocol part of the data packet and the valid data part of the data protocol, its data items can be described in the following forms: 1. Offset n bytes, length m bytes, byte order big end (i.e. high address) / little end (i.e. low address), which is the transmission value of the data item; 2. Offset n bytes, offset m bits, byte order big end / little end, which is the transmission value of the data item; 3. Offset n bytes, offset m bits, total k bits length, byte order big end / little end, which is the transmission value of the data item; 4. The data item matching the field name (such as JSON) is the transmission value of the data item; 5. The nth element (which can be a bit, byte, character Word, or a string separated by a fixed format), the byte order is big endian / little endian, which is the transmission value of the data item; 6. The nth element (can be a bit, byte, word, or a string separated by a fixed format), m elements long, the byte order is big endian / little endian, which is the transmission value of the data item; 7. The numbered nth element (can be a bit, byte, word, or a string separated by a fixed format), the byte order is big endian / little endian, which is the transmission value of the data item; 8. The numbered nth element (can be a bit, byte, word, or a string separated by a fixed format), m elements long, the byte order is big endian / little endian, which is the transmission value of the data item. After obtaining the actual transmission value, the codec processor specified by the data packet cooperates with the relevant parameters of the transmission value in the data item to convert the transmission value into a common data type (integer, floating point number, string, enumeration string, etc.) that can be directly used within the system.
[0074] Since the data packet is regarded as a nesting of communication protocols and data protocols with unlimited levels, the data packet can also contain embedded protocols. In order to obtain the target data more accurately, in one embodiment of the present application, after the corresponding data packet is format-converted according to the target codec processor and the corresponding data items of the communication protocol and / or the data protocol to obtain the target data, the parsing service also includes a fourth determination unit, a fifth determination unit, a search unit and a second conversion unit, wherein the fourth determination unit is used to determine whether there is a sub-protocol identifier in the data packet, the sub-protocol identifier is the protocol identifier of the sub-protocol, and the sub-protocol is the communication protocol or the data protocol; the fifth determination unit is used to determine, based on the sub-protocol identifier, in the protocol item when the sub-protocol identifier exists in the data packet. The above-mentioned protocol item table at least includes the above-mentioned protocol identifier and the above-mentioned codec processor corresponding to the above-mentioned protocol identifier; the searching unit is used to determine the above-mentioned codec processor as the above-mentioned target codec processor of the corresponding above-mentioned data packet when the corresponding above-mentioned codec processor is found in the above-mentioned protocol item table based on the above-mentioned sub-protocol identifier, and determine the preset codec processor as the above-mentioned target codec processor of the corresponding above-mentioned data packet when the corresponding above-mentioned codec processor is not found in the above-mentioned protocol item table based on the above-mentioned sub-protocol identifier; the above-mentioned second conversion unit is used to perform format conversion on the above-mentioned data packet based on the above-mentioned target codec processor to obtain the corresponding above-mentioned target data.
[0075] In a specific embodiment of the present application, after determining the preset codec processor as the target codec processor and using the target codec processor to perform format conversion on the corresponding data packet, the processing method of the present application may also include: updating the communication protocol and data protocol corresponding to the data packet, and the corresponding target codec processor in the protocol item table, to facilitate subsequent format conversion of such data packets.
[0076] The above-mentioned analysis service includes a processor and a memory. The above-mentioned first determination unit, second determination unit and first conversion unit are all stored in the memory as program units. The processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0077] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the problem of poor flexibility in data processing in the prior art can be solved by adjusting kernel parameters.
[0078] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0079] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned data processing method is implemented.
[0080] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the data processing method is executed when the program is run.
[0081] In a typical embodiment of the present application, an Internet of Things platform is also provided. Figure 6 As shown, the IoT platform includes an access service 116, a resolution service 117 and a business service 118. The access service 116 includes a plurality of target gateways 119, and the target gateway 119 is used to send the received data packets sent by the IoT terminal 114 to the resolution service 117; the resolution service 117 communicates with the access service 116, and the resolution service 117 is used to execute any of the above data processing methods; the business service 118 communicates with the resolution service 117, and is used to obtain the above target data converted by the resolution service 117.
[0082] The above-mentioned Internet of Things platform includes access service, parsing service and business service, wherein the parsing service is used to execute any of the above-mentioned data processing methods. In the above-mentioned data processing method, first, after receiving the data packet sent by the target gateway, it is determined whether the received data packet is an uplink data packet. In the case that the data packet is the uplink data packet, the target protocol of the data packet is determined, that is, the communication protocol and data protocol of the data packet are determined; then, at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol, the corresponding target codec processor is determined; finally, at least according to the target codec processor, the data packet is formatted to obtain the target data, that is, the data packet is converted into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as any nesting of the communication protocol and the data protocol. In the case that the received data packet is an uplink data packet, the communication protocol and data protocol of the data packet are determined, and the corresponding target codec processor is determined according to the communication protocol and / or the data protocol of the data packet, and at least according to the target codec processor, the corresponding data packet is formatted to obtain the target data, so that the format conversion of the valid data carried by the data packet is realized relatively simply. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0083] In a specific embodiment of the present application, Figure 6 As shown, the access service 116 includes multiple target gateways 119, which are used to provide connection support for communication modules 115 for different communication protocols. For example, different TCP private protocol access services, MQTT access services, CoAP access services, HTTP pull services (an implementation of third-party data access), etc. At the same time, the access service 116 and the resolution service 117 communicate through a message queue, that is, the target gateway 119 puts the received data packet into the message queue for the resolution service 117 to consume the data packet from the message queue and perform format conversion. If the target gateway 119 itself has the ability to authenticate the identity of the IoT terminal, the target gateway 119 will perform the identity authentication and send the authentication result to the message queue.
[0084] In actual application, Figure 6 As shown, one communication module 115 can communicate with multiple IoT terminals 114 . Of course, one communication module 115 can also communicate with only one IoT terminal 114 .
[0085] Specifically, Figure 6 As shown, in the present application, there is no restriction on the number of IoT terminals 114 connected to a communication module 115. Specifically, the IoT terminal itself may have communication capabilities. For example, the IoT terminal may support communication modules of 4G / 5G / NBIoT and other networks. Of course, the IoT terminal may not have communication capabilities. Specifically, the communication method between the business service 118 and the resolution service 117 is not limited to remote calls, but may also be to transmit messages through message queues to improve the adaptability to sudden traffic.
[0086] An embodiment of the present invention provides a device, the device including a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:
[0087] Step S101, when the received data packet sent by the target gateway is an uplink data packet, determine the target protocol of the data packet, the target protocol includes at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol for describing the data of the IoT terminal;
[0088] Step S102, determining a corresponding target codec processor at least according to the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet;
[0089] Step S103, performing format conversion on the data packet at least according to the target codec processor to obtain target data.
[0090] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0091] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0092] Step S101, when the received data packet sent by the target gateway is an uplink data packet, determine the target protocol of the data packet, the target protocol includes at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol for describing the data of the IoT terminal;
[0093] Step S102, determining a corresponding target codec processor at least according to the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet;
[0094] Step S103, performing format conversion on the data packet at least according to the target codec processor to obtain target data.
[0095] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the technical solution and technical effects of the present application will be explained below in conjunction with specific embodiments.
[0096] Example
[0097] This embodiment relates to a data processing solution, such as Figure 7 As shown. This solution is applied in a resolution service (a server). First, a data packet sent by a target gateway is received. After receiving the data packet sent by the target gateway, it is determined whether the received data packet is an uplink data packet. In the case where the received data packet is not an uplink data packet, it enters the process of processing other message types. In the case where the received data packet is an uplink data packet, the process of format conversion of the data packet is carried out. Specific steps:
[0098] The first step: when the communication protocol and data protocol of the corresponding data packet can be determined based on the unique identifier of the channel carried by the data packet, the communication protocol and data protocol used by the corresponding data packet are determined based on the unique identifier of the channel carried by the data packet; when the communication protocol and data protocol of the corresponding data packet cannot be determined based on the unique identifier of the channel carried by the data packet, the communication protocol and data protocol used by the data packet are determined at least according to the module identifier of the target gateway carried by the data packet (that is, the source of the data packet).
[0099] Step 2: After determining the communication protocol and data protocol used by the data packet at least based on the module identifier of the target gateway carried by the data packet (i.e., the source of the data packet), or determining the communication protocol and data protocol used by the corresponding data packet based on the unique channel identifier carried by the data packet, determine the codec processor corresponding to the data packet based on the communication protocol and / or data protocol of the data packet, and determine the determined codec processor as the target codec processor; if the communication protocol and data protocol used by the data packet cannot be determined at least based on the module identifier of the target gateway carried by the data packet (i.e., the source of the data packet), determine the preset codec processor as the target codec processor of the corresponding data packet.
[0100] Step 3: According to the target codec processor and corresponding data items of the data packet, the data packet is format converted to obtain the target data.
[0101] Step 4: After converting the format of the data packet according to the target codec processor and the corresponding data item of the data packet and obtaining the target data, determine whether the sub-protocol identifier exists in the corresponding data packet.
[0102] Step 5: When a sub-protocol identifier exists in the corresponding data packet, determine whether the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier; when the corresponding codec processor is found in the protocol item table based on the sub-protocol identifier, determine the codec processor as the target codec processor of the corresponding data packet; when the corresponding codec processor is not found in the protocol item table based on the sub-protocol identifier, determine the preset codec processor as the target codec processor of the corresponding data packet; perform format conversion on the data packet based on the target codec processor to obtain the corresponding target data.
[0103] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0104] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above-mentioned units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0105] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0106] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0107] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0108] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0109] 1) In the data processing method of the present application, first, after receiving the data packet sent by the target gateway, determine whether the received data packet is an uplink data packet. If the data packet is an uplink data packet, determine the target protocol of the data packet, that is, determine the communication protocol and data protocol of the data packet; then, at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol, determine the corresponding target codec processor; finally, at least according to the target codec processor, perform format conversion on the data packet to obtain target data, that is, convert the data packet into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as an arbitrary nesting of the communication protocol and the data protocol. If the received data packet is an uplink data packet, determine the communication protocol and data protocol of the data packet, and determine the corresponding target codec processor according to the communication protocol and / or the data protocol of the data packet, and at least according to the target codec processor, perform format conversion on the corresponding data packet to obtain the target data, so as to achieve a relatively simple format conversion of the valid data carried by the data packet. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0110] 2) In the resolution service of the present application, after receiving the data packet sent by the target gateway, the first determination unit determines whether the received data packet is an uplink data packet. If the data packet is an uplink data packet, the target protocol of the data packet is determined, that is, the communication protocol and data protocol of the data packet are determined; the second determination unit is used to determine the corresponding target codec processor at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol; the first conversion unit is used to perform format conversion on the data packet at least according to the target codec processor to obtain target data, that is, convert the data packet into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as an arbitrary nesting of the communication protocol and the data protocol. If the received data packet is an uplink data packet, the communication protocol and data protocol of the data packet are determined, and the corresponding target codec processor is determined according to the communication protocol and / or the data protocol of the data packet, and the corresponding data packet is format converted at least according to the target codec processor to obtain the target data, thereby realizing a relatively simple format conversion of the valid data carried by the data packet. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0111] 3) The Internet of Things platform of the present application includes access service, parsing service and business service, wherein the parsing service is used to execute any of the above data processing methods. In the above data processing method, first, after receiving the data packet sent by the target gateway, determine whether the received data packet is an uplink data packet. In the case where the data packet is the uplink data packet, determine the target protocol of the data packet, that is, determine the communication protocol and data protocol of the data packet; then, at least according to the target protocol of the data packet, that is, the communication protocol and / or the data protocol, determine the corresponding target codec processor; finally, at least according to the target codec processor, perform format conversion on the data packet to obtain the target data, that is, convert the data packet into a data format readable by the business service. In the data processing method of the present application, the protocol used by the data packet is regarded as any nesting of the communication protocol and the data protocol. In the case where the received data packet is an uplink data packet, determine the communication protocol and data protocol of the data packet, and determine the corresponding target codec processor according to the communication protocol and / or data protocol of the data packet, and at least according to the target codec processor, perform format conversion on the corresponding data packet to obtain the target data, so as to achieve a relatively simple format conversion of the valid data carried by the data packet. That is to say, the processing method of the present application can determine the corresponding target codec processor to realize format conversion of the data packet when the communication protocol and data protocol corresponding to the data packet are known. In this way, the processing method of the present application can process any type of data packet, realizing more flexible and more reliable data processing, thereby solving the problem of poor flexibility in data processing in the prior art.
[0112] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, the processing method is applied in a server, the server communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, characterized in that: The processing method comprises: In the case where the received data packet sent by the target gateway is an uplink data packet, determining a target protocol of the data packet, the target protocol including at least one of the following: a communication protocol, a data protocol, wherein the data protocol is a protocol for describing data of the IoT terminal; Determine a corresponding target codec processor at least according to the target protocol of the data packet, the target codec processor being used to perform format conversion on the corresponding data packet; At least according to the target codec processor, the data packet is format converted to obtain target data, The data packet carries a channel unique identifier and a module identifier, the channel unique identifier is a global unique identifier of a connection established between the communication module and the target gateway, the module identifier is a unique identifier of the target gateway, and when the received data packet sent by the target gateway is an uplink data packet, determining the target protocol of the data packet includes: In a case where the corresponding target protocol can be determined based on the channel unique identifier of the data packet, determining the target protocol based on the channel unique identifier of the data packet; In the case where the corresponding target protocol cannot be determined based on the channel unique identifier of the data packet, the target protocol of the data packet is determined at least according to the module identifier carried by the data packet.
2. The processing method according to claim 1, characterized in that: Determining the target protocol of the data packet at least according to the module identifier carried by the data packet includes: Determining the communication protocol according to the module identifier of the data packet; According to the module identifier of the data packet, searching for a corresponding product identifier in a communication module table, wherein the communication module table includes at least the module identifier and the product identifier, and the product identifier is an identifier of a product composed of the communication protocol and the data protocol; The data protocol of the corresponding data packet is determined according to the communication protocol and the product identification.
3. The processing method according to claim 1, characterized in that: Determining a corresponding target codec processor at least according to the target protocol of the data packet includes: In the case where the codec processor corresponding to the data packet is found in the protocol item table according to the protocol identifier, the found codec processor is determined as the corresponding target codec processor, the protocol identifier is the identifier of the target protocol of the data packet, and the protocol item table includes at least the protocol identifier and the codec processor corresponding to the protocol identifier; When the codec processor corresponding to the data packet is not found in the protocol item table according to the protocol identifier, a preset codec processor is determined as the corresponding target codec processor.
4. The processing method according to claim 1, characterized in that: The processing method also includes: When the target protocol of the data packet is not determined at least according to the module identifier of the target gateway carried by the data packet, a preset codec processor is determined as the corresponding target codec processor.
5. The processing method according to any one of claims 1 to 4, characterized in that: At least according to the target codec processor, converting the format of the data packet to obtain target data, including: According to the target codec processor and the corresponding data item of the target protocol, the corresponding data packet is format converted to obtain the target data, and the data item is used to mark the position of the transmission value of the communication protocol or the data protocol.
6. The processing method according to claim 5, characterized in that: After performing format conversion on the corresponding data packet according to the target codec processor and the corresponding data item of the target protocol to obtain the target data, the processing method further includes: Determine whether there is a subprotocol identifier in the data packet, where the subprotocol identifier is the protocol identifier of the subprotocol, and the subprotocol is the communication protocol or the data protocol; In the case where the subprotocol identifier exists in the data packet, determining whether the corresponding codec processor is found in the protocol item table based on the subprotocol identifier, the protocol item table at least including the protocol identifier and the codec processor corresponding to the protocol identifier; In the case where the corresponding codec processor is found in the protocol item table based on the subprotocol identifier, the codec processor is determined as the target codec processor of the corresponding data packet; in the case where the corresponding codec processor is not found in the protocol item table based on the subprotocol identifier, a preset codec processor is determined as the target codec processor of the corresponding data packet; The data packet is format-converted based on the target codec processor to obtain the corresponding target data.
7. A server, wherein the server communicates with multiple target gateways, one of the target gateways communicates with at least one communication module, and one of the communication modules is connected to at least one IoT terminal, characterized in that: The server comprises: A first determining unit is used to determine a target protocol of the data packet when the received data packet sent by the target gateway is an uplink data packet, wherein the target protocol includes at least one of the following: a communication protocol and a data protocol, wherein the data protocol is a protocol for describing data of the IoT terminal; A second determining unit, configured to determine a corresponding target codec processor at least according to the target protocol of the data packet, wherein the target codec processor is configured to perform format conversion on the corresponding data packet; a first conversion unit, configured to perform format conversion on the data packet at least according to the target codec processor to obtain target data, The data packet carries a channel unique identifier and a module identifier, the channel unique identifier is a globally unique identifier of the connection established between the communication module and the target gateway, and the module identifier is a unique identifier of the target gateway. The first determination unit includes a first determination module and a second determination module, wherein the first determination module is used to determine the target protocol based on the channel unique identifier of the data packet when the corresponding target protocol can be determined based on the channel unique identifier of the data packet; the second determination module is used to determine the target protocol of the data packet at least according to the module identifier carried by the data packet when the corresponding target protocol cannot be determined based on the channel unique identifier of the data packet.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the data processing method according to any one of claims 1 to 6.
9. An Internet of Things platform, characterized in that: include: An access service, wherein the access service includes a plurality of target gateways, and the target gateway is used to send the received data packets sent by the IoT terminal to the server; The server, the server communicating with the access service, the server being used to execute the data processing method according to any one of claims 1 to 6; A business service, wherein the business service communicates with the server and is used to obtain the target data converted by the server.
Citation Information
Patent Citations
Rule formula-based data communication protocol conversion system, decoding method and encoding method
CN112511416A