A method and device for dynamically generating an abstract model of a device

By dynamically generating device abstract models and providing a unified interface, it solves the problem of program repetitive development caused by different hardware acceleration devices, simplifies the development process and reduces costs.

CN112667213BActive Publication Date: 2024-11-26LENOVO FUTURE COMM TECH (CHONGQING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011621855.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2024-11-26
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

In open wireless access networks, there are a variety of hardware acceleration equipment, which leads to the need to write corresponding program code for different hardware acceleration equipment, resulting in repeated program development and increased complexity, and increased development and maintenance costs.

Method used

By obtaining the business function configuration information and hardware device information of the upper-level application, dynamically generate the device abstract model, providing a unified calling interface, encapsulating the driver and function implementation of different hardware devices, and reducing duplicate development.

Benefits of technology

It realizes that no matter the type or model of hardware equipment, upper-level applications can use the same set of interface calling functions, reducing development complexity and cost and simplifying the development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112667213B_ABST
    Figure CN112667213B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for dynamically generating a device abstract model. The method obtains a service function list of an upper-layer application, determines a device abstract class from the existing device abstract class according to the function list, and then generates a device function implementation class that implements the device abstract class and its functions according to the device abstract class and its functions and hardware device information. After that, the determined device abstract class and the generated device function implementation class dynamically generate a device abstract model, and call the device abstract model to respond to the service function call request sent by the upper-layer application, and return the corresponding processing result. In this way, a corresponding device abstract model can be dynamically generated according to the actual hardware device information and the functions required by the upper-layer application, and the upper-layer application can directly use the unified interface provided by the device abstract model to call the function without obtaining the actual connected hardware device information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing, and in particular to a method and device for dynamically generating an abstract model of a device. Background Art

[0002] The 5G digital indoor base station in the Open Radio Access Network (O-RAN) architecture consists of three parts: the host unit (distributed unit DU + central unit CU), the expansion unit (HUB), and the remote radio unit (RRU).

[0003] The host unit uses a general-purpose server processing platform, and the physical layer involves high-speed data exchange and a large number of parallel intensive complex operations. In order to meet high real-time requirements, hardware accelerators are often introduced into the host unit to handle some of the physical layer intensive operations, thereby greatly reducing the processor load and making full use of the respective advantages of the hardware accelerator and the processor to jointly complete the baseband processing part.

[0004] However, there are many types of hardware acceleration devices, such as FPGA, ASIC, GPU, etc. The drivers and application programming interfaces required to use these hardware are also different. Therefore, when implementing a function based on a hardware acceleration device, it is often necessary to write corresponding program codes for different hardware acceleration devices, which results in repeated program development, greatly increases the complexity of the program, and sharply increases the development and maintenance costs.

[0005] Therefore, how to encapsulate the drivers and functional implementations of different hardware acceleration devices to provide a unified calling interface for upper-level applications to call has become a technical problem that needs to be solved urgently. Summary of the invention

[0006] In view of the above problems, the inventors creatively provide a method and apparatus for dynamically generating an abstract model of a device.

[0007] According to a first aspect of an embodiment of the present invention, a method for dynamically generating a device abstract model comprises: obtaining business function configuration information of an upper-layer application, wherein the business function configuration information comprises a first function list required by the upper-layer application; obtaining a device abstract class and a second function list corresponding to each device abstract class; determining at least one available first device abstract class from existing device abstract classes according to the first function list and the second function list; generating at least one first device function implementation class for implementing the first device abstract class according to the second function list and existing hardware device information; and dynamically generating a device abstract model according to the first device abstract class and the first device function implementation class to call the functions in the second function list through the device abstract model.

[0008] According to an implementation of an embodiment of the present invention, before obtaining the device abstract class and the second function list corresponding to each device abstract class, the method also includes: generating at least one device abstract class and a first function list corresponding to each device abstract class based on a pre-acquired hardware device list, wherein each device abstract class corresponds to a hardware device in the hardware device list.

[0009] According to an implementation manner of an embodiment of the present invention, before generating at least one device abstract class and a first function list corresponding to each device abstract class according to a pre-acquired hardware device list, the method further includes: acquiring and storing the hardware device list and hardware device information.

[0010] According to an implementation manner of an embodiment of the present invention, before acquiring the device abstract class, the method further includes: detecting the number of device abstract classes, determining whether the number is greater than 0, and if not, reporting an error.

[0011] According to an implementation manner of an embodiment of the present invention, the device abstract model also includes a component class corresponding to the device function implementation class, wherein each component class corresponds to an operation object of the device function implementation class and its operation interface, and accordingly, a first device function implementation class is generated according to the second function list and the pre-acquired hardware device information corresponding to the first device abstract class, including: generating the first device function implementation class according to the second function list; generating at least one component class corresponding to the first device function implementation class according to the hardware device information corresponding to the first device abstract class; and adding at least one component class to the first device function implementation class.

[0012] According to an implementation manner of an embodiment of the present invention, after dynamically generating a device abstract model according to the first device abstract class and the first device function implementation class, the method further includes: clearing system resources occupied by the device abstract model; and deleting the device abstract model.

[0013] According to a second aspect of an embodiment of the present invention, a method for calling a device abstract model is provided, wherein the device abstract model includes a device abstract model generated by any of the above methods, and the method includes: receiving a business function call request sent by an upper-layer application; obtaining a device function implementation class corresponding to the business function call request; calling an operation object of the device function implementation class and its operation interface to process the business function call request to obtain a processing result; and returning the processing result.

[0014] According to an implementation manner of an embodiment of the present invention, the device abstract model also includes a component class corresponding to the device function implementation class, wherein each component class corresponds to an operation object of the device function implementation class and its operation interface, and accordingly, the operation object of the device function implementation class and its operation interface are called to process the business function call request to obtain the processing result, including obtaining the component class of the device function implementation class; calling the component class to process the business function call request to obtain the processing result.

[0015] According to a third aspect of an embodiment of the present invention, there is provided a device for dynamically generating a device abstract model, the device comprising: a business function configuration information acquisition module, used to acquire business function configuration information set by an upper-layer application, wherein the business function configuration information includes a first function list required by the upper-layer application; a device abstract class acquisition module, used to acquire device abstract classes and a second function list corresponding to each device abstract class; a first abstract class determination module, used to determine at least one available first device abstract class from existing device abstract classes based on the first function list and the second function list; a first device function implementation class generation module, used to generate at least one first device function implementation class that implements the first device abstract class based on the second function list and existing hardware device information; and a device abstract model generation module, used to dynamically generate a device abstract model based on the first device abstract class and the first device function implementation class, so as to call the functions in the second function list through the device abstract model.

[0016] According to a fourth aspect of an embodiment of the present invention, there is provided a device for calling a device abstract model, wherein the device abstract model includes a device abstract model generated by any one of the above methods, and the device includes: a call request receiving module, used to receive a business function call request sent by an upper-layer application; a device function implementation class acquisition module, used to obtain a device function implementation class corresponding to the business function call request; a business function call request processing module, used to call an operation object of the device function implementation class and its operation interface to process the business function call request to obtain a processing result; and a processing result returning module, used to return the processing result.

[0017] The embodiment of the present invention provides a method and apparatus for dynamically generating a device abstract model. The method obtains a service function list of an upper-layer application, determines a device abstract class from the existing device abstract class according to the function list, and then generates a device function implementation class that implements the device abstract class and its functions according to the device abstract class and its functions and hardware device information. Then, the determined device abstract class and the generated device function implementation class dynamically generate a device abstract model, and call the device abstract model to respond to the service function call request sent by the upper-layer application, and return the corresponding processing result. In this way, the corresponding device abstract model can be dynamically generated according to the actual hardware device information and the functions required by the upper-layer application, and the upper-layer application can directly use the unified interface provided by the device abstract model to call the function without obtaining the actual connected hardware device information. In this way, even if the hardware devices connected to each server are different, the upper-layer application can use the same set of calls to implement the corresponding functions, reducing repeated development, greatly simplifying the complexity of development, and thus reducing the cost of development and maintenance.

[0018] It should be understood that the teachings of the present invention are not required to achieve all of the beneficial effects described above, but specific technical solutions can achieve specific technical effects, and other embodiments of the present invention can also achieve beneficial effects not mentioned above. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:

[0020] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0021] Figure 1 It is a schematic diagram of the structure of the device abstract model according to an embodiment of the present invention;

