A communication method, device and electronic device
The communication process manager uses message queues to realize the registration and data transmission of communication links in the RTOS system, solving the problem of low development efficiency under the operating system with a smaller kernel, and improving the efficiency and resource utilization of multi-party cooperative development.
Patent Information
- Application Number
- CN202210082909.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2042-01-21
AI Technical Summary
In software systems developed jointly by multiple parties, when using RTOS operating systems with smaller kernels, the communication mechanism is lower, resulting in low development efficiency.
The communication request is received through the communication process manager, the communication link is found based on the link identification, and the corresponding communication operations are performed using a message queue, including registration, querying, sending and receiving data interface calls, simplifying the communication implementation method.
It improves the development efficiency of multi-party cooperative development, reduces the amount of code required, and the communication method has the advantages of portability and small resource utilization.
Smart Images

Figure CN114501407B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a communication method, device and electronic equipment. Background Art
[0002] In product software development, it is common for a software system to involve multiple parties in cooperative development. In order to achieve multi-threaded operation, microcontrollers with relatively limited resources use operating systems with smaller kernels, such as RTOS (Real-time operating system). However, the communication mechanism provided by operating systems with smaller kernels is relatively low-level, which is not easy for developers to operate and is not conducive to cooperative development by multiple parties, thus causing the problem of low efficiency of software multi-party development. Summary of the invention
[0003] In order to solve the problem of low efficiency in software development by multiple parties, the present application provides a communication method, device and electronic device.
[0004] In a first aspect, the present application provides a communication method, which is applied to a communication process manager, and the method comprises:
[0005] receiving a communication request sent by a communication node;
[0006] Based on the link identifier carried in the communication request, searching for a corresponding communication link from a preset communication chain table;
[0007] Based on the communication link and the communication request, a message queue is used to perform corresponding communication operations.
[0008] As a possible implementation manner, the using a message queue to perform a corresponding communication operation based on the communication link and the communication request includes:
[0009] If the communication request is a call request for sending a data interface in the communication process manager, another communication node under the communication link other than the communication node sending the communication request is determined as a communication object;
[0010] A write operation is performed on a receive data queue corresponding to the communication object in the communication process manager to write data sent by the communication node that sends the communication request into the receive data queue.
[0011] As a possible implementation manner, the using a message queue to perform a corresponding communication operation based on the communication link and the communication request includes:
[0012] If the communication request is a call request for the receive data interface in the communication process manager, determine the communication node that sends the communication request under the communication link as the communication object;
[0013] Perform a read operation on the receive data queue corresponding to the communication object in the communication process manager to read the data written in the receive data queue.
[0014] As a possible implementation manner, the write operation adopts a non-blocking write manner.
[0015] As a possible implementation manner, the read operation adopts a blocking read manner.
[0016] As a possible implementation manner, the communication linked list is set in the following manner:
[0017] Receive a link registration request, where the link registration request carries a communication identifier and two communication node identifiers;
[0018] Register a communication link corresponding to the communication identifier and the two communication node identifiers based on the link registration request, and generate a link identifier for the communication link;
[0019] Correspondingly store the link identifier, the communication identifier, the two communication node identifiers, and the communication link in a pre-set data table, so as to generate a communication linked list.
[0020] As a possible implementation manner, after generating the link identifier of the communication linked list, the method further includes:
[0021] Send the link identifier to the communication node that sends the registration request.
[0022] As a possible implementation manner, the method further includes:
[0023] Receive a link query request, where the link query request carries a communication identifier;
[0024] Search for the link identifier corresponding to the communication identifier from the communication linked list;
[0025] Send the link identifier to the communication node that sends the link query request.
[0026] In a second aspect, an embodiment of the present application further provides a communication device, which is applied to a communication process manager, and the device includes:
[0027] A receiving module, configured to receive a communication request sent by a communication node;
[0028] A link search module, configured to search for a corresponding communication link from a pre-set communication link list based on the link identifier carried in the communication request;
[0029] An execution module, configured to perform corresponding communication operations by using a message queue based on the communication link and the communication request.
[0030] In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor and a memory, where the processor is configured to execute a communication program stored in the memory to implement the communication method according to any one of the first aspects.
[0031] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art:
[0032] For a communication method provided by an embodiment of the present application, after receiving a communication request, a communication process manager first determines a corresponding communication link based on the link identifier carried in the communication request, and then performs corresponding communication operations by using a message queue based on the communication link and the communication request. Implementing communication between communication nodes based on a queue simplifies the implementation method of communication, requires less code, and developers only need to complete communication between different communication nodes through fewer interfaces, improving the development efficiency of software during multi-party collaborative development.
[0033] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0035] Figure 1 is a schematic diagram of a communication system shown according to an exemplary embodiment.
[0036] Figure 2 is a flowchart of a communication method shown according to an exemplary embodiment.
[0037] Figure 3 is a signaling diagram of a communication method shown according to an exemplary embodiment.
[0038] Figure 4 is a block diagram of a communication device shown according to an exemplary embodiment.
[0039] Figure 5 is a schematic diagram of an electronic device shown according to an exemplary embodiment. DETAILED DESCRIPTION
[0040] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0041] Please refer to Figure 1 , Figure 1 which is a schematic diagram of a communication system provided by an embodiment of the present application.
[0042] As Figure 1 shown, the communication system provided by this embodiment may include: a first communication node, a second communication node, and a communication process manager. In a multi-party cooperative software development scenario, both the first communication node and the second communication node are used for software development.
[0043] In practical applications, the number of communication nodes included in the communication system can be set according to actual situations. This embodiment only takes two communication nodes as an example, and does not constitute a limitation on the number of communication nodes in the communication system.
[0044] As an embodiment, the communication node may be a terminal such as a mobile phone or a computer equipped with an application for communication. The communication process manager may be a server.
[0045] In the embodiment of the present application, communication between the first communication node and the second communication node is implemented through the communication process manager. Among them, the communication process manager is mainly used to create a global variable of the communication linked list object structure, initialize resources, and maintain the communication link. The communication process manager also provides registration (i.e., creation), release, and query interfaces for the communication link, and is responsible for resource allocation and recycling.
[0046] As an embodiment, any one of the first communication node and the second communication node may create a communication link between the first communication node and the second communication node by calling the registration interface provided by the communication process manager. For example Figure 1 shown, the first communication node may send a link registration request to the communication process manager. After the communication process manager completes the registration of the communication link, the link identifier of the communication link may be returned to the first communication node, and the second communication node may send a link query request to the communication process manager by calling the link query interface to obtain the link identifier of the communication link. After that, the first communication node and the second communication node may implement data sending or reading through the communication process manager based on the link identifier.
[0047] As an example, either the first communication node or the second communication node can delete the communication link by calling the communication link deletion interface provided by the communication process manager.
[0048] Furthermore, the communication process manager also provides a data sending interface and a data receiving interface, where the data sending interface and the data receiving interface are respectively used to implement data sending and reading of the communication node.
[0049] The communication method provided in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0050] See Figure 2 , which is a flowchart of a communication method provided in the embodiments of the present application. This method can be applied to the communication process manager in a communication system as shown in Figure 1 As shown, this method may include the following steps: Figure 2 As shown, this method may include the following steps:
[0051] S21. Receive a communication request sent by a communication node.
[0052] In the embodiments of the present application, a communication link refers to a channel for communication between two communication nodes. Therefore, if you want to achieve communication with other communication nodes, you need to register the corresponding communication link in the communication process manager in advance. Based on this, the communication node sending the communication request can be any communication node that has completed the registration of the communication link in the communication process manager in the communication system.
[0053] As an example, the communication link in the communication process manager can be registered in the following manner:
[0054] Any communication node sends a link registration request to the communication process manager by calling the registration interface provided by the communication process manager. The link registration request carries a communication identifier and two communication node identifiers. After receiving the link registration request, the communication process manager can register the communication link corresponding to the communication identifier and the two communication node identifiers based on the link registration request and generate a link identifier of the communication link.
[0055] Among them, the link registration request can be sent by either of the two communication nodes corresponding to the two communication node identifiers. As for which communication node specifically sends it, it can be negotiated by the users of the two communication nodes. After completing the registration of the communication link based on the link registration request, it can be determined that both communication nodes have completed the registration of the communication link in the communication process manager.
[0056] As an example, the communication identifier carried in the link registration request can be determined through negotiation by the users of the two communication nodes. Preferably, the communication identifier can be in the form of a string that is relatively easy to remember.
[0057] In an embodiment of the present application, a communication identifier is generally an identifier used by a user of a communication node to determine the function of a communication link to be established before registering the communication link. For example, if a communication link for implementing Bluetooth communication between two communication nodes is to be registered, the communication identifier can be Bluetooth. Another example is that if a communication link for implementing WiFi communication between two communication nodes is to be registered, the communication identifier can be WiFi. The link identifier is a specified channel number generated after registering the communication link. After the registration of the communication link is completed through the communication identifier and the corresponding link identifier is generated, the communication identifier and the link identifier can generate a binding relationship for corresponding to the same communication link. In this way, the user of the communication node can determine the corresponding communication identifier according to the communication function to be achieved, and then query the corresponding link identifier according to the communication identifier to determine the corresponding communication link.
[0058] Further, after the registration of the communication link is completed, the link identifier, the communication identifier, the two communication node identifiers, and the communication link can be correspondingly stored in a preset data table to generate a communication link list for easy query.
[0059] Further, as an embodiment, after the registration of the communication link is completed based on a registration request, the link identifier of the communication link can be sent to the communication node that sent the registration request. For example, if the communication link is a communication link between a first communication node and a second communication node, and the registration request is sent by the first communication node, then after the registration of the communication link is completed, the link identifier of the communication link can be directly sent to the first communication node. In this way, in the subsequent communication process, the first communication node can communicate using the corresponding communication link based on the link identifier.
[0060] Still further, for another communication node other than the communication node that sent the registration request under the communication link, such as the second communication node, the link identifier of the communication link can be obtained by querying. For example, the second communication node can call the communication link query interface provided by the communication process manager, and then send a link query request to the communication process manager through the communication link query interface. The link query request can carry the communication identifier. In this way, after the communication process manager receives the link query request, it can search for the link identifier corresponding to the communication identifier in the communication link list, and then send the link identifier to the communication node that sent the link query request, that is, the second communication node. In this way, in the subsequent communication process, the second communication node can also communicate using the corresponding communication link based on the link identifier.
[0061] Further, while querying the sending linked list identifier based on the linked list, the communication process manager can also send the connection result of the communication link to the communication node that sends the linked list query request.
[0062] S22. Based on the link identifier carried in the communication request, find the corresponding communication link from the pre-set communication linked list.
[0063] As an embodiment, according to the above description, the communication linked list is set based on the communication links registered in the communication process manager, which contains the relevant information of at least one communication link. The relevant information includes but is not limited to the link representation, communication representation, and two communication node representations corresponding to the communication link. Therefore, when the link identifier is known, the corresponding communication link can be found from the communication linked list based on the link identifier.
[0064] S23. Based on the communication link and the communication request, perform corresponding communication operations using the message queue.
[0065] In the embodiment of the present application, the communication process manager can provide a sending data interface and a receiving data interface, and both communication nodes can call these two interfaces. Specifically, for each communication node, when the communication node needs to send data to other communication nodes, it can achieve this by calling the sending data interface. When the communication node needs to receive data sent by other communication nodes, it can achieve this by calling the receiving data interface.
[0066] As a possible implementation, if the communication request received by the communication process manager is a call request for the sending data interface in the communication process manager, then the other communication node except the communication node that sends the communication request under the determined communication link in S22 can be determined as the communication object, and then a write operation is performed on the receiving data queue corresponding to the communication object in the communication process manager to write the data sent by the communication node that sends the communication request into the receiving data queue.
[0067] For example, the communication link is the channel for communication between the first communication node and the second communication node, and the communication request is a call request for the sending data interface sent by the first communication node, then the second communication node is determined as the communication object.
[0068] Among them, performing a write operation on the receiving data queue corresponding to the communication object in the communication process manager means writing the data transmitted by the other communication node except the communication object under the communication link into the receiving data queue corresponding to the communication object. Specifically, it can be achieved by calling the write interface of the receiving data queue. The receiving data queue is pre-set in the communication process manager, and the receiving data queues corresponding to different communication nodes are different.
[0069] As an example, when performing a write operation on the receive data queue of a communication object, a non-blocking write method can be adopted, that is, the write result is returned immediately after writing the data. The advantage of using non-blocking write is that since the write is an actively initiated behavior and is controllable, using non-blocking write can obtain the write result immediately, and then process it based on the returned result, without affecting subsequent operations.
[0070] As another possible implementation, if the communication request received by the communication process manager is a call request for the receive data interface in the communication process manager, the communication node that sends the communication request under the communication link can be determined as the communication object, and then a read operation is performed on the receive data queue corresponding to the communication object in the communication process manager to read the data written in the receive data queue.
[0071] For example, if the communication request is a call request from the second communication node to the receive data interface, the second communication node is determined as the communication object.
[0072] Among them, performing a read operation on the receive data queue corresponding to the communication object in the communication process manager means reading out the data in the receive data queue corresponding to the communication object. Specifically, it can be implemented by calling the read interface of the receive data queue.
[0073] As an example, when performing a read operation on the receive data queue of a communication object, a blocking read method can be adopted, where the blocking duration can be set according to the actual situation, for example, it can be 10 ms. Since when reading data, the communication object is unknown about the timing of data arrival, that is, the communication object does not know when there will be data that can be read in its corresponding receive data queue, and adopting blocking read can monitor in real time whether there is data that can be read in the receive data queue, making the data reading have real-time performance, and can avoid the problem of the earlier written data being overwritten or data loss caused by not reading in real time after multiple data writes.
[0074] A communication method provided by an embodiment of the present application. After receiving a communication request, the communication process manager first determines the corresponding communication link based on the link identifier carried in the communication request, and then performs corresponding communication operations using a message queue based on the communication link and the communication request. Implementing communication between communication nodes based on a queue simplifies the communication implementation method, requires less code, and developers only need to complete communication between different communication nodes through fewer interfaces, improving the development efficiency of software in multi-party collaborative development. Moreover, the communication implemented based on the queue also has advantages such as strong portability and small resource occupation.
[0075] Specifically, by using the communication method provided in the embodiments of the present application, a communication node only needs to call the registration interface to register a communication link. When communicating, it only needs to call the send data interface and / or the receive data interface to send and / or receive data in a queue manner based on the registered communication link. In this way, the development efficiency of software in multi-party cooperative development is improved.
[0076] Further, based on the communication method provided in the above embodiments, the communication method may further include:
[0077] Receiving a link release request, where the link release request carries a link identifier, and canceling the corresponding communication link based on the link identifier carried in the link release request.
[0078] Among them, the link release request may be sent by either of the two communication nodes of the communication link to be canceled by calling the communication link deletion interface.
[0079] As an embodiment, canceling a communication link may include releasing the resources of the communication link and initializing the communication link object.
[0080] Further, after canceling the communication link, after receiving a call request for the data acquisition interface from the communication node that has not sent the link release request among the two communication nodes of the communication link, return information indicating that the communication link has been deleted to the communication node, so that the communication node can learn about the deletion of the communication link and facilitate timely response measures.
[0081] For the convenience of further understanding of the communication method provided in the present application, the following takes Figure 1 the communication process manager shown in the figure as an example to implement communication between the first communication node and the second communication node by using the communication method provided in the embodiments of the present application, and combines Figure 3 to describe the communication process.
[0082] As Figure 3 shown, the communication process may include the following steps:
[0083] S31. The first communication node sends a linked list registration request to the communication process manager. The linked list registration request includes a communication identifier magic and the identifiers of the first communication node and the second communication node.
[0084] S32. The communication process manager registers the corresponding communication link based on the linked list registration request and generates a link identifier corresponding to the communication link.
[0085] S33. The communication process manager sends the link identifier to the first communication node.
[0086] S34. The first communication node sends a first call request to the sending data interface of the communication process manager, and the call request carries a link identifier.
[0087] S35. The communication process manager determines the corresponding communication link based on the link identifier in the first call request, and determines the second communication node under the communication link as the communication object.
[0088] S36. The communication process manager performs a write operation on the data reception queue of the second communication node to write the data sent by the first communication node into the reception data queue.
[0089] S37. The second communication node sends a link query request to the communication process manager, and the link query request carries a communication identifier magic.
[0090] S38. The communication process manager determines the corresponding communication link based on the communication identifier magic in the link query request, and sends the link identifier of the communication link to the second communication node.
[0091] S39. The second communication node sends a second call request to the receiving data interface of the communication process manager, and the call request carries a link identifier.
[0092] S310. The communication process manager determines the corresponding communication link based on the link identifier in the second call request, and determines the second communication node under the communication link as the communication object.
[0093] S311. The communication process manager performs a read operation on the data reception queue of the second communication node to read the data written in the data reception queue.
[0094] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a communication device provided by another embodiment of the present application.
[0095] As shown in Figure 4 , the communication device provided in this embodiment may include:
[0096] A receiving module 401, configured to receive a communication request sent by a communication node;
[0097] A link search module 402, configured to search for a corresponding communication link from a pre-set communication link list based on the link identifier carried in the communication request;
[0098] An execution module 403, configured to perform corresponding communication operations using a message queue based on the communication link and the communication request.
[0099] As a possible implementation manner, the execution module 403 is specifically configured to:
[0100] If the communication request is a call request for the data sending interface in the communication process manager, determine another communication node in the communication link other than the communication node sending the communication request as the communication object;
[0101] Perform a write operation on the receive data queue corresponding to the communication object in the communication process manager to write the data sent by the communication node sending the communication request into the receive data queue.
[0102] As a possible implementation, the execution module 403 is specifically configured to:
[0103] If the communication request is a call request for the data receive interface in the communication process manager, determine the communication node sending the communication request in the communication link as the communication object;
[0104] Perform a read operation on the receive data queue corresponding to the communication object in the communication process manager to read the data written in the receive data queue.
[0105] As a possible implementation, the write operation adopts a non-blocking write mode.
[0106] As a possible implementation, the read operation adopts a blocking read mode.
[0107] As a possible implementation, the device may further include ( Figure 4 not shown in
[0108] A linked list setting module, configured to receive a link registration request, where the link registration request carries a communication identifier and two communication node identifiers; register a communication link corresponding to the communication identifier and the two communication node identifiers based on the link registration request, and generate a link identifier of the communication link; store the link identifier, the communication identifier, the two communication node identifiers, and the communication link in a pre-set data table correspondingly, so as to generate a communication linked list.
[0109] As a possible implementation, the device may further include ( Figure 4 not shown in
[0110] A sending module, configured to send the link identifier to the communication node sending the registration request after generating the link identifier of the communication linked list.
[0111] As a possible implementation, the device may further include ( Figure 4 not shown in
[0112] A query module, configured to receive a link query request carrying a communication identifier; find a link identifier corresponding to the communication identifier from the communication linked list; and send the link identifier to the communication node that sends the link query request.
[0113] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
[0114] As Figure 5 shown, the electronic device provided in this embodiment includes: at least one processor 501, a memory 502, at least one network interface 503, and other user interfaces 504. Each component in the electronic device 500 is coupled together through a bus system 505. It can be understood that the bus system 505 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all kinds of buses are labeled as the bus system 505 in the figure.
[0115] Among them, the user interface 504 may include a display, a keyboard, or a pointing device (such as a mouse, a trackball, a touchpad, or a touch screen, etc.).
[0116] It can be understood that the memory 502 in the embodiments of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synch link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The memory 502 described herein is intended to include but not be limited to these and any other suitable types of memory.
[0117] In some embodiments, the memory 502 stores the following elements, executable units, or data structures, or subsets thereof, or extended sets thereof: the operating system 5021 and the application program 5022.
[0118] Among them, the operating system 5021 includes various system programs, such as the framework layer, the core library layer, the driver layer, etc., and is used to implement various basic services and process hardware-based tasks. The application program 5022 includes various application programs, such as a media player and a browser, etc., and is used to implement various application services. The program for implementing the method of the embodiments of the present invention may be included in the application program 5022.
[0119] In the embodiments of the present invention, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application program 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:
[0120] Receiving a communication request sent by a communication node;
[0121] Find a corresponding communication link from a pre-set communication link list based on the link identifier carried in the communication request;
[0122] Based on the communication link and the communication request, perform corresponding communication operations using a message queue.
[0123] The method disclosed in the above embodiments of the present invention can be applied to or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. During implementation, the steps of the above method can be completed by the integrated logic circuit in the hardware of the processor 501 or instructions in software form. The above-mentioned processor 501 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor or completed by a combination of hardware and software units in the decoding processor. The software unit may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and combines its hardware to complete the steps of the above method.
[0124] It will be appreciated that the embodiments described herein may be implemented using hardware, software, firmware, middleware, microcode, or any combination thereof. For a hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions of this application, or any combination thereof.
[0125] For a software implementation, the techniques herein may be implemented by units that execute the functions herein. The software code may be stored in a memory and executed by a processor. The memory may be implemented within the processor or externally to the processor.
[0126] Embodiments of the present invention also provide a storage medium (computer-readable storage medium). The storage medium stores one or more programs. Here, the storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid-state drive; the memory may also include a combination of the above types of memory.
[0127] When one or more programs in the storage medium can be executed by one or more processors to implement the above communication method performed on the electronic device side.
[0128] The processor is used to execute the communication program stored in the memory to implement the following steps of the communication method performed on the electronic device side:
[0129] Receive a communication request sent by a communication node;
[0130] Based on the link identifier carried in the communication request, find the corresponding communication link from a pre-set communication linked list;
[0131] Based on the communication link and the communication request, perform corresponding communication operations using a message queue.
[0132] Regarding the device in the above embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0133] It is understandable that the same or similar parts in the above embodiments can be referred to each other, and for the content not detailed in some embodiments, reference can be made to the same or similar content in other embodiments.
[0134] It should be noted that in the description of the present application, the terms "first", "second", etc. are only used for descriptive purposes and cannot be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality of" refers to at least two.
[0135] Any process or method description in the flowchart or described in other ways herein can be understood to represent a module, segment, or part of code including one or more executable instructions for implementing a specific logical function or process. The scope of the preferred embodiments of the present application includes additional implementations, where the functions can be executed in a substantially simultaneous manner or in a reverse order according to the involved functions, rather than in the order shown or discussed, which should be understood by those skilled in the technical field of the embodiments of the present application.
[0136] It should be understood that each part of the present application can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following well-known technologies in the art can be used: discrete logic circuits with logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits with appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0137] Those of ordinary skill in the technical field can understand that all or part of the steps carried by the methods in the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.
[0138] In addition, each functional unit in the various embodiments of the present application can be integrated into a processing module, or each unit can exist physically alone, or two or more units can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. When the above integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0139] The above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disc, etc.
[0140] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples", etc., mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples.
[0141] Although the embodiments of this application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting this application. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A communication method, characterized in that, Applied to a communication process manager, the method includes: Receiving a communication request sent by a communication node; Based on the link identifier carried in the communication request, finding a corresponding communication link from a pre-set communication linked list; Based on the communication link and the communication request, performing corresponding communication operations using a message queue; Wherein, the performing corresponding communication operations using a message queue based on the communication link and the communication request includes: If the communication request is a call request for the data sending interface in the communication process manager, determining another communication node except the communication node sending the communication request under the communication link as the communication object; performing a write operation on the receive data queue corresponding to the communication object in the communication process manager to write the data sent by the communication node sending the communication request into the receive data queue; If the communication request is a call request for the data receiving interface in the communication process manager, determining the communication node sending the communication request under the communication link as the communication object; performing a read operation on the receive data queue corresponding to the communication object in the communication process manager to read the data written in the receive data queue; Wherein, the receive data queues corresponding to different communication nodes are different.
2. The method according to claim 1, characterized in that The write operation adopts a non-blocking write mode.
3. The method according to claim 1, characterized in that The read operation adopts a blocking read mode.
4. The method according to claim 1, characterized in that, The communication linked list is set in the following manner: Receiving a link registration request, which carries a communication identifier and two communication node identifiers; Registering a communication link corresponding to the communication identifier and the two communication node identifiers based on the link registration request, and generating a link identifier for the communication link; Correspondingly storing the link identifier, the communication identifier, the two communication node identifiers, and the communication link into a pre-set data table, thereby generating a communication linked list.
5. The method according to claim 4, wherein After generating the link identifier of the communication linked list, the method further includes: Sending the link identifier to the communication node that sent the registration request.
6. The method according to claim 4, characterized in that, The method further includes: Receiving a link query request, which carries a communication identifier; Finding the link identifier corresponding to the communication identifier from the communication linked list; Sending the link identifier to the communication node that sent the link query request.
7. A communication device, characterized in that, Applied to a communication process manager, the device includes: A receiving module, configured to receive a communication request sent by a communication node; A link finding module, configured to find a corresponding communication link from a pre-set communication linked list based on the link identifier carried in the communication request; An execution module, configured to perform corresponding communication operations using a message queue based on the communication link and the communication request; Wherein, the performing corresponding communication operations using a message queue based on the communication link and the communication request includes: If the communication request is a call request for the data sending interface in the communication process manager, determine another communication node other than the communication node that sends the communication request under the communication link as the communication object; perform a write operation on the receive data queue corresponding to the communication object in the communication process manager to write the data sent by the communication node that sends the communication request into the receive data queue; If the communication request is a call request for the data receiving interface in the communication process manager, determine the communication node that sends the communication request under the communication link as the communication object; perform a read operation on the receive data queue corresponding to the communication object in the communication process manager to read the data written in the receive data queue; Among them, the receive data queues corresponding to different communication nodes are different.
8. An electronic device, characterized in that, It includes: A processor and a memory, where the processor is used to execute the communication program stored in the memory to implement the communication method according to any one of claims 1-6.
Citation Information
Patent Citations
Method and device for communication between tasks in embedded real-time operating system
CN110825536A
Method And Device For Achieving Remote Manipulation
US20150201441A1