Communication method, communication framework and communication system
By defining the communication interface library, driver interface and device routing table, combined with the general communication framework, the problems of communication complexity and inefficiency between multiple modules are solved, and efficient multi-device communication and simplified application development are achieved.
Patent Information
- Application Number
- CN202411878735.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-25
AI Technical Summary
In a multi-module encryption terminal project, communication between different CPU modules is complex in development and inefficient in data transmission due to different hardware interface protocols. Especially when communication between 3 or more modules, the workload is huge and inefficient.
It provides a communication method and communication system, by defining a communication interface library, driver interface and device routing table, combining a general communication framework, decoupling applications and drivers, realizing common communication protocol packet conversion and routing table navigation between multiple devices, thereby realizing efficient communication between multiple modules.
It improves the efficiency of multi-module communication development and data transmission efficiency, simplifies application development, reduces the individual development needs for each device module, and achieves the goal of developing multi-end deployment at one time.
Smart Images

Figure CN119892799A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data interaction, and in particular to a communication system and a communication method. Background Art
[0002] In a multi-module encryption terminal project, multiple communication modules are usually included, and the communication problem between modules needs to be solved.
[0003] In the known prior art, when different CPU modules support different communication protocols, communication between CPU modules is generally based on hardware interface protocols. For example, a CPU module may support UART bus, SPI bus, I2C bus, USB bus, SDIO bus and network port communication, etc. After the module hardware circuit design is completed, it is necessary to develop a driver based on the hardware circuit based on the communication relationship between the hardware circuits and the communication bus form supported by the hardware module. The application realizes data transmission by calling the corresponding driver interface according to the bus supported by the modules to be communicated.
[0004] The workload of developing an application between two different bus modules is relatively small. However, if it involves communication between three or more modules, the communication paths between modules increase, and the number of driver interface programs that need to be designed increases, so the workload of application development is large and the data transmission efficiency is low. Summary of the invention
[0005] The purpose of the present invention is to solve one of the above technical problems and provide a communication system and a communication method, which can improve the development efficiency of multi-module communication.
[0006] A first aspect of the present invention provides a communication method for multi-device communication, comprising:
[0007] Defining a communication interface library, the communication interface library including interface functions, each interface function defining a communication rule corresponding to an interface type;
[0008] Defining a driver interface, wherein the driver interface specifies action pointers of an interface between an application and a target device, including an open pointer, a read pointer, a write pointer, and a close pointer;
[0009] Define a device routing table on the application side, the device routing table includes the device ID, the target device ID of the target device communicating with the device, and the communication route between the device and the target device; the communication rules corresponding to the interface type of each target device are covered by the communication interface library; the device is the device for loading the application;
[0010] Add communication interface library, driver interface, and device routing table to the general communication framework;
[0011] The application loads the general communication framework and starts the general communication framework thread. The communication framework thread calls the interface function according to the target device and converts the communication data into a general communication protocol data packet to realize the communication between the application device and the target device based on the device routing table.
[0012] In the embodiment of the present application, the communication method is based on the design of a general communication framework, which decouples the application from the driver program. By calling interface functions and driver interfaces, the problem of communication between different types of devices can be solved, thereby improving the communication efficiency between multiple devices and the development efficiency of the communication system.
[0013] In combination with the first aspect, in certain implementations of the first aspect, the communication route between the present device and the target device includes: the present device communicates directly with the target device, or the present device communicates with the target device via a transit device; when the present device transmits data to the target device, the communication framework thread forwards the data packet according to the communication route.
[0014] In the embodiment of the present application, in the data flow from the present device to the target device, direct data transmission or transit data transmission between devices is implemented.
[0015] In combination with the first aspect, in certain implementations of the first aspect, when the target device transmits data to the current device, the communication framework thread determines whether the transmission destination device of the target device is the current device according to the communication route. If so, the data packet is forwarded to the current device; if not, the data packet is forwarded.
[0016] In the embodiment of the present application, in the data flow from the target device to the current device, the corresponding device data will be monitored through the read and write threads to prevent the data from being erroneously forwarded to the current device.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the device routing table includes an index identifier for characterizing the target device, and an element identifier for characterizing the next-hop device; if the corresponding bit index identifier is consistent with the element identifier and is not 0, the current device and the target device can communicate directly; if the index identifier is B and is not 0, the next-hop transit device for communication between the current device and the target device is B; if the index identifier is 0, the current device and the target device cannot communicate.
[0018] In the embodiment of the present application, the routing information is stored through the device routing table to guide the transmission path of the data packet in the multi-device network, ensuring that the data can be efficiently transmitted to the destination device via the optimal path.
[0019] In combination with the first aspect, in certain implementations of the first aspect, the general communication protocol data packet includes header data and payload data, and the header data includes: a current device characterization byte, a next-hop device characterization byte, and a target device characterization byte.
[0020] In the embodiment of the present application, the communication protocol data packet is the basic unit of information transmission in a computer network, which contains all the information required for communication between the sender and the receiver. By defining the format of the communication protocol data packet and combining the design of the routing table, it is possible to ensure the normal transmission of data based on the general communication framework and ensure that the data can be correctly and efficiently transmitted from the source to the destination device.
[0021] A second aspect of the present invention provides a communication framework, including a main program thread and an interface module:
[0022] The interface module includes an application-side read-write interface and a driver registration interface, wherein the driver registration interface is used to call an interface function according to the interface type of the application device or the target device to be communicated, and drive the communication interface between the application device and the target device; the read-write interface is used to read data packets from the application-side device and the target device, and convert the read data packets into a universal communication protocol data packet format;
[0023] The main program thread includes a read-write thread: the read-write thread obtains a communication protocol data packet and sends it to an application device, or a target device, according to a device routing table of an application terminal device.
[0024] In combination with the second aspect, in certain implementations of the second aspect, the read-write thread is further configured to: according to the device routing table of the application-side device, when the application side sends data to the target device, forward the application-side device directly to the target device, or forward it to the target device via an intermediate device; when the target device sends data to the application side, determine whether the transmission destination device of the target device is this device, if so, forward the data packet to this device, if not, forward the data packet.
[0025] In combination with the second aspect, in certain implementations of the second aspect, the driver registration interface is configured to specify an access handle of the lower-level channel, a lower-level channel read function pointer, a lower-level channel write function pointer and a lower-level channel IO control interface function pointer.
[0026] In combination with the second aspect, in some implementations of the second aspect, the main program thread also includes a maintenance thread for internal maintenance of the communication framework.
[0027] A third aspect of the present invention provides a communication system, comprising the communication framework provided by the second aspect of the present invention.
[0028] Compared with the prior art, the technical effects of the present invention include at least:
[0029] 1. The present invention develops a universal communication framework suitable for multi-device communication. When the communication method provided by the present invention is used for multi-device communication, when data is communicated between different interface devices, calling the interface function and driver interface of the universal communication framework that matches the interface type can solve the communication problem between different types of devices, thereby improving the communication efficiency between multiple devices.
[0030] 2. The application development structure based on the general communication framework provided by the present invention decouples the application from the driver, develops once and deploys on multiple terminals, and does not require separate application development and driver development for each device module, thereby simplifying application development and solving the problem of low efficiency in multi-device communication application development. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 This is a schematic diagram of the structure of a multi-module connection communication system.
[0033] Figure 2 Develop a structural diagram for a traditional multi-module communication system application.
[0034] Figure 3 This is a schematic diagram of the application development structure of the multi-module communication system provided by the present invention.
[0035] Figure 4 This is a schematic diagram of the general communication framework structure provided by the present invention.
[0036] Figure 5 This is a communication data packet format diagram provided by the present invention.
[0037] Figure 6 This is a communication data packet format diagram provided by the present invention.
[0038] Figure 7 This is a schematic diagram of multi-device communication principle of the device routing table provided by the present invention.
[0039] Figure 8 This is a schematic diagram of the device routing table structure corresponding to the device 1 provided by the present invention. DETAILED DESCRIPTION
[0040] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0041] In the embodiments of the present application, prefixes such as "first" and "second" are used only to distinguish different description objects, and have no limiting effect on the position, order, priority, quantity or content of the described objects. The use of prefixes such as ordinal numbers to distinguish description objects in the embodiments of the present application does not constitute a limitation on the described objects. For the statement of the described objects, please refer to the description in the context of the claims or embodiments, and no unnecessary limitation should be constituted due to the use of such prefixes. In addition, in the description of the present embodiment, unless otherwise specified, the meaning of "multiple" is two or more.
[0042] The technical solution in the embodiment of the present application will be described below in conjunction with the drawings in the embodiment of the present application. In the description of the embodiment of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0043] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0044] refer to Figure 1 and Figure 2 , which is a specific application example of a multi-module transmission system.
[0045] Terminal A is the main control board, responsible for application processing. Module B is the isolation board, responsible for data encryption, module C is the communication board, responsible for 4G / 5G communication, and module D is the communication board, responsible for Bluetooth WIFI communication.
[0046] Direct data communication cannot be achieved between terminal A and module C and module D. If communication between terminal A and module C and module D is to be achieved, it is usually necessary to add a conversion interface between terminal A and module C, and between terminal A and module D.
[0047] Figure 1 Another way to achieve communication between terminal A and module C and module D is shown. Data encryption is achieved through module B, and then the external network is accessed through module C or module D.
[0048] Specifically, the main control board A has no communication function and needs to use the communication module C and the communication module D for network communication. At the same time, to ensure data security, the encryption module B is used to encrypt the data. Hardware design The main control board A and the encryption module B are connected using the SDIO interface, the encryption module B and the communication module C are connected using the UART, and the encryption module B and the communication module D are connected using the USB interface.
[0049] Existing applications have found that after the driver development is completed, the workload is huge when developing the application program. When developing the application program of module B, it is necessary to call the SDIO driver, UART driver and USB driver respectively, maintain the connection between each module, receive data and forward it. Similarly, the main control A and communication module C and communication module D all need to develop corresponding applications.
[0050] To achieve Figure 1 The communication function of the multi-module system shown requires the following system development work.
[0051] (1) Develop an SDIO driver for terminal A and develop an application for terminal A based on the driver to solve the communication problem between terminal A and terminal B;
[0052] (2) Develop Module B SDIO driver to solve the communication problem between terminal B and terminal A;
[0053] (3) Develop the UART driver for module B to solve the communication problem between terminal B and module C;
[0054] (4) Develop a USB driver for module B to solve the communication problem between terminal B and module D;
[0055] (5) Develop an application for module B, receive data through the module B SDIO driver, and forward the data to module C or module D through the module B UART driver or USB driver; receive data from module C or module D and forward it to module A;
[0056] (6) Develop the UART driver for module C and develop the application for module C to receive data and send it to the external network or forward the received data to module B;
[0057] (7) Develop a USB driver for module D and develop an application for module D to receive data and send it to an external network or to forward received data to module B.
[0058] From the above development process, after the driver developers develop the drivers for each module, the application developers need to develop different applications based on the drivers, and the application developers need to be familiar with different hardware interface protocols. The application and the driver are highly coupled, and the development difficulty and workload are large. The communication between each hardware module requires the design of a dedicated communication protocol or forwarding protocol, and the data transmission efficiency is low when communicating across modules.
[0059] To solve the above problems, the present invention provides a general agent framework suitable for multi-module communication, which improves the development efficiency of multi-device communication and the efficiency of multi-device communication. The general agent framework relates to a communication method and a communication system.
[0060] The present invention names the data packet format and protocol adopted by the general proxy framework as SCP, and SCP is used to refer to the general proxy framework and its data standard. The driver interface is registered to the SCP general framework, and the application is no longer based on the driver but is developed based on the SCP protocol. SCP is compiled into a shared library and can be directly applied to different modules. The SCP framework maintains multiple threads inside, including a reading thread, a maintenance thread and a read-write interface, to ensure efficient data transmission.
[0061] The following will describe the specific implementation of the present invention from two aspects: communication method, communication framework and communication system.
[0062] To solve the above problems, the first aspect of the present invention provides a communication method for multi-device communication. A communication architecture diagram of a specific application example of a multi-device system can be as follows: Figure 1 The structure shown includes device A, device B, device C, and device D. Device A carries an application. Device A can communicate directly with device B, but device A needs to communicate with device C through device B.
[0063] The communication method includes the following steps.
[0064] S1: Define a communication interface library, which includes interface functions. Each interface function defines a communication rule for a corresponding interface type.
[0065] The interface function in the embodiment of the present invention is an interface function for the application layer, and the interface function is defined according to the interface type between the devices in the multi-device system. For example, it includes USB interface function, UART interface function, etc. For different multi-device systems, corresponding communication interface libraries are developed according to the interface characteristics of the system devices.
[0066] S2: Define the driver interface, which specifies the action pointers of the interface between the application and the target device, including the open pointer, read pointer, write pointer and close pointer. It should be understood that each action of the driver interface includes channel_open, channel_read, channel_write and channel_close.
[0067] refer to Figure 3 Between the device where the application is located and device A, device B, and device C, each device corresponds to an independent communication interface, and each interface corresponds to a driver interface, which is used to control the driving action of the interface between the application and the device.
[0068] S3: Define the device routing table on the application side. The device routing table includes the device ID, the target device ID of the target device that communicates with the device, and the communication route between the device and the target device. The communication rules corresponding to the interface type of each target device are covered by the communication interface library. The device is the device for loading the application.
[0069] It should be understood that the present device is a device of the application end device, for example, it can be understood as the device A in the multi-device framework provided by the present invention. In some embodiments, if the application is developed for device B, the present device can also be device B. The connection modes of each device include direct physical connection and connection through other devices. The rules of the transfer are based on the routing table.
[0070] In some embodiments of the present invention, the communication route between the present device and the target device includes: the present device and the target device communicate directly, or the present device and the target device communicate via a transfer device. Figure 7 , device 1 and device 2 can communicate directly, but device 1 and device 3 cannot communicate directly. Data sent from device 1 to device 3 needs to be transferred through device 2, that is, first sent to device 2, and then sent to device 3. Conversely, data sent to device 1 via device 3 uses the same link rules.
[0071] Data transmission includes two directions, namely, sending data from the device to the target device, and sending data from the target device to the device. Figure 7 In the example, device 1 is the local device, and devices 2 and 3 are target devices.
[0072] When this device transmits data to the target device, that is, when the application sends data to the target device, the communication framework thread forwards the data packet according to the communication route. For example, according to the rules recorded in the routing table, when the target device is device 2, the data is sent from device 1 to device 2, and when the target device is device 3, the data is sent from device 1 to device 2 and then to device 3.
[0073] When the target device transmits data to this device, the communication framework thread determines whether the transmission destination device of the target device is this device according to the communication route. If so, the data packet is forwarded to this device; if not, the data packet is forwarded.
[0074] refer to Figure 8 In some embodiments of the present invention, the routing table includes an index identifier for characterizing a target device and an element identifier for characterizing a next-hop device; if the corresponding bit index identifier is consistent with the element identifier and is not 0, the present device and the target device can communicate directly; if the index identifier is B and is not 0, the next-hop transit device for communication between the present device and the target device is B; if the index identifier is 0, the present device and the target device cannot communicate.
[0075] Specifically, the routing table is a 256-element char type array, which is used to specify the rules for routing forwarding in the communication framework when calling to add channel handles and interfaces. The index of the array represents the destination device ID, the element represents the next hop device ID, and an element of 0 indicates that the destination device is unreachable.
[0076] by Figure 8 For example, this is the channel routing table of device 1. The number of index identifiers is determined according to the number of devices in the multi-device communication system. For example, in this embodiment, 3 devices are included, and the index identifiers include: 0, 1, 2, and 3. For device 1, this device corresponds to device 1 itself, and the target device can be device 2 or device 3. Taking the channel routing table of device 1 as an example, the element of index 2 is 2, indicating that device 1 communicates directly with device 2, and the element of index 3 is 2, indicating that device 1 communicates with device 3 through device 2 forwarding.
[0077] S4: adding the communication interface library, the channel operation descriptor, the driver interface, and the device routing table to the general communication framework, which is defined as the SCP communication framework in the present invention.
[0078] Among them, the channel operation descriptor is used to identify the opened channel.
[0079] S5: The application-side device loads the general communication framework and starts the general communication framework thread. The communication framework thread calls the interface function according to the target device and converts the communication data into a general communication protocol data packet to realize the communication between the application device and the target device based on the device routing table.
[0080] refer to Figure 4 According to the structure of the communication framework of the present invention, when data communication is performed, the application terminal device loads the communication framework, and the communication interface library data is simultaneously loaded into the application terminal device.
[0081] The general communication protocol data packet includes header data and payload data, and the header data includes: the device characterization byte, the next hop device characterization byte, and the target device characterization byte.
[0082] refer to Figure 5 and Figure 6 The general communication protocol data packet is divided into two parts: the SCP header and the payload data. The header length is 12 bytes, followed by the data payload. The first 4 bytes of the header are communication identifiers, namely the source device, next hop device, destination device, and service type, each occupying 1 byte.
[0083] The service type is used to distinguish different services of the target device, including encryption and decryption services, dial-up services, configuration services, etc. The target device calls different processing flows according to the received SCP service type.
[0084] The implementation process of the communication method provided by the present invention is described by taking a specific application example. In this embodiment, an application program of device A is developed based on the SCP communication framework.
[0085] 1. First, based on the composition of the multi-device system, the interface type defines the communication interface library of the multi-device system, and the device A application loads the SCP interface library;
[0086] 2. Define driver-oriented interfaces, including channel_open, channel_read, channel_write and channel_close;
[0087] 3. Define the device ID and device routing table. The SCP protocol will forward data based on the device ID, target device ID and routing table.
[0088] 4. Call the channel_open interface to obtain the channel operation descriptor, and add the channel descriptor and the channel read and write interfaces channel_read, channel_write and routing table to the SCP framework;
[0089] 5. Start the SCP worker thread
[0090] 6. Open the connection between this device and the target communication device SCP
[0091] 7. Send data to the target device. Take three devices as an example. Device A sends data to device B by directly calling the channel interface. Device A sends data to device C, then the next hop device of the data is set to device B, and the data is sent to device B. After receiving the data, the SCP of device B determines that the destination device is device C, and forwards it directly to device C.
[0092] 8. The SCP driver read and write thread will monitor the corresponding device data. When receiving the data, it will determine whether the destination device is the current device. If it is the current device, the data will be forwarded to the application. If it is not the current device, the data will be forwarded according to the destination device and the current device routing table.
[0093] When the communication method provided by the present invention is used for multi-device communication, when data is communicated between different interface devices, the interface function of the general communication framework matching the interface type is called, thereby improving the communication efficiency between the multiple devices.
[0094] A second aspect of the present invention provides a communication framework, defined as an SCP framework, including a main program thread and an interface module.
[0095] The interface module includes an application-side read-write interface and a driver registration interface. The driver registration interface is used to call an interface function according to the interface type of the application device or target device to be communicated, and drive the communication interface between the application device and the target device; the read-write interface is used to read data packets from the application-side device and the target device, and convert the read data packets into a general communication protocol data packet format;
[0096] The main program thread includes a read-write thread: the read-write thread obtains the communication protocol data packet and sends it to the application device, or the target device according to the device routing table of the application-side device.
[0097] In some embodiments of the present invention, the read-write thread is further configured to: according to the device routing table of the application-side device, when the application side sends data to the target device, forward the application-side device directly to the target device, or forward it to the target device via an intermediate device; when the target device sends data to the application side, determine whether the transmission destination device of the target device is this device, if so, forward the data packet to this device, if not, forward the data packet.
[0098] In some embodiments of the present invention, the driver registration interface is configured to specify an access handle of a lower layer channel, a lower layer channel read function pointer, a lower layer channel write function pointer and a lower layer channel IO control interface function pointer.
[0099] In some embodiments of the present invention, the main program thread also includes a maintenance thread for internal maintenance of the communication framework, wherein the internal maintenance of the communication framework includes channel status management, channel data recording, and the like.
[0100] refer to Figure 4 The upper layer of the SCP framework is the application-side docking part, and the lower layer is the target device-side docking part. The SCP framework itself is divided from top to bottom into SCP driver reading thread, SCP maintenance thread, SCP application read and write interface and driver registration interface;
[0101] The reading thread directly accesses the read interface of the lower layer channel and obtains the SCP data packet from the lower layer;
[0102] The SCP maintenance thread is responsible for the internal maintenance of the SCP framework, data push, etc.
[0103] The SCP application read and write interface provides a reliable data payload sending and receiving interface for upper layer applications;
[0104] The driver registration interface is used to register the access handle of the lower channel, the lower channel read function pointer, the lower channel write function pointer and the lower channel IO control interface function pointer to SCP;
[0105] The SCP driver registration interface specifies the function call interface that the lower layer channel should provide, including opening, closing, reading and writing data. The interface for opening and closing the channel is called in the application, and the read and write interface is provided to the SCP framework for use.
[0106] A third aspect of the present invention provides a communication system, comprising the communication framework provided by the second aspect of the present invention.
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A communication method for multi-device communication, characterized in that: include: Defining a communication interface library, the communication interface library including interface functions, each interface function defining a communication rule corresponding to an interface type; Defining a driver interface, wherein the driver interface specifies action pointers of an interface between an application and a target device, including an open pointer, a read pointer, a write pointer, and a close pointer; Define a device routing table on the application side, the device routing table includes the device ID, the target device ID of the target device communicating with the device, and the communication route between the device and the target device; the communication rules corresponding to the interface type of each target device are covered by the communication interface library; the device is the device for loading the application; Add communication interface library, driver interface, and device routing table to the general communication framework; The application loads the general communication framework and starts the general communication framework thread. The communication framework thread calls the interface function according to the target device and converts the communication data into a general communication protocol data packet to realize the communication between the application device and the target device based on the device routing table.
2. The communication method according to claim 1, characterized in that: The communication route between the present device and the target device includes: the present device directly communicates with the target device, or the present device communicates with the target device via a transfer device; when the present device transmits data to the target device, the communication framework thread forwards the data packet according to the communication route.
3. The communication method according to claim 2, characterized in that: When the target device transmits data to the current device, the communication framework thread determines whether the transmission destination device of the target device is the current device according to the communication route. If so, the data packet is forwarded to the current device; if not, the data packet is forwarded.
4. The communication method according to claim 2 or 4, characterized in that: The device routing table includes an index identifier for representing a target device and an element identifier for representing a next-hop device; If the corresponding bit index identifier is consistent with the element identifier and is not 0, the device and the target device can communicate directly; If the index is B and is not 0, the next hop transit device for communication between the current device and the target device is B; If the index mark is 0, this device cannot communicate with the target device.
5. The communication method according to claim 1, 2 or 3, characterized in that: The general communication protocol data packet includes header data and payload data, and the header data includes: a present device characterization byte, a next-hop device characterization byte, and a target device characterization byte.
6. A communication framework, characterized in that: Used to implement the communication method described in any one of claims 1 to 5, comprising a main program thread and an interface module: The interface module includes an application-side read-write interface and a driver registration interface, wherein the driver registration interface is used to call an interface function according to the interface type of the application device or the target device to be communicated, and drive the communication interface between the application device and the target device; The read / write interface is used to read data packets from the application end device and the target device end, and convert the read data packets into a universal communication protocol data packet format; The main program thread includes a read-write thread: the read-write thread obtains a communication protocol data packet and sends it to an application device, or a target device, according to a device routing table of an application terminal device.
7. The communication framework according to claim 6, characterized in that The read-write thread is further configured to: according to the device routing table of the application-side device, when the application side sends data to the target device, forward the application-side device directly to the target device, or forward it to the target device via an intermediate device; when the target device sends data to the application side, determine whether the transmission destination device of the target device is this device, if so, forward the data packet to this device, if not, forward the data packet.
8. The communication framework according to claim 6, characterized in that The driver registration interface is configured to specify an access handle of a lower layer channel, a lower layer channel read function pointer, a lower layer channel write function pointer and a lower layer channel IO control interface function pointer.
9. The communication framework according to claim 6, characterized in that The main program thread also includes a maintenance thread for internal maintenance of the communication framework.
10. A communication system, characterized in that: A communication framework comprising any one of claims 6 to 9.