[0022] Figure 2 It is a class diagram of a specific implementation of the device abstract model 1 according to an embodiment of the present invention;

[0023] Figure 3 Schematic diagram of the implementation process of the method for dynamically generating an abstract model of a device according to an embodiment of the present invention;

[0024] Figure 4 The specific implementation process of the method for dynamically generating an abstract model of a device according to an embodiment of the present invention;

[0025] Figure 5 The method for dynamically generating a device abstract model according to an embodiment of the present invention is a specific implementation process of applying and generating a device function implementation class;

[0026] Figure 6 A schematic diagram of the implementation flow of a method for calling a device abstract model according to an embodiment of the present invention;

[0027] Figure 7 A schematic diagram of the composition structure of a device for dynamically generating an abstract model of a device according to an embodiment of the present invention;

[0028] Figure 8 The figure is a schematic diagram of the composition structure of the calling device of the device abstract model according to the embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0030] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0031] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0032] In order to solve the problem that upper layer applications need to develop multiple sets of program codes according to the types or models of connected hardware devices, the inventor creatively designed a Figure 1 An abstract model of a device is shown.

[0033] like Figure 1As shown, exemplarily, the device abstract model includes a device abstract class 20 and a device function implementation class that implements the device abstract class (for example, a first device function implementation class 201, a first device function implementation class 201), wherein the device abstract class 20 corresponds to a device type (for example, a hardware accelerator card), and is provided with a function list of the corresponding device type, for example; each device function implementation class corresponds to a function in the function list, and is provided with an operation object and an operation interface required to implement the corresponding function; wherein the operation object in each device function implementation class can also be implemented by a component class (for example, the first device function implementation class 201 corresponds to the first component class 2011 and the second component class 2012, etc.), and each component class may also contain some operable objects, and these operation objects can also be implemented by other component classes, thus forming a tree-structured component class, such as the first component class 2011 containing the third component class 20111 and the fourth component class 20112; the device function implementation class may also not contain any component class, and implement all required operation objects and operations by itself, such as the second device function implementation class 202; the upper-level application 10 can directly call the function call interface provided by the device abstract class 20 to implement the required function.

