An embedded network framework and method for supporting multiple communication formats
Through the design of the function call module, function abstract module and network adaptation layer of the embedded network framework, combined with static configuration and network debugging command layer, the problems of insufficient resources of embedded devices and difficulty in debugging are solved, and efficient multi-network interfaces are realized Management and fault location.
Patent Information
- Application Number
- CN202110960925.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-20
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-08-20
AI Technical Summary
In the prior art, embedded devices are difficult to support multi-network interface design due to resource limitations, and lack general network debugging and diagnostic tools, resulting in high resource occupation and poor user experience.
Design an embedded network framework, including a function call module, a function abstract module and a network adaptation layer, statically configure the target communication standard identifier and device identifier, reduce resource consumption, and add network debugging command layer to achieve fault location.
The embedded network framework reduces resource consumption, supports the management of multiple network interfaces, improves the adaptability of embedded devices, and solves the problem of fault location through the network debugging command layer.
Smart Images

Figure CN115714720B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of communication and computers, and in particular to an embedded network framework and a method for supporting multiple communication formats. Background Art
[0002] With the advent of the era of the Internet of Everything, the communication function on embedded devices has become increasingly important. Among the existing technical solutions, the design that supports multiple network interfaces consumes a lot of resources, and it is necessary to design a relatively complex logic processing layer to identify different network interfaces. For embedded devices with less flash and random access memory (RAM) resources, it is very difficult to use. For the case of multiple network interfaces, it is necessary to design an abstract layer to distribute and process the network interfaces, which puts higher requirements on the resource environment. In addition, all current solutions do not have a universal network debugging and diagnostic tool, and cannot effectively locate network faults, resulting in a poor user experience. Summary of the invention
[0003] The technical purpose to be achieved by the embodiments of the present application is to provide an embedded network framework and a method for supporting multiple communication formats, so as to solve the problem that current embedded devices have limited resources and cannot support the design of multiple network interfaces that occupy more resources.
[0004] To solve the above technical problems, the embodiment of the present application provides an embedded network framework, including: a function calling module, a function abstraction module and a network adaptation layer;
[0005] The function call module is connected to the application program and is used to obtain the function call interface corresponding to the function call command when receiving the function call command of the application program, and determine the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table;
[0006] The function abstraction module is used to obtain and encapsulate the control logic related to the function requirements according to the target communication format type and the function requirements in the function call command, and associate it with the function call interface;
[0007] The network adaptation layer is connected to the function abstraction module and to multiple entity communication modules, and is used to call the function implementation interface corresponding to the function call interface from multiple entity communication modules according to the target device identifier in the user configuration table.
[0008] Preferably, in the embedded network framework as described above, the network adaptation layer comprises: an abstract application program interface, a core layer and a module adaptation layer;
[0009] Among them, the abstract application program interface is connected to the function abstract module to receive the function call interface issued by the function abstract module;
[0010] The core layer is provided with a plurality of function objects of abstract communication modules, which are used to obtain the target abstract communication module corresponding to the function call interface and the target function object corresponding to the function call interface in the target abstract communication module according to the target device identifier;
[0011] The module adaptation layer is connected to multiple entity communication modules and is used to instantiate the target abstract communication module and the target function object, obtain the corresponding entity communication module and function implementation interface, and call them.
[0012] Specifically, in the embedded network framework as described above, in the core layer, the abstract communication modules and functional objects are correspondingly arranged in the form of a linked list.
[0013] Preferably, in the embedded network framework as described above, the function call module includes: a socket layer and a network debugging command layer;
[0014] The socket layer has an application programming interface (API) consistent with a standard Berkeley socket BSD socket interface declaration, and is used to receive a first function call command about the socket, obtain a first function call interface corresponding to the first function call command, and determine a first target communication format type of the first function call interface according to a target communication format identifier;
[0015] The network debugging command layer has command encapsulation for the application to query network information and locate faults, and is used to receive a second function call command regarding network debugging, obtain a second function call interface corresponding to the second function call command, and determine the second target communication standard type of the second function call interface based on the target communication standard identifier.
[0016] Furthermore, the embedded network framework as described above further includes:
[0017] The user configuration module is used to obtain the user's selection information from the preset communication standard list and device list, determine the target communication standard identifier and the target device identifier according to the selection information, and generate a user configuration table.
[0018] Another preferred embodiment of the present application further provides a method for an embedded network framework to support multiple communication modes, which is applied to an embedded electronic device, wherein the embedded electronic device includes the embedded network framework as described above, and the embedded network framework includes a function calling module, a function abstraction module, and a network adaptation layer, and the network adaptation layer is connected to multiple entity communication modules:
[0019] After receiving the function call command of the application, the function call module obtains the function call interface corresponding to the function call command, and determines the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table;
[0020] The function abstraction module obtains and encapsulates the control logic related to the function requirements according to the target communication format type and the function requirements in the function call command, and associates it with the function call interface;
[0021] The network adaptation layer calls the function implementation interface corresponding to the function call interface from multiple physical communication modules according to the target device identifier in the user configuration table.
[0022] Preferably, in the method for supporting multiple communication modes in the embedded network framework as described above, when the network adaptation layer includes: an abstract application program interface, a core layer, and a module adaptation layer, the network adaptation layer calls the function implementation interface corresponding to the function call interface from multiple physical communication modules according to the target device identifier in the user configuration table, and the steps include:
[0023] The abstract application program interface receives the function call interface issued by the function abstract module;
[0024] The core layer obtains the target abstract communication module corresponding to the function call interface and the target function object corresponding to the function call interface in the target abstract module according to the target device identifier;
[0025] The module adaptation layer instantiates the target abstract communication module and the target function object, obtains the corresponding entity communication module and function implementation interface, and calls them.
[0026] Specifically, the method for supporting multiple communication modes in the embedded network framework as described above, after the function calling module receives the function calling command of the application program, the method further includes:
[0027] Determine, according to the type of the function call command, the step of executing at the socket layer to obtain a function call interface corresponding to the function call command, and determine, according to the target communication standard identifier in the pre-configured user configuration table, the type of the target communication standard of the function call interface;
[0028] Alternatively, the step of acquiring a function call interface corresponding to the function call command at the network debugging command layer is determined according to the type of the function call command, and determining the target communication standard type of the function call interface according to the target communication standard identifier in a pre-configured user configuration table.
[0029] Preferably, in the method for supporting multiple communication modes in the embedded network framework as described above, when the embedded network framework includes a user configuration module, the method further includes:
[0030] Obtaining user selection information from a pre-set communication standard list and device list;
[0031] The target communication standard identifier and the target device identifier are determined according to the selection information, and a user configuration table is generated.
[0032] Another preferred embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for a network framework to support multiple communication formats as described above are implemented.
[0033] Compared with the prior art, the embedded network framework and the method for supporting multiple communication modes provided by the embodiments of the present application have at least the following beneficial effects:
[0034] The embedded network framework in this embodiment pre-configures the target communication standard identifier and the target device identifier in a static configuration manner to ensure the accuracy of the function implementation interface that is ultimately called, thereby reducing the resource consumption caused by determining the function implementation interface in the prior art through dynamic configuration, making the embedded network architecture more suitable for embedded devices. At the same time, it can support multiple network interfaces, allowing different network devices to be managed through a unified application program interface, thereby facilitating the management of multiple network devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a schematic diagram of the structure of the embedded network framework of this application;
[0036] Figure 2 One of the flowcharts of the method for supporting multiple communication modes in the embedded network framework of the present application;
[0037] Figure 3 The second flowchart of the method for supporting multiple communication modes in the embedded network framework of the present application;
[0038] Figure 4 This is the third flowchart of the method for the embedded network framework of the present application to support multiple communication modes. DETAILED DESCRIPTION
[0039] In order to make the technical problems, technical solutions and advantages to be solved by the application clearer, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. In addition, for clarity and brevity, the description of known functions and structures has been omitted.
[0040] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0041] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0042] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0043] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0044] See also Figure 1 , a preferred embodiment of the present application provides an embedded network framework, including: a function calling module 1, a function abstraction module 2 and a network adaptation layer 3;
[0045] The function calling module 1 is connected to the application 4 and is used to determine the function calling interface corresponding to the function calling command when receiving the function calling command of the application 4, and determine the target communication standard type of the function calling interface according to the target communication standard identifier in the pre-configured user configuration table;
[0046] Function abstraction module 2, used to obtain and encapsulate the control logic related to the function requirement according to the target communication standard type and the function requirement in the function call command, and associate it with the function call interface;
[0047] The network adaptation layer 3 is connected to the function abstraction module 2 and to multiple entity communication modules 5, and is used to call the function implementation interface 501 corresponding to the function call interface from the multiple entity communication modules 5 according to the target device identifier in the user configuration table.
[0048] In a preferred embodiment of the present application, an embedded network architecture is provided, which can be applied to embedded devices such as smart watches, etc. The embedded network architecture includes: a function call module 1 corresponding to an application 4, a function abstraction module 2, and a network adaptation layer 3 connected to multiple physical communication modules 5, wherein the function call module 1 can receive a function call command issued by an upper-layer application 4, and after receiving the function call command, a function call interface corresponding to the function call command can be obtained, and a target communication standard type of the function call interface can be determined according to a target communication standard identifier pre-configured by the user in a user configuration table, wherein if the user does not pre-configure the target communication standard identifier, the pre-stored default type is determined to be the target communication standard identifier; the target communication standard type can facilitate subsequent calls to functions of the corresponding type; wherein the target communication standard type includes but is not limited to Light Weight IP (LWIP) and cellular technology cellular.
[0049] The function abstraction module 2 can receive the function call interface and function call command passed in by the function call module 1, and then according to the target communication format type determined by the function call module 1 and the function requirements in the function call command, can obtain the control logic related to the function requirements, encapsulate it, and associate it with the function call interface, so that when the function call interface is called, the corresponding control logic can be implemented to ensure the realization of the function;
[0050] The network adaptation layer 3 is not only connected to the function abstraction module but also connected to multiple entity communication modules 5. It can receive the function call interface issued by the function abstraction module 2, and can determine the function implementation interface 501 corresponding to the function call interface from multiple entity communication modules 5 according to the target device identifier in the user configuration table, so that when the upper-layer application 4 executes a certain target function, it can call the function implementation interface 501 of the target function in the entity communication module 5 through the embedded network framework to implement the function. The target device identifier includes but is not limited to Ethernet module, cellular module, WiFi module, etc., and can be incremented according to the specific supported module models to achieve sustainable integration increase.
[0051] During this process, the embedded network framework in this embodiment pre-configures the target communication standard identifier and the target device identifier in a static configuration manner to ensure the accuracy of the function implementation interface 501 that is finally called, reducing the resource consumption caused by determining the function implementation interface 501 by dynamic configuration in the prior art, making the embedded network architecture more suitable for embedded devices, and at the same time can support multiple network interfaces, so that different network devices can be managed through a unified application 4 interface, which facilitates the management of multiple network devices.
[0052] Preferably, in the embedded network framework as described above, the network adaptation layer 3 includes: an abstract application program interface 301, a core layer 302 and a module adaptation layer 303;
[0053] Among them, the abstract application program interface 301 is connected to the function abstract module 2 and is used to receive the function call interface issued by the function abstract module 2;
[0054] The core layer 302 is provided with a plurality of function objects of abstract communication modules, which are used to obtain the target abstract communication module corresponding to the function call interface and the target function object corresponding to the function call interface in the target abstract communication module according to the target device identifier;
[0055] The module adaptation layer 303 is connected to multiple physical communication modules 5, and is used to instantiate the target abstract communication module and the target functional object, obtain the corresponding physical communication module 5 and the functional implementation interface 501, and call them.
[0056] In another preferred embodiment of the present application, the network adaptation layer 3 in the above embodiment is further limited, wherein the network adaptation layer 3 includes: an abstract application program interface 301, a core layer 302 and a module adaptation layer 303, wherein the abstract application program interface 301 is an external interface of the network adaptation layer 3, which is used to connect with the function abstract module 2, etc., and can receive the function call interface under the function abstract module 2; the core layer 302 receives the abstract application program interface 301, wherein a plurality of function objects of abstract communication modules are arranged, and the abstract communication module corresponds to the entity communication module 5, and the function object corresponds to the entity The functions in the communication module 5 correspond, and the core layer 302 can determine the required target abstract communication module according to the target device identifier, and then determine the target function object corresponding to the function call interface from the target abstract communication module; the module adaptation layer 303 is connected to multiple entity communication modules 5. After the target abstract communication module and the target function object are determined in the core layer 302, the target abstract communication module and the target function object are instantiated to obtain the corresponding entity communication module 5 and the function implementation interface 501, and the function implementation interface 501 in the corresponding entity communication module 5 is called to realize the required function.
[0057] Optionally, after the controller carrying the embedded network framework calls the function implementation interface 501, in order to ensure accurate data and command transmission between different interfaces at both ends, a parser is also provided in the network adaptation layer 3 to parse and assemble the transmitted data, commands, etc.
[0058] Specifically, in the embedded network framework as described above, in the core layer 302, the abstract communication modules and the functional objects are correspondingly arranged in the form of a linked list.
[0059] In a specific embodiment of the present application, the abstract communication modules and functional objects in the core layer 302 are set in correspondence in the form of a linked list, which is beneficial to reducing resource consumption and improving resource utilization.
[0060] Preferably, in the embedded network framework as described above, the function call module 1 comprises: a socket layer 101 and a network debugging command layer 102;
[0061] The socket layer 101 has an application program interface API consistent with a standard Berkeley socket BSD socket interface declaration, and is used to receive a first function call command about a socket, obtain a first function call interface corresponding to the first function call command, and determine a first target communication standard type of the first function call interface according to a target communication standard identifier;
[0062] The network debugging command layer 102 has a command encapsulation for the application 4 to perform network information query and fault location, and is used to receive a second function call command regarding network debugging, and obtain a second function call interface corresponding to the second function call command, and determine the second target communication standard type of the second function call interface according to the target communication standard identifier.
[0063] In a specific embodiment of the present application, the function call module 1 includes a socket layer and a network debugging command layer 102, wherein the socket has an application program 4 interface consistent with the standard Berkeley socket BSD socket interface declaration, so that applications transmitted through the standard Berkeley socket can establish interaction and connection with the embedded network framework through the socket layer 101, which is conducive to improving the portability of the embedded network framework and expanding the scope of use of the embedded network framework; through the socket layer 101, the function call module 1 can receive a first function call command about the socket, and then obtain a first function call interface corresponding to the first function call command, and determine the first target communication standard type of the first function call interface according to the target communication standard identifier; wherein the functions called by the first function call command include but are not limited to socket allocation application, port binding, data transmission and reception, network connection, etc.
[0064] The network debugging command layer 102 has command encapsulation for the application 4 to query network information and locate faults, so that the upper layer application or user can obtain the currently obtained IP address, gateway address, and domain name system (DNS) by calling the corresponding network debugging command. At the same time, it can also provide corresponding network information for different network modules, such as providing cell information and signal strength for cellular modules, so as to facilitate querying the network status of network devices and locating faults. By adding the network debugging command layer 102, the problem of lacking necessary network debugging means and diagnostic tools in the current embedded network framework and the inability to effectively locate network faults can be solved.
[0065] In a specific implementation of the present application, when the application 4 calls the network connection function in the socket layer 101, the socket layer 101 obtains the corresponding connect interface according to the network connection function command, and determines that the target standard type of the connect interface is the cellular type through the target communication standard identifier, and then the function abstraction module 2 obtains the control logic related to the connection according to the cellular type and the connection function requirements in the network connection function command, including: the connection function of the cellular mode, the association with the file descriptor (file descriptor, abbreviated as: fd) of the socket, the conversion of the IP address, etc., and associates it with the connect interface to form a mo_netconn_connect interface, and then the network adaptation layer 3 maps the mo_netconn_connect interface to the corresponding function implementation interface 501 in the physical communication module 5 according to the device identifier, and then by calling the function implementation interface 501, the network connection function can be performed.
[0066] In another specific implementation of the present application, when the application 4 calls the ping function in the network debugging command layer 102 to test network connectivity, the network debugging command layer 102 obtains the corresponding ping function calling interface according to the ping function command, and determines that the target standard type of the ping function calling interface is the cellular type through the target communication standard identifier, and then the function abstraction module 2 obtains the relevant control logic according to the cellular type and the connection function requirements in the ping function command, including: the connection function of the cellular mode, etc., and associates it with the ping function calling interface to form a mo_ping interface, and then the network adaptation layer 3 maps the mo_ping interface to the corresponding function implementation interface 501 in the physical communication module 5 according to the device identifier, and then by calling the function implementation interface 501, the ping function can be used to test the network connectivity.
[0067] Furthermore, the embedded network framework as described above further includes:
[0068] The user configuration module is used to obtain the user's selection information from the preset communication standard list and device list, determine the target communication standard identifier and the target device identifier according to the selection information, and generate a user configuration table.
[0069] In a specific embodiment of the present application, the embedded network framework also includes a user configuration module, through which the user configuration module can obtain the user's selection information from the pre-set communication standard list and device list according to the user's configuration operation, and determine the target communication standard identifier corresponding to the target communication standard selected by the user and the target device identifier corresponding to the target device selected by the user from the communication standard list and the device list respectively according to the selection information, and then generate a user configuration table to facilitate subsequent selection operations according to the user configuration table. Optionally, the user configuration table pre-stores the default types of communication standards and devices, and when the user does not perform a selection operation or does not determine the selected target communication standard and target device, the normal use of the embedded network framework is guaranteed.
[0070] See also Figure 2 Another preferred embodiment of the present application further provides a method for an embedded network framework to support multiple communication modes, which is applied to an embedded electronic device, wherein the embedded electronic device includes the embedded network framework as described above, and the embedded network framework includes a function calling module, a function abstraction module, and a network adaptation layer, and the network adaptation layer is connected to multiple entity communication modules:
[0071] Step S201, after receiving the function call command of the application, the function call module obtains the function call interface corresponding to the function call command, and determines the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table;
[0072] Step S202, the function abstraction module obtains and encapsulates the control logic related to the function requirement according to the target communication standard type and the function requirement in the function call command, and associates it with the function call interface;
[0073] Step S203: the network adaptation layer calls a function implementation interface corresponding to the function call interface from a plurality of physical communication modules according to the target device identifier in the user configuration table.
[0074] In a preferred embodiment of the present application, a method for an embedded network framework to support multiple communication standards is provided. The embedded network architecture includes: a function call module corresponding to an application, a function abstraction module, and a network adaptation layer connected to multiple physical communication modules, wherein the function call module can receive a function call command issued by an upper-layer application, and after receiving the function call command, a function call interface corresponding to the function call command can be obtained, and a target communication standard type of the function call interface can be determined according to a target communication standard identifier pre-configured by the user in a user configuration table, wherein if the user does not pre-configure the target communication standard identifier, a pre-stored default type is determined to be the target communication standard identifier; the target communication standard type can facilitate subsequent calls to functions of the corresponding type; wherein the target communication standard types include but are not limited to LWIP and cellular.
[0075] The function abstraction module can receive the function call interface and function call command passed in by the function call module, and then according to the target communication format type determined by the function call module and the function requirements in the function call command, it can obtain the control logic related to the function requirements, encapsulate it, and associate it with the function call interface, so that when the function call interface is called, the corresponding control logic can be implemented to ensure the realization of the function;
[0076] The network adaptation layer is not only connected to the function abstraction module, but also connected to multiple physical communication modules. It can receive the function call interface issued by the function abstraction module, and can determine the function implementation interface corresponding to the function call interface from multiple physical communication modules according to the target device identifier in the user configuration table, so that when the upper-level application executes a certain target function, it can call the function implementation interface of the physical communication module with the target function through the embedded network framework to implement the function. The target device identifier includes but is not limited to Ethernet module, cellular module, WiFi module, etc., and can be incremented according to the specific supported module models to achieve sustainable integration increase.
[0077] During this process, the embedded network framework in this embodiment pre-configures the target communication standard identifier and the target device identifier in a static configuration manner to ensure the accuracy of the function implementation interface finally called, reducing the resource consumption caused by determining the function implementation interface through dynamic configuration in the prior art, making the embedded network architecture more suitable for embedded devices. At the same time, it can support multiple network interfaces, so that different network devices can be managed through a unified application program interface, which facilitates the management of multiple network devices.
[0078] See also Figure 3Preferably, in the method for supporting multiple communication modes in the embedded network framework as described above, when the network adaptation layer includes: an abstract application program interface, a core layer, and a module adaptation layer, the network adaptation layer calls the function implementation interface corresponding to the function call interface from multiple physical communication modules according to the target device identifier in the user configuration table, and the steps include:
[0079] Step S301, the abstract application program interface receives the function call interface issued by the function abstract module;
[0080] Step S302, in the core layer, according to the target device identifier, obtains a target abstract communication module corresponding to the function call interface, and a target function object corresponding to the function call interface in the target abstract module;
[0081] Step S303: the module adaptation layer instantiates the target abstract communication module and the target functional object, obtains the corresponding physical communication module and functional implementation interface, and calls them.
[0082] In another preferred embodiment of the present application, when the network adaptation layer includes: an abstract application program interface, a core layer and a module adaptation layer, in the step of calling the function implementation interface corresponding to the function call interface from multiple physical communication modules according to the target device identifier in the user configuration table, the abstract application program interface connected to the function abstract module, etc., receives the function call interface under the function abstract module; the core layer undertakes the abstract application program interface, in which multiple function objects of abstract communication modules are set, and the abstract communication module corresponds to the physical communication module, and the function object corresponds to the function in the physical communication module, so that the core layer can determine the required target abstract communication module according to the target device identifier, and then determine the target function object corresponding to the function call interface from the target abstract communication module; and then through the module adaptation layer connected to multiple physical communication modules, after the core layer determines the target abstract communication module and the target function object, the target abstract communication module and the target function object are instantiated to obtain the corresponding physical communication module and the function implementation interface, and the function implementation interface in the corresponding physical communication module is called to implement the required function. Preferably, in the core layer, the abstract communication modules and functional objects are set in correspondence in the form of a linked list, which is conducive to reducing resource consumption and improving resource utilization.
[0083] Specifically, the method for supporting multiple communication modes in the embedded network framework as described above, after the function calling module receives the function calling command of the application program, the method further includes:
[0084] Determine the steps of determining the function call interface according to the function call command at the socket layer according to the type of the function call command, and determining the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table;
[0085] Alternatively, the step of acquiring a function call interface corresponding to the function call command at the network debugging command layer is determined according to the type of the function call command, and determining the target communication standard type of the function call interface according to the target communication standard identifier in a pre-configured user configuration table.
[0086] In a specific embodiment of the present application, the function call module may include a socket layer and a network debugging command layer, wherein the socket has an application program interface consistent with the standard Berkeley socket BSD socket interface declaration, so that applications transmitted through the standard Berkeley socket can establish interactions and connections with the embedded network framework through the socket layer, which is conducive to improving the portability of the embedded network framework and expanding the scope of use of the embedded network framework; the network debugging command layer has command encapsulation for applications to query network information and locate faults, so that upper-level applications or users can obtain the currently obtained IP address, gateway address, and domain name system (Domain NameSystem, DNS for short) by calling corresponding network debugging commands. At the same time, corresponding network information can also be provided for different network modules, such as providing cell information, signal strength, etc. for cellular modules, which is convenient for querying the network status of network equipment and locating faults.
[0087] After receiving the function call command, it will first determine whether it is applicable to the network debugging command layer or the socket layer according to the type of the function call command, and then execute the steps of obtaining the function call interface corresponding to the function call command at the corresponding network debugging command layer or socket layer, and determine the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table, which is conducive to ensuring the timely and correct implementation of the function call command. And by adding a network debugging command layer, the lack of necessary network debugging means and diagnostic tools in the current embedded network framework, and the resulting inability to effectively locate network faults, can be solved.
[0088] See also Figure 4 Preferably, the network framework as described above supports the method for multiple communication modes. In the case where the embedded network framework includes a user configuration module, the method further includes:
[0089] Step S401, obtaining selection information of a user from a preset communication standard list and a device list;
[0090] Step S402: determine the target communication standard identifier and the target device identifier according to the selection information, and generate a user configuration table.
[0091] In a specific embodiment of the present application, when the embedded network framework includes a user configuration module, the user configuration module can obtain the user's selection information from the pre-set communication standard list and device list according to the user's configuration operation, and determine the target communication standard identifier corresponding to the target communication standard selected by the user and the target device identifier corresponding to the target device selected by the user from the communication standard list and the device list respectively according to the selection information, and then generate a user configuration table to facilitate subsequent selection operations according to the user configuration table. Optionally, the user configuration table pre-stores the default types of communication standards and devices, and when the user does not perform a selection operation or does not determine the selected target communication standard and target device, the normal use of the embedded network framework is guaranteed.
[0092] Another preferred embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for an embedded network framework to support multiple communication formats are implemented as described above.
[0093] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.
[0094] It should also 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", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.
[0095] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. An embedded network framework, characterized in that: include: Function call module, function abstraction module and network adaptation layer; The function calling module is connected to the application program, and is used to obtain a function calling interface corresponding to the function calling command when receiving the function calling command of the application program, and determine the target communication standard type of the function calling interface according to the target communication standard identifier in the pre-configured user configuration table or the pre-stored default type; A function abstraction module, used to obtain and encapsulate the control logic related to the function requirement according to the target communication standard type and the function requirement in the function call command, and associate it with the function call interface; A network adaptation layer, connected to the function abstraction module and connected to a plurality of entity communication modules, for calling a function implementation interface corresponding to the function calling interface from the plurality of entity communication modules according to a target device identifier in the user configuration table; The user configuration module is used to obtain the user's selection information from the preset communication standard list and device list, determine the target communication standard identifier and the target device identifier according to the selection information, and generate the user configuration table.
2. The embedded network framework according to claim 1, characterized in that: The network adaptation layer includes: an abstract application program interface, a core layer and a module adaptation layer; The abstract application program interface is connected to the function abstract module to receive the function call interface issued by the function abstract module; The core layer is provided with a plurality of function objects of abstract communication modules, which are used to obtain the target abstract communication module corresponding to the function call interface and the target function object corresponding to the function call interface in the target abstract communication module according to the target device identifier; The module adaptation layer is connected to a plurality of the entity communication modules, and is used to instantiate the target abstract communication module and the target functional object, obtain the corresponding entity communication module and the functional implementation interface, and call them.
3. The embedded network framework according to claim 2, characterized in that: In the core layer, the abstract communication module and the functional object are correspondingly arranged in the form of a linked list.
4. The embedded network framework according to claim 1, characterized in that: The function calling module includes: a socket layer and a network debugging command layer; The socket layer has an application program interface API consistent with a standard Berkeley socket BSD socket interface declaration, and is used to receive a first function call command about a socket, and obtain a first function call interface corresponding to the first function call command, and determine a first target communication format type of the first function call interface according to the target communication format identifier or a pre-stored default type; The network debugging command layer has a command encapsulation for the application to query network information and locate faults, and is used to receive a second function call command regarding network debugging, and obtain a second function call interface corresponding to the second function call command, and determine the second target communication standard type of the second function call interface according to the target communication standard identifier.
5. A method for supporting multiple communication modes in an embedded network framework, characterized in that: Applied to an embedded electronic device, the embedded electronic device comprises the embedded network framework according to any one of claims 1 to 4, the embedded network framework comprises a function call module, a function abstraction module and a network adaptation layer, the network adaptation layer is connected to a plurality of entity communication modules: After receiving the function call command of the application, the function call module obtains the function call interface corresponding to the function call command, and determines the target communication standard type of the function call interface according to the target communication standard identifier in the pre-configured user configuration table or the pre-stored default type; The function abstraction module obtains and encapsulates the control logic related to the function requirement according to the target communication standard type and the function requirement in the function call command, and associates it with the function call interface; The network adaptation layer calls the function implementation interface corresponding to the function calling interface from the plurality of physical communication modules according to the target device identifier in the user configuration table; In the case where the network framework includes a user configuration module, the method further includes: Obtaining user selection information from a pre-set communication standard list and device list; The target communication format identifier and the target device identifier are determined according to the selection information, and the user configuration table is generated.
6. The method for supporting multiple communication modes in an embedded network framework according to claim 5, characterized in that: In the case where the network adaptation layer includes: an abstract application program interface, a core layer, and a module adaptation layer, the network adaptation layer calls a function implementation interface corresponding to the function call interface from a plurality of physical communication modules according to a target device identifier in the user configuration table, including: The abstract application program interface receives the function call interface issued by the function abstract module; The core layer acquires a target abstract communication module corresponding to the function call interface and a target function object corresponding to the function call interface in the target abstract module according to the target device identifier; The module adaptation layer instantiates the target abstract communication module and the target functional object, obtains the corresponding physical communication module and the functional implementation interface, and calls them.
7. The method for supporting multiple communication modes in an embedded network framework according to claim 5, characterized in that: After the function calling module receives the function calling command of the application program, the method further includes: Determining, according to the type of the function call command, to execute at the socket layer the step of obtaining the function call interface corresponding to the function call command, and determining, according to the target communication standard identifier in a pre-configured user configuration table or a pre-stored default type, the target communication standard type of the function call interface; Alternatively, the step of obtaining the function call interface corresponding to the function call command at the network debugging command layer is determined according to the type of the function call command, and the target communication standard type of the function call interface is determined according to the target communication standard identifier in a pre-configured user configuration table.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a method for an embedded network framework to support multiple communication formats as claimed in any one of claims 5 to 7 are implemented.