CN115801657A - Communication method, communication device thereof, electronic device, and computer storage medium - Google Patents

Communication method, communication device thereof, electronic device, and computer storage medium Download PDF

Info

Publication number
CN115801657A
CN115801657A CN202211370849.9A CN202211370849A CN115801657A CN 115801657 A CN115801657 A CN 115801657A CN 202211370849 A CN202211370849 A CN 202211370849A CN 115801657 A CN115801657 A CN 115801657A
Authority
CN
China
Prior art keywords
module
address
port
frame
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211370849.9A
Other languages
Chinese (zh)
Inventor
陈振龙
吴东
陈熙
王雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ecoflow Technology Ltd
Original Assignee
Ecoflow Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ecoflow Technology Ltd filed Critical Ecoflow Technology Ltd
Priority to CN202211370849.9A priority Critical patent/CN115801657A/en
Publication of CN115801657A publication Critical patent/CN115801657A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The application relates to a communication method and a communication device thereof, an electronic device and a computer storage medium, wherein the communication method is applied to a first module in the electronic device and comprises the following steps: when a target data frame is received through a first port, a first target address in the target data frame is obtained; if the first target address is the same as the address of the first module, acquiring data in a target data frame; and if the first target address is different from the address of the first module, determining a second port corresponding to the first target address according to the routing table, and sending a target data frame through the second port. Each module in the electronic equipment need not all set up physics port and connecting wire each other alone in this application, and when two modules were not directly continuous, can be through data in other modules in order to realize communicating to the technical problem that each module set up physics port and connecting wire each other alone to a certain extent and lead to that communication circuit is complicated, the flying wire increases has been solved.

Description

