Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided a method embodiment of a data transmission method, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that presented herein.
Fig. 1 is a flowchart of a data transmission method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, carrying out availability detection on a data channel connected with target equipment;
step S104, under the condition that the availability detection result of the connected data channel is unavailable, determining whether the data channel is the data channel used by the current data transmission;
and step S106, under the condition that the data channel is the data channel used by the current data transmission, switching the data channel into a standby channel according to the available standby channel list, and performing data transmission with the target equipment through the switched standby channel.
Through the steps, the availability detection is carried out on the data channel connected with the target equipment; determining whether the data channel is a data channel used for current data transmission or not under the condition that the availability detection result of the connected data channel is unavailable; the method comprises the steps that when a data channel is used for data transmission at present, the data channel is switched to a standby channel according to an available standby channel list, the availability of the data transmission channel connected with a target device is detected in a data transmission mode between the switched standby channel and the target device, and when the data channel for data transmission is unavailable, the standby channel is switched to the standby channel, so that the purpose of ensuring the stability and the efficiency of data transmission is achieved, the technical effect of eliminating the influence of the computing capacity and signal instability of hardware equipment on the stability and the efficiency of data transmission is achieved, and the technical problems that the computing capacity of intelligent hardware equipment in the related technology is limited, and instability is possibly caused by the problem of signal difference and the like when the equipment is connected and data communication is carried out are solved.
The executing main body of the above steps may be an active device or a passive device, where the active device is a terminal device which actively searches and initiates a connection request during establishing a data connection, and the passive device is a terminal device which accepts the search of the active device and is passively connected. The target device is a device corresponding to the execution subject, and for example, when the execution subject is an active device, the target device is a passive device, and when the execution subject is a passive device, the target device is an active device.
A plurality of data channels, for example, WIFI data channels, network data channels, near field communication data channels, and the like, may be established between the execution main body and the target device. When the data channel is established, the active device may search for the target device using the channel information through the search connection module. The channel information includes data channel type, channel configuration information, connection timeout time, state detection mode, data availability detection, health threshold, channel switching algorithm threshold, and the like. When the active device searches for the device, the device uses different target device information to broadcast or directly search according to different channel types. On the passive device, the search connection module is responsible for responding after receiving the broadcast or direct search request from the active device, so as to ensure that the opposite side can acquire own device information.
And the active searching equipment respectively starts to connect data channels on one or more target equipment by using the target equipment information acquired in the searching process and monitors the connection result.
And carrying out availability detection on the data channel connected with the target equipment, and carrying out different operations according to the use condition of the data channel under the condition that the data channel is determined to be unavailable.
When the data channel is a data channel used for current data transmission, it indicates that the data transmission has been hindered, and the data channel used currently needs to be replaced by another connected alternative channel, so that the quality and stability of data transmission can be ensured.
The above-mentioned alternative channels may be a plurality of data channels that are simultaneously established when establishing the data connection between the execution main body and the target device. The alternative channel can transmit data through a data transmission channel and a data transmission mode corresponding to the data channel.
The alternative channels are arranged in an alternative channel list, and are sorted according to the priorities of the alternative channels, and when the alternative channels are replaced, the alternative channels with high priorities are preferentially selected.
Optionally, the detecting availability of the data channel to which the target device is connected includes at least one of: detecting the health state of the connectivity of the data channel; detecting the data availability of the data channel; the hardware state of the data channel is detected.
The data transmission of the data channel may be affected by various factors, and therefore, it is necessary to detect the various factors to determine whether the data transmission of the data channel is affected, so as to cause the problems of unstable data transmission and low efficiency.
The detection can be used for detecting the health state of the connectivity of the channel, the data availability of the data channel, the hardware state of the data channel and other dimensions, and the more the detected dimensions are, the more accurate the detection is, and the more the data transmission stability of the data channel can be ensured.
Optionally, the detecting the health status of the connectivity of the data channel includes: detecting the connectivity of the data channel by a polling detection tool; and under the condition that the connection performance of the data channel is not detected to reach the preset connection performance or the information of disconnecting the data channel of the target device is detected, determining that the data channel is unavailable.
The connectivity of the data channel is detected at regular time through the polling detection tool, the disconnection notice from the target equipment is monitored, and when the situation that the connectivity of the data channel does not reach the preset connectivity or the situation that the information of the data channel of the target equipment is disconnected is detected, the situation that the data channel is unavailable is determined, and the current data channel needs to be switched.
Optionally, the detecting the data availability of the data channel includes: detecting the timeliness and/or accuracy of data transmission of a data channel in a preset time period; determining the transmission data which does not meet the timeliness or the accuracy as unavailable data, and determining the transmission data which meets the timeliness or the accuracy as available data; and determining that the data channel is unavailable under the condition that a first ratio of available data of the data channel to the total amount of transmission data in a preset time period is lower than a first preset threshold value, or a second ratio of unavailable data of the data channel to the total amount of transmission data in the preset time period is higher than a second preset threshold value.
The timeliness of the data channel depends on the transmission timeout time set by the channel configuration, and the data which is not successfully transmitted after the timeout time is exceeded is recorded as unavailable data; correctness depends on the verification mechanism of the data, and data that fails the verification mechanism is recorded as erroneous data. The channel configuration is provided with a threshold of availability ratio of valid data in unit time, and if the threshold is found to be lower than the threshold within a period of time, namely the channel is detected to be unavailable, the current data channel needs to be switched.
Optionally, the detecting the hardware state of the data channel includes: detecting hardware of the data channel through a hardware detection tool; in the event that a hardware failure is detected that affects data transmission of the data channel, the data channel is determined to be unavailable.
The hardware equipment of the data channel has faults, such as power-on fault, power-off failure and naturally data transmission failure, but the hardware equipment of the data channel may also have other faults, and the efficiency of data transmission is not influenced and is not considered, so that the phenomenon that the response is too sensitive, the error rate of unavailable judgment of the data channel is increased, and useless channel switching is caused is prevented.
Optionally, the method further includes: determining the data channel as a standby channel when the data channel is not the data channel used by the current data transmission; the backup tunnels are determined to be unavailable and removed from the list of backup tunnels.
And when the data channel is not the data channel used for the current data transmission, that is, the data channel is the alternative channel of the data channel used for the current data transmission, the data channel used for the current data transmission is switched. And under the condition that the alternative channel is unavailable, removing the alternative channel from the alternative channel list, and when the channel used by the current data transmission needs to be switched, not considering the alternative channel. Therefore, the data volume of the alternative channel list is reduced, and the efficiency of channel switching is improved.
Optionally, when the data channel is a data channel used for current data transmission, switching the data channel to a standby channel according to the available standby channel list, and performing data transmission with the target device through the switched standby channel includes: determining the priority of the standby channel in the standby channel list according to the channel information of the standby channel; and switching the data channel into a standby channel with the highest priority according to the priority.
The channel information of the backup channel may include a type of the data channel, a data transmission capability of the data channel, and a transmission parameter, and may further include a preset priority label, and the priority of the backup channel in the backup channel list may be determined according to the channel information.
Optionally, switching the data channel to the backup channel with the highest priority according to the priority includes: entering a channel switching state, and suspending data receiving and transmitting of a data channel of current data transmission; sending a switching instruction to target equipment; receiving a confirmation instruction returned by the target equipment after receiving the switching instruction, wherein the target equipment enters a data channel of current data transmission into a channel switching state after receiving the switching instruction, switches a standby channel with the highest priority to an operating state, and generates the confirmation instruction; and switching the standby channel with the highest priority to an operating state, and transmitting data through the standby channel with the highest priority.
The data receiving and sending can be carried out when the switching instruction is sent to the target equipment side, and the target equipment can also carry out the data receiving and sending through the data channel of the current data transmission when receiving the switching instruction to carry out the corresponding data receiving and sending. That is, when the data channel is switched, the original data channel can keep receiving and sending data, thereby realizing the user's noninductive switching.
It should be noted that the present application also provides an alternative implementation, and the details of the implementation are described below.
The embodiment realizes the function of simultaneously monitoring the operating conditions of a plurality of data channels, provides the functions of receiving and transmitting optimization, channel state management and channel switching of the user-plane unaware data packets, and improves the channel stability and the data transmission efficiency.
The method specifically comprises the following steps: the terminal equipment: the entity is an entity which communicates in the use process of the intelligent hardware equipment and comprises the intelligent hardware equipment, a mobile application platform client, clients of other application platforms and the like.
An active device: the terminal equipment actively searches and initiates connection.
Passive devices: the terminal equipment receives the search of the active equipment and is requested to be connected by the active equipment.
Data channel: and the terminal equipment carries out data transmission carriers, such as a WiFi connection channel, a Bluetooth connection channel, an Internet connection channel and the like. The channel has a priority used as a basis for selecting the channel.
Channel configuration: a set of attribute settings for a data channel, such as the type of data acceptable to the channel, information required for connection of the channel, the manner of detection of the channel, a threshold for a condition of unavailability of detection of the channel, etc.
Protocol: refers to a negotiation carrier used by a terminal device for data exchange and confirmation.
Protocol data: the content of protocol content transmitted and received on the data channel,
Service data: refers to the content that the device transceives over the data channel while providing the service function.
Channel connection and switching:
fig. 2 is a flowchart of multi-channel connection and handover according to an embodiment of the present invention, as shown in fig. 2, a terminal device connects to a target device set by a protocol within a range specified by the protocol using a predefined protocol. In the process, the terminal devices of both parties are subjected to protocol confirmation, channel information negotiation and confirmation of the used protocol and channel type, such as step 1.a and step 1. b.
The terminal device initiating the connection request will simultaneously try to connect and use the channels supported by both devices, as in step 2.a, in this process, the connection states of the multiple channels are confirmed and managed separately without interfering with each other. The passive device responds to all the channels requested to connect. The active device processes the connection results of all requested connection channels, step 2. b.
The active device evaluates the availability and stability of the channel and selects a currently used data channel, as in step 3. Subsequent data transmission is performed through this selected channel, step 4.
And the active equipment and the passive equipment implement channel switching under the condition of meeting the condition. In this process, the other device that has already been connected needs to be notified, step 5.a, and the party that received the handover request confirms, step 5. b. In the process, data receiving and sending are not influenced, and users feel no sense.
Problem identification and non-inductive channel switching:
after the terminal device is connected, the following detections are performed on each channel to find out the channel unavailable status, including but not limited to:
monitoring the connection state of the channel;
and monitoring the availability of data.
These detections may be timed triggers or triggers according to predefined conditions, the triggering conditions being in the data channel configuration. In the detection process, if a channel state unavailability condition satisfied in the channel configuration occurs, channel switching will be performed.
Fig. 3 is a flow chart of channel identification and switching according to an embodiment of the present invention, as shown in fig. 3, when the channel is switched:
1. the terminal equipment actively performs switching: entering a switching channel state, and suspending the receiving and sending of the service data. It is checked whether there is an already connected and available backup channel and, if so, a channel is selected to replace the currently used channel using an algorithm specified by the protocol.
2. And the equipment for actively switching the channel sends a switching instruction in a predefined protocol.
3. And after receiving the switching request, the other side equipment enters a channel switching state, confirms the channel switching state and then switches back to the running state.
4. The device actively switching channels confirms the completion of the request and switches back to the running state.
5. The two-party equipment replaces the current channel for the standby channel, and the subsequent data receiving and sending are carried out on the switched channel.
Fig. 4 is a schematic diagram of an overall structure according to an embodiment of the present invention, and as shown in fig. 4, a system module of the embodiment includes: the system comprises a search connection module, a channel configuration module, a channel state management module, a data exchange module and a channel switching module. The details will be described below.
A search connection module: the search connection module is responsible for searching for the target device using the channel information. The channel information is obtained from the channel configuration management module.
When the active device searches for the device, the device uses different target device information to broadcast or directly search according to different channel types. On the passive device, the search connection module is responsible for responding after receiving the broadcast or direct search request from the active device, so as to ensure that the opposite side can acquire own device information.
And the active searching equipment respectively starts to connect data channels on one or more target equipment by using the target equipment information acquired in the searching process and monitors the connection result.
After connection, the channel availability information is transmitted to the channel state management module for recording the channel connection state and selecting an available channel.
The available channel after connection is passed to the data exchange module.
A data exchange module: the data exchange module receives the current available channel from the channel state management module.
The data exchange module is responsible for exchanging protocol data and service data between the devices by using the current channel.
A channel configuration management module: the channel configuration management module stores and manages the following contents, including:
data channel type information supported by the terminal equipment;
the configuration information of each data channel comprises information such as connection timeout time, state detection mode, data availability detection health degree threshold value, channel switching algorithm threshold value and the like of the channel.
The various configuration information of the channel can be managed in two ways:
a mode capable of being durably processed. Such information is already stored in the persistent medium at module initialization and is read and saved using the channel configuration management module.
And II, a dynamic configuration mode. Such information is modified and retrieved by other modules as the modules are run.
The channel configuration management module transmits the channel information to the search connection module when the search connection module requests the channel information.
And the channel configuration management module transmits the configuration information to the corresponding module when the state management module and the channel switching module request the configuration information.
A channel state management module: the channel state management module receives the connected channel information transmitted by the connection searching module, selects a current used channel from the connected channel information according to the channel priority, and transmits the current used channel to the data exchange module for use. And other connected modules which are not selected are saved as spare channel information for later use.
And the channel state management module detects and monitors the channel.
The detection algorithm used in the present embodiment during the operation of the device mainly includes:
1. and detecting the health state of the data connection channel. And using a polling detection tool which is effective after the channel connection is established, regularly checking the connectivity of the current channel, and monitoring the disconnection notice from the remote equipment. The polling tool finds that the connectivity is in an unexpected state or detects that the channel is unavailable after receiving a disconnection notice from the remote equipment;
2. and detecting the availability of the data. And recording and calculating the timeliness and the correctness of the data during service data transmission. The timeliness depends on the transmission overtime time set by the channel configuration, and the data which is not successfully transmitted after the overtime time is exceeded is recorded as unavailable data; correctness depends on the verification mechanism of the data, and data that fails the verification mechanism is recorded as erroneous data. And setting a threshold value of the availability proportion of valid data in unit time in the channel configuration, and if the threshold value is detected to be lower than the threshold value within a period of time, determining that the channel is detected to be unavailable.
3. Other detection tools, such as hardware status detection of the device, etc.
The channel status management module records an availability history of the channel.
And when detecting the channel unavailable state, the channel state management module judges whether the channel is the current channel.
If it is a backup channel, the channel unavailable status is recorded and silent reconnection is attempted. And updating the channel state to be available after the connection is successful. If the silent reconnection is still not available, then the tunnel is removed from the standby tunnel.
If the channel is the current channel, the current channel information and all the standby channel information are transmitted to the channel switching module, and the result of the channel switching module is received. And under the condition of successful switching, transmitting the switched current channel information to a data exchange module for subsequent data exchange.
A channel switching module: the channel switching module receives the current channel information and all standby channel information from the channel state management module and performs switching by using a channel switching algorithm.
The handover algorithm used in the present embodiment is briefly described as follows:
1. and judging whether the standby channels are available or not, and if all the standby channels are unavailable, feeding back the information of the unavailable channels.
2. If at least one of the alternate channels is available, then the channel with the highest channel priority is returned.
3. And if at least one available channel with the same priority exists, calculating the channel with the highest availability according to the historical availability record of the channel recorded in the channel state management channel module, and returning to the channel.
And transmitting the information of the selected standby channel or the unavailable channel to a channel state management module as a new available channel.
Fig. 5 is a schematic diagram of a data transmission apparatus according to an embodiment of the present invention, and as shown in fig. 5, according to another aspect of the embodiment of the present invention, there is also provided a data transmission apparatus including: a detection module 52, a determination module 54 and a switching module 56, which are described in detail below.
A detecting module 52, configured to perform availability detection on data channels to which a target device is connected, where the number of the data channels to which the target device is connected is multiple; a determining module 54, connected to the detecting module 52, for determining whether the data channel is the data channel used for the current data transmission if the availability detection result of the connected data channel is unavailable; and a switching module 56, connected to the determining module 54, configured to switch the data channel to a standby channel according to the available standby channel list when the data channel is a data channel used for current data transmission, and perform data transmission with the target device through the switched standby channel.
By the device, the availability of the data channel connected with the target equipment is detected by using the detection module 52; the determining module 54 determines whether the data channel is a data channel used for current data transmission when the availability detection result of the connected data channel is unavailable; the switching module 56 switches the data channel to the standby channel according to the available standby channel list when the data channel is the data channel used by the current data transmission, detects the availability of the data transmission channel connected to the target device by the switched standby channel and the target device for data transmission, and switches the data channel to the standby channel when the data channel for the current data transmission is unavailable, so as to achieve the purpose of ensuring the stability and efficiency of the data transmission, thereby achieving the technical effect of eliminating the influence of the computing capacity and signal instability of the hardware device on the stability and efficiency of the data transmission, and further solving the technical problems that the computing capacity of the intelligent hardware device in the related art is limited, and the instability may be caused by the problem of signal difference when the device is connected and data communication is performed.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes the data transmission method of any one item.
According to another aspect of the embodiments of the present invention, there is also provided a computer storage medium, where the computer storage medium includes a stored program, and when the program runs, the apparatus on which the computer storage medium is located is controlled to execute the data transmission method of any one of the above.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.