A kind of data transmission method and terminal, storage mediumTechnical field
This application involves the communications field more particularly to a kind of data transmission method and terminals, storage medium.
Background technique
The long term evolution of third generation partner program (3GPP, 3rd Generation Partnership Project)Especially following the 5th third-generation mobile communication technology (5G, the 5th Generation) communication can promote to office, family, publicA kind of local network interconnection agreement (IP, Internet Protocol) under hot spot or outdoor environment services to be visitedIt asks.Locality connection or the most brief use-case of local IP access be between even hundred meters of ten meters of distance of short-range terminal directly intoThe mode of row communication, i.e. device-to-device (D2D, Device-to-Device) communicate, D2D communication as the term suggests be exactly terminal withThe process of communication between terminal, general D2D communication is, when first terminal needs are communicated with second terminal, firstTerminal first establishes connection with base station, base station allocation of communication channels to first terminal, first terminal using the communication channel realize withCommunication between second terminal.
Between the communication channel and second terminal that first terminal is distributed by base station when mutual data transmission, it should realize and refer toIt the transmission process of control class business such as enables, request, realizing the transmission process of the data service of big data quantity again, however, communicationThe bandwidth bearing capacity of channel is limited, and data transmission bauds when will lead to D2D communication reduces.
Summary of the invention
The embodiment of the present application provides a kind of data transmission method and terminal, storage medium, can be improved number when D2D communicationAccording to transmission speed.
The technical solution of the application is achieved in that
The embodiment of the present application provides a kind of data transmission method, is applied to first terminal, which comprises
When foundation is communicated with the device-to-device of second terminal, the first short-range communication is established with the second terminal,First short-range communication is the communication type in addition to device-to-device communication;
When detecting the first data to be transmitted, the data volume of first data to be transmitted is obtained;
When the data volume is less than preset threshold, institute is transmitted to the second terminal by first short-range communicationState the first data to be transmitted.
In the above-mentioned methods, after the data volume for obtaining first data to be transmitted, the method also includes:
When the data volume is more than or equal to the preset threshold, communicated by the device-to-device to described theFirst data to be transmitted described in two terminal transmissions.
It is in the above-mentioned methods, described to establish the first short-range communication with the second terminal, comprising:
Start the first short-range communication function of itself;
When using the first short-range communication function and the second terminal successful matching, closely for described firstAllocation of communications first communication channel;
By the first communication channel, first short-range communication is established with the second terminal.
In the above-mentioned methods, described to be passed to second terminal transmission described first by first short-range communicationTransmission of data, comprising:
By the first communication channel, first data to be transmitted is transmitted to the second terminal.
In the above-mentioned methods, described to be established before the first short-range communication with the second terminal, the method also includes:
To base station sending device to equipment communication connection request, the device-to-device communication connection request be used for it is describedSecond terminal establishes device-to-device communication connection;
When getting the second communication channel of base station transmission, using second communication channel, with the second terminalEstablish the device-to-device communication.
In the above-mentioned methods, it is described communicated by the device-to-device transmitted to the second terminal it is described first to be passedTransmission of data, comprising:
Using second communication channel, first data to be transmitted is transmitted to the second terminal.
In the above-mentioned methods, first short-range communication includes at least: Bluetooth communication or Wireless Fidelity communication.
The embodiment of the present application provides a kind of first terminal, and the first terminal includes:
Establish unit, for when establish communicated with the device-to-device of second terminal when, establish the with the second terminalOne short-range communication, first short-range communication are the communication type in addition to device-to-device communication;
Acquiring unit, for obtaining the data volume of first data to be transmitted when detecting the first data to be transmitted;
Transmission unit, for when the data volume is less than preset threshold, by first short-range communication to describedSecond terminal transmits first data to be transmitted.
In above-mentioned first terminal, the transmission unit is also used to be more than or equal to described preset when the data volumeWhen threshold value, is communicated by the device-to-device to the second terminal and transmit first data to be transmitted.
In above-mentioned first terminal, the first terminal further include: start unit and allocation unit;
The start unit, for starting itself the first short-range communication function;
The allocation unit utilizes the first short-range communication function and the second terminal successful matching for working asWhen, first communication channel is distributed for first short-range communication;
It is described to establish unit, for establishing first low coverage with the second terminal by the first communication channelFrom communication.
In above-mentioned first terminal, the transmission unit is specifically used for by the first communication channel, to described secondFirst data to be transmitted described in terminal transmission.
In above-mentioned first terminal, the first terminal further include: transmission unit;
The transmission unit, for arriving equipment communication connection request to base station sending device, the device-to-device is communicatedConnection request is used to establish device-to-device communication connection with the second terminal;
It is described to establish unit, it is also used to when getting the second communication channel of base station transmission, utilizes second communicationChannel is established the device-to-device with the second terminal and is communicated.
In above-mentioned first terminal, the transmission unit is also used to using second communication channel, eventually to described secondTransmit first data to be transmitted in end.
In above-mentioned first terminal, first short-range communication is included at least: Bluetooth communication or Wireless Fidelity communication.
The embodiment of the present application provides a kind of first terminal, the first terminal include: memory, processor, transmitter andThe computer program that can be run on a memory and on a processor is stored, is realized when said program is executed by a processor as aboveState described in any item data transmission methods.
The embodiment of the present application provides a kind of storage medium, is stored thereon with computer program, is applied to first terminal, the meterCalculation machine program realizes data transmission method as described in any one of the above embodiments when being executed by processor.
The embodiment of the present application provides a kind of data transmission method and terminal, storage medium, is applied to first terminal, the partyMethod may include: to establish the first short-range communication with second terminal when foundation is communicated with the device-to-device of second terminal, theOne short-range communication is the communication type in addition to device-to-device communication;When detecting the first data to be transmitted, first is obtainedThe data volume of data to be transmitted;When data volume is less than preset threshold, by the first short-range communication to second terminal transmission theOne data to be transmitted.Using above method implementation, first terminal when establishing device-to-device with second terminal and communicating, withSecond terminal establishes the first short-range communication, when transmitting small data quantity data between first terminal and second terminal, utilizes theOne short-range communication transmission, at this point, device-to-device, which communicates corresponding second transmission channel, is completely used for transmission big data quantity numberAccording to due to the characteristics such as the transmission reliability and stability of the second communication channel are high, the interference in transmission process is small, in the big number of transmissionWhen according to amount data, data transmission bauds when D2D communication can be improved while improving transmission quality.
Detailed description of the invention
Fig. 1 is a kind of flow chart one of data transmission method provided by the embodiments of the present application;
Fig. 2 is a kind of flowchart 2 of data transmission method provided by the embodiments of the present application;
Fig. 3 is a kind of flow chart of illustrative data transmission method provided by the embodiments of the present application;
Fig. 4 is a kind of structural schematic diagram one of first terminal provided by the embodiments of the present application;
Fig. 5 is a kind of structural schematic diagram two of first terminal provided by the embodiments of the present application.
Specific embodiment
It should be appreciated that specific embodiment described herein is only used to explain the application.It is not used to limit the application.
Embodiment one
The embodiment of the present application provides a kind of data transmission method, is applied to first terminal, as shown in Figure 1, this method can be withInclude:
S101, when establish communicated with the device-to-device of second terminal when, establish the first short-range communication with second terminal,First short-range communication is the communication type in addition to device-to-device communication.
A kind of data transmission method provided by the embodiments of the present application is suitable for first terminal and second terminal establishes D2D communicationUnder the scene carried out data transmission later.
In the embodiment of the present application, above-mentioned calling terminal and called terminal can have setting for communication and store function to be anyIt is standby, such as: tablet computer, mobile phone, electronic reader, remote controler, personal computer (Personal Computer, PC), notesThe equipment such as this computer, mobile unit, Web TV, wearable device, are specifically selected according to the actual situation, and the application is realIt applies example and does not do specific restriction.
In the embodiment of the present application, user selects the second terminal mark of second terminal on the communication connection interface of first terminalKnow, and click D2D communications buttons, at this point, first terminal is sent and second according to the operation for clicking D2D communications buttons to base stationTerminal carries out the communication connection request of D2D communication, and when base station is that first terminal distributes the second communication channel, first terminal is utilizedSecond communication channel, establish with the D2D link of second terminal, at this point, first terminal and second terminal on D2D chain road using pairThe IP address at end carries out data transmission, without being subjected to base station.
It should be noted that base station is the second communication channel for carrying out D2D communication of first terminal distribution due to makingIt is the authorized spectrum band of telecom operators, therefore, the transmission reliability and stability of the second communication channel be high, in transmission processInterference it is small.
In the embodiment of the present application, when first terminal, which establishes D2D with second terminal, to be communicated, first terminal is built with second terminalVertical first short-range communication, wherein the first short-range communication is the communication type in addition to D2D communication.
Optionally, the first short-range communication includes that Bluetooth communication, Wireless Fidelity (WiFi, Wireless Fidelity) are logicalLetter etc. is specifically selected, the embodiment of the present application according to the actual situation by the communication mode of first terminal allocation of communication channelsSpecific restriction is not done.
In the embodiment of the present application, first terminal starts the first short-range communication function of itself, and closely using firstCommunication function searches for second terminal, needs second terminal at this time while starting the second short-range communication function of itself, when firstAfter terminal utilizes the first short-range communication searching functions to second terminal, first terminal sends pairing request to second terminal,When first terminal and second terminal successful matching, first terminal is the first short-range communication distribution first communication channel, at this point,First terminal is by establishing the first short-range communication between first communication channel, with second terminal.
Illustratively, terminal 1 starts Bluetooth function, and by bluetooth discovery terminal 2, when terminal 1 searches terminal 2,Terminal 1 sends pairing request to terminal 2, and after terminal 2 agrees to the pairing request with terminal 1, terminal 1 distributes channel, at this point,It can use the channel between terminal 1 and terminal 2 and carry out Bluetooth communication.
S102, when detecting the first data to be transmitted, obtain the first data to be transmitted data volume.
After first terminal and second terminal establish the first short-range communication, first terminal will detect first toWhen transmitting data, the data volume of the first data to be transmitted is obtained.
In the embodiment of the present application, when first terminal detects the first data to be transmitted, it is to be transmitted that first terminal obtains firstThe data volume of data, to determine the transmission mode of the first data to be transmitted of transmission according to the data volume of the first data to be transmitted, i.e.,The first data to be transmitted is transmitted using D2D communication or the first data to be transmitted is transmitted using the first short-range communication.
S103, when data volume is less than preset threshold, it is first to be passed to second terminal transmission by the first short-range communicationTransmission of data.
After first terminal gets the data volume of the first data to be transmitted, first terminal will be by data volume and defaultThreshold value is compared, and when first terminal judges that data volume is less than preset threshold, first terminal is closely logical by firstBelieve to second terminal and transmits the first data to be transmitted.
In the embodiment of the present application, the data volume of the first data to be transmitted and preset threshold are compared by first terminal, whenWhen first terminal judges that data volume is less than preset threshold, the first data to be transmitted of characterization is the small data quantities such as instruction, requestClass data are controlled, at this point, first terminal transmits the first data to be transmitted to second terminal by the first short-range communication.
Further, when first terminal judges that data volume is more than or equal to preset threshold, characterization first is to be transmittedData are the data of big data quantity, at this point, first terminal transmits the first number to be transmitted to second terminal by D2D communication modeAccording to.
It is understood that first terminal when establishing device-to-device with second terminal and communicating, is established with second terminalFirst short-range communication utilizes the first short-range communication when transmitting small data quantity data between first terminal and second terminalTransmission, at this point, device-to-device, which communicates corresponding second transmission channel, is completely used for transmission Volume data, due to second logicalBelieve the characteristics such as transmission reliability and the stability of channel is high, the interference in transmission process is small, when transmitting Volume data, energyEnough data transmission bauds while improving transmission quality, when raising D2D is communicated.
Embodiment two
The embodiment of the present application provides a kind of data transmission method, is applied to first terminal, as shown in Fig. 2, this method can be withInclude:
S201, first terminal are to base station sending device to equipment communication connection request, device-to-device communication connection requestFor establishing device-to-device communication connection with second terminal.
A kind of data transmission method provided by the embodiments of the present application is suitable for first terminal and second terminal establishes D2D communicationUnder the scene carried out data transmission later.
In the embodiment of the present application, above-mentioned calling terminal and called terminal can have setting for communication and store function to be anyIt is standby, such as: tablet computer, electronic reader, remote controler, PC, laptop, mobile unit, Web TV, can be worn mobile phoneThe equipment such as equipment are worn, are specifically selected according to the actual situation, the embodiment of the present application does not do specific restriction.
In the embodiment of the present application, user selects the second terminal mark of second terminal on the communication connection interface of first terminalKnow, and click D2D communications buttons, at this point, first terminal is sent and second according to the operation for clicking D2D communications buttons to base stationThe communication connection request of terminal progress D2D communication.
S202, when first terminal get base station transmission the second communication channel when, first terminal using second communication letterRoad is established device-to-device with second terminal and is communicated.
After first terminal is to base station sending device to equipment communication connection request, first terminal will receive baseWhen the second communication channel sent of standing, using the second communication channel, device-to-device is established with second terminal and is communicated.
In the embodiment of the present application, after base station receives the communication connection request of first terminal transmission, base station judges firstThe condition of terminal and the whether full then D2D communication of second terminal, when base station judges that first terminal and second terminal are all satisfied D2D and lead toWhen the condition of letter, base station is that first terminal distributes the second communication channel, and the channel information of the second communication channel is sent to theOne terminal, after the channel information that first terminal receives the second communication channel of base station transmission, first terminal utilizes secondCommunication channel establishes the D2D link with second terminal, at this point, establishing D2D communication between first terminal and second terminal.
S203, when first terminal foundation is communicated with the device-to-device of second terminal, first terminal starts itself theOne short-range communication function.
When first terminal, which establishes device-to-device with second terminal, to be communicated, it is first close will to start itself for first terminalDistance communication function.
In the embodiment of the present application, when first terminal foundation is communicated with the D2D of second terminal, first terminal starts itselfFirst short-range communication function, wherein the first short-range communication includes at least: Bluetooth communication or Wi-Fi communication, specific rootIt is selected according to actual conditions, the embodiment of the present application does not do specific restriction.
S204, when first terminal utilize the first short-range communication function and second terminal successful matching when, first terminal isFirst short-range communication distributes first communication channel, and the first short-range communication is the communication type in addition to device-to-device communication.
After first terminal starts the first short-range communication function of itself, first terminal will be using first closelyIt is right that function is matched with second terminal, when first terminal is using the first short-range communication function and second terminal successful matching, theOne terminal will distribute first communication channel for the first short-range communication.
In the embodiment of the present application, first terminal utilizes the first short-range communication searching functions second terminal, needs the at this timeTwo terminals start the second short-range communication function of itself simultaneously, when first terminal is arrived using the first short-range communication searching functionsAfter second terminal, first terminal sends pairing request to second terminal, when first terminal and second terminal successful matching, theOne terminal is that the first short-range communication distributes first communication channel.
S205, first terminal establish the first short-range communication with second terminal by first communication channel.
After first terminal is that the first short-range communication distributes first communication channel, first terminal will be logical by firstBelieve channel, establishes the first short-range communication with second terminal.
In the embodiment of the present application, first terminal establishes the first short-range communication by first communication channel and second terminal.
Illustratively, terminal 1 starts Bluetooth function, and by bluetooth discovery terminal 2, when terminal 1 searches terminal 2,Terminal 1 sends pairing request to terminal 2, and after terminal 2 agrees to the pairing request with terminal 1, terminal 1 distributes channel, at this point,It can use the channel between terminal 1 and terminal 2 and carry out Bluetooth communication.
S206, when first terminal detects the first data to be transmitted, first terminal obtain the first data to be transmitted numberAccording to amount.
After first terminal and second terminal establish the first short-range communication, first terminal will detect first toWhen transmitting data, the data volume of the first data to be transmitted is obtained.
In the embodiment of the present application, when first terminal detects the first data to be transmitted, it is to be transmitted that first terminal obtains firstThe data volume of data, to determine the transmission mode of the first data to be transmitted of transmission according to the data volume of the first data to be transmitted, i.e.,The first data to be transmitted is transmitted using D2D communication or the first data to be transmitted is transmitted using the first short-range communication.
It should be noted that established between first terminal and second terminal D2D communication and the first short-range communication itAfterwards, first terminal and second terminal can be according to the data volumes of the data to be transmitted of itself, to select different transmission modes, thisApplication embodiment is only explained by taking first terminal as an example, but is not limited to actively establish the first terminal of communication connection.
S207, when data volume is less than preset threshold, first terminal is by first communication channel, to second terminal transmission theOne data to be transmitted.
After first terminal gets the data volume of the first data to be transmitted, first terminal will be by data volume and defaultThreshold value is compared, when first terminal judges the data volume of the first data to be transmitted less than preset threshold, first terminalThe first data to be transmitted will be transmitted to second terminal by first communication channel.
In the embodiment of the present application, the data volume of the first data to be transmitted and preset threshold are compared by first terminal, whenWhen first terminal judges that data volume is less than preset threshold, the first data to be transmitted of characterization is the small data quantities such as instruction, requestControl class data, at this point, first terminal by the first short-range communication to second terminal transmit the first data to be transmitted, i.e., firstTerminal transmits the first data to be transmitted by the corresponding first communication channel of the first short-range communication, to second terminal.
S208, when data volume be more than or equal to preset threshold when, first terminal is communicated by device-to-device to secondThe first data to be transmitted of terminal transmission.
After first terminal gets the data volume of the first data to be transmitted, first terminal will be by data volume and defaultThreshold value is compared, when first terminal judges the data volume of the first data to be transmitted more than or equal to preset threshold,First terminal will be communicated to second terminal by device-to-device and transmit the first data to be transmitted.
In the embodiment of the present application, when first terminal judges that data volume is more than or equal to preset threshold, characterization firstData to be transmitted is Volume data, at this point, first terminal, which is communicated by D2D to second terminal, transmits the first number to be transmittedAccording to.
Specifically, first terminal utilizes the second communication channel, the first data to be transmitted is transmitted to second terminal.
Illustratively, as shown in figure 3, the process carried out data transmission between terminal A and terminal B includes:
1, terminal A initiates D2D communication request to base station;
2, base station is that terminal A distributes Traffic Channel according to D2D communication request;
3, terminal A and terminal B establishes D2D using Traffic Channel and communicates to connect, and carries out big data quantity using Traffic ChannelData transmission;
4, bluetooth connection is carried out between terminal A and terminal B, terminal A is that Bluetooth communication distributes control channel;
5, terminal A and terminal B such as makes requests using control channel, instructs at being transmitted across for the control class data of small data quantitiesJourney.
S207 and S208 is two steps arranged side by side after S206, and specific execution sequence is selected according to the actual situationIt selects, the embodiment of the present application does not do specific restriction.
It is understood that first terminal when establishing device-to-device with second terminal and communicating, is established with second terminalFirst short-range communication utilizes the first short-range communication when transmitting small data quantity data between first terminal and second terminalTransmission, at this point, device-to-device, which communicates corresponding second transmission channel, is completely used for transmission Volume data, due to second logicalBelieve the characteristics such as transmission reliability and the stability of channel is high, the interference in transmission process is small, when transmitting Volume data, energyEnough data transmission bauds while improving transmission quality, when raising D2D is communicated.
Embodiment three
The embodiment of the present application provides a kind of first terminal 1, as shown in figure 4, the first terminal 1 includes:
Unit 10 is established, for being established with the second terminal when foundation is communicated with the device-to-device of second terminalFirst short-range communication, first short-range communication are the communication type in addition to device-to-device communication;
Acquiring unit 11, for obtaining the data of first data to be transmitted when detecting the first data to be transmittedAmount;
Transmission unit 12, for when the data volume is less than preset threshold, by first short-range communication to instituteIt states second terminal and transmits first data to be transmitted.
Optionally, the transmission unit 12 is also used to lead to when the data volume is more than or equal to the preset thresholdThe device-to-device is crossed to communicate to second terminal transmission first data to be transmitted.
Optionally, the first terminal 1 further include: start unit 13 and allocation unit 14;
The start unit 13, for starting itself the first short-range communication function;
The allocation unit 14 utilizes the first short-range communication function and the second terminal successful matching for working asWhen, first communication channel is distributed for first short-range communication;
It is described to establish unit 10, for it is close to establish described first with the second terminal by the first communication channelDistance communication.
Optionally, the transmission unit 12 is specifically used for transmitting by the first communication channel to the second terminalFirst data to be transmitted.
Optionally, the first terminal 1 further include: transmission unit 15;
The transmission unit 15, for base station sending device arrive equipment communication connection request, the device-to-device lead toLetter connection request is used to establish device-to-device communication connection with the second terminal;
It is described to establish unit 10, it is also used to when getting the second communication channel of base station transmission, it is logical using described secondBelieve channel, establishes the device-to-device with the second terminal and communicate.
Optionally, the transmission unit 12, is also used to using second communication channel, transmits institute to the second terminalState the first data to be transmitted.
Optionally, first short-range communication includes at least: Bluetooth communication or Wireless Fidelity communication.
In practical applications, under the same inventive concept based on embodiment one and embodiment two, as shown in figure 5, first is wholeEnd 1 may include: processor 16, memory 17, transmitter 18, communication interface 19 and bus 110;
Above-mentioned unit 10, acquiring unit 11, transmission unit 12, start unit 13 and the allocation unit 14 established can be by being located at theProcessor 16 in one terminal 1 realizes that above-mentioned transmission unit 15 can be realized that above-mentioned processor 16 can be specific by transmitter 18Purposes integrated circuit (ASIC, Application Specific Integrated Circuit), digital signal processor(DSP, Digital Signal Processor), digital signal processing device (DSPD, Digital SignalProcessing Device), programmable logic device (PLD, Programmable Logic Device), field programmable gateArray (FPGA, Field Programmable Gate Array), central processing unit (CPU, Central ProcessingUnit), at least one of controller, microcontroller, microprocessor.It is to be appreciated that for different equipment, for realizingThe electronic device of above-mentioned processor function can also be to be other, and the embodiment of the present application is not especially limited, which also wrapsIncluding memory 17, wherein for memory 17 for storing executable program code, which includes computer operation instruction,Memory 17 may include high speed RAM memory, it is also possible to further include nonvolatile memory, for example, at least one disk is depositedReservoir.
The bus 110 for connect the processor 16, the memory 17, the transmitter 18, it is described communication connectBeing in communication with each other between mouth 19 and these devices;
The communication interface 19, for carrying out data transmission with ext nal network element;
The memory 17, for storing instruction and data;
The transmitter 18, for arriving equipment communication connection request to base station sending device, the device-to-device is communicatedConnection request is used to establish device-to-device communication connection with the second terminal;
The processor 16 executes described instruction and is used for: when foundation is communicated with the device-to-device of second terminal, with instituteIt states second terminal and establishes the first short-range communication, first short-range communication is the communication in addition to device-to-device communicationType;When detecting the first data to be transmitted, the data volume of first data to be transmitted is obtained;When the data volume is less thanWhen preset threshold, first data to be transmitted is transmitted to the second terminal by first short-range communication.
In practical applications, above-mentioned memory 17 can be volatibility first memory (volatile memory), such asArbitrary access first memory (RAM, Random-Access Memory);Or non-volatile first memories (non-Volatile memory), for example, read-only first memory (ROM, Read-Only Memory), quick flashing first memory(flash memory), hard disk (HDD, Hard Disk Drive) or solid state hard disk (SSD, Solid-State Drive);OrThe combination of the first memory of person's mentioned kind, and instruction and data is provided to processor 16.
In addition, each functional module in the present embodiment can integrate in one processing unit, it is also possible to each listMember physically exists alone, and can also be integrated in one unit with two or more units.Above-mentioned integrated unit both can be withUsing formal implementation of hardware, can also be realized in the form of software function module.
If the integrated unit realizes that being not intended as independent product is sold in the form of software function moduleOr in use, can store in a computer readable storage medium, based on this understanding, the technical side of the present embodimentSubstantially all or part of the part that contributes to existing technology or the technical solution can be produced case in other words with softwareThe form of product embodies, which is stored in a storage medium, including some instructions are used so that onePlatform computer equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute sheetThe all or part of the steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, ROM, RAM, magnetic diskOr the various media that can store program code such as CD.
The embodiment of the present application provides a kind of storage medium, is stored thereon with computer program, is applied in first terminal 1,The data transmission method as described in embodiment one and embodiment two is realized when the computer program is executed by processor 16.
The above, the only preferred embodiment of the application, are not intended to limit the protection scope of the application.