Communication method, communication device, electronic apparatus, and computer storage medium
Technical Field
The present invention relates to the field of electronic communications, and in particular, to a communication method, a communication apparatus, an electronic device, and a computer storage medium.
Background
In general, there may be multiple modules in an electronic device that need to communicate with each other. In this case, if the modules in the electronic device communicate with each other by separately providing the physical ports and the connection lines, the communication circuit is easily complicated, and the number of flying leads between the modules is increased.
Disclosure of Invention
In view of the above, it is necessary to provide a communication method, a communication apparatus thereof, and an electronic device to solve the technical problem of implementing communication between modules in the electronic device by separately providing a physical port and a connection line.
In a first aspect, the present application provides a communication method, including: when a target data frame is received through a first port, a first target address in the target data frame is obtained; if the first target address is the same as the address of the first module, acquiring data in the target data frame; and if the first target address is different from the address of the first module, determining a second port corresponding to the first target address according to a routing table, and sending the target data frame through the second port.
In the method provided in this embodiment, when a first module receives a first data frame, it may be determined whether the first module is a receiving object of the first data frame according to a first target address in the first data frame. If the first module is not the receiving object of the first data frame, the first module may determine a second port for forwarding the first data frame according to the first destination address and the routing table, and pass the first data frame to a next module in the data transmission link through the second port. That is to say, each module in the electronic equipment need not all set up physical port and connecting wire each other alone, and when two modules were not direct continuous, can be through the data realization communication in other modules to solved each module and set up physical port and connecting wire each other alone and lead to the technical problem that communication circuit is complicated, the flying wire increases to a certain extent.
In an embodiment of the application, the determining, according to the routing table, the second port corresponding to the first destination address includes: acquiring a routing table corresponding to each port of the first module; and determining the port corresponding to the routing table containing the first target address as the second port.
In the above method, the port corresponding to the routing table containing the first destination address is determined as the second port, so that the first module can send the destination data frame to the module with the first destination address through the second port.
In an embodiment of the present application, the method further includes: receiving a first detection frame through the second port, wherein a source address in the first detection frame is the first target address; recording the first target address into a routing table corresponding to the second port; if the target address of the first detection frame is the same as the address of the first module, sending a first response frame through the second port; the source address of the first response frame is the address of the first module, and the target address of the first response frame is a first target address; and if the target address of the first detection frame is different from the address of the first module, sending the first detection frame through a port except the second port.
In the method, if the target address of the first detection frame is the same as the address of the first module, that is, the receiver of the first detection frame is determined to be the first module, the first module returns a first response frame to the sender of the first detection frame after receiving the first detection frame to indicate that the first module has received the first detection frame; if the target address of the first detection frame is different from the address of the first module, that is, it is determined that the receiver of the first detection frame is not the first module, the first module sends the first detection frame through a port other than the second port after receiving the first detection frame, so that establishment of a communication path between the modules of the electronic device is facilitated.
In an embodiment of the present application, the method further includes: receiving a second response frame through the second port, wherein a source address in the second response frame is the first target address; recording the first target address into a routing table corresponding to the second port; if the destination address of the second response frame is different from the address of the first module, determining a third port corresponding to the destination address of the second response frame according to a routing table corresponding to each port of the first module; transmitting the second response frame through the third port.
In the method, after the first module receives the second response frame through the second port, if the receiver of the second response frame is not the first module, the first module determines, according to the routing table corresponding to each port of the first module, a third port corresponding to the routing table containing the target address of the second response frame as a port for forwarding the second response frame, and sends the second response frame through the third port, thereby improving the efficiency of establishing communication between the first template and the module corresponding to the first target address.
In an embodiment of the present application, the method further includes: if the target address of the second response frame is the same as the address of the first module, periodically sending a connection detection frame through the second port; the source address of the connection detection frame is the address of the first module, and the target address of the connection detection frame is the first target address; and after the connection detection frame is sent, if a connection response frame is not received within a preset time length, deleting the first target address in a routing table corresponding to the second port.
In the method, if the first module establishes communication connection with the module corresponding to the first target address, the first module periodically sends a connection detection frame to the module corresponding to the first target address through the second port to monitor whether the first module maintains the connection state between the modules corresponding to the first target address, and deletes the first target address in the routing table corresponding to the second port when a connection response frame is not received within a preset time length, so that maintenance of the routing table of the port of the first module is realized, and continuous communication connection between the first module and the module corresponding to the first target address is ensured.
In an embodiment of the present application, the method further comprises: when a preset operation event for establishing communication connection is detected, determining a second target address according to the preset operation event; generating a second detection frame according to the address of the first module and the second target address; the source address of the second detection frame is the address of the first module, and the target address of the second detection frame is the second target address; and sending the second detection frame through each port of the first module.
In the method, when a preset operation event for establishing communication connection is detected, the first module sends a second probe frame through each port of the first module to establish communication between the first module and a module corresponding to the second target address.
In a second aspect, an embodiment of the present application provides a communication apparatus, including: the device comprises an address acquisition module, a first address generation module and a second address generation module, wherein the address acquisition module is used for acquiring a first target address in a target data frame when the target data frame is received through a first port; a data obtaining module, configured to obtain data in the target data frame if the first target address is the same as the address of the first module; and the data frame sending module is used for determining a second port corresponding to the first target address according to a routing table if the first target address is different from the address of the first module, and sending the target data frame through the second port.
In the above scheme, the communication apparatus further includes: a data frame receiving module, configured to receive a first probe frame through the second port, where a source address in the first probe frame is the first target address; an address recording module, configured to record the first target address in a routing table corresponding to the second port; a first response frame sending module, configured to send a first response frame through the second port if the target address of the first probe frame is the same as the address of the first module; the source address of the first response frame is the address of the first module, and the target address of the first response frame is a first target address; a first probe frame sending module, configured to send the first probe frame through a port other than the second port if the destination address of the first probe frame is different from the address of the first module.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory for storing program instructions; and a processor for reading and executing the program instructions stored in the memory, and when the program instructions are executed by the processor, the electronic device is caused to execute the communication method.
In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores program instructions that, when executed on an electronic device, cause the electronic device to execute the above communication method.
In addition, for technical effects brought by the second aspect to the fourth aspect, reference may be made to the description related to the methods designed in the foregoing communication method section, and details are not repeated here.
In summary, in the method provided in the embodiment of the present application, when a first module receives a first data frame, it may be determined whether the first module is a receiving object of the first data frame according to a first target address in the first data frame. If the first module is not the receiving object of the first data frame, the first module may determine a second port for forwarding the first data frame according to the first destination address and the routing table, and pass the first data frame to a next module in the data transmission link through the second port. That is to say, each module in the electronic equipment need not all set up physical port and connecting wire each other alone, and when two modules were not direct continuous, can be through the data realization communication in other modules to solved each module and set up physical port and connecting wire each other alone and lead to the technical problem that communication circuit is complicated, the flying wire increases to a certain extent.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is an application scenario diagram of a communication method provided in an embodiment of the present application.
Fig. 2 is a flowchart of a communication method according to an embodiment of the present application.
Fig. 3 is a schematic diagram illustrating connection of modules in an electronic device according to an embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a default data frame format according to an embodiment of the present application.
Fig. 5 is a flowchart illustrating a first module receiving and processing a probe frame according to an embodiment of the present application.
Fig. 6 is a flowchart illustrating a process of the first module receiving and processing the second response frame according to an embodiment of the application.
Fig. 7 is a flowchart illustrating a process of sending a probe frame by a first module according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of a communication device according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of a communication device according to another embodiment of the present application.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The following detailed description will further illustrate the present application in conjunction with the above-described figures.
Detailed Description
In order that the above objects, features and advantages of the present application can be more clearly understood, a detailed description of the present application will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, and the described embodiments are merely some, but not all embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the description of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
Referring to fig. 1, a diagram of an application scenario of a communication method provided in an embodiment of the present application is shown. The communication method is applied in a plurality of modules (11, 12, 13, 14, 15, 16) of the electronic device 10. Each module of the electronic device 10 is provided with a port, and two adjacent ports can be connected by a wire through the respective ports.
For example, module 11 is provided with port 111, module 12 is provided with port 121 and port 122, module 11 is connected to port 121 of module 12 through port 111, and module 12 is connected to module 13 through port 122.
For another example, the module 13 is further provided with a port 131, a port 132, and a port 133, the module 13 is connected to the port 122 of the module 12 through the port 131, the module 13 is connected to the module 14 through the port 132, and the module 13 is connected to the module 15 through the port 133. Module 14 has port 141, module 15 has port 151 and port 152, and module 16 has port 161. Module 14 is connected to port 132 of module 13 through port 141. Module 15 is connected to port 133 of module 13 through port 151. The module 16 is connected to the port 152 of the module 15 by a port 161.
In all embodiments of the present application, a port is associated with a corresponding routing table, and addresses of modules that the port can communicate with are recorded in the routing table. In an embodiment of the present application, the port includes one or more of a Controller Area NetWork (CAN) port, a Universal Asynchronous Receiver Transmitter (UART) port, a Serial Peripheral Interface (SPI), a Bluetooth Low Energy (BLE) port, and the like.
In the embodiment of the application, communication can be realized between the modules 11 in the electronic device 10 without separately setting physical ports and connecting lines, and when two modules 11 are not directly connected, data can be transferred through other modules 11 to realize communication, thereby solving the technical problems of complicated communication circuits and increased flying lines caused by separately setting physical ports and connecting lines between the modules 11 to some extent.
It should be noted that the example in fig. 1 is only an exemplary illustration, and is not limited to this in practical application. It is understood that the electronic device 10 may be any one of mobile energy storage devices, home energy storage devices, mobile air conditioners, home air conditioners, lawn mowers, floor sweepers, smart power distribution panels, mobile phones, notebook computers, tablet computers, smart screens, and other types of electronic devices. For example, when the electronic device 10 is an energy storage device, the module 11 of the energy storage device may be a screen control board, the module 12 of the energy storage device may be a battery control board, the module 13 of the energy storage device may be an inverter control board, and the modules 14, 15 of the energy storage device may be any one or a combination of multiple kinds of modules such as a Maximum Power Point Tracking (MPPT) control board.
Referring to fig. 2, a flowchart of a communication method according to an embodiment of the present application is shown. The above communication method may be applied to the electronic device 10 shown in fig. 1. As shown in fig. 2, the communication method specifically includes the following steps, and the order of the steps in the flowchart may be changed and some steps may be omitted according to different requirements. As shown in fig. 2, the communication method in the embodiment of the present application includes steps 201 to 203.
Step 201, when a target data frame is received through a first port, a first target address in the target data frame is obtained.
The communication method provided by the present application may be applied to the first module in the electronic device 10, and the first module may be any module in the electronic device 10.
In step 201, the first port generally refers to any physical port of the first module. In the electronic device, each module is provided with at least one physical port, and the physical port can be in wired connection with other adjacent modules, so that the target data frame is the data frame received by the first module through the physical port. The first destination address is a destination address of the target data frame, and the first destination address is used for identifying a destination module for receiving the target data frame, i.e., indicating a receiver of the target data frame.
Fig. 3 is a schematic diagram illustrating connection of modules in an electronic device according to an example of the present application. In fig. 3, the electronic device includes three modules, which are module 1, module 2 and module 3, wherein module 1 is connected to module 2 and module 3, respectively. Wherein, the module 1 is connected with the port 2 of the module 2 through the port 1. When the module 2 sends the target data frame to the port 1 of the module 1 through the port 2, the module 1 may be understood as the first module, and the port 1 may be understood as the first port. The target data frame includes a first target address, and the first target address may be an address of the module 1 or an address of the module 3.
In an embodiment of the present application, the module for sending the target data frame encapsulates the target data frame according to a preset data packet format.
Fig. 4 is a schematic structural diagram of a preset data frame format according to an embodiment of the present application. The preset data frame may include a start header field, a frame type field, a source address field, a destination address field, a data length field, a data content field, and a check field. Wherein the start header field is used to indicate the start position of the frame. The frame type field is used to indicate the type of the frame. In this embodiment, the frame type corresponding to the frame type field includes a data frame, a probe frame, a response probe frame, a connection detection frame, and a response connection detection frame. The source address field indicates address information of a sender of the frame, and the destination address field indicates address information of a receiver of the frame. The data length field indicates the frame length. The data content field contains the data of the frame. The check field indicates the check bits of the frame. In an embodiment of the present application, the frame type of the target data frame is a data frame, and a target address field in the target data frame includes a first target address.
The first module receives a target data frame through a first port and acquires a first target address of the target data frame from a target address field of the target data frame.
Step 202, if the first target address is the same as the address of the first module, the data in the target data frame is obtained.
In step 202, since the first target address is used to identify a destination module that receives the target data frame, that is, to indicate a receiver of the target data frame, when any module in the electronic device receives the target data frame through the port, it may be determined whether the module acquires data in the target data frame by comparing whether the first target address is the same as its own address.
In an embodiment of the application, if the first destination address is the same as the address of the first module, indicating that the receiver of the target data frame is the first module, the first module may obtain the data in the target data frame from the data content field of the target data frame.
Step 203, if the first destination address is different from the address of the first module, determining a second port corresponding to the first destination address according to the routing table, and sending the destination data frame through the second port.
In an embodiment of the application, if the first destination address is different from the address of the first module, which indicates that the receiver of the destination data frame is not the first module, the first module may determine, according to the routing table, a second port corresponding to the first destination address, and send the destination data frame through the second port.
In an embodiment of the application, the determining, by the first module, the second port corresponding to the first destination address according to the routing table includes: acquiring a routing table corresponding to each port (for example, port 111 in fig. 1) of a first module; and determining the port corresponding to the routing table containing the first target address as a second port.
In an embodiment of the present application, each port 111 of the first module may correspond to a different routing table. The routing table of the port 111 records the addresses of the modules 11 to which the port 111 can be connected. In the embodiment of the application, the port corresponding to the routing table containing the first destination address is determined as the second port, so that the first module can send the target data frame to the module corresponding to the first destination address through the second port. For example, referring to the example shown in fig. 3, assuming that the first destination address is the same as the address of the module 3, and the port 3 of the module 1 is connected to the port 4 of the module 3, at this time, since the module 1 detects that the address of the module 3 is included in the routing table corresponding to the port 3, the module 1 may determine the port 3 as the second port, and forward the destination data frame to the module 3 through the port 3.
In the method provided by the embodiment of the present application, when a first module receives a data frame, it may be determined whether the first module is a receiving object of the first data frame according to a first target address in the data frame. If the first module is not the receiving object of the data frame, the first module can determine a second port for forwarding the first data frame according to the first target address and the routing table, and transmit the first data frame to a next module in the data transmission link through the second port, and through a data transfer mode, the technical problems that each module of the original electronic equipment needs to be provided with a physical port and a connecting line separately for realizing data transmission, so that the communication circuit is complex and the number of flying lines is increased can be effectively solved.
In an embodiment of the present application, when it is detected that the electronic device 10 is powered on or a module in the electronic device establishes a communication connection with another module, each module 11 in the electronic device 10 indicates, according to a pre-configuration document, the corresponding module to send a probe frame to the other module, so as to establish a communication connection between the modules 11. The pre-configuration document defines the communication requirements between each module 11 and the other modules. When receiving the probe frame sent by the other modules, the first module may reply the response frame to the module corresponding to the source address of the probe frame according to the probe frame, or forward the probe frame to the next module, so as to complete the process of establishing the communication connection between the modules 11 of the electronic device 10.
And when receiving the detection frame of the other module, the first module may record the source address of the detection frame on the routing table corresponding to the port receiving the detection frame, thereby establishing the routing table of each port of the first module. That is to say, the first destination address recorded in the routing table of the second port may be recorded in the routing table of the second port by the first module after receiving, through the second port, the probe frame sent by the first destination address.
Referring to fig. 5, a schematic flow chart of the first module receiving and processing a probe frame in this embodiment is shown, which specifically includes the following steps.
Step 501, a first module receives a first probe frame through a second port, where a source address in the first probe frame is a first target address.
In an embodiment of the present application, the first module receives, through the second port, the first probe frame sent by the other module. And packaging the first detection frame according to the preset data packet format. In the embodiment of the present application, the specific content of the first probe frame encapsulated according to the preset data packet format may refer to the content of the target data frame encapsulated, and is not described herein again. For example, with reference to the example shown in fig. 3, it is assumed that module 1 receives a first probe frame sent by module 3 through port 4 through port 3, and the source address of the first probe frame is the first destination address, i.e. the address of module 3. At this time, the port 3 may be understood as the above-described second port.
Step 502, record the first destination address in the routing table corresponding to the second port.
In an embodiment of the present application, the first module may record the first destination address, that is, the source address of the first probe frame, in the routing table corresponding to the second port. It can be understood that, since the first module receives the probe frame with the source address being the first destination address through the second port, which indicates that the first module can communicate with the module corresponding to the first destination address through the second port, the first module can record the first destination address in the routing table corresponding to the second port, so as to subsequently communicate with the module corresponding to the first destination address through the second port.
It should be noted that in all embodiments of the present application, a physical port of each module may be provided with a corresponding routing table, and the contents in the routing table are used to describe addresses of other physical ports communicating with the physical port.
Step 503, if the destination address of the first probe frame is the same as the address of the first module, sending a first response frame through the second port, where the source address of the first response frame is the address of the first module, and the destination address of the first response frame is the first destination address.
In an embodiment of the present application, if the target address of the first probe frame is the same as the address of the first module, that is, it is determined that the receiver of the first probe frame is the first module, the first module returns a first response frame to the sender of the first probe frame after receiving the first probe frame, so as to indicate that the first module has received the first probe frame. The source address of the first response frame is the address of the first module, which means that the sender of the first response frame is the first module. The destination address of the first response frame is a first destination address, which indicates that the receiver of the first response frame is the sender of the first probe frame. In the embodiment of the present application, the specific content of the first response frame encapsulated according to the preset data packet format may refer to the content of the target data frame encapsulated, and is not described herein again.
In step 504, if the target address of the first probe frame is different from the address of the first module, the first probe frame is sent through a port other than the second port.
In an embodiment of the application, if the destination address of the first probe frame is different from the address of the first module, that is, it is determined that the receiver of the first probe frame is not the first module, the first module sends the first probe frame through a port other than the second port after receiving the first probe frame. Specifically, the first module uses a port corresponding to a routing table that includes a destination address of the first probe frame, except the second port, as a forwarding port, and sends the first probe frame through the forwarding port. In this manner, the establishment of communication paths between the modules 11 of the electronic device 10 is facilitated.
In this embodiment, step 503 and step 504 are parallel steps, that is, step 503 and step 504 are not executed sequentially. After step 503 is performed, step 504 is not performed any more, and accordingly, after step 504 is performed, step 503 is not performed any more until the first module receives another probe frame through the second port again.
In addition, when the first module receives the response frame of the other module, the first module may record the source address of the response frame on the routing table corresponding to the port that receives the response frame, thereby establishing the routing table of each port of the first module. That is, the first destination address recorded in the routing table of the second port may be recorded in the routing table of the second port by the first module after receiving the response frame sent by the first destination address through the second port.
Referring to fig. 6, a schematic flow chart of the first module receiving and processing the second response frame in the embodiment of the present application is shown, which specifically includes the following steps.
In step 701, the first module receives a second response frame through the second port, where a source address in the second response frame is the first destination address.
In an embodiment of the application, the first module receives a second response frame sent by the module from the first destination address through the second port. In the embodiment of the present application, the specific content of the second response frame encapsulated according to the preset data packet format may refer to the content of the target data frame encapsulated as described above.
Step 702, the first module records the first destination address in a routing table corresponding to the second port.
In an embodiment of the application, regardless of whether the first destination address is an address of the first module, the first module records the first destination address in a routing table corresponding to the second port of the first module, so as to indicate that the first module can communicate with the module corresponding to the first destination address through the second port.
Step 703, if the destination address of the second response frame is not the same as the address of the first module, the first module determines a third port corresponding to the destination address of the second response frame according to the routing table corresponding to each port of the first module, and sends the second response frame through the third port.
In an embodiment of the application, if the destination address of the second response frame is different from the address of the first module, that is, the receiver of the second response frame is not the first module, the first module determines, according to the routing table corresponding to each port of the first module, a third port corresponding to the routing table including the destination address of the second response frame as a port for forwarding the second response frame, and sends the second response frame through the third port.
Step 704, if the destination address of the second response frame is the same as the address of the first module, periodically sending a connection detection frame through the second port, where the source address of the connection detection frame is the address of the first module, and the destination address of the connection detection frame is the first destination address.
In an embodiment of the present application, if the destination address of the second response frame is the same as the address of the first module, that is, the receiver of the second response frame is the first module, it indicates that the first module establishes a communication connection with the module corresponding to the first destination address. In order to maintain the connection state between the first module and the module corresponding to the first target address, the first module periodically sends a connection detection frame to the module corresponding to the first target address through the second port to monitor whether the first module maintains the connection state between the modules corresponding to the first target address. In the embodiment of the present application, the specific content of the connection detection frame encapsulated according to the preset data packet format may refer to the content of the target data frame encapsulated as described above.
Step 705, after sending the connection detection frame, if the connection response frame is not received within the preset time period, the first module deletes the first destination address in the routing table corresponding to the second port.
In an embodiment of the application, after the first module sends the connection detection frame, if the connection response frame is not received within the preset time duration, it indicates whether the first module keeps the modules corresponding to the first target address in a disconnected state, and the first module modifies the routing table corresponding to the second port, for example, deletes the first target address or the address of the module connected to the second port in the routing table corresponding to the second port, and resends the probe frame pointing to the first target address. Therefore, the maintenance of the routing table of the port of the first module is realized, and the continuous communication connection between the first module and the module corresponding to the first target address is ensured.
In an embodiment of the present application, the first module may further send a probe frame to other modules of the electronic device 10 to complete a process of establishing a communication connection between the modules 11 of the electronic device 10. Referring to fig. 7, a schematic flow chart of sending a probe frame by a first module in an embodiment of the present application is shown, which specifically includes the following steps.
Step 601, when a preset operation event for establishing a communication connection is detected, the first module determines a second target address according to the preset operation event.
In an embodiment of the present application, the predetermined operation event includes at least one of an operation of starting the electronic device 10 or an operation of triggering modules of the electronic device 10 to establish a communication connection. For example, the user may press a power-on button of the electronic device 10 to input an operation to start the power-on of the electronic device 10. For another example, the user may trigger the operation of the modules of the electronic device 10 to establish a communication connection by adding a new module or resetting a communication path between the modules in the electronic device 10. When a preset operation event for establishing communication connection is detected, the first module determines the address of a module needing to communicate with the first module, namely a second target address, from the pre-configuration document.
Step 602, the first module generates a second probe frame according to the address of the first module and a second target address, where a source address of the second probe frame is the address of the first module, and a target address of the second probe frame is the second target address.
In an embodiment of the present application, the first module uses an address of the first module as a source address of the second probe frame, and uses a second destination address of a module that needs to establish communication with the first module as a destination address of the second probe frame. In an embodiment of the present application, specific contents of the second probe frame encapsulated according to the preset data packet format may refer to the contents of the target data frame encapsulated as described above.
Step 603, the first module sends a second probe frame through each port of the first module.
In an embodiment of the present application, the first module sends the second probe frame through each port of the first module, so as to establish communication between the first module and the module corresponding to the second target address.
Fig. 8 is a schematic structural diagram of a communication device 100 according to an embodiment of the present disclosure. The communication device 100 may be used to implement the communication method described above.
Specifically, the communication device 100 includes an address acquisition module 101, a data acquisition module 102, and a data frame transmission module 103.
The address obtaining module 101 is configured to obtain a first target address in a target data frame when the target data frame is received through a first port.
The data obtaining module 102 is configured to obtain data in the target data frame when the first target address is the same as the address of the first module;
the data frame sending module 103 is configured to determine, according to a routing table, a second port corresponding to the first destination address when the first destination address is different from the address of the first module, and send the target data frame through the second port.
As an embodiment, the data frame sending module 103 is specifically configured to obtain a routing table corresponding to each port of the first module; and determining the port corresponding to the routing table containing the first target address as the second port.
Fig. 9 is a schematic structural diagram of a communication device 100' according to another embodiment of the present application. The communication device 100' may be used to implement the above-described communication method.
Specifically, the communication device 100' includes, in addition to the address obtaining module 101, the data obtaining module 102, and the data frame sending module 103, a data frame receiving module 104, a first address recording module 105, a first response frame sending module 106, and a first probe frame sending module 107.
A data frame receiving module 104, configured to receive a first probe frame through the second port, where a source address in the first probe frame is the first target address.
A first address recording module 105, configured to record the first target address into a routing table corresponding to the second port.
A first response frame sending module 106, configured to send a first response frame through the second port if the target address of the first probe frame is the same as the address of the first module; and the source address of the first response frame is the address of the first module, and the target address of the first response frame is a first target address.
A first probe frame sending module 107, configured to send the first probe frame through a port other than the second port if the target address of the first probe frame is different from the address of the first module.
As an embodiment, the communication device 100' further comprises:
and a second response frame receiving module, configured to receive a second response frame through the second port, where a source address in the second response frame is the first target address.
And the second address recording module is used for recording the first target address into a routing table corresponding to the second port.
And a port determining module, configured to determine, according to a routing table corresponding to each port of the first module, a third port corresponding to the target address of the second response frame if the target address of the second response frame is different from the address of the first module.
And the second response frame sending module is used for sending the second response frame through the third port.
As an embodiment, the communication device 100' further comprises:
a connection detection frame sending module, configured to periodically send a connection detection frame through the second port if the target address of the second response frame is the same as the address of the first module; and the source address of the connection detection frame is the address of the first module, and the target address of the connection detection frame is the first target address.
And the connection response frame receiving module is used for deleting the first target address in a routing table corresponding to the second port if the connection response frame is not received within a preset time length after the connection detection frame is sent.
As an embodiment, the communication device 100' further comprises:
and the target address determining module is used for determining a second target address according to a preset operation event when the preset operation event for establishing the communication connection is detected.
A detection frame generation module, configured to generate a second detection frame according to the address of the first module and the second target address; the source address of the second probe frame is the address of the first module, and the target address of the second probe frame is the second target address.
A second probe frame sending module, configured to send the second probe frame through each port of the first module.
The present application also provides a computer-readable storage medium. The computer readable storage medium stores a plurality of instructions adapted to be loaded and executed by a processor to implement the respective steps of the above-described communication method, such as steps 201-203, steps 501-504, steps 601-603, and steps 701-705.
Please refer to fig. 10, which is a schematic structural diagram of an electronic device 10 according to an embodiment of the present disclosure. The electronic device 10 may include at least one processor 17, memory 18. The memory 18 comprises a computer readable storage medium for storing a plurality of logic instructions that can be executed by the processor 17 to perform the above-described communication method.
The logic instructions in the computer-readable storage medium can be implemented in the form of software functional units and stored in a computer-readable storage medium when the logic instructions are sold or used as independent products.
The computer-readable storage medium may be configured to store a software program, a computer-executable program, such as program instructions corresponding to the communication method in the embodiment of the present application or modules in the communication apparatus 100 or the communication apparatus 100'. The processor 17 executes the functional application and the image processing, that is, implements the communication method in the above-described embodiments, by executing the software program, instructions, or modules stored in the computer-readable storage medium.
In embodiments of the present application, the computer-readable storage medium includes non-volatile computer-readable storage, such as disks, memory, and the like. It will be appreciated that the computer-readable storage medium may also include other non-volatile computer-readable memory, such as a plug-in hard drive, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one Flash memory device, and/or other non-volatile solid state memory devices.
In the embodiment of the present Application, the Processor 17 may be a Central Processing Unit (CPU), or may be other general-purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, a discrete hardware component, or the like. The processor 17 is the control center of the electronic device 10 and may be connected to other devices and/or systems/modules/units using various interfaces and lines to provide communication functions to applications of the other devices and/or systems/modules/units.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A communication method is applied to a first module in an electronic device, and comprises the following steps:
when a target data frame is received through a first port, a first target address in the target data frame is obtained;
if the first target address is the same as the address of the first module, acquiring data in the target data frame;
and if the first target address is different from the address of the first module, determining a second port corresponding to the first target address according to a routing table, and sending the target data frame through the second port.
2. The communication method as claimed in claim 1, wherein said determining the second port corresponding to the first destination address according to the routing table comprises:
obtaining a routing table corresponding to each port of the first module;
and determining a port corresponding to a routing table containing the first target address as the second port.
3. The communication method of claim 1, wherein the method further comprises:
receiving a first detection frame through the second port, wherein a source address in the first detection frame is the first target address;
recording the first target address into a routing table corresponding to the second port;
if the target address of the first detection frame is the same as the address of the first module, sending a first response frame through the second port; the source address of the first response frame is the address of the first module, and the target address of the first response frame is the first target address;
and if the target address of the first detection frame is different from the address of the first module, sending the first detection frame through a port except the second port.
4. The communication method of claim 1, wherein the method further comprises:
receiving a second response frame through the second port, wherein a source address in the second response frame is the first target address;
recording the first target address into a routing table corresponding to the second port;
if the target address of the second response frame is different from the address of the first module, determining a third port corresponding to the target address of the second response frame according to a routing table corresponding to each port of the first module;
transmitting the second response frame through the third port.
5. The communication method of claim 4, wherein the method further comprises:
if the target address of the second response frame is the same as the address of the first module, periodically sending a connection detection frame through the second port; the source address of the connection detection frame is the address of the first module, and the target address of the connection detection frame is the first target address;
and after the connection detection frame is sent, if a connection response frame is not received within a preset time length, deleting the first target address in a routing table corresponding to the second port.
6. The communication method according to any of claims 1 to 5, wherein the method further comprises:
when a preset operation event for establishing communication connection is detected, determining a second target address according to the preset operation event;
generating a second detection frame according to the address of the first module and the second target address; the source address of the second detection frame is the address of the first module, and the target address of the second detection frame is the second target address;
and sending the second detection frame through each port of the first module.
7. A communication apparatus, applied to a first module in an electronic device, the apparatus comprising:
the device comprises an address acquisition module, a first address generation module and a second address generation module, wherein the address acquisition module is used for acquiring a first target address in a target data frame when the target data frame is received through a first port;
a data obtaining module, configured to obtain data in the target data frame if the first target address is the same as the address of the first module;
and the data frame sending module is used for determining a second port corresponding to the first target address according to a routing table if the first target address is different from the address of the first module, and sending the target data frame through the second port.
8. The communications apparatus of claim 7, the apparatus further comprising:
a data frame receiving module, configured to receive a first probe frame through the second port, where a source address in the first probe frame is the first target address;
an address recording module, configured to record the first target address in a routing table corresponding to the second port;
a first response frame sending module, configured to send a first response frame through the second port if the target address of the first probe frame is the same as the address of the first module; the source address of the first response frame is the address of the first module, and the target address of the first response frame is a first target address;
a first probe frame sending module, configured to send the first probe frame through a port other than the second port if the destination address of the first probe frame is different from the address of the first module.
9. An electronic device, characterized in that: the electronic device comprises a processor for implementing the communication method according to any one of claims 1 to 6 when executing a computer program stored in a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to implement the communication method according to any one of claims 1 to 6.
CN202211370849.9A 2022-11-03 2022-11-03 Communication method, communication device thereof, electronic device, and computer storage medium Pending CN115801657A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211370849.9A CN115801657A (en) 2022-11-03 2022-11-03 Communication method, communication device thereof, electronic device, and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211370849.9A CN115801657A (en) 2022-11-03 2022-11-03 Communication method, communication device thereof, electronic device, and computer storage medium