[0034] The device abstract model can encapsulate the drivers and functional implementations of different hardware devices, and can be applied to various types and models of hardware devices using the same set of functional interfaces. Moreover, this hardware device is not limited to local devices. As long as the relevant information of the device can be obtained, remote devices can also use the device abstract model to call.

[0035] In addition, the device abstract model decouples devices and functions. When a device adds a new function, only a new device function implementation class needs to be added, which can greatly improve the development speed.

[0036] Figure 2 The class diagram of the specific implementation of this device abstract model is shown in FIG. Figure 2 In the specific implementation shown:

[0037] The device abstract class ORAN_AAL_Dev is used to implement the hardware acceleration card of the base station message forwarding function. It has attributes such as id and name. The feature structure lists all the functions of the device abstract class, such as ORAN_AAL_BACKHAUL, ORAN_AAL_FRONTHAUL, ORAN_AAL_HIGHPHY and ORAN_AAL_TIMING.

[0038] Each function corresponds to a device function implementation class. For example, HighPHY_Dev is used to implement the ORAN_AAL_HIGHPHY function; FrontHaul_Dev is used to implement the ORAN_AAL_FRONTHAUL function; BackHaul_Dev is used to implement the ORAN_AAL_BACKHAUL function, etc.

[0039] Each device function implementation class contains multiple attributes (such as id, name), sub-function lists (such as func_capability), component classes (such as channel) and operations (such as device_ops), etc. Some of these attributes, operations or function lists are set differently depending on the type and model of the hardware device. The hardware device information can also be obtained through the hardware scanning tool and dynamically generated based on the hardware device information.

