Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
As shown in fig. 1, A, B, C, D, E are respectively application programs of 5 different electronic devices, the number of times that the 5 application programs need to establish an IPC channel is 10 times, if n (n is an integer greater than or equal to 2) ends are provided, the number of times that the IPC channel needs to be accessed is n (n-1)/2, and the whole access cost is exponentially increased, which tends to increase the access complexity, cause the access speed and the slow and very low efficiency, and is unfavorable for the backward expansion. When A and B communicate through IPC mechanism, a connection is established, module coupling is generated, any change of B will affect A, otherwise any change of A will affect B. Such a module is too high in coupling, which tends to increase the cost of code maintenance and is disadvantageous for rapid iterative development. Particularly, if the access of the C end and the D end is considered, the coupling degree is greatly increased, and the maintenance cost is greatly increased. Moreover, if there is a new requirement for each module to be updated, compatibility problems are easy to occur, such as: when the A end upgrades to the new version, the B end has the new version but the user chooses not to update, and then the problem is easy to happen. And if this is the case, the compatibility problem caused by the version differences is more pronounced. Therefore, as shown in fig. 2, in the case of 5 electronic devices, only each electronic device needs to be connected with the VIPC, the VIPC mechanism is a communication bus, data sharing and transmission of application programs of all electronic devices are in a communication channel, and communication between application programs of any electronic device and application programs of other electronic devices can be realized by accessing the VIPC once.
As shown in fig. 3, an embodiment of the present invention provides a distributed inter-process communication bus system, including:
the access layer is in communication connection with application programs of at least two electronic devices, wherein the application programs of the at least two electronic devices comprise a first application program of a first electronic device and a second application program of a second electronic device;
a software development kit in communication with the access stratum;
a database communicatively coupled to the software development kit;
the software development kit is used for acquiring first request information of the first application program, sending the first request information to the second application program, acquiring a data object generated by the second application program according to the first request information, and sending the data object to the first application program, wherein the first request information is used for requesting to acquire the data object of the second application program;
the database is used for storing the data objects.
It should be noted that the data object includes second application data acquired by the first application.
Specifically, as shown in fig. 3, the distributed inter-process communication bus system is divided into three layers from top to bottom, namely an access layer, a software development package and a database. The access layer is a distributed feature implementation, and is divided into a data generating end Producer end (i.e. a data transmitting end, generally speaking, a transmitting end) and a data consuming end consumer end (i.e. a data receiving end, generally speaking, a receiving end). The respective processes of the application programs of the plurality of electronic devices, that is, the P1 process, the P2 process, the P3 process, and the like in fig. 3 are started at the access layer.
Specifically, as shown in fig. 3, the software development kit may specifically provide a software development kit for an access layer to provide a cross-process communication connection, and the VIPC provides each electronic device with access in the manner of the software development kit. The software development kit is a characteristic implementation of cross-process communication, mainly provides some cross-process communication interfaces for an access layer to use, and can comprise a plurality of application program interfaces (Application Programming Interface, API) which can provide a series of application program interfaces for calling and using application programs of electronic equipment for the VIPC so as to realize data transfer among application programs of the electronic equipment. The Producer APIs are interface methods called by the application sending end provided for the electronic device, the Consumer APIs are interface methods called by the application receiving end provided for the electronic device, the Common APIs are interface methods commonly called by the application sending end and the receiving end provided for the electronic device, the LiveData APIs are interface methods of data objects, the LiveData is a data transfer object (namely a data object), the LiveDataProducer is responsible for sending the LiveData object, and the LiveDataConsumer is responsible for receiving the LiveData object. Libs are public libraries of third parties, such as a data encryption library Sqlicpher, a static page display control Nuwangine and the like.
Specifically, as shown in fig. 3, the database is implemented by the characteristics of the data bus, and all data is stored by one database, so that the data sharing access of the application programs of all electronic devices can be realized, and the characteristics of the data bus are achieved. Wherein, P1.db, p2.db, p3.db and the like refer to database files corresponding to application program processes of the electronic devices; C/R/U/D indicates the initial shorthand of adding a plurality of words of Create, reading Read, updating Update and deleting Delete when doing calculation processing, and data operation.
In the embodiment of the invention, the first request information of the first application program for acquiring the second application program data is acquired through the software development kit, the first request information is sent to the second application program, the data object generated by the second application program according to the first request information is acquired, and the data object is sent to the first application program, the inter-process communication is supported by the VIPC, the inter-process communication can be realized by the application programs of a plurality of electronic devices only by butting the VIPC, no module coupling exists, the access cost is reduced, the application programs of the electronic devices can be accessed at any time, the application programs of other electronic devices can not be influenced, and the application programs of the other electronic devices can be accessed at any time, namely the application programs are accessed and used at any time.
Optionally, as shown in fig. 4, the software development kit includes:
the receiving module is used for receiving the first request information and sending the first request information to the management module;
the management module is used for acquiring the data object according to the first request information and storing the data object into the database;
the monitoring module is used for acquiring the data object in the database and sending the data object to the first application program;
the receiving module, the management module and the monitoring module are in communication connection.
Optionally, as shown in fig. 4, the software development kit further includes:
the sending module is in communication connection with the management module and is used for receiving the first request information sent by the management module, sending the first request information to the second application program, acquiring the data object generated by the second application program and sending the data object to the management module.
Specifically, a first application program is connected with a receiving end of an access layer, and a second application program is connected with a transmitting end of the access layer; the first application program sends the first request information to the management module through the receiving module, the management module searches a sending module capable of obtaining a data object of a second application program according to the first request information, and sends the first request information to the sending module, then the sending module sends the first request information to the second application program, so that the second application program generates a data object (namely a data object LiveData) related to the second application program according to the first request information, the sending module obtains the data object generated by the second application program, and sends the data object to the management module, and the management module sends information of inserting the data object (namely a data object) to the database, and stores the data object in the database. The first application program can acquire the data object of the second application program in the database through the monitoring module.
Specifically, the receiving module may be specifically responsible for receiving a LiveData data object (i.e. livedataConsumer), the sending module may be specifically responsible for sending a LiveData data object (i.e. LiveDataProducer), the management module may be specifically responsible for managing the LiveData data object for the LiveDataManager, and the listening module may be a listener, which is responsible for listening and processing the received data object.
Optionally, as shown in fig. 4, the database is respectively connected with the monitoring module and the management module in a communication manner;
the database is specifically configured to store the data object acquired by the management module, and send notification information for storing the data object to the monitoring module.
Specifically, after receiving the information of the inserted data object sent by the management module, the database stores the data object in the database. After the data object is stored, the database sends a notification message of the stored data object to the monitoring module.
Optionally, as shown in fig. 4, the monitoring module is specifically configured to send, after receiving the notification information, second request information that requests to process the data object to the database; and receiving the data object sent by the database according to the second request information.
Specifically, after receiving the notification message, the monitoring module sends second request information to the database to request to process the data object, and if the database allows to process the data object, the monitoring module may acquire the data object, process the data object after acquiring the data object, and send the data object to the first application program, so that the first application program acquires the data object of the second application program.
Alternatively, as shown in fig. 4, the database may include:
the control module is in communication connection with the management module and is used for receiving the data object sent by the management module and controlling the data object to be stored in the storage module;
and the storage module is in communication connection with the control module and is used for storing the data object.
Specifically, the control module may be a class management object vipcprovider of the operation database, and the storage module stores data files of application programs of the plurality of electronic devices.
Optionally, as shown in fig. 4, the control module is in communication connection with the monitoring module, and is further configured to send the notification information to the monitoring module after the data object is saved in the storage module; and receiving the second request information sent by the monitoring module after receiving the notification information.
Specifically, the control module controls the data object to be stored in the storage module after receiving the information of the inserted data object sent by the management module. After the storage module stores the data object, the control module sends a notification message of the stored data object to the monitoring module; and the control module receives the second request information sent by the monitoring module under the condition that the monitoring module sends the second request information to the database.
Optionally, as shown in fig. 4, the control module is further configured to delete the data object from the storage module after sending the data object to the listening module according to the second request information.
Specifically, the second request information may include information requesting to read the data object, and information requesting to delete the data object stored in the database after the listening module reads the data object. After the monitoring module reads the data object, the control module controls the data object to be deleted from the storage module, so that the storage space can be saved.
In addition, in the embodiment of the present invention, a central server may be set up to provide shared storage and public services for application programs of other electronic devices, which is not limited herein.
In summary, in the above embodiment of the present invention, the VIPC access speed is fast, the complexity is low, the cost is low and controllable, no matter how many applications of the electronic devices need to be accessed to communicate with one end of the VIPC, and no workload is increased; moreover, the application programs of each accessed electronic device have no coupling degree, the rapid iteration cost is extremely low, and the modification of the application program of each accessed electronic device can not influence the application programs of other electronic devices; the inter-process communication mode can improve communication efficiency and reduce power consumption; the compatibility is excellent, and the version upgrading condition of the application program of each electronic device does not influence the application programs of other electronic devices.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.