Publications (1)

Publication Number Publication Date
CN115801657A true CN115801657A (en) 2023-03-14

Family

ID=85435313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211370849.9A Pending CN115801657A (en) 2022-11-03 2022-11-03 Communication method, communication device thereof, electronic device, and computer storage medium

Country Status (1)

Country Link
CN (1) CN115801657A (en)

Similar Documents

Publication Publication Date Title
CN102916866B (en) A kind of data sharing method, terminal, server and system
US20160037429A1 (en) Low cost mesh network capability
CN103905447A (en) Service link selection control method and device
CN104135339A (en) Bluetooth low-power-consumption communication method, Bluetooth equipment and system
CN111464419B (en) Data transmission control method based on bus network communication
US20120225621A1 (en) Electronic device with the function of supporting multiple cards
CN104333913A (en) Electronic device and online setting method of external network and electronic device
CN104936258A (en) Network access method, terminal and system
JP7046983B2 (en) Packet transmission method and equipment
CN112422485B (en) Communication method and device of transmission control protocol
CN113014510B (en) Data caching method and device in distributed test of inertial navigation system
CN104125656A (en) Device connection method, electronic device and connection system
CN105812413A (en) Communication method and device
CN110247926A (en) A kind of exchange method and system
CN101459670A (en) Electronic device for communication within a network and method for operating an electronic device
JP7201676B2 (en) Feedback response information transmission method and related products
TWI221224B (en) Method for controlling wireless network access through wired network access interface and associated computer system
CN104348728A (en) Method and equipment for generating forwarding information
CN115801657A (en) Communication method, communication device thereof, electronic device, and computer storage medium
CN115022424B (en) Hydropower LCU controller network card virtual control method, system, equipment and medium thereof
CN106330787B (en) Data packet transmission method, equipment and system
JP2007221522A (en) Polling device, terminal device, polling method and program
CN114116574A (en) Data transmission method and device, electronic equipment and storage medium
CN108712373B (en) Unidirectional communication method, device, user terminal and computer readable storage medium
CN109714734B (en) DMR system, wireless communication method and device of DMR and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination