Communication protocol development method and device, equipment, medium and product
The industrial communication equipment is packaged through predefined communication interface standards and transmission standards, solving the problems of equipment compatibility and low development efficiency, and achieving efficient industrial Internet development.
Patent Information
- Application Number
- CN202411111666.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-06
AI Technical Summary
The existing industrial communication protocol development methods lead to incompatibility and interaction between devices, resulting in poor communication, and the development process is complex and repetitive, and inefficient.
The target communication interface and equipment are encapsulated through predefined communication interface standards and transmission standards, so as to achieve rapid customized packaging, optimize development processes, unify development standards, improve code reusability, and avoid duplicate development.
It significantly improves the development efficiency and system stability of the industrial Internet, reduces duplicate labor, and promotes the efficient development of the industrial Internet.
Smart Images

Figure CN119094621A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication protocol development method, device, equipment, medium and product. Background Art
[0002] The development of industrial communication protocols for hydropower stations can be traced back to the 1970s, starting with serial communication protocols such as RS232 / RS485 and gradually developing into field buses such as CAN, Interbus, Profibus, DeviceNet, CCLink, FF, etc. In order to further improve openness, integrability, transmission rate, reduce costs, and achieve the integration of control network and information network, the industrial Internet platform came into being. The industrial Internet platform uses Ethernet technology in the physical and link layers, the network layer and the transport layer usually use the TCP / IP protocol family, and the application layer has different protocols, such as Modbus, IEC-104, 61850, EtherNet / IP, Profinet, EtherCAT, etc. At the same time, the access of a large number of intelligent devices has led to the emergence of a wide variety of industrial protocols (according to incomplete statistics, there are currently thousands of industrial protocols used in industrial scenarios, and the mainstream protocols are more than 100). These protocols have been widely used in the field of hydropower automation, meeting the communication needs between different devices and systems and promoting the development of the industrial Internet.
[0003] In the related art, in order to solve the above problems, all protocols are developed independently. However, this method may cause the same device or system to follow different protocol standards, resulting in the newly developed protocol being incompatible and incompatible with existing devices, and the devices being unable to communicate smoothly. Summary of the invention
[0004] The present invention provides a communication protocol development method, device, equipment, medium and product.
[0005] In a first aspect, the present invention provides a communication protocol development method, the method comprising:
[0006] In the case of detecting receiving a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0007] The first communication device and the second communication device are encapsulated according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0008] Optionally, after the step of encapsulating the first communication device and the second communication device according to the transmission standard and / or data format of the predefined communication protocol, the method includes:
[0009] The target address and / or node address range is divided for the first communication device and the second communication device according to the address rule of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
[0010] Optionally, the physical parameter definition in the predefined communication interface standard includes a predefined hardware connection mode corresponding to the target communication interface.
[0011] Optionally, the communication protocol in the predefined communication interface standard includes a network layer protocol.
[0012] Optionally, the communication interface command set in the predefined communication interface standard includes operation commands supported by the target communication interface.
[0013] Optionally, encapsulating the first communication device and the second communication device according to a data format of a predefined communication protocol includes:
[0014] The first communication device and the second communication device are encapsulated according to a data encoding method and a data structure in a data format of a predefined communication protocol.
[0015] Optionally, the transmission standard of the predefined communication protocol includes at least one of message type, data content specification, data transmission order, data length indication, verification mechanism, error handling rules, flow control strategy, congestion control strategy, time information, upper layer application interface connection rules and data security policy.
[0016] Optionally, before the step of encapsulating the target communication interface according to a predefined communication interface standard, the method includes:
[0017] Receive communication protocol development instructions sent by users;
[0018] According to the communication protocol development instruction, a target communication interface and a target communication device are obtained, wherein the target communication device includes at least one first communication device and at least one second communication device, when the first communication device is a receiving end, the second communication device is a transmitting end, and when the first communication device is a transmitting end, the second communication device is a receiving end.
[0019] In a second aspect, the present invention provides a communication protocol development device, the device comprising:
[0020] A first encapsulation module is used to encapsulate a target communication interface according to a predefined communication interface standard when detecting that a communication protocol development instruction is received, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0021] The second encapsulation module is used to encapsulate the first communication device and the second communication device according to the transmission standard and / or data format of the predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0022] Optionally, the device further comprises:
[0023] An address division module is used to divide the target address and / or node address range of the first communication device and the second communication device according to the address rules of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
[0024] Optionally, the first encapsulation module is specifically used to define a physical parameter in the predefined communication interface standard, including a hardware connection method corresponding to a predefined target communication interface.
[0025] Optionally, the communication protocol specifically used by the first encapsulation module in the predefined communication interface standard includes a network layer protocol.
[0026] Optionally, the first encapsulation module is specifically used for the communication interface command set in the predefined communication interface standard to include operation commands supported by the target communication interface.
[0027] Optionally, the second packaging module includes:
[0028] The first submodule is used to encapsulate the first communication device and the second communication device according to the data encoding method and the data structure in the data format of the predefined communication protocol.
[0029] Optionally, the second encapsulation module is specifically used for the transmission standard of the predefined communication protocol, including message type, data content specification, data transmission order, data length indication, verification mechanism, error handling rules, flow control strategy, congestion control strategy, time information, upper-layer application interface connection rules and at least one of data security policies.
[0030] Optionally, the device comprises:
[0031] A receiving module, used for receiving a communication protocol development instruction sent by a user;
[0032] An acquisition module is used to acquire a target communication interface and a target communication device according to the communication protocol development instruction, wherein the target communication device includes at least one first communication device and at least one second communication device, when the first communication device is a receiving end, the second communication device is a transmitting end, and when the first communication device is a transmitting end, the second communication device is a receiving end.
[0033] In a third aspect, the present invention provides a communication device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements any of the communication protocol development methods described above.
[0034] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the communication protocol development methods described above.
[0035] In a fourth aspect, the present invention further provides a computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the communication protocol development method as described above is implemented.
[0036] In an embodiment of the present invention, a communication protocol development method is disclosed, the communication protocol development method comprising: in the case of detecting the reception of a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set; encapsulating a first communication device and a second communication device according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction. In an embodiment of the present invention, the communication protocol development method realizes rapid customized encapsulation of the target communication interface and the communication device through predefined communication interface standards and transmission standards. This method not only optimizes the development process and unifies the development standards, but also significantly improves the reusability of the code, avoids repeated development, and thus greatly improves the development efficiency and system stability of the industrial Internet. Through this method, developers can focus more on innovation and optimization, rather than repetitive work, which effectively promotes the efficient development of the industrial Internet. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0038] Figure 1 One of the step flow charts of a communication protocol development method provided in an embodiment of the present invention;
[0039] Figure 2 This is a second flow chart of a communication protocol development method provided in an embodiment of the present invention;
[0040] Figure 3 This is a flowchart of a communication protocol development method provided in an embodiment of the present invention;
[0041] Figure 4 A device block diagram of a communication protocol development device provided in an embodiment of the present invention;
[0042] Figure 5 A schematic diagram of the structure of a communication device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0044] Reference Figure 1 , shows a flow chart of the steps of a communication protocol development method provided by an embodiment of the present invention, the method may include the following steps:
[0045] Step 101, when detecting receiving a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0046] Furthermore, the physical parameter definition in the predefined communication interface standard includes a predefined hardware connection mode corresponding to the target communication interface.
[0047] Furthermore, the communication protocol in the predefined communication interface standard includes a network layer protocol.
[0048] Furthermore, the communication interface command set in the predefined communication interface standard includes operation commands supported by the target communication interface.
[0049] It should be noted that in the embodiments of the present application, the user only needs to focus on the problems to be solved by the protocol during the process of developing the protocol, namely, the application layer protocol, data specifications and the definition of the device address provided. The underlying protocol calls the encapsulated native communication library, which can realize the development of most industrial communication protocols.
[0050] Therefore, firstly, a communication protocol development instruction sent by a user is received, that is, when the communication protocol development instruction is detected, the target communication interface is encapsulated according to a predefined communication interface standard.
[0051] Specifically, it defines and encapsulates the communication interface standard (protocol stack basic communication library). The communication interface standard is the hardware protocol of communication, which provides mechanical, hardware, electrical, and functional characteristics and procedures. At the same time, it defines the connection method of the transmission medium and the network interface and the method of sending and receiving data. For example, the serial data interface RS485 / RS232, Ethernet data interface, etc.
[0052] Among them, the pre-defined communication interface standards mainly include the following parameters:
[0053] Physical parameter definition: defines the hardware connection method of the interface, such as plug type, pin assignment, electrical characteristics (voltage, current, etc.);
[0054] Communication protocol: encapsulate common network layer protocols, such as TCP / IP, UDP, serial communication protocols, etc., and clarify their parameters and rules;
[0055] Communication interface command set: Determine the various operation commands supported by the target communication interface and their formats and meanings.
[0056] Step 102: encapsulate the first communication device and the second communication device according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0057] Further, encapsulating the first communication device and the second communication device according to the data format of the predefined communication protocol includes:
[0058] The first communication device and the second communication device are encapsulated according to a data encoding method and a data structure in a data format of a predefined communication protocol.
[0059] Furthermore, the transmission standard of the predefined communication protocol includes at least one of message type, data content specification, data transmission order, data length indication, verification mechanism, error handling rules, flow control strategy, congestion control strategy, time information, upper layer application interface connection rules and data security strategy.
[0060] It should be noted that in the embodiments of the present application, the transmission standard and data format of the communication protocol are defined and encapsulated, that is, the communicating parties must make unified settings for the communication data transmission method, the transmitted data length, the verification method and the transmission rate, so as to ensure the correctness of the communication between the two parties.
[0061] The transmission standards and / or data formats of the predefined communication protocols mainly include the following aspects:
[0062] Data format: clarify the data encoding method, such as binary, ASCII, etc., and the basic structure of the data, such as field division, length, etc.;
[0063] Message type: distinguish messages with different functions, such as request messages, response messages, status messages, etc., and give them specific identifiers;
[0064] Data content specification: specifies in detail the meaning, value range and constraints of each field;
[0065] Data transmission order: Determine the order in which data is sent and received during the transmission process;
[0066] Data length indication: contains information indicating the length of each data unit, which facilitates accurate processing by the receiver;
[0067] Verification mechanism: Use appropriate verification algorithms, such as parity check, CRC check, etc., to ensure data integrity;
[0068] It should be noted that in the embodiments of the present application, a suitable verification algorithm, such as parity check, CRC check, etc., is adopted to ensure data integrity.
[0069] For example, CRC checksum: after K bits of information code, R bits of checksum are spliced, and the entire code length is N bits. Therefore, this code is also called (N, K) code. For a given (N, K) code, it can be proved that there is a polynomial G(x) with the highest power of NK=R. According to G(x), a checksum of K bits of information can be generated, and G(x) is called the generator polynomial of this CRC code. The specific generation process of the checksum is as follows: Assuming that the transmitted information is represented by the information polynomial C(X), shift C(x) left by R bits, it can be represented as C(x)*x to the Rth power, so that R bits will be vacant on the right side of C(x), which is the position of the checksum. The remainder obtained by dividing C(x)*X to the Rth power by the generator polynomial G(x) is the checksum.
[0070] Error handling rules: define the handling methods when encountering transmission errors, such as retransmission, error reporting, etc.
[0071] Flow control strategy and congestion control strategy: determine how to manage data transmission rate to avoid congestion and data loss;
[0072] Time information: such as the interval between message sending and timeout period;
[0073] Upper-layer application interface connection rules: clarify the data format and semantic conversion rules for interaction with upper-layer applications;
[0074] Data security strategy: Incorporate encryption, authentication, authorization and other security measures to protect data security.
[0075] In an embodiment of the present invention, a communication protocol development method is disclosed, the communication protocol development method comprising: in the case of detecting the reception of a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set; encapsulating a first communication device and a second communication device according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction. In an embodiment of the present invention, the communication protocol development method realizes rapid customized encapsulation of the target communication interface and the communication device through predefined communication interface standards and transmission standards. This method not only optimizes the development process and unifies the development standards, but also significantly improves the reusability of the code, avoids repeated development, and thus greatly improves the development efficiency and system stability of the industrial Internet. Through this method, developers can focus more on innovation and optimization, rather than repetitive work, which effectively promotes the efficient development of the industrial Internet.
[0076] Reference Figure 2 , shows a flow chart of the steps of a communication protocol development method provided by an embodiment of the present invention, the method may include the following steps:
[0077] Step 201, in the case of detecting receiving a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0078] Step 202: encapsulate the first communication device and the second communication device according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0079] Step 203, divide the target address and / or node address range for the first communication device and the second communication device according to the address rule of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
[0080] It should be noted that, in the embodiment of the present application, after the interface and protocol encapsulation in steps 201 and 202 are performed, the device address can be further divided based on the device address definition of the communication protocol.
[0081] Specifically, it may include:
[0082] Range division: Divide the device address or node address range to make it readable and understandable so as to accurately identify the communication object, such as using a specific numeric interval to represent the device address;
[0083] Hierarchical structure: A hierarchical address structure can be used, such as dividing the address into a network part and a device part, to better organize and manage a large number of devices;
[0084] Uniqueness: Ensure that each device address is unique to avoid communication confusion caused by address conflicts;
[0085] Reservation and expansion: A certain number of special addresses or reserved addresses are reserved for future expansion or to cope with special circumstances.
[0086] It should be noted that in the embodiment of the present application, the first communication device and the second communication device can act as a receiving end or a sending end. By setting the address, the communication object can be accurately identified to further achieve communication.
[0087] In addition, in the embodiment of the present application, the user only needs to focus on the problems to be solved by the protocol during the development of the protocol, namely, the application layer protocol, data specifications and the definition of the device address provided. The underlying protocol calls the encapsulated native communication library, which can realize the development of most industrial communication protocols. The specific process includes: determining the data specifications, clarifying the basic units of data, such as bytes, words, etc., designing data fields, defining the meaning, length, data type and constraints of each field, and planning the organizational structure of data, such as the format of data packets, the division of data blocks, etc. Define the device address, select the appropriate address representation form, such as digital encoding, binary encoding, etc., determine the range and allocation rules of the address, ensure uniqueness, and consider the hierarchical structure or grouping method of the address for easy management and identification. Write the application layer protocol, design the message type, such as request message, response message, status message, and specify the format and content of the message, including command code, parameters, etc. Define the message interaction process and logic, such as the processing order of requests, exception handling, etc. Integrate the general communication library, integrate the general communication library through the reserved interface, and establish a connection and data interaction channel with the application layer protocol.
[0088] It should be noted that the general communication library contains the main constants, type definitions and function interfaces required for protocol development.
[0089] Among them, constants can include the following:
[0090] TAG_NAME_LEN Maximum length of the point name
[0091] TAG_ADDRESS_LEN Maximum length of the point address
[0092] TAG_DESCRIPTION_LEN Maximum length of the point description string
[0093] GROUP_NAME_LEN Maximum length of group name
[0094] GROUP_INTERVAL_LIMITThe minimum time limit for group data subscription
[0095] NODE_NAME_LEN Maximum length of the node name
[0096] protocol_NAME_LEN Maximum length of the communication library name
[0097] protocol_LIBRARY_LEN Maximum length of the communication dynamic library file name
[0098] protocol_DESCRIPTION_LEN Maximum length of the communication library description string
[0099] The protocol connection status can be expressed as follows:
[0100] typedef enum link_state{
[0101] LINK_STATE_DISCONNECTED=0,
[0102] LINK_STATE_CONNECTING,
[0103] LINK_STATE_CONNECTED,
[0104] }link_state_e;
[0105] Furthermore, for protocol development, the message types of internal communication mainly include REQ_READ_GROUP, RESP_READ_GROUP, REQ_WRITE_TAG, RESP_ERROR, and REQRESP_TRANS_DATA.
[0106] Among them, the REQ_READ_GROUP message indicates a request to read all point data under a group, and its response is returned by a message of the RESP_READ_GROUP type; the REQ_WRITE_TAG message indicates a request to write a point data, and its response is returned with an error code indicated by the RESP_ERROR message.
[0107] Types can include the following:
[0108] typedef struct reqresp_head{
[0109] reqresp_type_e type;
[0110] void* ctx;
[0111] char sender[NODE_NAME_LEN];
[0112] char receiver[NODE_NAME_LEN];
[0113] }reqresp_head_t;
[0114] It should be noted that the above structure types define the header data of the message communication within the communication library. In addition, other different communication messages carry different types of data (initialization, error messages, etc.), and each structure type corresponds to the data body of each message type except the header data.
[0115] The interface may include the following:
[0116] struct protocol{
[0117] protocol_common_t common;
[0118] }; typedef struct protocol_group protocol_group_t;
[0119] typedef void(*protocol_group_free)(protocol_group_t*pgp);
[0120] struct protocol_group{
[0121] char*group_name;
[0122] UT_array*tags;
[0123] void*user_data;
[0124] protocol_group_free group_free;
[0125] };
[0126] typedef struct protocol_intf_funs{
[0127] protocol_t*(*open)(const protocol_callbacks_t*callbacks);
[0128] int(*close)(protocol_t*protocol);
[0129] int(*init)(protocol_t*protocol);
[0130] int(*uninit)(protocol_t*protocol);
[0131] int(*start)(protocol_t*protocol);
[0132] int(*stop)(protocol_t*protocol);
[0133] int(*config)(protocol_t*protocol,config_t*configs);
[0134] int(*request)(protocol_t*protocol,reqresp_head_t*head,void
[0135] *data);
[0136] union{
[0137] struct{
[0138] int(*validate_tag)(protocol_t*protocol,datatag_t
[0139] *tag);
[0140] int(*group_timer)(protocol_t*protocol,protocol_group_t
[0141] *group);
[0142] int(*write_tag)(protocol_t*protocol,void*req,
[0143] datatag_t*tag,value_u value);
[0144] }driver;
[0145] };
[0146] }protocol_intf_funs_t;
[0147] It should be noted that, in the embodiment of the present application, plugin_intf_funs_t indicates that the structure type defines the interface function of the protocol; open indicates opening the protocol, generally allocating memory for the protocol; close indicates closing the protocol, generally releasing the protocol memory; init indicates initializing the protocol; uninit indicates the opposite of initialization; start indicates starting the protocol, generally connecting the device and setting the connection status to connected; stop indicates stopping the protocol, generally closing the device connection and setting the connection status to disconnected; config indicates configuring the protocol, such as configuring the device address, port number, etc.; request indicates the message request interface; driver indicates the southbound protocol-specific interface; -validate_tag indicates point verification, such as address format and data type verification; -group_timer indicates the group timer callback function, which is used to be called periodically when the protocol is subscribed; -write_tag indicates point data.
[0148] The following is a protocol development process using modbus as an example:
[0149] First, the entrance:
[0150] struct protocol{
[0151] protocol_common_t common;
[0152] conn_t*conn;
[0153] modbus_stack_t *stack;
[0154] void *plugin_group_data;
[0155] uint16_t cmd_idx;
[0156] event_io_t*tcp_server_io;
[0157] int client_fd;
[0158] events_t *events;
[0159] };
[0160] The above defines the struct protocol structure of the modbus_tcp protocol. The first member is common of the protocol_common_t type, and the other members are necessary data to implement the protocol functions, such as TCP connection.
[0161] Among them, the interface of the protocol is given by the following structure:
[0162] static const protocol_intf_funs_t plugin_intf_funs={
[0163] .open=driver_open,
[0164] .close=driver_close,
[0165] .init=driver_init,
[0166] .uninit=driver_uninit,
[0167] .start=driver_start,
[0168] .stop=driver_stop,
[0169] .config=driver_config,
[0170] .request = driver_request,
[0171] .driver.validate_tag=driver_validate_tag,
[0172] .driver.group_timer=driver_group_timer,
[0173] .driver.write_tag=driver_write,
[0174] }
[0175] At this point, the entry point of the protocol is basically there. The following is to implement the above interface functions, such as the open function:
[0176] static protocol_t*driver_open(const adapter_callbacks_t*callbacks)
[0177] {
[0178] protocol_t*protocol=calloc(1,sizeof(protocol_t));
[0179] protocol_common_init(&plugin->common);
[0180] protocol->common.adapter=adapter;
[0181] protocol->common.adapter_callbacks=callbacks;
[0182] protocol->common.link_state=
[0183] protocol_LINK_STATE_DISCONNECTED;
[0184] return plugin;
[0185] }
[0186] The open interface of the modbus_tcp protocol is implemented by the driver_open function. It can be seen that the first step of the driver_open function is to allocate memory for the protocol, and then call protocol_comm on_init to initialize the common member.
[0187] Next, implement the interface functions one by one according to the specific functions and rules of the protocol.
[0188] The communication protocol development method in the embodiment of the present invention realizes the rapid customized encapsulation of the target communication interface and communication equipment through the predefined communication interface standard and transmission standard. This method not only optimizes the development process and unifies the development standards, but also significantly improves the reusability of the code and avoids repeated development, thereby greatly improving the development efficiency and system stability of the industrial Internet. Through this method, developers can focus more on innovation and optimization rather than duplication of work, which effectively promotes the efficient development of the industrial Internet.
[0189] Reference Figure 3 , shows a flow chart of the steps of a communication protocol development method provided by an embodiment of the present invention, the method may include the following steps:
[0190] Step 301, receiving a communication protocol development instruction sent by a user;
[0191] Step 302, acquiring a target communication interface and a target communication device according to the communication protocol development instruction, wherein the target communication device includes at least one first communication device and at least one second communication device, when the first communication device is a receiving end, the second communication device is a transmitting end, and when the first communication device is a transmitting end, the second communication device is a receiving end.
[0192] Step 303, in the case of detecting that a communication protocol development instruction is received, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0193] Step 304: encapsulate the first communication device and the second communication device according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0194] The communication protocol development method in the embodiment of the present invention realizes the rapid customized encapsulation of the target communication interface and communication equipment through the predefined communication interface standard and transmission standard. This method not only optimizes the development process and unifies the development standards, but also significantly improves the reusability of the code and avoids repeated development, thereby greatly improving the development efficiency and system stability of the industrial Internet. Through this method, developers can focus more on innovation and optimization rather than duplication of work, which effectively promotes the efficient development of the industrial Internet.
[0195] Reference Figure 4 , Figure 4 A device block diagram of a communication protocol development device is provided, the device comprising:
[0196] A first encapsulation module 401 is used to encapsulate a target communication interface according to a predefined communication interface standard when detecting that a communication protocol development instruction is received, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0197] The second encapsulation module 402 is used to encapsulate the first communication device and the second communication device according to the transmission standard and / or data format of the predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0198] Optionally, the device further comprises:
[0199] An address division module is used to divide the target address and / or node address range of the first communication device and the second communication device according to the address rules of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
[0200] Optionally, the first encapsulation module is specifically used to define a physical parameter in the predefined communication interface standard, including a hardware connection method corresponding to a predefined target communication interface.
[0201] Optionally, the communication protocol specifically used by the first encapsulation module in the predefined communication interface standard includes a network layer protocol.
[0202] Optionally, the first encapsulation module is specifically used for the communication interface command set in the predefined communication interface standard to include operation commands supported by the target communication interface.
[0203] Optionally, the second packaging module includes:
[0204] The first submodule is used to encapsulate the first communication device and the second communication device according to the data encoding method and the data structure in the data format of the predefined communication protocol.
[0205] Optionally, the second encapsulation module is specifically used for the transmission standard of the predefined communication protocol, including message type, data content specification, data transmission order, data length indication, verification mechanism, error handling rules, flow control strategy, congestion control strategy, time information, upper-layer application interface connection rules and at least one of data security policies.
[0206] Optionally, the device comprises:
[0207] A receiving module, used for receiving a communication protocol development instruction sent by a user;
[0208] An acquisition module is used to acquire a target communication interface and a target communication device according to the communication protocol development instruction, wherein the target communication device includes at least one first communication device and at least one second communication device, when the first communication device is a receiving end, the second communication device is a transmitting end, and when the first communication device is a transmitting end, the second communication device is a receiving end.
[0209] The communication protocol development device in the embodiment of the present invention realizes the rapid customized encapsulation of the target communication interface and communication equipment through the predefined communication interface standard and transmission standard. This method not only optimizes the development process and unifies the development standards, but also significantly improves the reusability of the code and avoids repeated development, thereby greatly improving the development efficiency and system stability of the industrial Internet. Through this method, developers can focus more on innovation and optimization rather than duplication of work, which effectively promotes the efficient development of the industrial Internet.
[0210] The embodiment of the present invention also provides a communication device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0211] Memory 503, used for storing computer programs;
[0212] The processor 501, when used to execute the program stored in the memory 503, can implement the following steps:
[0213] In the case of detecting receiving a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set;
[0214] The first communication device and the second communication device are encapsulated according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
[0215] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits together, which are all well known in the art, so this article will not further describe them. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor can be transmitted on a wired medium or on a wireless medium through an antenna. Further, the antenna also receives data and transmits the data to the processor. The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory can be used to store data used by the processor when performing operations.
[0216] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0217] The communication interface is used for communication between the above terminal and other devices.
[0218] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0219] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0220] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the communication protocol development method described in any of the above embodiments.
[0221] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the communication protocol development method described in any one of the above embodiments.
[0222] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidState Disk (SSD)), etc.
[0223] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0224] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0225] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A communication protocol development method, characterized in that: The method comprises: In the case of detecting receiving a communication protocol development instruction, encapsulating a target communication interface according to a predefined communication interface standard, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set; The first communication device and the second communication device are encapsulated according to a transmission standard and / or a data format of a predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
2. The method according to claim 1, characterized in that: After the step of encapsulating the first communication device and the second communication device according to the transmission standard and / or data format of the predefined communication protocol, the method comprises: The target address and / or node address range is divided for the first communication device and the second communication device according to the address rule of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
3. The method according to claim 1, characterized in that The physical parameter definition in the predefined communication interface standard includes a predefined hardware connection mode corresponding to the target communication interface.
4. The method according to claim 1, characterized in that: The communication protocol in the predefined communication interface standard includes a network layer protocol.
5. The method according to claim 1, characterized in that The communication interface command set in the predefined communication interface standard includes operation commands supported by the target communication interface.
6. The method according to claim 1, characterized in that The encapsulating the first communication device and the second communication device according to the data format of the predefined communication protocol comprises: The first communication device and the second communication device are encapsulated according to a data encoding method and a data structure in a data format of a predefined communication protocol.
7. The method according to claim 6, characterized in that The transmission standard of the predefined communication protocol includes at least one of message type, data content specification, data transmission order, data length indication, verification mechanism, error handling rules, flow control strategy, congestion control strategy, time information, upper layer application interface connection rules and data security strategy.
8. The method according to claim 1, characterized in that Before the step of encapsulating the target communication interface according to the predefined communication interface standard, the method includes: Receive communication protocol development instructions sent by users; According to the communication protocol development instruction, a target communication interface and a target communication device are obtained, wherein the target communication device includes at least one first communication device and at least one second communication device, when the first communication device is a receiving end, the second communication device is a transmitting end, and when the first communication device is a transmitting end, the second communication device is a receiving end.
9. A communication protocol development device, characterized in that: The device comprises: A first encapsulation module is used to encapsulate a target communication interface according to a predefined communication interface standard when detecting that a communication protocol development instruction is received, wherein the target communication interface is determined based on the communication protocol development instruction, and the predefined communication interface standard includes a physical parameter definition, a communication protocol, and a communication interface command set; The second encapsulation module is used to encapsulate the first communication device and the second communication device according to the transmission standard and / or data format of the predefined communication protocol, wherein the first communication device and the second communication device are determined based on the communication protocol development instruction.
10. The device according to claim 9, characterized in that The device also includes: An address division module is used to divide the target address and / or node address range of the first communication device and the second communication device according to the address rules of the predefined communication protocol, wherein the target address includes a network address and / or a device address, and each of the first communication device and each of the second communication devices corresponds to one target address respectively.
11. The device according to claim 9, characterized in that The first encapsulation module is specifically used for defining the physical parameters in the predefined communication interface standard, including a predefined hardware connection method corresponding to the target communication interface.
12. The device according to claim 9, characterized in that The first encapsulation module is specifically used for the communication protocol in the predefined communication interface standard including the network layer protocol.
13. A communication device, characterized in that: include: A transceiver, a memory, a processor, and a program stored on the memory and executable on the processor; The processor is used to read the program in the memory to implement the communication protocol development method as described in any one of claims 1-8.
14. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the communication protocol development method as described in any one of claims 1 to 8 is implemented.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, a communication protocol development method as described in any one of claims 1 to 8 is implemented.