[0040] When a hardware device adds a new function, for example, forwarding function, a function name can be added to the feature structure, for example, ORAN_AAL_FORWARD, and then a new device function implementation class corresponding to the function can be implemented, for example, Forwar_Dev.

[0041] The following will describe in detail how to use the method for dynamically generating a device abstract model according to hardware device information in accordance with the method for dynamically generating a device abstract model according to an embodiment of the present invention and a method and apparatus for dynamically generating the device abstract model.

[0042] Figure 3 A method for dynamically generating a device abstract model according to an embodiment of the present invention is shown, the method comprising: operation 310, obtaining business function configuration information of an upper-layer application, wherein the business function configuration information comprises a first function list required by the upper-layer application; operation 320, obtaining a device abstract class and a second function list corresponding to each device abstract class; operation 330, determining at least one available first device abstract class from existing device abstract classes according to the first function list and the second function list; operation 340, generating at least one first device function implementation class for implementing the first device abstract class according to the second function list and existing hardware device information; and operation 350, dynamically generating a device abstract model according to the first device abstract class and the first device function implementation class, so as to call the functions in the second function list through the device abstract model.

[0043] In operation 310, the business function configuration information of the upper layer application is used by the upper layer application to specify the functions to be used by the application and some parameter information that may need to be specified when using each function. Among them, the first function list lists all the functions required by the upper layer application.

[0044] That is to say, the first function list of the business function configuration information can only include the function implementations required by the upper-layer application in the device abstract model, and the function implementations not used by the upper-layer application do not need to be loaded or included in this device abstract model.

[0045] In operation 320, the acquired device abstract class corresponds to the detected hardware device one by one. When multiple hardware devices (including remote devices) are detected, multiple device abstract classes can be acquired accordingly. After acquiring the device abstract class, in order to determine which device can implement the functions required by the upper layer application, it is necessary to further acquire the function list of the device abstract class, for example, Figure 2 The ORAN_AAL_Dev.feature shown in the figure, the function list of this abstract class is the second function list.

[0046] In operation 330, after obtaining the first function list required by the upper layer application and the second function list corresponding to the device abstract class, the device abstract class used to implement the functions required by the upper layer application can be determined. Generally, if the function list of the device abstract class contains all the functions required by the upper layer application, the device abstract class can be determined as the device abstract class that can be used to implement the functions required by the upper layer application, that is, the first device abstract class.

[0047] After the first device abstract class that can be used to implement the functions required by the upper-layer application is determined, it is necessary to dynamically generate a device function implementation class corresponding to the functions required by the upper-layer application in the device abstract class through operation 340 .

[0048] In operation 340, as mentioned above, usually one function corresponds to one device function implementation class. According to the functions required by the upper layer application, i.e., the second function list, it is possible to determine which device function implementation classes are to be dynamically generated. After the device function implementation class is determined, the relevant properties, sub-function list, operation object and other specific information of the device function implementation class can be set according to the existing hardware device information to generate an instance of the corresponding device function implementation class. The existing hardware device information refers to the pre-acquired hardware device information, which can be not only the local device information but also the device information of the remote device.

[0049] Then, through operation 350, the instance of the first device abstract class determined in operation 330 and the device function implementation class generated in operation 340 is loaded into the operating environment, and a device abstract model is dynamically generated in combination with other configuration information for describing the device abstract model. Among them, the configuration information for describing the device abstract model is not necessary in some embodiments.

[0050] By using the method for dynamically generating a device abstract model according to the embodiment of the present invention, not only can the minimum functional implementation required by the upper-layer application be dynamically generated based on the actually obtained hardware device information and the specific needs of the upper-layer application, but on the one hand, the matching functional interface implementation can be determined through the actually obtained hardware device information, so that the upper-layer application can complete the same function call using the same interface, thereby avoiding repeated development; on the other hand, other irrelevant implementations can be introduced as little as possible through functional customization, thereby making the program run more efficient and reducing program overhead to a certain extent; in addition, since the corresponding device abstract model can be dynamically generated as long as the corresponding hardware device information can be obtained, this means that as long as the hardware device information of the remote device can be obtained, a device abstract model for calling the remote device can also be generated.

