CN115664455A - Data transmission method, holder, computer device and storage medium - Google Patents
Data transmission method, holder, computer device and storage medium Download PDFInfo
- Publication number
- CN115664455A CN115664455A CN202211207441.XA CN202211207441A CN115664455A CN 115664455 A CN115664455 A CN 115664455A CN 202211207441 A CN202211207441 A CN 202211207441A CN 115664455 A CN115664455 A CN 115664455A
- Authority
- CN
- China
- Prior art keywords
- communication party
- data packet
- switching
- communication
- party
- 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
Links
Images
Landscapes
- Communication Control (AREA)
Abstract
The present application relates to a data transmission method, a head, a computer device, a computer readable storage medium and a computer program product. The method comprises the steps of detecting the states of the first communication party and the second communication party; if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line; and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line. By adopting the method, the stability of data transmission can be improved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data transmission method, a cradle head, a computer device, a storage medium, and a computer program product.
Background
With the development of computer technology, when images or videos are collected, the cloud platform is often used for fixing the image collecting equipment, and the cloud platform is more and more widely used. The components of the holder communicate with each other through the signal lines, but if the number of the signal lines is too large, the signal lines are likely to rub against the central shaft of the holder motor, so that the signal lines are easy to break, and the signals have large interference, resulting in poor communication stability among the components of the holder.
Disclosure of Invention
In view of the above, it is necessary to provide a data transmission method, a cradle head, a computer device, a computer readable storage medium and a computer program product, which can improve communication stability.
In a first aspect, the present application provides a data transmission method. The method is applied to a holder, the holder comprises a first communication party and a second communication party which are connected through a signal line, and the method comprises the following steps:
detecting the states of the first communication party and the second communication party;
if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line;
and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
In a second aspect, the present application further provides a holder. The cloud platform includes:
the detection module is used for detecting the states of the first communication party and the second communication party;
the control module is used for controlling the first communication party and sending a first data packet to the second communication party through the signal wire if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state;
and the switching module is used for switching the first communication party into a receiving state if the first communication party meets a first switching condition so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
In one embodiment, the switching module is further configured to:
detecting whether the first data packet is a data packet expected to respond or not;
and if the first data packet is the data packet expected to be responded, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
In one embodiment, the head further comprises:
the detection module is further configured to detect whether the first data packet is a heartbeat data packet if the first data packet is not a data packet expected to be responded;
the switching module is further configured to determine that the first data packet meets a first switching condition and switch the first communication party to a receiving state if the first data packet is a heartbeat data packet.
In one embodiment, the switching module is further configured to:
if the first data packet meets a first switching condition, generating a square wave signal;
and if the generated square wave signal is detected to meet the preset waveform, switching the first communication party into a receiving state.
In one embodiment, the head further comprises:
the detection module is further configured to detect the received first data packet when the second communication party receives the first data packet;
the switching module is further configured to switch the second communication party to a sending state if it is detected that the first data packet is a data packet expected to be responded to or a heartbeat data packet.
In one embodiment, the head further comprises:
the timing module is used for timing the duration of the first communication party in the receiving state;
the switching module is further configured to switch the first communication party to a sending state if the duration reaches a first preset duration.
In one embodiment, the head further comprises:
and the circulating module is used for returning to execute the step of detecting the states of the first communication party and the second communication party to carry out circulation until the first communication party and the second communication party finish communication.
In one embodiment, the first communication party is one of a handle of the pan/tilt head or a main control board, and the second communication party is one of the handle or the main control board.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
detecting the states of the first communication party and the second communication party;
if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line;
and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so that the first communication party receives a second data packet replied by the second communication party through the signal line.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
detecting the states of the first communication party and the second communication party;
if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line;
and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
detecting the states of the first communication party and the second communication party;
if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line;
and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
The data transmission method, the holder, the computer equipment, the storage medium and the computer program product detect the states of the first communication party and the second communication party; if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through a signal line; and if the first data packet meets the first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line. Therefore, a plurality of signal wires between the first communication party and the second communication party can be combined, the first communication party and the second communication party can communicate through the combined signal wires by switching the states of the first communication party and the second communication party, the number of the signal wires between the first communication party and the second communication party is reduced, the friction between the signal wires and the interference between the signals are reduced, and the stability of the communication between the first communication party and the second communication party is improved.
Drawings
FIG. 1 is a diagram of an exemplary data transmission method;
FIG. 2 is a flow diagram illustrating a method for data transmission according to one embodiment;
FIG. 3a is a diagram illustrating an embodiment of combining RXD signal lines and TXD signal lines for data transmission;
FIG. 3b is a diagram illustrating data transmission after combining RXD signal lines and TXD signal lines in another embodiment;
FIG. 4 is a schematic diagram of a square wave signal in one embodiment;
FIG. 5a is a diagram illustrating an embodiment of data transmission after combining RXD signal lines, TXD signal lines, and key signal lines;
FIG. 5b is a diagram illustrating an embodiment of combining a TXD signal line and a key signal line of a first communication party and combining an RXD signal line and a key signal line of a second communication party for data transmission;
FIG. 6 is a schematic view of various components of the holder in one embodiment;
FIG. 7 is a schematic view of the connections between the various components of the pan and tilt head in one embodiment;
fig. 8a is a schematic diagram illustrating a flow of data transmission performed by a first communication party according to an embodiment;
fig. 8b is a schematic diagram illustrating a data transmission process performed by a second communication party according to an embodiment;
FIG. 9a is a schematic diagram illustrating the data transmission process at various times in one embodiment;
FIG. 9b is a schematic diagram of the data transmission process at various times in another embodiment;
FIG. 10 is a timing diagram of a data transfer method in one embodiment;
FIG. 11 is a block diagram of a cradle head according to an embodiment;
FIG. 12 is a block diagram showing the construction of a cradle head according to another embodiment;
FIG. 13 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The data transmission method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. The cradle head 10 comprises a first communication party 102 and a second communication party 104 which are connected through a signal line, and the cradle head 10 detects the states of the first communication party 102 and the second communication party 104; if the first communication party 102 is detected to be in the sending state and the second communication party 104 is detected to be in the receiving state, controlling the first communication party 102 to send a first data packet to the second communication party 104 through the signal line; if the first data packet satisfies the first switching condition, the first communication party 102 is switched to the receiving state, so that the first communication party 102 receives the second data packet returned by the second communication party 104 through the signal line. The pan/tilt head 10 is a supporting device capable of fixing a mobile phone, a camera or a video camera, and includes a handle, a pan/tilt head main control unit, a motor and other components. The first communication party 102 is a component in the cradle head, and may be a handle or a cradle head master control, etc. The second communication party 104 is another component in the cradle head, which communicates with the first communication party, and may be a handle or a cradle head master control. The handle and the holder main control can communicate through a signal line.
In an embodiment, as shown in fig. 2, a data transmission method is provided, which is described by taking the method as an example applied to the pan-tilt in fig. 1, and includes the following steps:
s202, detecting the states of the first communication party and the second communication party.
Wherein, first communication side and second communication side are the part in the cloud platform, can be in handle or cloud platform main control board. The handle may be a bluetooth handle, for example, and the pan/tilt head master may be a Yaw axis (rotational axis for Yaw angle) master, a Pitch axis (rotational axis for Pitch angle) master, or a Roll axis (rotational axis for Roll angle) master, for example. For example, the first communication party is a handle, and the second communication party is a Yaw axis master control. For another example, the first communication party is the Pitch axis master, and the second communication party is the Roll axis master. The first communication party comprises a controller, and the state of the first communication party is controlled through the controller. The signal line is a line for transmitting information, and may be a coaxial signal line, an optical fiber signal line, or the like.
In one embodiment, as shown in fig. 3a, the first communication party is a communication initiator, and the first communication party and the second communication party each include a controller and an electronic switch. The controller in the first communication party can control the electronic switch to switch the state of the first communication party; the controller in the second communication party can control the electronic switch to switch the state of the second communication party. The electronic switch is a hardware chip and is used for selecting the data signal transmitted on the signal line. For example, when an electronic switch in a first communication party selects to send a data signal, the first communication party is in a sending state; when the electronic switch in the first communication party selects to receive the data signal, the first communication party is in a receiving state. The cradle head detects the states of the first communication party and the second communication party.
In one embodiment, as shown in fig. 3b, the RXD (Receive External Data) signal line and the TXD (Transmit External Data) signal line are shorted inside the controller of the first communication party, and the controller of the first communication party switches the RXD signal line and the TXD signal line through software. When the first communication party conducts the TXD signal line, the first communication party is in a transmitting state. When the second communication party conducts the RXD signal wire, the second communication party is in a receiving state. The cloud platform detects the states of the first communication party and the second communication party. The RXD signal line is used for receiving transmitted data, and the TXD signal line is used for transmitting data.
S204, if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, the first communication party is controlled, and the first data packet is sent to the second communication party through the signal line.
The receiving state is a state in which a packet can be received. The transmission state is a state in which a packet can be transmitted. The first data packet is a data packet carrying information, and may be a data packet carrying valid data information, or may also be a heartbeat data packet. And if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send the first data packet to the second communication party through the signal line.
S206, if the first data packet satisfies the first switching condition, the first communication party is switched to a receiving state, so that the first communication party receives the second data packet returned by the second communication party through the signal line.
Wherein the first switching condition is a condition for determining whether to switch the first communication party to the receiving state. For example, the first switching condition may be that the first packet is a packet for which a response is expected. For another example, the first switching condition may be that the first packet is a heartbeat packet. The second data packet is a data packet which is replied to the first communication party by the second communication party based on the received first data packet. For example, the second data may be a packet that responds to the first packet, or the second data may be a heartbeat packet, or the like.
In one embodiment, S206 specifically includes: if the first data packet meets the first switching condition, the first communication party is switched to a receiving state through the electronic switch, so that the first communication party receives a second data packet replied by the second communication party through the signal line. Alternatively, the controller may switch the first communication party to the receiving state by software.
In the above embodiment, the states of the first communication party and the second communication party are detected; if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through a signal line; and if the first data packet meets the first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line. Therefore, a plurality of signal wires between the first communication party and the second communication party can be combined, the first communication party and the second communication party can communicate through the combined signal wires by switching the states of the first communication party and the second communication party, the number of the signal wires between the first communication party and the second communication party is reduced, the friction between the signal wires and the interference between the signals are reduced, and the stability of the communication between the first communication party and the second communication party is improved.
In one embodiment, S206 specifically includes: detecting whether the first data packet is a data packet expected to respond or not; and if the first data packet is the data packet expected to be responded, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
The data packet to be responded to is a data packet that needs the second communication party to respond. For example, if the first packet is a packet requesting the second communication party to reply to the data, the first packet is a packet that is expected to respond. For another example, if the first packet is a packet that requests the second communication party to reply the acknowledgement message, the first packet is a packet that is expected to respond. If the first data packet is the data packet expected to be responded, the second communication party immediately replies the first data packet when receiving the first data packet, so that when the first data packet is judged to be the data packet expected to be responded, the first data packet is determined to meet the first switching condition, the first communication party is switched to the receiving state, the second data packet replied to the first data packet by the second communication party is received, the second data packet can be received in time, and the orderly data transmission is ensured.
In one embodiment, if the first data packet is not the data packet expected to respond, detecting whether the first data packet is a heartbeat data packet; and if the first data packet is a heartbeat data packet, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
The heartbeat packet is a packet for confirming an online status between the communication parties. The heartbeat data packet comprises a self-defined command word and is sent according to a certain time interval, and a communication party receiving the heartbeat data packet can confirm that the sending party is in an online state through the heartbeat data packet.
If the first data packet is a heartbeat data packet, the second communication party returns the heartbeat data packet to the first communication party when receiving the first data packet, so that the first communication party can confirm that the second communication party is in an online state. Therefore, when the first data packet is judged to be the heartbeat data packet, the first data packet is determined to meet the first switching condition, the first communication party is switched to the receiving state, and the heartbeat data packet replied by the second communication party to the first data packet is received, so that the second data packet can be received timely, and the ordered data transmission is ensured.
Specifically, if the first data packet is not a data packet expected to respond, the first communication party judges whether the time for sending the heartbeat data packet is reached, if the time for sending the heartbeat data packet is reached, the first communication party sends the heartbeat data packet to the second communication party through the signal line, and when the heartbeat data packet is sent, the first communication party is switched from a sending state to a receiving state. The first communication party sends the heartbeat data packet to the second communication party according to a preset heartbeat data packet sending frequency, the heartbeat data packet sending frequency can be determined according to the data sending frequency of the cradle head master control, for example, the heartbeat data packet sending frequency is in direct proportion to the data sending frequency of the cradle head master control. For example, the transmission frequency of the heartbeat data packet is greater than the data transmission frequency of the pan/tilt head master control.
When the time for sending the heartbeat data packet arrives, the first communication party sends the heartbeat data packet to the second communication party so as to keep communication connection with the second communication party through a heartbeat mechanism, avoid communication interruption with the second communication party and ensure the stability of data transmission.
In the above embodiment, if the first packet is a packet expected to respond or a heartbeat packet, the first communication party is switched to the receiving state when the first packet is completely sent. Therefore, the state of the first communication party can be switched in time, and the orderly data transmission is ensured. And the first communication party and the second communication party can carry out data transmission through the combined signal wire, so that the number of the signal wires between the first communication party and the second communication party is reduced, the friction between the signal wires and the interference between the signals are reduced, and the stability of the communication between the first communication party and the second communication party is improved.
In one embodiment, when the second communication party receives the first data packet, the received first data packet is detected; and if the first data packet is detected to be the data packet expected to respond or the heartbeat data packet, switching the second communication party into a sending state.
When the second communication party receives the first data packet, the first data packet is analyzed, data analyzed from the first data packet is detected, and if the first data packet is determined to be a data packet expected to be responded or a heartbeat data packet through detection, the second communication party is switched to a sending state, so that the second communication party can timely reply to the first communication party. And when the first data packet is a heartbeat data packet, the second communication direction replies the heartbeat data packet to the first communication party.
In the above embodiment, when the second communication party receives the first data packet, the received first data packet is detected; and if the first data packet is detected to be a data packet expected to respond or a heartbeat data packet, switching the second communication party into a sending state. Therefore, under the condition of combining a plurality of signal lines, communication can be carried out through the signal lines combined into one signal line, and the orderly data transmission is ensured.
In one embodiment, S206 specifically includes: if the first data packet meets the first switching condition, generating a square wave signal; and if the generated square wave signal is detected to meet the preset waveform, switching the first communication party into a receiving state.
The square wave signal is a signal composed of high and low levels. For example, as shown in fig. 4, the square wave signal is a signal composed of a high level 1 and a low level 0. For example, if the generated square wave signal is detected to be a high level waveform, the first communication party is switched to a receiving state. Alternatively, the first communication party may be switched to the receiving state when the generated square wave signal is detected to be a low level waveform.
In one embodiment, when more than two signal lines are combined into one signal line, the cradle head selects the states of the first communication party and the second communication party through the combination of high and low levels in the square wave signal. For example, when four signal lines (the signal line 1, the signal line 2, the signal line 3, and the signal line 4) are combined into one signal line, assuming that 1 represents a high level and 0 represents a low level, a combination of the high and low levels may include four compositions of 11, 10, 01, and 00. For example, the first communication party may switch to the state of selecting the signal line 1 when detecting "11"; when the '10' is detected, the state is switched to the state of selecting the signal line 2; when the 01 is detected, the state of the signal wire 3 is switched to be selected; when "00" is detected, the state of the selection signal line 4 is switched. For example, in a time period from 0 to t1, the first communication party detects that the square wave signal is '00', and switches to a state of selecting and sending an RXD signal data packet; in the time period from t1 to t2, detecting that the square wave signal is '01', and switching to a state of selecting and sending a key signal data packet; and in the time period from t2 to t3, detecting that the square wave signal is 10, and switching to a receiving state.
In one embodiment, as shown in fig. 5a, the electronic switches in the first communication party and the second communication party are used for switching TXD, RXD and the key signal lines. When the electronic switch in the first communication party is switched to select the TXD signal line and the electronic switch in the second communication party is switched to select the RXD signal line, namely the first communication party is in a sending state and the second communication party is in a receiving state, the first communication party can send a data packet to the second communication party through the signal line, and the second communication party receives the data packet through the signal line. When the electronic switch in the first communication party is switched to select the RXD signal line and the electronic switch in the second communication party is switched to select the TXD signal line, namely the first communication party is in a receiving state, and the second communication party is in a sending state, the first communication party can receive the data packet sent by the second communication party through the signal line. When the electronic switches of the first communication party and the second communication party are switched to the key signal line, the key signal can be transmitted between the first communication party and the second communication party.
In one embodiment, as shown in fig. 5b, the electronic switch in the first communication party is used to select the TXD and the keystroke signal line. The electronic switch in the second communication party is used for selecting RXD and key signal lines. When the electronic switch in the first communication party selects the TXD signal line and the electronic switch in the second communication party selects the RXD signal line, the first communication party can send a data packet to the second communication party through the signal line, and the second communication party receives the data packet through the signal line. When the electronic switch in the first communication party and the electronic switch in the second communication party both select the key signal line, the first communication party can send the data packet of the key signal to the second communication party or receive the data packet of the key signal from the second communication party through the signal line.
In one embodiment, S206 is followed by: timing the duration of the first communication party remaining in the receiving state; and if the duration reaches a first preset duration, switching the first communication party into a sending state.
The first preset time length is a time length used for judging whether the time length of the first communication party in the receiving state is overtime or not. In order to avoid that the first communication party cannot transmit data due to being in the receiving state for a long time, when the time length of the first communication party in the receiving state reaches a first preset time length, the receiving state of the first communication party is switched back to the transmitting state. Since the required receiving time is longer when the first communication party receives the larger data packet, the first preset time period may be set according to the size of the data packet received by the first communication party, for example, the first preset time period is proportional to the size of the data packet received by the first communication party.
In one embodiment, after the cradle head switches the first communication party into the sending state, the cradle head returns to the step of detecting the states of the first communication party and the second communication party for circulation until the first communication party and the second communication party finish communication.
In the above embodiment, the duration of the first communication party remaining in the receiving state is timed; and if the duration reaches a first preset duration, switching the first communication party into a sending state. Therefore, the first communication party can be prevented from being incapable of sending data due to the fact that the first communication party is in the receiving state for a long time, and orderly data transmission is guaranteed.
In one embodiment, the cradle head times the time that the second communication party is in the sending state; when the timed duration reaches a second preset duration, switching the second communication party from the sending state to the receiving state; and when the timed duration does not reach the second preset duration, if the fact that all the data packets to be sent are sent is detected to be finished, the second communication party is switched back to the receiving state from the sending state.
And the second preset time length is used for judging whether the time length of the second communication party in the sending state is overtime or not. In order to avoid that the second communication party cannot receive data because the second communication party is in the sending state for a long time, when the time length that the second communication party is in the sending state reaches a second preset time length, the sending state of the second communication party is switched back to the receiving state. Since the required sending time is longer when the data packet sent by the second communication party is larger, the second preset time period may be set according to the size of the data packet sent by the second communication party, for example, the second preset time period is proportional to the size of the data packet sent by the second communication party. And if the timed duration does not reach the second preset duration but all the data packets to be sent have been sent, switching the sending state of the second communication party back to the receiving state so that the second communication party is switched back to the receiving state in time and waits for receiving the data packets sent by the first communication party.
In the above embodiment, if the time length of the second communication party in the sending state reaches the second preset time length, or even if the timed time length does not reach the second preset time length, the sending of all the data packets to be sent is detected to be completed, and the second communication party is switched from the sending state to the receiving state. Therefore, the second communication party can be switched back to the receiving state in time, and the orderly data transmission is ensured.
In one embodiment, as shown in fig. 6, the cradle head includes a bluetooth handle, a Yaw axis, a Pitch axis, a Roll axis, and the like, for holding the mobile terminal. The Yaw axis, the Pitch axis, and the Roll axis respectively include a Yaw axis PCB (Printed Circuit Board) Board, a Pitch axis PCB Board, and a Roll axis PCB Board. As shown in FIG. 7, the Bluetooth handle is connected with the Yaw axis PCB, the Yaw axis PCB is connected with the Pitch axis PCB, and the Pitch axis PCB is connected with the Roll axis PCB through connecting wires. Specifically, the connection line includes a power supply line, a ground line, a signal line, or the like. The controller of the Bluetooth handle, the controller of the Yaw shaft, the controller of the Pitch shaft and the controller of the Roll shaft are respectively connected with the electronic switches through multi-path signal wires. The connecting wires among the electronic switches comprise power wires, grounding wires and signal wires. The electronic switch is used for selecting the multi-channel signal lines between the controller and the electronic switch and transmitting the data packets in the selected signal lines through the signal lines. For example, when an electronic switch of the Bluetooth handle selects a TXD signal line, the Bluetooth handle is in a sending state, and a data packet of the TXD signal is sent to the Yaw shaft PCB through the signal line; when an electronic switch of the Bluetooth handle selects an RXD signal line, the Bluetooth handle is in a receiving state, and a data packet is received from the Yaw shaft PCB through the signal line.
In one embodiment, the first communication party acts as a communication initiator to perform data transmission with the second communication party. Fig. 8a shows a flow chart of data transmission of the first communication party, and fig. 8b shows a flow chart of data transmission of the second communication party. When data transmission starts, the electronic switch of the first communication party selects TXD, the electronic switch of the first communication party is in a sending state, the electronic switch of the second communication party selects RXD, and the electronic switch of the second communication party is in a receiving state. The first communication party sends a first data packet to the second communication party through the signal wire and judges whether the first data packet is a data packet which needs to be immediately replied by the second communication party. If the first data packet is a data packet which needs to be immediately replied by the second communication party, the first communication party is switched from a sending state to a receiving state when the first data packet is sent, so as to wait for receiving a second data packet replied by the second communication party in response to the first data packet; and if the first data packet is not the data packet which needs to be immediately replied by the second communication party, the first communication party judges whether the time for sending the heartbeat data packet is up or not when the first data packet is sent. And if the time for sending the heartbeat data packet is up, the first communication party sends the heartbeat data packet to the second communication party when the first data packet is sent, and the sending state is switched to the receiving state when the heartbeat data packet is sent. And the first communication party times the time in the receiving state, and when the overtime time of the receiving state is up, the first communication party is switched back to the sending state from the receiving state and enters the cycle of the next data transmission process.
In one embodiment, as shown in fig. 9a, the time T1 and the time T2 are the time when the first communication party sends the heartbeat data packet, and the first communication party switches from the sending state to the receiving state when sending the heartbeat data packet, and keeps in the receiving state during the time period T1-T3. And the time T3 is the receiving state overtime of the first communication party, and when the time T3 is up, the first communication party is switched from the receiving state to the sending state and can send data in the time period from T3 to T2. And when the first communication party finishes sending the heartbeat data packet at the time T2, switching from the sending state to the receiving state. And the time T5 is the receiving state overtime time of the first communication party, and the first communication party is kept in the receiving state in the time period from T2 to T5 and can receive the data packet sent by the second communication party. And the second communication party receives the heartbeat data packet sent by the first communication party at the time T4 and switches from the receiving state to the sending state at the time T4. And the second communication party continuously sends three data packets to the first communication party after the time T4, reaches the overtime of the sending state at the time T6 and switches from the sending state to the receiving state.
In one embodiment, as shown in fig. 9b, the first communication party is in a transmission state before time T1, and time T1 is the time when the first communication party transmits the data packet 1. And after the first communication party finishes sending the data packet 1, the sending state is switched to the receiving state, and the first communication party waits for receiving the data packet replied by the second communication party. The second communication party receives the data packet 1 at time T2 and parses the data packet 1. And if the data packet 1 is determined to be a data packet needing immediate reply through analysis, the second communication party is switched from the receiving state to the sending state, and the data packet 2 is sent to the first communication party. The second communication party may switch to the receiving state immediately after the data packet 2 is sent, or may switch to the receiving state when the timeout time of the sending state is reached, that is, when the time T3 is reached. If the second communication party switches to the receiving state at the time T3, the second communication party can send the data packet to the first communication party before the time T3 arrives. And the time T4 is the receiving state overtime time of the first communication party, and when the time T4 is reached, the first communication party is switched back to the sending state from the receiving state.
In one embodiment, multiple signal lines between the first communication party and the second communication party are combined into one signal line, and when the first communication party is in a sending state, data packets of the signals of the multiple signal lines can be sent in a time-sharing mode before the timeout period of the sending state is reached. Therefore, the number of signal lines can be reduced, and the stability of data transmission is improved.
In the above embodiment, multiple signal lines between the first communication party and the second communication party are combined into one signal line, and data transmission between the first communication party and the second communication party is realized through a time division multiplexing mechanism, so that the number of signal lines between the first communication party and the second communication party is reduced, friction between signal lines and interference between signals are reduced, and thus the stability of communication between the first communication party and the second communication party is improved. And the ordered data transmission is realized by controlling the states of the first communication party and the second communication party.
In one embodiment, the data transmission method is applied to a pan-tilt, the pan-tilt includes a first communication party and a second communication party connected by a signal line, as shown in fig. 10, the data transmission method includes the following steps:
s1002, when the first communication party is in a sending state and the second communication party is in a receiving state, the first communication party sends a first data packet to the second communication party through a signal line.
S1004, the first communication party determines whether the first data packet is a data packet for which a response is expected.
S1006, if the first data packet is a data packet expected to respond, after the first data packet is completely transmitted, the transmitting state of the first communication party is switched to the receiving state.
S1008, the second communication party receives the first data packet through the signal line.
S1010, the second communication party parses the first data packet to determine whether the first data packet is a data packet expected to be responded.
S1012, if the first packet is a packet expected to respond, the second communication party switches the receiving status of the second communication party to the sending status.
S1014, the second communication party sends the second data packet to the first communication party through the signal line.
And S1016, when the overtime time limit of the sending state of the second communication party is reached, the sending state is switched back to the receiving state.
And S1018. When the timeout period of the receiving state of the first communication party is reached, the receiving state is switched back to the sending state.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the application also provides a cloud deck for realizing the data transmission method. The implementation scheme for solving the problem provided by the pan-tilt is similar to the implementation scheme described in the above method, so the specific limitations in one or more pan-tilt embodiments provided below can refer to the limitations on the data transmission method in the foregoing, and details are not described here.
In one embodiment, as shown in fig. 11, there is provided a head including: a detection module 1102, a control module 1104, a switching module 1106, wherein,
a detecting module 1102, configured to detect states of a first communication party and a second communication party;
the control module 1104 is configured to control the first communication party and send a first data packet to the second communication party through a signal line if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state;
the switching module 1106 is configured to switch the first communication party to the receiving state if the first communication party satisfies the first switching condition, so that the first communication party receives the second data packet returned by the second communication party through the signal line.
In the above embodiment, the states of the first communication party and the second communication party are detected; if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through a signal line; and if the first data packet meets the first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line. Therefore, a plurality of signal wires between the first communication party and the second communication party can be combined, the first communication party and the second communication party can communicate through the combined signal wires by switching the states of the first communication party and the second communication party, the number of the signal wires between the first communication party and the second communication party is reduced, the friction between the signal wires and the interference between the signals are reduced, and the stability of the communication between the first communication party and the second communication party is improved.
In one embodiment, the switching module 1106 is further configured to:
detecting whether the first data packet is a data packet expected to respond or not;
and if the first data packet is the data packet expected to be responded, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
In one embodiment, the head further comprises:
the detecting module 1102 is further configured to detect whether the first data packet is a heartbeat data packet if the first data packet is not a data packet expected to be responded;
the switching module 1106 is further configured to determine that the first data packet meets the first switching condition and switch the first communication party to the receiving state if the first data packet is a heartbeat data packet.
In one embodiment, the switching module 1106 is further configured to:
if the first data packet meets the first switching condition, generating a square wave signal;
and if the generated square wave signal is detected to meet the preset waveform, switching the first communication party into a receiving state.
In one embodiment, the head further comprises:
the detecting module 1102 is further configured to detect the received first data packet when the second communication party receives the first data packet;
the switching module 1106 is further configured to switch the second communication party to the sending state if it is detected that the first data packet is a data packet expected to be responded to or a heartbeat data packet.
In one embodiment, as shown in fig. 12, the pan/tilt head further includes:
a timing module 1108, configured to time a duration that the first communication party remains in the receiving state;
the switching module 1106 is further configured to switch the first communication party to the sending state if the duration reaches a first preset duration.
In one embodiment, the head further comprises:
the loop module 1110 is configured to return to performing the step of detecting the status of the first communication party and the second communication party for loop until the first communication party and the second communication party end communication.
In one embodiment, the first communication party is one of a handle or a main control board of the pan/tilt/zoom apparatus, and the second communication party is one of a handle or a main control board.
Each module in the above-mentioned pan-tilt can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a pan-tilt head, and the internal structure thereof may be as shown in fig. 13. The computer apparatus includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device. The processor, the memory and the input/output interface are connected by a system bus, and the communication interface, the display unit and the input device are connected by the input/output interface to the system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data transmission method.
Those skilled in the art will appreciate that the architecture shown in fig. 13 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, carries out the steps in the method embodiments described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the relevant laws and regulations and standards of the relevant country and region.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), magnetic Random Access Memory (MRAM), ferroelectric Random Access Memory (FRAM), phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the various embodiments provided herein may be, without limitation, general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, or the like.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as 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 application, and the description thereof is specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims (11)
1. A data transmission method applied to a pan-tilt, the pan-tilt including a first communication party and a second communication party connected by a signal line, the method comprising:
detecting the states of the first communication party and the second communication party;
if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state, controlling the first communication party to send a first data packet to the second communication party through the signal line;
and if the first data packet meets a first switching condition, switching the first communication party into a receiving state so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
2. The method of claim 1, wherein the switching the first party to the receiving state if the first packet satisfies a first switching condition comprises:
detecting whether the first data packet is a data packet expected to respond or not;
and if the first data packet is the data packet expected to be responded, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
3. The method of claim 2, further comprising:
if the first data packet is not the data packet expected to be responded, detecting whether the first data packet is a heartbeat data packet;
and if the first data packet is a heartbeat data packet, determining that the first data packet meets a first switching condition, and switching the first communication party into a receiving state.
4. The method of claim 1, wherein the switching the first party to the receiving state if the first packet satisfies a first switching condition comprises:
if the first data packet meets a first switching condition, generating a square wave signal;
and if the generated square wave signal is detected to meet the preset waveform, switching the first communication party into a receiving state.
5. The method of claim 1, further comprising:
when the second communication party receives the first data packet, detecting the received first data packet;
and if the first data packet is detected to be a data packet expected to respond or a heartbeat data packet, switching the second communication party into a sending state.
6. The method of claim 1, wherein after switching the first communication party to the receiving state, the method further comprises:
timing the duration of the first communication party remaining in the receiving state;
and if the duration reaches a first preset duration, switching the first communication party into a sending state.
7. The method of claim 6, wherein after the switching the first communication party to the transmission state, the method further comprises:
and returning to execute the step of detecting the states of the first communication party and the second communication party for circulation until the first communication party and the second communication party finish communication.
8. The method of claim 1, wherein the first communication party is one of a handle of the pan/tilt or a main control board, and the second communication party is one of the handle or the main control board.
9. A head, characterized in that it comprises:
the detection module is used for detecting the states of the first communication party and the second communication party;
the control module is used for controlling the first communication party and sending a first data packet to the second communication party through the signal wire if the first communication party is detected to be in a sending state and the second communication party is detected to be in a receiving state;
and the switching module is used for switching the first communication party into a receiving state if the first communication party meets a first switching condition so as to enable the first communication party to receive a second data packet replied by the second communication party through the signal line.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211207441.XA CN115664455A (en) | 2022-09-30 | 2022-09-30 | Data transmission method, holder, computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211207441.XA CN115664455A (en) | 2022-09-30 | 2022-09-30 | Data transmission method, holder, computer device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115664455A true CN115664455A (en) | 2023-01-31 |
Family
ID=84984581
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211207441.XA Pending CN115664455A (en) | 2022-09-30 | 2022-09-30 | Data transmission method, holder, computer device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115664455A (en) |
-
2022
- 2022-09-30 CN CN202211207441.XA patent/CN115664455A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733604A (en) | A kind of 485 bus intelligent expansion method and devices based on modbus communications protocol | |
CN104980416A (en) | Data access method, device and system in content distribution network | |
CN111177025B (en) | Data storage method and device and terminal equipment | |
CN103685426B (en) | Message processing device and information processing method | |
CN109561054A (en) | A kind of data transmission method, controller and access device | |
CN106954043A (en) | The method for allocating tasks and system of cloud service in monitoring system | |
CN113110815A (en) | Method and system for realizing screen transmission function through touch and collision, electronic equipment and storage medium | |
CN113411806A (en) | Mobile hotspot authorization checking method and device, storage medium and electronic equipment | |
CN108366129B (en) | USB data transmission method, device and USB are from device adapter | |
CN101889470B (en) | A contents supply system, a method, a service server, a storage means, a relay method, an application server and a cellular phone for multi connected end terminal | |
CN108182195A (en) | A kind of loading method of data, device, terminal and storage medium | |
CN108881493A (en) | A kind of Task Progress information-pushing method, device and equipment | |
CN115664455A (en) | Data transmission method, holder, computer device and storage medium | |
CN108170470A (en) | SOC system step-by-step write devices | |
CN103227816A (en) | Data transmission method, data processing method, device and system | |
CN106952207A (en) | Monitor the electoral machinery and system of cloud platform distributed system | |
CN103428273B (en) | The method and apparatus of response inquiry is carried out in asynchronous system is mutual | |
KR100736902B1 (en) | Method and apparatus for sharing memory by a plurality of processors | |
CN115114192B (en) | Memory interface, functional core, many-core system and memory data access method | |
CN112637121B (en) | Data port updating method and device, electronic equipment and readable storage medium | |
CN113840313B (en) | Network mode control method and device of mobile terminal and computer equipment | |
JP2019528608A (en) | Transmission resource instruction method, apparatus, and storage medium | |
CN102891888B (en) | Data access method and related equipment and system | |
JPH07177161A (en) | Polling selecting method | |
CN110266665B (en) | Connection method, device and equipment of network block equipment and readable storage medium |
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 |