A protocol library docking execution system and working method suitable for the Internet of Things
By designing a protocol library docking execution system suitable for the Internet of Things, using the header module to call protocol functions, the problems of docking complexity and large amount of code in a narrow bandwidth environment are solved, and efficient data transmission and flexible use of the new protocol library are achieved.
Patent Information
- Application Number
- CN201911164581.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-25
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2039-11-25
AI Technical Summary
When IoT devices transmit data in a narrow bandwidth environment, the existing docking methods are complex and the code volume is large, making it difficult to adapt to the needs of low-cost master control. At the same time, the dynamic library docking is not flexible enough.
A protocol library docking execution system suitable for the Internet of Things is designed, including the main program module, upgrade platform and protocol program module. The protocol functions are called through the header module to reduce the implementation code of the dynamic library docking, and transfer a series of them at a time. Poll function to get docking device information.
It realizes efficient data transmission in a narrow bandwidth environment, simplifies the docking process, reduces storage space requirements, and improves the flexibility of the new protocol library.
Smart Images

Figure CN110780630B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and in particular relates to a protocol library docking execution system and a working method suitable for the Internet of Things. Background Art
[0002] In today's industrial production, the degree of automation is getting higher and higher, and there will be special systems for supporting use. In order to connect different intelligent devices, different communication protocol libraries need to be used. This requires developers to provide a flexible way to allow on-site construction personnel to import different protocol libraries according to the actual situation of the customer. Since the protocol library is relatively complicated and there are many on-site construction situations, remote protocol library upgrades and execution docking have become a very important post-maintenance means.
[0003] In narrow-bandwidth IoT, due to bandwidth limitations, the amount of single data transmission should not be too large. The existing docking includes whole-machine docking and dynamic library docking. Whole-machine docking is not suitable for use in narrow-bandwidth IoT areas because the upgrade package is large and the upgrade time is long. The existing dynamic library docking method is very complicated, and the amount of implementation code is large, which is not suitable for low-cost master control. Summary of the invention
[0004] In view of the above problems, the present invention provides a protocol library docking execution system and working method suitable for the Internet of Things, which mainly solves the problems of limitation of Internet of Things bandwidth on data transmission, complexity of dynamic library docking method, large amount of implementation code, difficulty in low-cost master docking, and insufficient flexibility of dynamic library.
[0005] In order to solve the above problems, the present invention adopts the following technical solutions:
[0006] A protocol library docking execution system suitable for the Internet of Things, comprising a main program module, an upgrade platform and a protocol program module, wherein the protocol program module is arranged in the main program module, and the main program module exchanges information with the upgrade platform;
[0007] The main program module includes:
[0008] Data storage area, used to store data and protocol program modules;
[0009] The execution program module is used to obtain the function address from the protocol library placement interval and execute it.
[0010] The protocol program module includes:
[0011] The protocol main function module is used to store protocol functions.
[0012] The header module is used to store the addresses of all protocol functions in the protocol program module to call the protocol functions in the protocol main function module.
[0013] In one embodiment, the data storage interval includes a protocol library storage interval and a miscellaneous storage interval.
[0014] The protocol library placement area is used to store protocol program modules and protocol library data.
[0015] Miscellaneous storage area is used to store miscellaneous data.
[0016] In one embodiment, the miscellaneous data includes user configuration data and measurement point data.
[0017] In one embodiment, the protocol functions placed in the protocol main function module include a configuration function, a parsing function, and several polling functions.
[0018] In one embodiment, the data stored in the header module includes a dynamic library version, the number of polling functions, a polling interval, a configuration function address, a parsing function address, and several polling function addresses.
[0019] A working method for connecting an IoT protocol library to an execution system:
[0020] A main program module obtains the protocol file and sends it to the execution program module;
[0021] The B execution program module upgrades the protocol library data in the protocol library placement interval according to the received protocol file:
[0022] 1.1 Verify the protocol file. If the content of the protocol file is the same as the protocol library data in the protocol library placement interval, go directly to step C.
[0023] 1.2 Verify the protocol file. If the content of the protocol file is different from the protocol library data in the protocol library placement interval, replace the protocol library data with the data in the protocol file, and then proceed to step C;
[0024] The C main program module connects to the docking device, and the execution program module obtains the configuration function address in the header module and performs hardware configuration;
[0025] The D execution program module obtains the polling function interval and the number of polling function instructions in the header module, and calls the polling function in the protocol main function module according to the function address in the header module to obtain a complete polling protocol command, and sends it to the docking device;
[0026] F The docking device receives the complete polling protocol command, and the device performs the polling command operations one by one according to the polling function interval, and sends the executed command response data back to the execution program module;
[0027] The G execution program module calls the parsing function in the protocol main function module according to the received command response data, performs parsing, and generates measurement point data;
[0028] H saves the measurement point data to the miscellaneous placement area.
[0029] In one embodiment, the main program module in step A exchanges information with the upgrade platform to obtain the protocol file.
[0030] In one embodiment, the protocol file includes a configuration function, a parsing function, several polling functions, a dynamic library version, the number of polling functions, a polling interval, a configuration function address, a parsing function address, and several polling function addresses.
[0031] The beneficial effects of the present invention are:
[0032] 1. Transmit a series of polling functions at a time to obtain information from the docking device, which is suitable for low-cost master control with narrow bandwidth in the Internet of Things;
[0033] 2. The amount of code for implementing dynamic library docking is reduced by calling the corresponding function through the table header, which requires less storage space for IoT devices and simplifies the docking process and method;
[0034] 3. The new protocol library in the later stage is flexible and is not limited by the size of a single protocol function and the number of protocol functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart for obtaining a protocol file for the main program module of the present invention;
[0036] Figure 2 It is a flow chart of the docking process between the main program module and the docking device of the present invention;
[0037] Figure 3 It is a workflow diagram of the protocol library docking execution system of the present invention;
[0038] In the figure:
[0039] 10 main program module; 20 upgrade platform; 30 protocol program module; 11 execution program module; 12 data storage interval; 31 header module; 32 protocol main function module; 121 protocol library placement interval; 122 miscellaneous placement interval. DETAILED DESCRIPTION
[0040] The following is combined with Figure 1-3 The present invention is further described:
[0041] A protocol library docking execution system suitable for the Internet of Things, comprising a main program module 10, an upgrade platform 20 and a protocol program module 30, wherein the protocol program module 30 is arranged in the main program module 10, and the main program module 10 exchanges information with the upgrade platform 20;
[0042] The main program module 10 includes:
[0043] A data storage area 12 for storing data and a protocol program module 30;
[0044] The execution program module 11 is used to obtain the function address from the protocol library placement interval 121 and execute it,
[0045] The protocol program module 30 includes:
[0046] The protocol main function module 32 is used to store the protocol functions.
[0047] The header module 31 is used to store the addresses of all protocol functions of the protocol program module 30 to call the protocol functions in the protocol main function module 32.
[0048] The data storage interval 12 includes a protocol library storage interval 121 and a miscellaneous storage interval 122.
[0049] The protocol library storage area 121 is used to store the protocol program module 30 and the protocol library data.
[0050] The miscellaneous storage area 122 is used to store miscellaneous data.
[0051] Miscellaneous data includes user configuration data and measurement point data.
[0052] The protocol functions placed in the protocol main function module 32 include a configuration function, a parsing function and several polling functions.
[0053] The data stored in the header module 31 includes the dynamic library version, the number of polling functions, the polling interval, the configuration function address, the parsing function address and several polling function addresses.
[0054] A working method for connecting an IoT protocol library to an execution system:
[0055] A main program module 10 exchanges information with the upgrade platform 20, obtains the protocol file, and sends it to the execution program module 11;
[0056] B execution program module 11 upgrades the protocol library data in protocol library placement interval 121 according to the received protocol file:
[0057] 1.1 Verify the protocol file. If the content of the protocol file is the same as the protocol library data in the protocol library placement interval 121, directly proceed to step C.
[0058] 1.2 Verify the protocol file. If the content of the protocol file is different from the protocol library data in the protocol library placement interval 121, replace the protocol library data with the data in the protocol file, and then proceed to step C;
[0059] C. The main program module 10 connects to the docking device, and the execution program module 11 obtains the configuration function address in the header module 31 and executes the hardware configuration;
[0060] D execution program module 11 obtains the polling function interval and the number of polling function instructions in the header module 31, and calls the polling function in the protocol main function module 32 according to the function address in the header module 31 to obtain a complete polling protocol command, and sends it to the docking device;
[0061] F The docking device receives the complete polling protocol command, and the device performs the polling command operation one by one according to the polling function interval, and sends the executed command response data back to the execution program module 11;
[0062] G execution program module 11 calls the parsing function in protocol main function module 32 according to the received command response data, performs parsing, and generates measurement point data;
[0063] H saves the measurement point data to the miscellaneous placement interval 122.
[0064] The upgrade platform 20 is a software service module responsible for updating protocol files.
[0065] The executive program module 11 provides periodic execution codes.
[0066] The configuration function is used to configure the chip hardware or peripheral hardware. In this embodiment, the baud rate, data bit, stop bit, and check bit of the RS485 serial port are configured.
[0067] The parsing function is used to parse the command response data sent back by the docking device into monitoring point data, for example, voltage: 220V is a monitoring point.
[0068] A monitoring point is a specific monitoring signal on the monitored object, such as voltage, temperature, operating status, etc.
[0069] The polling function obtains the function of the polling command according to the polling interval. For example, if there are three polling commands and the polling interval is 10s, the first polling command is sent to the docking device at the 0th second. The docking device protocol library generates a command response data according to the received command and sends it back to the main program module 10. The main program module 10 calls the parsing function to parse the data to obtain the first measuring point. The second polling command is issued at the 10th second. The second measuring point is obtained by the same process. The third polling command is issued at the 20th second to obtain the third measuring point, and so on. The composition of the complete polling command is very free and flexible.
[0070] The complete polling protocol command is a command set consisting of multiple polling commands and a fixed or fluctuating polling interval setting data.
[0071] The function address is the entry address of the code, which is used to call a specific function.
[0072] The protocol file contains configuration functions, parsing functions, several polling functions, dynamic library version, number of polling functions, polling interval, configuration function address, parsing function address and several polling function addresses. These data are specially prepared for the docking device, that is, the protocol file matches the protocol library of the docking device.
[0073] The key functions of the protocol library program are called through the header. By saving the addresses of all protocol function bodies in the header in sequence, the length of the protocol body function can be changed arbitrarily. The number of protocol body functions can be flexibly changed through the function quantity attribute saved in the attribute.
[0074] In steps 1.1 and 1.2, the verification file is implemented through the CRC component, and the configuration function, parsing function and polling function can use function algorithms that can solve related requirements.
[0075] The key function segments of the configuration function are as follows:
[0076]
[0077]
[0078] The key function segments of the parsing function are as follows:
[0079]
[0080]
[0081]
[0082] The key parts of the polling function are as follows:
[0083]
[0084]
[0085] It will be clear to those skilled in the art that various modifications to the above embodiments may be made without departing from the overall spirit and concept of the present invention. All of these modifications fall within the scope of protection of the present invention. The protection scheme of the present invention shall be subject to the claims attached to the present invention.
Claims
1. A protocol library docking execution system suitable for the Internet of Things, comprising a main program module (10), an upgrade platform (20) and a protocol program module (30), wherein the protocol program module (30) is arranged in the main program module (10), and the main program module (10) exchanges information with the upgrade platform (20); characterized in that: The main program module (10) comprises: A data storage area (12) for storing data and a protocol program module (30); An execution program module (11) is used to obtain a function address from a data storage area (12) and execute the function. The protocol program module (30) comprises: The protocol main function module (32) is used to store the protocol functions. A header module (31) is used to store the addresses of all protocol functions of the protocol program module (30) so as to call the protocol functions in the protocol main function module (32); The data storage interval (12) includes a protocol library storage interval (121) and a miscellaneous storage interval (122). The protocol library storage area (121) is used to store the protocol program module (30) and the protocol library data. Miscellaneous storage area (122), used to store miscellaneous data; The protocol functions placed in the protocol main function module (32) include a configuration function, a parsing function and a plurality of polling functions; The data stored in the header module (31) includes a dynamic library version, the number of polling functions, a polling interval, a configuration function address, a parsing function address, and a plurality of polling function addresses.
2. The protocol library docking execution system suitable for the Internet of Things according to claim 1, characterized in that: The miscellaneous data includes user configuration data and measurement point data.
3. The working method of any one of claims 1-2, wherein: A main program module (10) obtains the protocol file and sends it to the execution program module (11); The B execution program module (11) updates the protocol library data in the protocol library placement interval (121) according to the received protocol file: 1.1 Verify the protocol file. If the content of the protocol file is the same as the protocol library data in the protocol library placement interval (121), directly proceed to step C. 1.2 Verify the protocol file. If the content of the protocol file is different from the protocol library data in the protocol library placement interval (121), replace the protocol library data with the data in the protocol file, and then proceed to step C; The C main program module (10) connects to the docking device, and the execution program module (11) obtains the configuration function address in the header module (31) and executes the hardware configuration; The D execution program module (11) obtains the polling function interval and the number of polling function instructions in the header module (31), and calls the polling function in the protocol main function module (32) according to the function address in the header module (31) to obtain a complete polling protocol command, and sends it to the docking device; The F docking device receives the complete polling protocol command, and the device performs the polling command operations one by one according to the polling function interval, and sends the executed command response data back to the execution program module (11); The G execution program module (11) calls the parsing function in the protocol main function module (32) according to the received command response data, performs parsing, and generates measurement point data; H saves the measurement point data to the miscellaneous storage area (122).
4. The working method of the docking execution system according to claim 3, characterized in that: In step A, the main program module (10) exchanges information with the upgrade platform (20) to obtain a protocol file.
5. The working method of the docking execution system according to claim 3, characterized in that: The protocol file includes a configuration function, a parsing function, several polling functions, a dynamic library version, the number of polling functions, a polling interval, a configuration function address, a parsing function address, and several polling function addresses.
Citation Information
Patent Citations
Protocol library docking execution device suitable for Internet of Things
CN211454276U