[0051] According to an implementation of an embodiment of the present invention, before obtaining the device abstract class and the second function list corresponding to each device abstract class, the method also includes: generating at least one device abstract class and a first function list corresponding to each device abstract class based on a pre-acquired hardware device list, wherein each device abstract class corresponds to a hardware device in the hardware device list.

[0052] The pre-acquired hardware device list may be obtained by scanning with a hardware scanning program. As mentioned above, each device abstract class corresponds to a hardware device in the hardware device list. In this implementation, the pre-acquired hardware device list may be generated.

[0053] The first function list corresponding to each device abstract class can be obtained according to the attribute or list data structure in the device abstract class, for example, Figure 2 ORAN_AAL_Dev.feature shown.

[0054] According to an implementation manner of an embodiment of the present invention, before generating at least one device abstract class and a first function list corresponding to each device abstract class according to a pre-acquired hardware device list, the method further includes: acquiring and storing the hardware device list and hardware device information.

[0055] In this embodiment, in addition to obtaining the hardware device list in advance, the hardware device information required for the subsequent device function implementation class generation is also obtained. The hardware device list and hardware device information are obtained in advance and stored in a data storage system. They can be obtained only once and can be used at any time for subsequent operations, which can greatly reduce the number of times the hardware device is accessed and improve the efficiency of program execution.

[0056] According to an implementation manner of an embodiment of the present invention, before acquiring the device abstract class, the method further includes: detecting the number of device abstract classes, determining whether the number is greater than 0, and if not, reporting an error.

[0057] In this implementation, if the number of device abstract classes is less than 0, it means that there is no corresponding hardware device, and the corresponding function call cannot be completed. At this time, an error is reported and the program is terminated to avoid more serious errors in subsequent calls.

[0058] According to an implementation manner of an embodiment of the present invention, the device abstract model also includes a component class corresponding to the device function implementation class, wherein each component class corresponds to an operation object of the device function implementation class and its operation interface, and accordingly, a first device function implementation class is generated according to the second function list and the pre-acquired hardware device information corresponding to the first device abstract class, including: generating the first device function implementation class according to the second function list; generating at least one component class corresponding to the first device function implementation class according to the hardware device information corresponding to the first device abstract class; and adding at least one component class to the first device function implementation class.

[0059] In this embodiment, the operable objects in the device function realization class are further realized as component classes, and corresponding operation data can be obtained according to specific hardware information. For example, according to the channel information of the hardware, the data in the component class (for example, HighPHY_Dev.channel) is set, and the initialized component class becomes an operable channel for the channel realizing the hardware.

[0060] According to an implementation manner of an embodiment of the present invention, after dynamically generating a device abstract model according to the first device abstract class and the first device function implementation class, the method further includes: clearing system resources occupied by the device abstract model; and deleting the device abstract model.

[0061] In the process of dynamically generating device abstract models, some system resources will be occupied. After the generated device abstract model completes its corresponding mission, it is necessary to clean up and recycle these occupied system resources, and then delete the device abstract model.

[0062] Figure 4 The specific implementation process of the dynamic generation method of the device abstract model according to the embodiment of the present invention is shown, wherein the boxes represent the various implementation classes and tool classes in the program, and the arrows represent the mutual operation and calling relationship between the various classes.

[0063] like Figure 4 As shown, in this application, the process of using the upper layer application 10 to call the device abstract model 20 mainly includes:

[0064] Step 410, the SDK manufacturer completes the process of enumerating and discovering hardware devices in the system, and adds the hardware device information to the device manager in the device abstract model 20 through SDK registration or AAL active query. At this time, the status information of the discovered hardware device is unavailable.

[0065] Step 420, the upper layer application 10 calls the device abstract model 20, and generates business function configuration information according to the function list required by the business of the upper layer application 10;

[0066] Step 430, determining the corresponding device function implementation class according to the business function configuration information;

[0067] Step 440, the corresponding device function implementation class builds the required component class through the builder;

