Detailed Description
Referring to fig. 1, the terminal communication method in an embodiment may be applied to a terminal in communication with an unmanned aerial vehicle and a network server, and the terminal may be a mobile terminal. The terminal communication method includes the following steps.
S110: searching for the communication unmanned aerial vehicle, and establishing P2P (Peer-to-Peer Peer-to-Peer) communication with the communication unmanned aerial vehicle through the WiFi module.
The communication unmanned aerial vehicle searches for a determined communication object, and specifically can search through the nodes of the searching equipment. After searching the communication unmanned aerial vehicle, the terminal establishes P2P communication with the communication unmanned aerial vehicle through the internal WiFi module. The P2P communication can be realized by adding the required functional modules to the terminal operating system. For example, a wpa _ supplicant Java call library is added in addroid sdk (software development kit) of a JNI (Java native invocation) layer of an addrod system, and a P2P implementation module and a configuration file are added in a Java application layer.
S120: whether the WiFi module is in communication connection with a network server in an STA (Station) mode is detected.
The network server is a server which communicates with the WiFi module and other remote devices through a network, and specifically, the corresponding server may be searched as the network server according to an external network identifier of a WLAN (Wireless LAN Wireless local area network).
The working modes of the WiFi module include an STA mode and an AP (Access Point) mode. The WiFi module working in the AP mode provides wireless access service, allows other wireless equipment to access and provides data access; the WiFi module operating in the STA mode may be connected to the WiFi module operating in the AP mode. When the terminal is connected with the network server in a WiFi mode, the WiFi module of the terminal works in an STA mode, and the WiFi module at the network server works in an AP mode.
Detecting whether the WiFi module is in communication connection with the network server in the STA mode, specifically testing whether data can be transmitted and received by connecting the network server through the STA mode of the WiFi module, if so, indicating that the WiFi module can be in communication connection with the network server in the STA mode, and executing step S130; otherwise, step S140 is executed.
S130: and the STA mode of the WiFi module is adopted to communicate with the network server.
S140: a cellular mobile network is employed to communicate with a network server.
The cellular mobile network includes 4G, 3G, 2G, and the like networks.
By detecting the STA mode of the WiFi module, when the STA mode of the WiFi module is in communication connection with the network server, the STA mode of the WiFi module is adopted to communicate with the network server, otherwise, the mobile communication network is adopted, so that the STA mode is set as the optimal mode for communicating with the network server, and the cellular mobile network is set as the alternative mode.
The terminal communication method can be applied to terminals which are respectively communicated with the unmanned aerial vehicle and the network server, P2P communication is established with the searched communication unmanned aerial vehicle through the WiFi module, and data are transmitted with the communication unmanned aerial vehicle through P2P communication; whether the WiFi module is in communication connection with the network server in the STA mode or not is detected, if yes, the STA mode of the WiFi module is adopted for communication with the network server, and otherwise, the cellular mobile network is adopted for communication with the network server. Therefore, when the WiFi module is adopted to communicate with the communication unmanned aerial vehicle P2P, the STA mode of the WiFi module can be supported to communicate with the network server, the transfer communication between the communication unmanned aerial vehicle and the network server is realized, the Bluetooth transmission with low transmission efficiency is not needed, the problem that the communication with the network server cannot be carried out any more due to the default setting mode that the WiFi priority is greater than 4G is avoided, and the reliability of data transmission is high; in addition, the STA mode of the WiFi module is preferentially selected by detecting whether the STA mode of the WiFi module is in communication connection with the network server or not, so that the traffic cost generated by cellular mobile network communication is reduced, and the communication cost is reduced.
In one embodiment, step S110 includes steps (a 1) to (a 4).
Step (a 1): and receiving a scanning instruction, scanning the identification code according to the scanning instruction to obtain a scanning verification sequence, and acquiring a scanning node from the scanning verification sequence.
The scan command may be manually input by a user, for example, the user clicks a scan function of the terminal interface, and the scan command is input accordingly. The identification code refers to an identifier carrying information, and can include any one of a bar code and a two-dimensional code, and each unmanned aerial vehicle corresponds to a unique identification code. In this embodiment, the information carried by the identification code is a scanning verification sequence; the scanning verification sequence includes information such as scanning node, device name, and device SSID (service set identifier). And scanning the identification code to obtain a corresponding scanning verification sequence and scanning nodes in the scanning verification sequence.
Step (a 2): searching nodes in a preset geographic range, and searching nodes consistent with the scanning nodes from the searched nodes.
The preset geographical range can be specifically set according to actual conditions. There may be a plurality of nodes searched within the preset geographic range, and by comparing the searched nodes with the scanning nodes, the nodes consistent with the scanning nodes can be searched.
Step (a 3): and taking the equipment corresponding to the node consistent with the scanning node as the communication unmanned aerial vehicle.
The searched nodes are consistent with the scanning nodes, and the device corresponding to the searched nodes is represented as a device needing communication and can be used as a communication unmanned aerial vehicle.
Step (a 4): and sending the scanning verification sequence to the communication unmanned aerial vehicle for communication with the communication unmanned aerial vehicle P2P when the communication unmanned aerial vehicle passes the scanning verification sequence.
After the scanning verification sequence is sent to the communication unmanned aerial vehicle, the communication unmanned aerial vehicle carries out verification, when the verification is passed, the communication unmanned aerial vehicle initiates a P2P session, and the terminal can join the P2P session to carry out P2P communication with the communication unmanned aerial vehicle.
The scanning verification sequence is obtained in the steps (a 1) to (a 4) in a mode of scanning the identification code, the communication unmanned aerial vehicle is determined according to the scanning verification sequence, and the scanning verification sequence is sent to the communication unmanned aerial vehicle, so that P2P communication is carried out, manual input of the verification code is not needed, and the operation is convenient.
In an embodiment, after the step (a 3) and before the step (a 4), the method further includes: and generating and displaying prompt information, and judging whether a communication instruction input according to the prompt information is received. If yes, executing step (a 4); if not, whether a rescan command is received is judged, and when the rescan command is received, the process returns to the step (a 1).
The prompt message is used for informing the user of the scanning verification sequence corresponding to the communication unmanned aerial vehicle searched, and inquiring whether to send the scanning verification sequence. The communication instruction is used for indicating to send a scanning verification sequence, and the rescan instruction is used for indicating to rescan the identification code. If the communication instruction is received, the communication instruction is used for agreeing to send a scanning verification sequence to the communication unmanned aerial vehicle; if receiving the rescan instruction, it indicates that the user does not agree to send the scan verification sequence to the current communication unmanned aerial vehicle, and the identification code needs to be rescanned. By generating and displaying the prompt information, the user can actively select the prompt information according to the requirement, and the autonomous selectivity of the user is improved.
In another embodiment, step S110 includes steps (b 1) to (b 3).
Step (b 1): searching nodes in a preset geographic range, and generating and displaying a terminal node list according to the searched nodes.
One node corresponds to one device, and the corresponding device can be searched by searching the nodes in the preset geographic range. By generating and displaying the terminal node list, the user can conveniently view and select the searched nodes.
Step (b 2): and receiving a node selection instruction, determining a selected node from the terminal node list according to the node selection instruction, and taking the equipment corresponding to the selected node as the communication unmanned aerial vehicle.
The node selection instruction can be manually input by a user, for example, the user clicks a node to be selected in the terminal node list, and the node selection instruction is correspondingly input.
Step (b 3): and receiving an input verification sequence, sending the input verification sequence to the communication unmanned aerial vehicle, and communicating with the communication unmanned aerial vehicle P2P when the communication unmanned aerial vehicle passes the verification of the input verification sequence.
The input verification sequence may be manually entered by the user. After the verification sequence is input and sent to the communication unmanned aerial vehicle, the communication unmanned aerial vehicle conducts verification, when the verification is passed, the communication unmanned aerial vehicle initiates a P2P session, and the terminal can join the P2P session to conduct P2P communication with the communication unmanned aerial vehicle.
In the steps (b 1) to (b 3), a terminal node list is displayed, so that a user can conveniently select from the devices corresponding to the nodes, and the selection diversity is improved.
In an embodiment, referring to fig. 2, step S150 is further included after step S110.
S150: and detecting the transmission rate and the communication quality of P2P communication between the WiFi module and the communication unmanned aerial vehicle, and obtaining and displaying a detection result.
The transmission rate refers to the rate of receiving and transmitting data in the communication process, and can be detected and analyzed by detecting the time difference between the transmitted data and the received data; the communication quality refers to the strength of signals communicated by the P2P, and the signals can be tested by adopting test software. By detecting and displaying the transmission rate and the communication quality of the P2P communication, the user can know the communication quality in time.
In an embodiment, with continued reference to fig. 2, step S110 is followed by step S160 and step S170.
S160: and detecting whether the P2P communication between the WiFi module and the communication unmanned aerial vehicle is timed out.
If the P2P communication timeout is detected, it indicates that the communication link between the WiFi module and the communication drone is disconnected, and at this time, step S170 is executed. It is understood that step S160 may be performed simultaneously with step S150, or may be performed after step S150.
In one embodiment, step S160 includes steps (c 1) to (c 4).
Step (c 1): and judging whether a response timeout signal sent by the communication unmanned aerial vehicle is received.
The response time-out signal is used to indicate a communication time-out, and is sent by the communicating drone after detecting a P2P communication time-out. If a response time-out signal is received, indicating that the communication link is disconnected, step (c 2) is performed.
Step (c 2): and judging the communication timeout of the P2P between the WiFi module and the communication unmanned aerial vehicle.
By judging whether a response timeout signal sent by the communication unmanned aerial vehicle is received or not, the communication timeout of the P2P is judged when the timeout signal is received, and the operation is simple.
Step (c 3): and judging whether a receiving response signal returned by the communication unmanned aerial vehicle is received within a preset time after the data is sent to the communication unmanned aerial vehicle.
The preset duration can be specifically set according to actual needs. In the data transmission process of P2P communication, after receiving data sent by the sender, the receiver returns a receive response signal to inform the sender that the data has been received. And if the receiving response signal returned by the communication unmanned aerial vehicle is not received within the preset time after the data is sent to the communication unmanned aerial vehicle, the communication link is disconnected, and at this time, the step (c 4) is executed.
Step (c 4): and judging the communication timeout of the P2P between the WiFi module and the communication unmanned aerial vehicle.
The data are actively sent to the communication unmanned aerial vehicle for detection, if the receiving response signal is not received within the preset time after the data are sent, the P2P communication timeout is judged, and the detection accuracy is high.
In this embodiment, step S160 includes steps (c 1) to (c 4), and the P2P communication timeout is detected by detecting whether the response timeout signal is received or not and detecting whether the response signal is received within the preset time period after the data is sent, so as to avoid missing detection and further improve the detection accuracy. It is understood that, in other embodiments, step S160 may also include only step (c 1) and step (c 2), or only step (c 3) and step (c 4).
S170: and establishing P2P communication with the communication unmanned aerial vehicle through the WiFi module again.
When the P2P communication timeout is detected, the P2P communication is established with the communication unmanned aerial vehicle again, so that automatic reconnection after network disconnection can be realized, and the reliability of communication is further improved.
In an embodiment, please continue to refer to fig. 2, step S170 is followed by step S180 and step S190.
S180: and recording the connection times of establishing P2P communication with the communication unmanned aerial vehicle again through the WiFi module.
By recording the number of times of connection, it can be known that step S170 is currently repeatedly performed for the number of times. The method for recording the connection times can comprise the following steps: and taking zero as the initial number, after the step S170 is executed, adding one to the initial number to obtain an updated initial number, and taking the updated initial number as the current connection number.
S190: and judging whether the connection times are less than the preset times. If yes, the process returns to step S160.
The preset times can be set according to actual needs. And comparing the connection times with the preset times, if the connection times are less than the preset times, returning to the step S160 to detect whether the P2P is overtime again, so as to automatically reestablish the P2P communication again when the P2P network disconnection is detected again. If the connection times is greater than or equal to the preset times, the process does not return to step S160. Therefore, the program occupation caused by repeated operation can be avoided, and the program space utilization rate is improved.
In an embodiment, step S110 is followed by: and receiving a communication ending instruction, and disconnecting the P2P communication between the WiFi module and the communication unmanned aerial vehicle according to the communication ending instruction.
The communication ending instruction is used for indicating ending of communication and can be manually input or remotely input by a user after the terminal completes a data transmission task. By disconnecting the P2P communication according to the received communication ending instruction, the network disconnection of user operation can be realized, the continuous occupation of the program after the data transmission task is completed is avoided, and the space utilization rate of the program is further improved.
Referring to fig. 3, the terminal communication device in an embodiment may be applied to a terminal that communicates with an unmanned aerial vehicle and a network server, and the terminal may be a mobile terminal. The terminal communication device includes a P2P communication establishing module 110, an STA mode detecting module 120, a first mode selecting module 130 and a second mode selecting module 140.
The P2P communication establishment module 110 is used to search for a communicating drone and establish P2P communication with the communicating drone through the WiFi module.
The STA mode detection module 120 is configured to detect whether the WiFi module is communicatively connected to the network server in the STA mode.
The first mode selection module 130 is configured to communicate with the network server in the STA mode of the WiFi module when the WiFi module is in communication connection with the network server in the STA mode.
The second mode selection module 140 is configured to communicate with the network server using the cellular mobile network when the WiFi module is not communicatively connected to the network server in the STA mode.
The terminal communication device can be applied to terminals which are respectively communicated with an unmanned aerial vehicle and a network server, the communication unmanned aerial vehicle is searched through the P2P communication establishing module 110, P2P communication is established with the communication unmanned aerial vehicle through the WiFi module, and data are transmitted with the communication unmanned aerial vehicle through P2P communication; the STA mode detection module 120 detects whether the WiFi module is in communication connection with the network server in the STA mode, the first mode selection module 130 adopts the STA mode of the WiFi module to communicate with the network server when the WiFi module can be in communication connection with the network server in the STA mode, and the second mode selection module 140 adopts the cellular mobile network to communicate with the network server when the WiFi module is not in communication connection with the network server in the STA mode. Therefore, when the WiFi module is adopted to communicate with the communication unmanned aerial vehicle P2P, the STA mode of the WiFi module can be supported to communicate with the network server, the transfer communication between the communication unmanned aerial vehicle and the network server is realized, the Bluetooth transmission with low transmission efficiency is not needed, the problem that the communication with the network server cannot be carried out any more due to the default setting mode that the WiFi priority is greater than 4G is avoided, and the reliability of data transmission is high; in addition, the STA mode of the WiFi module is preferentially selected by detecting whether the STA mode of the WiFi module is in communication connection with the network server or not, so that the traffic cost generated by cellular mobile network communication is reduced, and the communication cost is reduced.
In one embodiment, the P2P communication setup module 110 includes an identification code scanning unit (not shown), a coherent node searching unit (not shown), a communication drone determining unit (not shown), and a scan verification sequence transmitting unit (not shown).
The identification code scanning unit is used for receiving a scanning instruction, scanning the identification code according to the scanning instruction to obtain a scanning verification sequence, and acquiring a scanning node from the scanning verification sequence.
The consistent node searching unit is used for searching nodes in a preset geographic range and searching nodes consistent with the scanning nodes from the searched nodes.
The communication unmanned aerial vehicle determining unit is used for taking the equipment corresponding to the node consistent with the scanning node as the communication unmanned aerial vehicle.
The scanning verification sequence sending unit is used for sending the scanning verification sequence to the communication unmanned aerial vehicle so that the communication unmanned aerial vehicle can communicate with the communication unmanned aerial vehicle P2P when the communication unmanned aerial vehicle passes the scanning verification sequence.
The scanning verification sequence is acquired by adopting a scanning identification code mode, the communication unmanned aerial vehicle is determined according to the scanning verification sequence, and the scanning verification sequence is sent to the communication unmanned aerial vehicle, so that P2P communication is carried out, verification codes do not need to be manually input, and the operation is convenient and fast.
In an embodiment, the P2P communication establishing module 110 further includes a communication prompting module (not shown) for generating and displaying prompting information after executing the function of the communication drone determining unit, and determining whether a communication instruction input according to the prompting information is received. If yes, controlling a scanning verification sequence sending unit to execute a corresponding function; if not, whether a rescan instruction is received or not is judged, and when the rescan instruction is received, the identification code scanning unit is controlled to execute the corresponding function. By generating and displaying the prompt information, the user can actively select the prompt information according to the requirement, and the autonomous selectivity of the user is improved.
In another embodiment, the P2P communication setup module 110 includes a node search unit (not shown), a selection instruction response unit (not shown), and an input authentication sequence transmission unit (not shown).
The node searching unit is used for searching nodes in a preset geographic range, and generating and displaying a terminal node list according to the searched nodes.
The selection instruction response unit is used for receiving a node selection instruction, determining a selected node from the terminal node list according to the node selection instruction, and taking equipment corresponding to the selected node as the communication unmanned aerial vehicle.
The input authentication sequence sending unit is used for receiving the input authentication sequence and sending the input authentication sequence to the communication unmanned aerial vehicle so that the communication unmanned aerial vehicle can communicate with the communication unmanned aerial vehicle P2P when the communication unmanned aerial vehicle passes the input authentication sequence.
By adopting the mode of displaying the terminal node list, a user can conveniently select from the equipment corresponding to the nodes, and the selection diversity is improved.
In an embodiment, referring to fig. 4, the terminal communication device further includes a communication detection module 150, configured to detect a transmission rate and a communication quality of P2P communication between the WiFi module and the communication drone, and obtain and display a detection result. By detecting and displaying the transmission rate and the communication quality of the P2P communication, the user can know the communication quality in time.
In one embodiment, with continued reference to fig. 4, the end communication device further includes a timeout detection module 160 and a re-communication module 170.
The timeout detection module 160 is configured to detect whether P2P communication between the WiFi module and the communication drone is timed out.
In an embodiment, the timeout detecting module 160 is specifically configured to: judging whether a response overtime signal sent by the communication unmanned aerial vehicle is received or not, and if the response overtime signal sent by the communication unmanned aerial vehicle is received, judging that the P2P communication between the WiFi module and the communication unmanned aerial vehicle is overtime; and/or the P2P communication timeout between the WiFi module and the communication unmanned aerial vehicle is judged if a receiving response signal returned by the communication unmanned aerial vehicle is received within a preset time after the data is sent to the communication unmanned aerial vehicle, and if the receiving response signal returned by the communication unmanned aerial vehicle is not received within the preset time.
The re-communication module 170 is configured to re-establish P2P communication with the communication drone through the WiFi module when detecting a P2P communication timeout between the WiFi module and the communication drone.
In an embodiment, with continuing reference to fig. 4, the terminal communication device further includes a reconnection recording module 180, configured to record connection times for reestablishing P2P communication with the communication drone through the WiFi module, and determine whether the connection times are less than a preset number of times; when the connection times are less than the preset times, the control timeout detection module detects whether the P2P communication between the WiFi module and the communication unmanned aerial vehicle is timeout again. Therefore, the program occupation caused by repeated operation can be avoided, and the program space utilization rate is improved.
Referring to fig. 5, in an embodiment, the communication method for the drone may be applied to the drone, and the communication method for the drone includes the following steps.
S210: and receiving a starting instruction, and starting the P2P process of the WiFi module according to the starting instruction.
The starting instruction is used for instructing to start the P2P process, and may be input remotely or manually by a user, for example, a starting button is provided on the drone, and when the user presses the starting button, the user correspondingly indicates to input the starting instruction. In order to enable the WiFi module to support P2P communication, before step S210, a driver supporting WiFi-P2P needs to be added to a kenel layer of the system, and implemented at the bottom of a P2P interface where a wpa-application is added to an application configuration layer.
S220: searching nodes in a preset geographic range, and generating an unmanned aerial vehicle node list according to the searched nodes.
The preset geographical range can be specifically set according to actual conditions. One node corresponds to one device, and the corresponding device can be searched by searching the nodes in the preset geographic range.
S230: and receiving a verification sequence sent by the terminal, and judging whether the node corresponding to the terminal is in the unmanned aerial vehicle node list.
The verification sequence comprises a scanning verification sequence obtained by scanning the identification code by the terminal and an input verification sequence received by the terminal. After receiving the verification sequence sent by the terminal, the node of the terminal sending the verification sequence can be acquired, so as to determine whether the node corresponding to the terminal is in the node list of the unmanned aerial vehicle, if so, it indicates that the terminal sending the verification sequence can be searched, and it is ensured that the communication is accurate, and at this time, step S240 is executed.
S240: the terminal is used as a communication terminal, and the verification sequence is checked.
And when the node corresponding to the terminal is detected to be in the unmanned aerial vehicle node list, the unmanned aerial vehicle can search the terminal sending the verification sequence, and at the moment, the terminal is used as a communication terminal and the verification sequence is verified. And checking the verification sequence, specifically comparing the verification sequence with a preset sequence, and if the verification sequence is consistent with the preset sequence, indicating that the verification is passed.
S250: and when the verification sequence passes, opening a P2P session, and establishing P2P communication with the communication terminal through the P2P session.
And opening the P2P session, namely creating the role of group owner to provide a network access point, so that the communication terminal corresponding to the verified authentication sequence can establish P2P communication in the role of client and associated with the group owner.
The unmanned aerial vehicle communication method can be applied to an unmanned aerial vehicle, by receiving a starting instruction, starting a P2P process of a WiFi module according to the starting instruction, searching nodes within a preset geographic range, and generating an unmanned aerial vehicle node list according to the searched nodes; receiving a verification sequence sent by a terminal, and judging whether a node corresponding to the terminal is in an unmanned aerial vehicle node list or not; if yes, the terminal is used as a communication terminal, the verification sequence is checked, a P2P session is opened when the verification of the verification sequence is passed, and P2P communication is established with the communication terminal through a P2P session. Like this, adopt the mode of P2P communication to communicate with communication terminal for communication terminal still can support to communicate with the network server with the STA mode of wiFi module when communicating with unmanned aerial vehicle P2P, simultaneously, compare in using the bluetooth, transmission distance is longer and transmission rate is high, has improved data transmission's reliability.
In an embodiment, referring to fig. 6, step S250 is followed by step S260 and step S270.
S260: it is detected whether the P2P communication with the communication terminal is timed out.
If the communication timeout of P2P is detected, it indicates that the communication link with the communication terminal is disconnected, and then step S270 is executed.
In one embodiment, step S260 includes steps (d 1) to (d 4).
Step (d 1): and judging whether a response overtime signal sent by the communication terminal is received.
The response time-out signal is used for indicating communication time-out, and is sent after the communication terminal detects P2P communication time-out. If a response time-out signal is received, indicating that the communication link is disconnected, step (d 2) is performed.
Step (d 2): it is determined that the P2P communication with the communication terminal is timed out.
By judging whether a response timeout signal transmitted by the communication terminal is received or not, if the response timeout signal is received, the communication timeout of the P2P is judged, and the operation is simple.
Step (d 3): and judging whether a receiving response signal returned by the communication terminal is received within a preset time length after the data is sent to the communication terminal.
The preset duration can be specifically set according to actual needs. If it is detected that the receiving response signal returned by the communication terminal is not received within the preset time period after the data is sent to the communication terminal, it indicates that the communication link is disconnected, and at this time, step (d 4) is executed.
Step (d 4): it is determined that the P2P communication with the communication terminal is timed out.
The data are actively sent to the communication terminal for detection, if the receiving response signal is not received within the preset time after the data are sent, the P2P communication is judged to be overtime, and the detection accuracy is high.
In this embodiment, the step S260 includes steps (d 1) to (d 4), and the P2P communication timeout is detected by detecting whether the response timeout signal is received or not and detecting whether the response signal is received within the preset time after the data is sent, so that missed detection is avoided, and the detection accuracy is further improved. It is understood that, in other embodiments, step S260 may also include only step (d 1) and step (d 4), or only step (d 3) and step (d 4).
S270: the P2P session is closed and the process returns to step S220.
When detecting the communication timeout of the P2P, the P2P session is closed and the process returns to step S220, so as to establish P2P communication with the communication terminal again, thereby realizing automatic reconnection after network disconnection and further improving the reliability of communication.
In an embodiment, with continued reference to fig. 6, after closing the P2P session, before returning to step S220, step S280 and step S290 are further included.
S280: the number of closures closing the P2P session is recorded.
By recording the number of connections, it can be known that the P2P session is currently closed for the second time.
S290: and judging whether the closing times are less than the preset times. If yes, the process returns to step S220.
The preset times can be set according to actual needs. Comparing the connection times with the preset times, if the connection times is less than the preset times, returning to step S220 to reestablish P2P. If the connection times is greater than or equal to the preset times, the process does not return to step S220. Therefore, the program occupation caused by repeated operation can be avoided, and the program space utilization rate is improved.
In an embodiment, step S250 is followed by: and receiving a communication ending instruction, closing the P2P session according to the communication instruction, and ending the P2P process.
The communication ending instruction is used for indicating ending of communication, and can be input by a user in a remote control mode after the unmanned aerial vehicle completes a data transmission task. The P2P conversation is closed and the P2P process is ended according to the received communication ending instruction, so that the P2P communication with the communication terminal is disconnected, the network disconnection of user operation can be realized, the program is prevented from being continuously occupied after the data transmission task is completed, and the space utilization rate of the program is further improved.
Referring to fig. 7, in an embodiment, the drone communication device may be applied to a drone, and the drone communication device includes a P2P process starting module 210, a node searching module 220, a terminal analyzing module 230, a verification sequence checking module 240, and a communication terminal communication module 250.
The P2P process starting module 210 is configured to receive a starting instruction, and start the P2P process of the WiFi module according to the starting instruction.
The node searching module 220 is configured to search for nodes within a preset geographic range, and generate an unmanned aerial vehicle node list according to the searched nodes.
The terminal analysis module 230 is configured to receive a verification sequence sent by the terminal, and determine whether a node corresponding to the terminal is in the unmanned aerial vehicle node list.
The verification sequence checking module 240 is configured to use the terminal as a communication terminal when the node corresponding to the terminal is in the unmanned aerial vehicle node list, and check the verification sequence.
The communication terminal communication module 250 is used for opening a P2P session and establishing P2P communication with the communication terminal through a P2P session when the verification sequence passes.
The unmanned aerial vehicle communication device can be applied to an unmanned aerial vehicle, the P2P process starting module 210 receives a starting instruction, the P2P process of the WiFi module is started according to the starting instruction, the node searching module 220 searches for nodes within a preset geographic range, and an unmanned aerial vehicle node list is generated according to the searched nodes; the terminal analysis module 230 receives a verification sequence sent by the terminal, and judges whether a node corresponding to the terminal is in the unmanned aerial vehicle node list; when the node corresponding to the terminal is in the unmanned aerial vehicle node list, the verification sequence check module 240 takes the terminal as a communication terminal and checks the verification sequence, and the communication terminal communication module 250 opens a P2P session when the verification of the verification sequence is passed, and establishes P2P communication with the communication terminal through a P2P session. Like this, adopt the mode of P2P communication to communicate with communication terminal for communication terminal still can support to communicate with the network server with the STA mode of wiFi module when communicating with unmanned aerial vehicle P2P, simultaneously, compare in using the bluetooth, transmission distance is longer and transmission rate is high, has improved data transmission's reliability.
In an embodiment, referring to fig. 8, the communication device of the unmanned aerial vehicle further includes a network disconnection detecting module 260 and a re-networking module 270.
The network disconnection detecting module 260 is configured to detect whether the P2P communication with the communication terminal is timed out.
In an embodiment, the network outage detection module 260 is specifically configured to: judging whether a response overtime signal sent by the communication terminal is received or not, and if the response overtime signal sent by the communication terminal is received, judging that the P2P communication with the communication terminal is overtime; and/or the P2P communication timeout determination module is used for determining whether a receiving response signal returned by the communication terminal is received within a preset time period after the data is sent to the communication terminal, and if the receiving response signal returned by the communication terminal is not received within the preset time period, determining that the P2P communication timeout with the communication terminal.
The re-networking module 270 is configured to close the P2P session when the P2P communication with the communication terminal is out of time, control the node searching module 220 to search for a node within the preset geographic range again, and generate an unmanned aerial vehicle node list according to the searched node.
When the communication timeout of the P2P is detected, the control node searching module 220 executes the corresponding function after the P2P session is closed, so that the P2P communication is established again with the communication terminal, automatic reconnection after the network is disconnected can be realized, and the reliability of the communication is further improved.
In an embodiment, with continued reference to fig. 8, the unmanned aerial vehicle communication device further includes a network disconnection and reconnection analysis module 280, configured to record closing times for closing a P2P session, and determine whether the closing times are less than a preset number; and when the closing times are smaller than the preset times, the control node searching module searches the nodes within the preset geographic range again, and generates an unmanned aerial vehicle node list according to the searched nodes. Therefore, the program occupation caused by repeated operation can be avoided, and the program space utilization rate is improved.
Referring to fig. 9, which is an application environment diagram of a terminal communication method and an unmanned aerial vehicle communication method, the terminal communication method is applied to a mobile phone 310, the unmanned aerial vehicle communication method is applied to an unmanned aerial vehicle 320, the mobile phone 310 prefers a WiFi STA mode to communicate with a network server 330, and when the WiFi STA mode is unavailable, the mobile phone communicates with the network server 330 using 4G. The mobile phone 310 forwards the audio and video data and the status information sent by the unmanned aerial vehicle 320 to the network server 330, so that the remote device connected to the network server 330 can download the audio and video data and the status information from the network server 330; the remote device may also send control information to the web server 330, and the terminal receives the control information sent by the web server 330 and forwards the control information to the drone 320. As such, coexistence of WiFi communication and 4G communication is achieved without changing the architecture of the handset 310, and WiFi communication is preferred to transmit and receive data to and from the network server at the lowest cost.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.