A communication method, apparatus, electronic device, and storage medium
By using the Java Virtual Machine language to compile target interface information and map it into protocol messages in financial terminal devices, the operational risks caused by operating system inconsistencies are resolved, enabling cross-operating system business application operation, reducing maintenance costs and improving R&D efficiency.
Patent Information
- Application Number
- CN202210220636.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-08
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-03-08
AI Technical Summary
In financial terminal devices, the high operational risks and maintenance costs caused by inconsistent operating systems make it difficult to enable business applications to run across operating systems.
The interface information of the target interface is compiled using the Java Virtual Machine language and mapped into protocol messages. Cross-operating system communication is achieved through communication between the application layer and the service layer.
It reduced the maintenance cost of the corresponding program code for business applications, improved the efficiency of application development, and enabled business applications to run across operating systems.
Smart Images

Figure CN114579334B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer technology, and particularly relate to a communication method and device, electronic equipment and storage medium. BACKGROUND
[0002] In the field of financial terminal equipment, such as an automatic teller machine, all follow the CEN / XFS (Comite Europeen de Normalisat1n / extens1ns for Financial Services) specification based on the Windows operating system, and have strong operating system binding characteristics, and cannot be directly migrated to other systems. However, with the progress of society, in addition to Windows, other application systems are also gradually widely used, such as the Linux system, forming an XFS implementation system based on the Linux system, referred to as the LFS (Linux Financial Services) system.
[0003] Financial institutions are maintaining a large number of Windows terminal devices, and are also purchasing terminal devices developed based on other new systems. In the financial terminal device, the upper application program calls the driver program of the lower hardware device through the API method, and if different operating systems (such as Windows and Linux) are to be adapted, all related programs must be recompiled in different operating system environments to achieve application in different operating systems. For example, if an application program is developed in the Windows system and runs in the Linux system, all application programs developed in the Windows system need to be loaded and compiled in the Linux system to enable the application program to run in the Linux system.
[0004] However, with the gradual increase of user demand, the application program needs to be continuously updated, thereby increasing the maintenance cost, and when recompilation is performed on different operating systems, operating risk problems are prone to occur due to inconsistent versions, thereby causing the terminal device to be unable to normally operate. SUMMARY
[0005] Embodiments of the present application provide a communication method and device, electronic equipment and storage medium, which can reduce maintenance costs, reduce operating risks, and improve research and development efficiency.
[0006] In a first aspect, embodiments of the present application provide a communication method applied to a communication device, wherein an operating system is installed on the communication device, and the operating system includes an application layer and a service layer, and the method includes:
[0007] The interface information of the target interface compiled by using a preset language is acquired from the application layer, the interface information is mapped into a first protocol packet, and the first protocol packet is sent to the service layer.
[0008] The first protocol packet is identified as a target language corresponding to the service layer, the target interface corresponding to the interface information is called by using the target language, and communication between the application layer and the service layer in the operating system is realized.
[0009] In a second aspect, an embodiment of the present application provides a communication device applied to a communication equipment, wherein the communication equipment is installed with an operating system, and the operating system comprises an application layer and a service layer, and the device comprises:
[0010] A compiling module is configured to acquire interface information of a target interface compiled by using a preset language from the application layer, map the interface information into a first protocol packet, and send the first protocol packet to the service layer.
[0011] A calling module is configured to identify the first protocol packet as a target language corresponding to the service layer, call a target interface corresponding to the interface information by using the target language, and realize communication between the application layer and the service layer in the operating system.
[0012] In a third aspect, an embodiment of the present application further provides an electronic device, which comprises:
[0013] at least one processor; and
[0014] a memory connected with the at least one processor in communication; wherein
[0015] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the communication method in any embodiment of the present application.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer readable storage medium, which stores computer instructions for enabling a processor to execute the communication method in any embodiment of the present application when the processor executes the computer instructions.
[0017] The technical scheme of the embodiment of the application is applied to a communication device, and an operating system is installed on the communication device, and the operating system comprises an application layer and a service layer. First, interface information of a target interface compiled by using a preset language is acquired from the application layer, the interface information is mapped into a first protocol packet, and the first protocol packet is sent to the service layer; then the first protocol packet is identified as a target language corresponding to the service layer, the target interface corresponding to the interface information is called by using the target language, and finally the communication between the application layer and the service layer in the operating system is realized. The embodiment of the application can realize that the interface information is compiled only once in the application layer by using the interface information of the target interface compiled by using the preset language and mapping the interface information into the form of the protocol packet, and the effect that the interface information can be deployed and run in different operating systems is achieved, so that the purpose of running the business application across operating systems is achieved. When the hardware function of the terminal device needs to be changed or a new module needs to be extended according to the business requirement, only the corresponding interface information needs to be modified or newly added in the application layer, and the corresponding protocol packet does not need to be newly added or modified, so that the maintenance cost of the program code corresponding to the business application is reduced, and the application program development efficiency is improved.
[0018] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the application, nor is it used to limit the scope of the application. Other features of the embodiments of the application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical scheme of the embodiments of the application, the drawings needed in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the application, and therefore should not be regarded as limiting the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0020] Figure 1 is a flowchart of a communication method provided by the embodiment of the application;
[0021] Figure 2A is another flowchart of a communication method provided by the embodiment of the application;
[0022] Figure 2B is an architectural diagram of an application layer provided by the embodiment of the application;
[0023] Figure 2C is an architectural diagram of a communication system provided by the embodiment of the application;
[0024] Figure 3 is a structural diagram of a communication device provided by the embodiment of the application;
[0025] Figure 4is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative work should fall within the protection scope of the present application.
[0027] The present application will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, rather than limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, rather than all the structures.
[0028] The communication method provided by the embodiments of the present application can be executed by the communication device provided by the embodiments of the present application, which can be realized in the form of software and / or hardware. Generally, it can be integrated in a computer device such as a server. The data processing method provided by the embodiments of the present application is applied to a communication device, and the communication device is installed with an operating system, which includes an application layer and a service layer.
[0029] The communication device can be integrated with a micro controller (MCU) so that the communication device can process relevant service applications according to actual needs of users, thereby achieving the purpose of serving users. Currently, the communication device can be of multiple types according to different use fields. For example, in the financial field, the communication device can be an automatic teller machine device, and in the medical field, the communication device can be a self-service device, and the type of the communication device is not limited herein.
[0030] For example, in the financial field, the service application can be a deposit service application, a withdrawal service application or a query service application, etc. In the medical field, the service application can be a registration service application, a medical record query service application or a payment service application, etc. The specific content of the service application on the communication device is not limited herein.
[0031] The operating system (OS) refers to an environment for providing a runtime of an application program when implementing a corresponding service application in a communication device, and an application interface for associating computer software and hardware, through which a software program and a hardware interface are connected, so that the service application program is normally run in the operating system, and the target hardware interface is driven through the normal running of the service application program. Exemplarily, the operating system can be a Windows operating system, a Linux operating system, a Mac OS X operating system, or a UNIX operating system, and the type of the specific operating system is not limited herein.
[0032] Optionally, the operating system provided by the embodiment of the present application comprises an application layer (AP) and a service layer (SP).
[0033] The application layer and the service layer are connected through an application programming interface (API) to realize interaction. The application layer is used to define a hardware interface to be called according to a logic of a software program for implementing a service application. The service layer is connected with a corresponding interface of the hardware, and is used to drive a program of a target hardware interface according to the hardware interface defined in the application layer, so as to realize the calling of the target hardware interface in the application layer.
[0034] Generally, the calling mode of the library file corresponding to the application interface is different when the application interface is called in different operating systems. Exemplarily, when the API is called in the Windows operating system, the dll library file is usually loaded to call; when the API is called in the Linux operating system, the so library file is usually loaded to call, and the code implementation mode of the library file is different in the two operating systems.
[0035] In the prior art, in order to realize normal running of a program in different operating systems, and to achieve the purpose of calling an application interface, the following manner is generally adopted to call a corresponding library file: an application layer can be implemented by a direct compilation language (such as C, C++, etc.), or can be implemented based on a virtual machine language (such as Java). If the application layer is implemented by a direct compilation language, it needs to be compiled in the operating system where the application layer or a service layer is located, and is called by using a library file calling manner suitable for the operating system where the application layer or the service layer is located. If the application layer is implemented based on a virtual machine language, since the operating system currently all has or supports a virtual machine language, the application layer only needs to be compiled in an environment, but the service layer still needs to be called by using a library file calling manner suitable for the operating system where the service layer is located. Therefore, no matter which language is used to implement the application layer, the service layer needs to use a suitable library file calling manner to realize calling of a hardware interface according to the current operating system. Therefore, different code versions or library file calling manners compatible with different operating systems in the same set of codes will appear, and the problem of operation risk caused by inconsistent versions will easily occur, so that the terminal device cannot run normally.
[0036] Therefore, the embodiment of the present application provides a communication method, compared with the prior art, which can solve the problem of operation risk caused by inconsistent operating systems, realize cross-operating system running of a business application, thereby reducing the maintenance cost of program code of the business application, and improving the beneficial effects of application program development efficiency.
[0037] Specifically, referring to Figure 1 , Figure 1 a flowchart of the communication method provided by the embodiment of the present application, the data processing method provided by the embodiment of the present application specifically includes the following steps:
[0038] S110, obtaining interface information of a target interface compiled by using a preset language from an application layer, mapping the interface information into a first protocol packet, and sending the first protocol packet to a service layer.
[0039] The interface information of the target interface needs to be obtained from a target application program compiled by using a preset language in the application layer. The current target application program represents a computer code program for realizing calling of a hardware interface in a business application. The interface information of a target interface to be called is defined in the current target application program, so as to realize calling of the target interface by running the target application program in the application layer, and realize driving of a corresponding hardware interface connected with the service layer.
[0040] The interface information of the target interface is also compiled by using a preset language, and therefore, the interface information of the target interface compiled by using the preset language can be directly obtained from the application layer in the current step.
[0041] The preset language provided by the embodiment of the present application is a Java virtual machine language, and the target application program is compiled by using the Java virtual machine language, and the interface information of the target interface is obtained from the target application program. The advantage of this is that the Java language based on the virtual machine can compile the target application program in the application layer, and the interface information value in the application layer can be compiled once, and the effect of running on different operating systems can be achieved, and the purpose of running the business application across operating systems can be achieved in the subsequent steps.
[0042] The Java virtual machine is an abstract computer, which is realized by simulating various computer functions on an actual computer. The Java virtual machine has its own perfect hardware architecture, such as a processor, a stack, a register, and the like, and also has a corresponding instruction system. The Java virtual machine shields the information related to the specific operating system platform, so that the Java program only needs to generate the target code (byte code) running on the Java virtual machine, and can run on multiple platforms without modification.
[0043] Further, the interface information compiled by using the Java virtual machine language is mapped into a first protocol message. The way of mapping the interface information compiled by using the Java virtual machine language into the first protocol message can be that, by using the characteristics of the Java virtual machine language, the reflection mechanism and the annotation of Java are used to map the interface information of the target interface compiled by using the Java virtual machine language into the first protocol message (i.e., Transmission Control Protocol / Internet Protocol, TCP / IP for short), that is, the transmission of the interface information of the target interface is realized in the form of a message. The advantage of this setting is that when the terminal device hardware function and module expansion are performed, the application layer only needs to add or modify the corresponding application interface definition, and does not need to add and modify the message configuration operation, further reducing the maintenance cost of the application program code, and improving the program development efficiency.
[0044] In an optional embodiment, the interface information of the target interface includes an interface name, a parameter type of the interface, a parameter name of the interface, and a return value type of the interface.
[0045] Wherein, the interface name represents the name of the interface to be called, such as the names of "camera", "withdrawal" or "inquiry", etc.; the parameter type of the interface represents the type of the interface adopted by the graphics card and the motherboard connection, which can be a parallel port or a serial port (Universal Serial Bus, USB) and the like; the parameter name of the interface represents the number, identity information (Identity Document, ID) or protocol address (Internet Protocol, IP) and the like related to the interface; and the return value type of the interface represents the return information represented by the return value, such as that the return value of 1 represents "success", the return value of 2 represents "failure", the return value of 0 represents "error" and the like. The specific content contained in the specific interface information is not limited here.
[0046] S120, the first protocol message is identified as a target language corresponding to the service layer, and a target interface corresponding to the interface information is called using the target language, so as to realize the communication between the application layer and the service layer in the operating system.
[0047] The application layer sends the converted first protocol message to the service layer, and the service layer can convert the first protocol message into a target language that can be recognized by the current operating system according to the current operating system environment, and call the target interface required by the application layer based on the target language in the service layer, so as to realize the communication between the application layer and the service layer in the operating system.
[0048] It should be noted that the communication method provided by the embodiment of the application is suitable for the case that the general application layer and the service layer are in different operating systems. In the prior art, if the operating systems of the application layer and the service layer are different, the target application program compiled in the application layer operating system needs to be recompiled in the service layer according to the language environment required by the service layer, which is easy to cause the operation risk problem due to the inconsistency of versions, thereby causing the terminal device to be unable to normally operate.
[0049] The scheme provided by the embodiment of the application converts the calling of the target interface into the form of the first protocol message in the application layer, and converts the first protocol message into a language that can be recognized by the operating system in which the service layer is located, and realizes the calling of the hardware interface according to the language of the service layer in the service layer. Compared with the prior art, the strongly bound API calling mode is mapped into the loosely coupled network communication message interaction mode, the decoupling between the application layer and the service layer is realized, and the same set of application layer implementation logic can be applied to multiple operating systems.
[0050] Exemplarily, the language corresponding to the current service layer can be a Java virtual machine language, or a directly compiled language (C, C++), etc., and the first protocol message can be converted according to the language corresponding to the service layer, without the need to reconfigure the completed application program. The type of the language corresponding to the specific service layer is not limited here, and is subject to the actual operating system type in which the service layer is located.
[0051] The communication method provided by the embodiment of the application is applied to a communication device, and an operating system is installed on the communication device. The operating system includes an application layer and a service layer. First, interface information of a target interface compiled by using a preset language is acquired from the application layer, the interface information is mapped into a first protocol message, and the first protocol message is sent to the service layer. Then, the first protocol message is identified as a target language corresponding to the service layer, the target interface corresponding to the interface information is called by using the target language, and finally, communication between the application layer and the service layer in the operating system is realized. The embodiment of the application can realize that the interface information is compiled only once in the application layer by using the interface information of the target interface compiled by using the preset language and mapping the interface information into the form of a protocol message, can achieve the effect of being deployed and running in different operating systems, and achieves the purpose of cross-operating system running of a business application. Moreover, when the hardware function of the terminal device needs to be changed or a new module needs to be extended according to the business requirement, only the corresponding interface information needs to be modified or newly added in the application layer, and the corresponding protocol message does not need to be newly added or modified, thereby reducing the maintenance cost of the program code corresponding to the business application, and improving the application program development efficiency.
[0052] Figure 2A is another flowchart of the communication method provided by the embodiment of the application, and the relationship between the embodiment and the above-mentioned embodiment is a further refinement of the corresponding features of the above-mentioned embodiment. As shown in Figure 2A the method can include the following steps:
[0053] S210, acquiring a target application program compiled by using a preset language.
[0054] The target application program represents a computer code program for realizing hardware interface calling in a business application.
[0055] Specifically, refer to Figure 2B , Figure 2Bis a schematic diagram of an application layer provided by an embodiment of the present application, which can include a business logic layer, an application interface layer and an interface and message mapping layer. The operation of compiling a target application program using a preset language can be implemented in the business logic layer, and the target application program at least includes target interface information that needs to be called when the application program is implemented, so that the subsequent step of calling the target interface information is facilitated. Further, when there is a business requirement adjustment and no hardware change is involved, the business logic layer can be directly optimized, upgraded, recompiled and released, and each layer below can remain unchanged.
[0056] The current preset language represents a Java virtual machine language.
[0057] S211, extracting interface information of the target interface from the target application program.
[0058] After the target application program is compiled in the business logic layer of the application layer, the application interface layer further extracts interface information of the target interface from the target application program.
[0059] Specifically, the interface information of the target interface can be extracted according to the interface identifier of the target interface or according to a code value. For example, the interface information of the target interface is extracted from the target application program in the form of extracting a corresponding value in each line of code, and the specific manner of extracting the interface information of the target interface from the target application program is not limited herein.
[0060] The target interface of the application interface layer corresponds to the service layer, and the basic target interface exposed by the service layer can be further encapsulated into a high-level target interface. For example, a high-level target interface can continuously call multiple basic target interfaces to complete a predetermined business regulation action. For example, the high-level target interface can be used to inhale a bank card, read two-magnetic track information, read three-magnetic track information, and return two-magnetic track information and three-magnetic track information.
[0061] The interface encapsulation is specifically implemented by the service layer. When there is a business requirement adjustment and a hardware change is involved, for the application layer, when a corresponding target interface parameter needs to be added or modified in the application interface layer, the business logic layer can be modified to implement the business call of the added or modified hardware interface.
[0062] S220, mapping the interface information into a first protocol message, and sending the first protocol message to the service layer.
[0063] After the application interface layer extracts the target interface information compiled by the Java virtual machine language in step S211, the interface and message mapping layer in the application program can dynamically obtain the interface information of the target interface (such as the interface name, parameter type, parameter name, and interface return value type) when the Java program is running, and convert the interface information into the form of the first protocol message and send it to the service layer. The current step maps the calling mode of the strongly bound target interface into the loosely coupled network communication message interaction mode, thereby realizing the calling of the target interface in different operating systems in different service layers by the same set of Java application programs.
[0064] S230, obtaining the target language corresponding to the service layer.
[0065] The target language corresponding to the service layer can be the Java virtual machine language or the direct compilation language (C, C++), or other implementation language code, and the specific target language required by the actual operating system where the service layer is located.
[0066] S231, parsing the first protocol message by using the target language, obtaining the target interface corresponding to the target language, and calling the target interface corresponding to the target language.
[0067] The target language parses the first protocol message. For ease of understanding, the Java virtual machine language in the application layer, the first protocol message, and the target language can be explained in the following way: the target application program is written by using the Java virtual machine language in the business logic layer of the application layer, and the interface information of the target interface contained in the target application program is extracted by using the application interface layer. It is easy to know that the interface information of the current target interface is also represented by using the Java virtual machine language, and the interface and message mapping layer contained in the application layer maps the interface information compiled by using the Java virtual machine language into the first protocol message to be sent to the service layer in the form of a string; since the operating system environment where the service layer is currently located can be the same as the operating system environment where the application layer is located, or can be different, further, the service layer parses the first protocol message according to the target language to parse it into the language required by the operating system where the current service layer is located, so that the interface information of the target interface corresponding to the current target language can be recognized by the operating system where the current service layer is located, thereby completing the calling of the target interface connected with the service layer according to the current interface information.
[0068] S240, obtaining the calling result of the target interface in the service layer, and converting the calling result into the second protocol message and sending it to the application layer.
[0069] In the calling interface of the target according to the target language, the calling result needs to be fed back to the application layer according to the actual calling condition, and the current calling result can be represented according to the interface return value type in the interface information. Specifically, when the calling result of the target interface is fed back from the service layer to the application layer, since there is a case that the operating system of the application layer is different from the operating system of the service layer, in order to facilitate the service layer to identify the calling result, the service layer first converts the obtained calling result into a second protocol packet, so as to send the calling result in the form of the second packet to the application layer.
[0070] S241, the application layer identifies the calling result according to the second protocol packet, and when the calling result is a preset value, it is determined that the target interface calling is successful.
[0071] An optional embodiment, the application layer identifies the calling result according to the second protocol packet, including: the application layer converts the second protocol packet into a preset language, and identifies the calling result according to the preset language. Wherein, the target interface calling success is used to indicate that the communication between the application layer and the service layer in the operating system is successful, so as to realize the successful communication between the application layer and the service layer across the operating system.
[0072] The interface and packet mapping layer in the application layer will feed back the second protocol packet in the form of Java virtual machine language, and when the calling result is a preset value, it is determined that the target interface calling is successful.
[0073] Wherein, when the return value type of the interface is used to represent the calling result, when the return value type of the interface is 1, it indicates that the target interface calling is successful; when the return value of the target interface is 2, it indicates that the current interface calling fails, and when the application layer obtains the calling result of the target interface, the next operation step can be determined according to the current calling result. For example, taking reading bank card information as an example, if reading is successful, when the application interface receives the return value type of the interface is 1, the subsequent step can be continued, for example, inputting the bank card password; when the application interface receives the return value type of the interface is 2, the application layer can continue to send the interface calling operation of reading bank card information to the service layer, which can be continued until reading is successful, or when reading fails more than a preset number of times, error information can be fed back to the operator, so that the operator can maintain the current program accordingly.
[0074] Optionally, the current preset value can also be T (True) or Y (Yes), etc., to indicate that the target interface calling is successful, and the type of the specific preset value is not limited here.
[0075] An optional embodiment, specifically, please refer to Figure 2C , Figure 2Cis a schematic diagram of an architecture of a communication system provided by an embodiment of the present application. The service layer includes a middleware layer; the middleware layer is configured to convert a first protocol message into a target language corresponding to the service layer, and invoke a target interface from the service layer according to the target language; and configured to receive a calling result of the target interface invoked from the service layer according to the target language, and convert the calling result into a second protocol message and send the second protocol message to the application layer.
[0076] The present application converts the calling of the target interface into the form of the protocol message, and the application layer is implemented by using the Java language. When the hardware device is called, the actual operating system environment of the service layer is adapted, so that the application program is compiled once in the application layer, cross-operating system running is realized, and only the implementation code in the application layer needs to be maintained for the same business requirement in different operating system environments. The problems of the prior art, such as the need to maintain multiple versions of programs in the application layer, high system maintenance cost, and inconsistency of versions, are solved. Further, the present application uses the Java reflection mechanism and the annotation to realize the direct mapping of the target interface into the protocol message. When the hardware function and the module of the terminal device are expanded, the application layer only needs to add and modify the corresponding target interface, without adding and modifying the message configuration, so that the maintenance cost of the application program code is further reduced, and the program development efficiency is improved.
[0077] Figure 3 is a structural schematic diagram of a communication device provided by an embodiment of the present application. The device is suitable for executing the communication method provided by the embodiment of the present application. As shown in Figure 3 , the device is applied to a communication device, and the communication device is installed with an operating system. The operating system includes an application layer and a service layer. The device specifically can include a compiling module 310 and a calling module 320, wherein:
[0078] The compiling module 310 is configured to acquire interface information of a target interface compiled by using a preset language from the application layer, map the interface information into a first protocol message, and send the first protocol message to the service layer.
[0079] The calling module 320 is configured to identify the first protocol message as a target language corresponding to the service layer, call a target interface corresponding to the interface information by using the target language, and realize the communication between the application layer and the service layer in the operating system.
[0080] The communication device provided by the embodiment of the present application is applied to a communication device, and an operating system is installed on the communication device, and the operating system comprises an application layer and a service layer. First, interface information of a target interface compiled by using a preset language is acquired from the application layer, the interface information is mapped into a first protocol packet, and the first protocol packet is sent to the service layer; then, the first protocol packet is identified as a target language corresponding to the service layer, the target interface corresponding to the interface information is called by using the target language, and finally, communication between the application layer and the service layer in the operating system is realized. The embodiment of the present application can realize that interface information is compiled only once in the application layer by using the interface information of the target interface compiled by using the preset language and mapping the interface information into the form of a protocol packet, can achieve the effect that the interface information can be deployed and run in different operating systems, and achieves the purpose that a business application runs across operating systems. Moreover, when the hardware function of a terminal device needs to be changed or a new module needs to be extended according to a business requirement, only the corresponding interface information needs to be modified or newly added in the application layer, and the corresponding protocol packet does not need to be newly added or modified, so that the maintenance cost of program code corresponding to the business application is reduced, and the application program development efficiency is improved.
[0081] In an embodiment, the compiling module 310 comprises a first acquisition unit and an extraction unit, wherein:
[0082] The first acquisition unit is configured to acquire a target application program compiled by using the preset language.
[0083] The extraction unit is configured to extract interface information of the target interface from the target application program.
[0084] In an embodiment, the calling module 320 comprises a second acquisition unit and a calling unit, wherein:
[0085] The second acquisition unit is configured to acquire a target language corresponding to the service layer.
[0086] The calling unit is configured to parse the first protocol packet by using the target language, obtain a target interface corresponding to the target language, and call the target interface corresponding to the target language.
[0087] In an embodiment, the device further comprises a sending module and an identification module, wherein:
[0088] The sending module is configured to acquire a calling result of calling the target interface in the service layer, and convert the calling result into a second protocol packet and send the second protocol packet to the application layer.
[0089] The identification module is configured to identify the calling result according to the second protocol packet in the application layer, and determine that the target interface is called successfully when the calling result is a preset value, wherein the target interface called successfully is used to indicate that the communication between the application layer and the service layer in the operating system is successful.
[0090] In an embodiment, the identification module is configured to convert the second protocol message into the preset language in the application layer, and identify the calling result according to the preset language.
[0091] In an embodiment, the service layer comprises a middleware layer; the middleware layer is configured to convert the first protocol message into a target language corresponding to the service layer, and call the target interface from the service layer according to the target language; and receive a calling result of the target interface called from the service layer according to the target language, and convert the calling result into the second protocol message and send the second protocol message to the application layer.
[0092] In an embodiment, the interface information of the target interface comprises an interface name, a parameter type of the interface, a parameter name of the interface, and a return value type of the interface.
[0093] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is taken as an example for illustration, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the above described functional modules can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0094] The embodiment of the present application also provides an electronic device, which comprises at least one processor and a memory connected with the at least one processor in communication; wherein the memory stores a computer program which can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the communication method provided by any one of the embodiments of the present application.
[0095] The embodiment of the present application also provides a computer readable medium, which stores computer instructions for enabling a processor to execute the communication method provided by any one of the embodiments of the present application.
[0096] Reference will be made to the following Figure 4 which shows a structural schematic diagram of a computer system 500 suitable for implementing the electronic device of the embodiment of the present application. Figure 4 The electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiment of the present application.
[0097] As Figure 4As shown, the computer system 500 includes a central processing unit (CPU) 501 which can perform various appropriate actions and processes in accordance with programs stored in a read only memory (ROM) 502 or loaded from a storage section 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0098] Connected to the I / O interface 505 are an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a loudspeaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as necessary. A removable recording medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 510 as necessary, so that a computer program read therefrom is installed into the storage section 508 as necessary.
[0099] In particular, the processes described above with reference to the flow charts can be implemented as a computer software program in accordance with the embodiments of the present disclosure. For example, the embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flow charts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 509, and / or installed from the removable recording medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the system of the present disclosure are performed.
[0100] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0101] The flow diagrams and block diagrams in the drawings are schematic illustrations of possible architectures, functions and operations of systems, methods and computer program products in accordance with various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may be executed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams or flow diagrams, and combinations of blocks in the block diagrams or flow diagrams, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0102] The modules and / or units involved in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The modules and / or units described can be arranged in a processor, for example, can be described as a processor includes an obtaining module, a determining module and a creating module. In some cases, the names of the modules do not constitute a limitation on the modules themselves.
[0103] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to include: obtaining interface information of a target interface compiled using a preset language from the application layer, mapping the interface information into a first protocol packet, and sending the first protocol packet to the service layer;
[0104] identifying the first protocol packet as a target language corresponding to the service layer, calling a target interface corresponding to the interface information using the target language, and realizing the communication between the application layer and the service layer in the operating system.
[0105] According to the technical scheme of the embodiments of the present application, the application is applied to a communication device, and the communication device is installed with an operating system, and the operating system includes an application layer and a service layer. First, interface information of a target interface compiled using a preset language is obtained from the application layer, the interface information is mapped into a first protocol packet, and the first protocol packet is sent to the service layer; then, the first protocol packet is identified as a target language corresponding to the service layer, a target interface corresponding to the interface information is called using the target language, and finally the communication between the application layer and the service layer in the operating system is realized. The embodiments of the present application can realize that the interface information is compiled only once in the application layer by compiling the interface information of the target interface using the preset language and mapping the interface information into the form of the protocol packet, can be deployed and run in different operating systems, and achieves the purpose of running the business application across the operating systems. When the hardware function of the terminal device needs to be changed or a new module needs to be expanded according to the business demand, only the corresponding interface information needs to be modified or added in the application layer, and the corresponding protocol packet does not need to be added or modified, thereby reducing the maintenance cost of the program code corresponding to the business application, and improving the application program development efficiency.
[0106] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made depending on design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A communication method characterized by comprising: The application is applied to a communication device, wherein the communication device is installed with an operating system, and the operating system comprises an application layer and a service layer. Interface information of a target interface compiled by using a preset language is acquired from the application layer, the interface information is mapped into a first protocol packet, and the first protocol packet is sent to the service layer; wherein the preset language is a Java virtual machine language, and the first protocol packet is a transmission control protocol / internet protocol (TCP / IP) packet; The first protocol packet is identified as a target language corresponding to the service layer, the target interface corresponding to the interface information is called by using the target language, and communication between the application layer and the service layer in the operating system is realized; wherein the application layer and the service layer are in different operating systems; wherein the interface information of the target interface comprises an interface name, a parameter type of the interface, a parameter name of the interface, and a return value type of the interface.
2. The method of claim 1, wherein, The interface information of the target interface compiled by using the preset language is acquired from the application layer, comprising: A target application program compiled by using the preset language is acquired; The interface information of the target interface is extracted from the target application program.
3. The method of claim 1, wherein, The first protocol packet is identified as a target language corresponding to the service layer, and the target interface corresponding to the interface information is called by using the target language, comprising: The target language corresponding to the service layer is acquired; The first protocol packet is parsed by using the target language, the target interface corresponding to the target language is obtained, and the target interface corresponding to the target language is called.
4. The method of claim 1, wherein, After the target interface corresponding to the interface information is called by using the target language, the method further comprises: A calling result of calling the target interface in the service layer is acquired, and the calling result is converted into a second protocol packet and sent to the application layer; The application layer identifies the calling result according to the second protocol packet, and when the calling result is a preset value, it is determined that the target interface is called successfully, wherein the target interface called successfully indicates that the communication between the application layer and the service layer in the operating system is successful.
5. The method of claim 4, wherein, The application layer identifies the calling result according to the second protocol packet, comprising: The application layer converts the second protocol packet into the preset language, and identifies the calling result according to the preset language.
6. The method of claim 4, wherein, The service layer comprises a middleware layer; The middleware layer is used for converting the first protocol packet into a target language corresponding to the service layer, calling the target interface from the service layer according to the target language, receiving a calling result of calling the target interface in the service layer according to the target language, and converting the calling result into the second protocol packet and sending the second protocol packet to the application layer. The application is applied to a communication device, wherein the communication device is installed with an operating system, and the operating system comprises an application layer and a service layer.
7. A communication device, characterized by The compiling module is configured to obtain interface information of a target interface compiled in a preset language from the application layer, map the interface information into a first protocol packet, and send the first protocol packet to the service layer; the preset language is a Java virtual machine language, and the first protocol packet is a transmission control protocol / internet protocol (TCP / IP) packet; The calling module is configured to identify the first protocol packet as a target language corresponding to the service layer, call a target interface corresponding to the interface information using the target language, and realize communication between the application layer and the service layer in the operating system; the application layer and the service layer are in different operating systems; the interface information of the target interface includes an interface name, a parameter type of the interface, a parameter name of the interface, and a return value type of the interface.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the communication method of any one of claims 1-6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the communication method of any one of claims 1-6.
Citation Information
Patent Citations
An application function running method and device
CN109840133A