[0068] Step 450, the builder obtains the corresponding hardware device information from the device management module and sends it to the component class generator;

[0069] Step 460: The component class generator generates a corresponding component class according to the hardware device information.

[0070] Afterwards, the device function implementation class modifies the status information of the corresponding device in the device management module after completing the generation of the component class, so that it becomes available.

[0071] Combine the following Figure 2 The classes in the class diagram of a specific implementation of the device abstract model of the embodiment of the present invention are shown as examples of how to generate a specific implementation process of a device function implementation class according to a function list specified by an upper-layer application.

[0072] Assuming that the function specified by the upper layer application is ORAN_AAL_HIGHPHY, the process of generating the device function implementation class based on this function and the obtained hardware device information is as follows: Figure 5 As shown, it mainly includes:

[0073] Step 5010, obtaining the number N of device abstract classes (ORAN_AAL_Dev);

[0074] Step 5020, determine whether N is greater than 0, if so, proceed to step 5030, if not, proceed to step 5100 to report an error, and then end;

[0075] Step 5030, obtaining the i-th device abstract class (ORAN_AAL_Dev);

[0076] Step 5040, determine whether the abstract class (ORAN_AAL_Dev) contains the specified function (ORAN_AAL_HIGHPHY), if yes, proceed to step 5050, if no, proceed to step 5100 to report an error, and then end;

[0077] Step 5050, create a device function implementation class (HighPHY_Dev), specifically, obtain the specific function of the hardware device through ops.get_capability;

[0078] Step 5060, generating a component class (channel) included in the device function implementation class, specifically, obtaining the component class (channel) information after initializing the device function implementation class (HighPHY_Dev), and then processing the data in the component class (channel);

[0079] Step 5070, calling the component class function to perform corresponding operations (performed when ORAN_AAL_Dev is called at runtime);

[0080] Step 5080, clearing the occupied system resources (performed after calling ORAN_AAL_Dev at runtime);

[0081] Step 5080: After the upper layer application completes the corresponding function through ORAN_AAL_Dev, it closes the device abstract class and ends.

[0082] It should be noted that the above specific applications are all exemplary descriptions, and are not intended to limit the implementation methods or application scenarios of the method for dynamically generating an abstract device model in the embodiment of the present invention. The implementer may adopt any applicable implementation method and apply it to any applicable application scenario according to specific implementation conditions.

[0083] Figure 6 The schematic diagram of the implementation process of the calling method of the device abstract model of the embodiment of the present invention is shown. The device abstract model includes the device abstract model generated by any of the above methods, such as Figure 2 As shown, the method includes: operation 610, receiving a business function call request sent by an upper-layer application; operation 620, obtaining a device function implementation class corresponding to the business function call request; operation 630, calling an operation object of the device function implementation class and its operation interface to process the business function call request to obtain a processing result; operation 640, returning the processing result.

[0084] Among them, the business function call request sent by the upper-level application is usually sent to the device abstract class, the device abstract class or obtains the specific function called by the business function call request, and then determines the device function implementation class corresponding to this function based on the function, and then processes the business function call request by calling the operation object and operation interface of the corresponding device function implementation class.

[0085] In this process, the device function implementation class is generated according to the specific information of the underlying hardware device, which can operate the underlying hardware device to complete the corresponding function, which is transparent to the upper-level application. Regardless of the type or model of the underlying hardware device, the same interface can be used for calling, which greatly saves the development cost of the upper-level application.

[0086] According to an implementation manner of an embodiment of the present invention, the device abstract model also includes a component class corresponding to the device function implementation class, wherein each component class corresponds to an operation object of the device function implementation class and its operation interface, and accordingly, the operation object of the device function implementation class and its operation interface are called to process the business function call request to obtain the processing result, including obtaining the component class of the device function implementation class; calling the component class to process the business function call request to obtain the processing result.

[0087] In this embodiment, the operable objects in the device function implementation class are further implemented as components, and corresponding operation data can be obtained according to specific hardware information. Therefore, when processing a business function call request, the corresponding component class can be used.

[0088] The component class is generated based on the specific information of the underlying hardware devices and can operate the underlying hardware devices to complete corresponding functions, which is transparent to the upper-level applications.

[0089] Furthermore, the embodiment of the present invention also provides a device for dynamically generating an abstract model of a device, such as Figure 7 As shown, the device 70 includes: a business function configuration information acquisition module 701, which is used to obtain the business function configuration information set by the upper-layer application, wherein the business function configuration information includes a first function list required by the upper-layer application; a device abstract class acquisition module 702, which is used to obtain the device abstract class and the second function list corresponding to each device abstract class; a first abstract class determination module 703, which is used to determine at least one available first device abstract class from the existing device abstract classes according to the first function list and the second function list; a first device function implementation class generation module 704, which is used to generate at least one first device function implementation class that implements the first device abstract class according to the second function list and the existing hardware device information; a device abstract model generation module 705, which is used to dynamically generate a device abstract model according to the first device abstract class and the first device function implementation class, so as to call the functions in the second function list through the device abstract model.

[0090] According to an implementation of an embodiment of the present invention, the device 70 also includes: a device abstract class generation module, which generates at least one device abstract class and a first function list corresponding to each device abstract class based on a pre-acquired hardware device list, wherein each device abstract class corresponds to a hardware device in the hardware device list.

[0091] According to an implementation of an embodiment of the present invention, the apparatus 70 further includes: a hardware device information acquisition module, which is used to acquire and store a hardware device list and hardware device information.

[0092] According to an implementation of an embodiment of the present invention, the apparatus 70 further includes: a device abstract class number detection module, which is used to detect the number of device abstract classes and determine whether the number is greater than 0. If not, an error is reported.

[0093] According to an embodiment of the present invention, the first device function implementation class generation module 704 includes: a first device function implementation class generation sub-module, used to generate a first device function implementation class according to a second function list; a component class generation sub-module, used to generate at least one component class corresponding to the first device function implementation class according to the hardware device information corresponding to the first device abstract class; a component adding sub-module, used to add at least one component class to the first device function implementation class.

[0094] According to an implementation of an embodiment of the present invention, the apparatus 70 further includes: a system resource cleaning module, used to clean up system resources occupied by the device abstract model; and a device abstract model deleting module, used to delete the device abstract model.

[0095] In addition, the embodiment of the present invention also provides a device for calling an abstract model of a device, such as Figure 8 As shown, the device 80 includes: a call request receiving module 801, which is used to receive a business function call request sent by an upper-level application; a device function implementation class acquisition module 802, which is used to obtain a device function implementation class corresponding to the business function call request; a business function call request processing module 803, which is used to call the operation object of the device function implementation class and its operation interface to process the business function call request to obtain a processing result; and a processing result returning module 804, which is used to return the processing result.

[0096] According to an implementation of an embodiment of the present invention, the business function call request processing module 803 includes: a component class acquisition submodule, used to obtain the component class of the device function implementation class; and a component class calling submodule, used to call the component class to process the business function call request and obtain a processing result.

[0097] It should be pointed out here that: the above description of the embodiment of the dynamic generation device of the device abstract model, the above description of the embodiment of the calling device of the device abstract model, and the above description of the embodiment of the computer storage medium are similar to the description of the aforementioned method embodiment, and have similar beneficial effects as the aforementioned method embodiment, so they are not described in detail. For the technical details of the description of the embodiment of the dynamic generation device of the device abstract model and the description of the embodiment of the calling device of the device abstract model of the present invention that have not been disclosed, please refer to the description of the aforementioned method embodiment of the present invention for understanding, and in order to save space, they are not described in detail.

[0098] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0099] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of 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 can be integrated into another device, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0100] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0101] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0102] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage medium, read-only memory (ROM), disk or optical disk, etc. Various media that can store program codes.

[0103] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage media, ROM, magnetic disks or optical disks.

[0104] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for dynamically generating a device abstract model, the method comprising: Acquire business function configuration information of an upper layer application, wherein the business function configuration information includes a first function list required by the upper layer application; Obtain device abstract classes and a second function list corresponding to each device abstract class; Determine at least one available first device abstract class from existing device abstract classes according to the first function list and the second function list; Generate at least one first device function implementation class that implements the first device abstract class according to the second function list and the existing hardware device information; dynamically generating the device abstract model according to the first device abstract class and the first device function implementation class, so as to call the function in the second function list through the device abstract model; The device abstract model includes component classes corresponding to device function implementation classes, wherein each component class corresponds to an operation object and an operation interface of the device function implementation class. Accordingly, generating the first device function implementation class according to the second function list and pre-acquired hardware device information corresponding to the first device abstract class includes: Generate the first device function implementation class according to the second function list; Generate at least one component class corresponding to the first device function implementation class according to the hardware device information corresponding to the first device abstract class; Add the at least one component class to the first device function implementation class.

2. The method according to claim 1, before obtaining the device abstract class and the second function list corresponding to each device abstract class, the method further comprises: At least one device abstract class and a first function list corresponding to each device abstract class are generated according to the pre-acquired hardware device list, wherein each device abstract class corresponds to a hardware device in the hardware device list.

3. The method according to claim 2, before generating at least one device abstract class and a first function list corresponding to each device abstract class according to the pre-acquired hardware device list, the method further comprises: Obtain and store a list of hardware devices and hardware device information.

4. The method according to claim 1, before obtaining the device abstract class, the method further comprises: Detect the number of device abstract classes and determine whether the number is greater than 0. If not, report an error.

5. The method according to claim 1, after dynamically generating the device abstract model according to the first device abstract class and the first device function implementation class, the method further comprises: Cleaning up system resources occupied by the device abstract model; Delete the device abstract model.

6. A method for calling a device abstract model, the device abstract model comprising the device abstract model generated by the method according to any one of claims 1 to 5, the method comprising: Receive business function call requests sent by upper-layer applications; Obtaining a device function implementation class corresponding to the business function call request; Calling the operation object of the device function implementation class and its operation interface to process the business function call request to obtain a processing result; The processing result is returned.

7. The method according to claim 6, wherein the device abstract model further comprises component classes corresponding to the device function implementation classes, wherein each component class corresponds to an operation object and an operation interface of the device function implementation class, Accordingly, the operation object and the operation interface of the device function implementation class are called to process the business function call request to obtain a processing result, including: Obtaining the component class of the device function implementation class; The component class is called to process the business function call request to obtain a processing result.

8. A device for dynamically generating a device abstract model, the device comprising: A business function configuration information acquisition module, used to acquire business function configuration information set by an upper layer application, wherein the business function configuration information includes a first function list required by the upper layer application; A device abstract class acquisition module, used to acquire device abstract classes and a second function list corresponding to each device abstract class; A first abstract class determining module, configured to determine at least one available first device abstract class from existing device abstract classes according to the first function list and the second function list; The first device function implementation class generation module is used to generate a first device function implementation class according to the second function list and the existing hardware device information. generating at least one first device function implementation class that implements the first device abstract class; a device abstract model generation module, configured to dynamically generate the device abstract model according to the first device abstract class and the first device function implementation class, so as to call the function in the second function list through the device abstract model; The device abstract model includes component classes corresponding to device function implementation classes, wherein each component class corresponds to an operation object and an operation interface of the device function implementation class; The first device function implementation class generation module includes: A first device function implementation class generation submodule, used to generate a first device function implementation class according to the second function list; A component class generation submodule, used to generate at least one component class corresponding to the first device function implementation class according to the hardware device information corresponding to the first device abstract class; The component adding submodule is used to add at least one component class to the first device function implementation class.

9. A device for calling a device abstract model, the device abstract model comprising the device abstract model generated by the method according to any one of claims 1 to 5, the device comprising: A call request receiving module is used to receive a business function call request sent by an upper-layer application; A device function implementation class acquisition module, used to acquire the device function implementation class corresponding to the business function call request; A business function call request processing module, used for calling the operation object of the device function implementation class and its operation interface to process the business function call request and obtain a processing result; The processing result returning module is used to return the processing result.