CN109981651A - Data transmission method, device, mobile terminal and readable storage medium storing program for executing - Google Patents

Data transmission method, device, mobile terminal and readable storage medium storing program for executing Download PDF

Info

Publication number
CN109981651A
CN109981651A CN201910241759.1A CN201910241759A CN109981651A CN 109981651 A CN109981651 A CN 109981651A CN 201910241759 A CN201910241759 A CN 201910241759A CN 109981651 A CN109981651 A CN 109981651A
Authority
CN
China
Prior art keywords
data
thresholding
transmitted
length
tlv
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910241759.1A
Other languages
Chinese (zh)
Inventor
张林涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201910241759.1A priority Critical patent/CN109981651A/en
Publication of CN109981651A publication Critical patent/CN109981651A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Abstract

The invention discloses a kind of data transmission methods, by the data to be transmitted for obtaining transmitting terminal;According to default TLV agreement, the data to be transmitted is encoded to the transmission data packet of hexadecimal TLV format;The transmission data packet is transmitted to receiving end waiting, so that end group to be received is decoded to obtain the data to be transmitted in default TLV agreement to the transmission data packet.The invention also discloses a kind of data transmission device, mobile terminal and readable storage medium storing program for executing.The present invention can greatly reduce transmission data package size, improve efficiency of transmission;And the safety of data transmission is improved to a certain extent.

Description

Data transmission method, device, mobile terminal and readable storage medium storing program for executing
Technical field
The present invention relates to data communication technology field more particularly to a kind of data transmission method, device, mobile terminals and can Read storage medium.
Background technique
When terminal device is carried out data transmission by bluetooth at present, in order to realize it is simple, facilitate parsing, generally can all use The character string of json format carries out data transmitting, and the message transmissions of json format are that the message data that will need to transmit directly is converted It is transmitted after character string for corresponding system.The message transmissions of json format are directly directly to convert the reference data of message data It is transmitted after character string for corresponding system, though the reference data of message data is converted directly into the character string of corresponding system So realize that simple, development cost is low, but the byte length that will lead to transmitting message occupancy is longer, influences efficiency of transmission.
Above content is only used to facilitate the understanding of the technical scheme, and is not represented and is recognized that above content is existing skill Art.
Summary of the invention
The main purpose of the present invention is to provide a kind of data transmission methods, it is intended to solve message number in current transmission mode According to occupying, byte length is larger, leads to the technical problem that data transmission efficiency is low.
To achieve the above object, the present invention provides a kind of data transmission method, comprising:
Obtain the data to be transmitted of transmitting terminal;
According to default TLV agreement, the data to be transmitted is encoded to the transmission data packet of hexadecimal TLV format;
The transmission data packet is transmitted to receiving end waiting, for end group to be received in default TLV agreement to the transmission Data packet is decoded to obtain the data to be transmitted.
Optionally, the basis presets TLV agreement, and the data to be transmitted is encoded to the biography of hexadecimal TLV format The step of transmission of data packet includes:
According to default TLV agreement, the data type of the data to be transmitted is indicated using hexadecimal number, it is described to obtain The label thresholding of data to be transmitted;
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, it is described to obtain The length thresholding of data to be transmitted;
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number, to obtain the data to be transmitted In label thresholding and length thresholding described in every group content thresholding;
It is the transmission number of hexadecimal TLV format by the label thresholding, length thresholding and content thresholding assembly coding According to packet.
Optionally, the basis presets TLV agreement, the data to be transmitted is indicated using hexadecimal number, to obtain The step of stating the content thresholding of label thresholding and length thresholding described in every group in data to be transmitted include:
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number;
Using the label thresholding of pairing and length thresholding as a thresholding group, the nesting level of each thresholding group is determined Grade;
According to preset nested layer level traversal order, the data to be transmitted that hexadecimal number indicates is configured to each domain Value group, to obtain the content thresholding of each thresholding group in the data to be transmitted.
Optionally, the basis presets TLV agreement, and the byte long of the data to be transmitted is indicated using hexadecimal number Degree, to include: the step of obtaining the length thresholding of the data to be transmitted
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, and it is long to obtain first Spend thresholding;
Judge whether byte number shared by the first length thresholding is greater than predetermined word joint number;
If byte number shared by the first length thresholding is greater than predetermined word joint number, increasing indicates first length field The byte of value, until the first length thresholding complete representation, to obtain the length thresholding of the data to be transmitted.
Optionally, described to increase the byte for indicating the first length thresholding, until the first length thresholding complete representation, with The step of obtaining the length thresholding of the data to be transmitted include:
Increase the byte for indicating the first length thresholding, until the first length thresholding complete representation, obtains described in expression The target byte of first length thresholding;
It is indicated, is obtained using the target byte by the extreme higher position 1 of each newly-increased byte, and by the first length thresholding To the second length thresholding;
The second length thresholding, which is converted to hexadecimal number, to be indicated, the length thresholding of the data to be transmitted is obtained.
Optionally, it is described judge the step of whether byte number shared by the first length thresholding is greater than predetermined word joint number it Afterwards further include:
If byte number shared by the first length thresholding is less than or equal to predetermined word joint number, by first length field It is worth the length thresholding as the data to be transmitted.
Optionally, the data transmission method further include:
Receive the transmission data packet of transmitting terminal transmission;
According to default TLV agreement, label thresholding, length thresholding and the content thresholding of the transmission data packet are determined;
According to the label thresholding, length thresholding and content thresholding, the data content of the transmission data packet transmission is determined.
In addition, to achieve the above object, the present invention also provides a kind of data transmission device, the data transmission device packet It includes:
Data acquisition module, for obtaining the data to be transmitted of transmitting terminal;
Data coding module, for according to TLV agreement is preset, the data to be transmitted to be encoded to hexadecimal TLV lattice The transmission data packet of formula;
Data transmission module, for the transmission data packet to be transmitted to receiving end waiting, so that end group to be received is in default TLV agreement is decoded to obtain the data to be transmitted to the transmission data packet.
In addition, to achieve the above object, the present invention also provides a kind of mobile terminal, the mobile terminal include: memory, Processor and it is stored in the data distributing program that can be run on the memory and on the processor, the data transmit journey The step of sequence realizes data transmission method as described above when being executed by the processor.
In addition, to achieve the above object, the present invention also provides a kind of readable storage medium storing program for executing, being deposited on the readable storage medium storing program for executing Data distributing program is contained, the data distributing program realizes the step of data transmission method as described above when being executed by processor Suddenly.
A kind of data transmission method that the embodiment of the present invention proposes, by transmitting terminal by data to be transmitted according to default TLV agreement carries out coding and forms transmission data packet, is then transmit to receiving end waiting;After termination to be received receives transmission data packet, It is decoded according to default TLV agreement, data to be transmitted, data transmission procedure is completed using default TLV agreement to realize.It is logical The data using default TLV agreement transmission are crossed, the T value for transmitting the area T in data packet defines the V of the area V data to be transmitted type, the area V Value defines specific data content, because T value and V value are customized numerical value, and not reference data, byte long shared by customized numerical value It is much smaller to spend relative datum data, so as to greatly reduce transmission data package size, improves efficiency of transmission.In addition, because in T Qu represents the T value of institute's wire data type or attribute and is customized value in the V value that the area V represents specific data content, Even if data are intercepted in transmission process, are compareed without Protocol document, meaning in data packet can not be understood, thus in certain journey The safety of data transmission is improved on degree.
Detailed description of the invention
Fig. 1 is the hardware structural diagram of the embodiment of the present invention one optional mobile terminal;
Fig. 2 is the wireless communication device schematic diagram of mobile terminal in Fig. 1;
Fig. 3 is the flow diagram of data transmission method first embodiment of the present invention;
Fig. 4 is a schematic diagram of a scenario of the data packet of TLV of embodiment of the present invention format;
Fig. 5 is the scene that the identical data of the multiple data types of second embodiment of the invention form a transmission data packet Schematic diagram;
Fig. 6 is the scene that the identical data of the multiple data types of second embodiment of the invention form multiple transmission data packets Schematic diagram.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In subsequent description, it is only using the suffix for indicating such as " module ", " component " or " unit " of element Be conducive to explanation of the invention, itself there is no a specific meaning.Therefore, " module ", " component " or " unit " can mix Ground uses.
Terminal can be implemented in a variety of manners.For example, terminal described in the present invention may include such as mobile phone, plate Computer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable Media player (Portable Media Player, PMP), navigation device, wearable device, Intelligent bracelet, pedometer etc. move The fixed terminals such as dynamic terminal, and number TV, desktop computer.
It will be illustrated by taking mobile terminal as an example in subsequent descriptions, it will be appreciated by those skilled in the art that in addition to special Except element for moving purpose, the construction of embodiment according to the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, a kind of hardware structural diagram of its mobile terminal of each embodiment to realize the present invention, the shifting Dynamic terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, the components such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1 Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal may include components more more or fewer than diagram, Perhaps certain components or different component layouts are combined.
It is specifically introduced below with reference to all parts of the Fig. 1 to mobile terminal:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, signal sends and receivees, specifically, by base station Downlink information receive after, to processor 110 handle;In addition, the data of uplink are sent to base station.In general, radio frequency unit 101 Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrating Frequency unit 101 can also be communicated with network and other equipment by wireless communication.Any communication can be used in above-mentioned wireless communication Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code Division Multiple Access2000, CDMA 2000), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division Duplexing-Long Term Evolution, frequency division duplex long term evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution, time division duplex long term evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch electricity by WiFi module 102 Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 1 shows Go out WiFi module 102, but it is understood that, and it is not belonging to must be configured into for mobile terminal, it completely can be according to need It to omit within the scope of not changing the essence of the invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100 When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is received or The audio data stored in memory 109 is converted into audio signal and exports to be sound.Moreover, audio output unit 103 Audio output relevant to the specific function that mobile terminal 100 executes can also be provided (for example, call signal receives sound, disappears Breath receives sound etc.).Audio output unit 103 may include loudspeaker, buzzer etc..
A/V input unit 104 is for receiving audio or video signal.A/V input unit 104 may include graphics processor (Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition mode Or the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries out Reason.Treated, and picture frame may be displayed on display unit 106.Through graphics processor 1041, treated that picture frame can be deposited Storage is sent in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042 Quiet down sound (audio data), and can be audio data by such acoustic processing.Audio that treated (voice) data can To be converted to the format output that can be sent to mobile communication base station via radio frequency unit 101 in the case where telephone calling model. Microphone 1042 can be implemented various types of noises elimination (or inhibition) algorithms and send and receive sound to eliminate (or inhibition) The noise generated during frequency signal or interference.
Mobile terminal 100 further includes at least one sensor 105, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 1061, and proximity sensor can close when mobile terminal 100 is moved in one's ear Display panel 1061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (general For three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.; The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, The other sensors such as hygrometer, thermometer, infrared sensor, details are not described herein.
Display unit 106 is for showing information input by user or being supplied to the information of user.Display unit 106 can wrap Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configure display panel 1061.
User input unit 107 can be used for receiving the number or character information of input, and generate the use with mobile terminal Family setting and the related key signals input of function control.Specifically, user input unit 107 may include touch panel 1071 with And other input equipments 1072.Touch panel 1071, also referred to as touch screen collect the touch operation of user on it or nearby (for example user uses any suitable objects or attachment such as finger, stylus on touch panel 1071 or in touch panel 1071 Neighbouring operation), and corresponding attachment device is driven according to preset formula.Touch panel 1071 may include touch detection Two parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation band The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it It is converted into contact coordinate, then gives processor 110, and order that processor 110 is sent can be received and executed.In addition, can To realize touch panel 1071 using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves.In addition to touch panel 1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrap It includes but is not limited in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, operating stick etc. It is one or more, specifically herein without limitation.
Further, touch panel 1071 can cover display panel 1061, when touch panel 1071 detect on it or After neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thing The type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, touch panel 1071 and display panel 1061 be the function that outputs and inputs of realizing mobile terminal as two independent components, but in certain embodiments, it can The function that outputs and inputs of mobile terminal is realized so that touch panel 1071 and display panel 1061 is integrated, is not done herein specifically It limits.
Interface unit 108 be used as at least one external device (ED) connect with mobile terminal 100 can by interface.For example, External device (ED) may include wired or wireless headphone port, external power supply (or battery charger) port, wired or nothing Line data port, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be with For transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storing software program and various data, and memory 109 can be situated between for a kind of storage of computer Matter, the memory 109 are stored with data distributing program of the present invention.Memory 109 can mainly include storing program area and storage number According to area, wherein storing program area can application program needed for storage program area, at least one function (for example sound plays function Energy, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such as audio data, Phone directory etc.) etc..In addition, memory 109 may include high-speed random access memory, it can also include non-volatile memories Device, for example, at least a disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the entire mobile terminal of connection A part by running or execute the software program and/or module that are stored in memory 109, and calls and is stored in storage Data in device 109 execute the various functions and processing data of mobile terminal, to carry out integral monitoring to mobile terminal.Such as Processor 110 executes the data distributing program in memory 109, to realize the step of each embodiment of data transmission method of the present invention Suddenly.
Processor 110 may include one or more processing units;Optionally, processor 110 can integrate application processor and Modem processor, wherein the main processing operation system of application processor, user interface and application program etc., modulation /demodulation Processor mainly handles wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110 In.
Mobile terminal 100 can also include the power supply 111 (such as battery) powered to all parts, optionally, power supply 111 Can be logically contiguous by power-supply management system and processor 110, to realize management charging by power-supply management system, put The functions such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also be including bluetooth module etc., and details are not described herein.
Embodiment to facilitate the understanding of the present invention, the communications network system that mobile terminal of the invention is based below into Row description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system architecture diagram provided in an embodiment of the present invention, the communication network system System is the LTE system of universal mobile communications technology, which includes UE (User Equipment, the use of successively communication connection Family equipment) (the land Evolved UMTS Terrestrial Radio Access Network, evolved UMTS 201, E-UTRAN Ground wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation 204。
Specifically, UE201 can be above-mentioned terminal 100, and details are not described herein again.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returning Journey (backhaul) (such as X2 interface) is connect with other eNodeB2022, and eNodeB2021 is connected to EPC203, ENodeB2021 can provide the access of UE201 to EPC203.
EPC203 may include MME (Mobility Management Entity, mobility management entity) 2031, HSS (Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving GateWay, Gateway) 2034, PGW (PDN GateWay, grouped data network gateway) 2035 and PCRF (Policy and Charging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 is between processing UE201 and EPC203 The control node of signaling, provides carrying and connection management.HSS2032 is for providing some registers to manage such as homing position The function of register (not shown) etc, and preserve the dedicated letters of users such as some related service features, data rates Breath.All customer data can be sent by SGW2034, PGW2035 can provide UE 201 IP address distribution with And other functions, PCRF2036 are the strategy and charging control policy decision point of business data flow and IP bearing resource, it is plan Available strategy and charging control decision are slightly selected and provided with charge execution function unit (not shown).
IP operation 204 may include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimedia System) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art should know the present invention is not only Suitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA with And the following new network system etc., herein without limitation.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the method for the present invention is proposed.
Referring to Fig. 3, in data transmission method first embodiment of the present invention, data transmission method includes:
Step S10 obtains the data to be transmitted of transmitting terminal;
In embodiments of the present invention, before data are sent, data to be sent are compiled according to default TLV agreement in transmitting terminal Code, is then transmit to receiving end waiting;After termination to be received receives the data of transmitting terminal transmission, it will be carried out according to default TLV agreement Decoding, obtains data to be sent.Firstly, obtaining data to be transmitted in transmitting terminal.Wherein, data to be transmitted refers to that transmitting terminal needs The data of receiving end waiting are sent to according to default TLV agreement;Data to be transmitted will be by according to default TLV agreement in transmitting terminal It is encoded, is then transmit to receiving end waiting;The process that termination to be received receives transmitting terminal transmission presets the number of TLV protocol code According to, will be decoded by the data of default TLV protocol code according to the coding rule of default TLV agreement, obtained after decoding to Transmit data.
The data to be transmitted is encoded to the transmission number of hexadecimal TLV format according to default TLV agreement by step S20 According to packet;
According to the content of default TLV protocol definition, the area the data packet T hexadecimal formed needed for data to be transmitted is determined Byte long of the V value and data to be transmitted that T values that number indicates, data to be transmitted are indicated in the area V with hexadecimal number in the area V Degree, and indicate that the byte length in the area V obtains L value with hexadecimal number in the area L.Then by the T value in the area T, the L value in the area L, the area V V Value connects to form a data packet, so that data to be transmitted encodes the transmission data packet to form hexadecimal TLV format.
Default TLV agreement refers to the transport protocol based on current TLV format establishment transmission data packet, the number of TLV format According to being divided into the area T, the area L and the area V in packet.In the present embodiment, in the data packet of TLV format, the value in the area T is known as T value (in the present invention Label thresholding is also known as in embodiment), the value in the area L is known as L value (being also known as length thresholding in embodiments of the present invention), the value in the area V claims For V value (being also known as content thresholding in embodiments of the present invention).V value is placed on the end of data packet, indicates the interior of specific data content Capacitance (in default TLV agreement, if specific data content is numerical value, is converted directly into hexadecimal representation;If specific number It is other kinds of value according to content, then can is voluntarily hexadecimal representation according to service definition);T value is placed on the beginning of data packet, It indicates the type of the specific data content in V value, presets the customized difference of type in TLV agreement according to different data contents T value;L value is placed between data packet T value and V value, indicates the byte length in the area V.In embodiments of the present invention, data are sent Before, data to be sent are encoded according to default TLV agreement in transmitting terminal, are then transmit to receiving end waiting;Termination to be received After the data for receiving transmitting terminal transmission, it will be decoded according to default TLV agreement, and obtain data to be sent.
In addition, it is necessary to illustrate, in the data packet of a TLV format, each area V may include multiple TLV formatters Data packet.For convenience of understanding, Fig. 4 can refer to, in Fig. 4 in the data packet of a TLV format, the area V contains three TLV formats The subdata packet of subdata packet, these three TLV formats constitutes a total V value.
To facilitate understanding of the present embodiment of the invention default TLV agreement, is illustrated below with specific embodiment used by The coding mode of default TLV agreement.For example, the object of pre-defined three types, User, Device and FileInfo are respectively The object of definition, and give the corresponding T value of each type of object definition;In order to make it easy to understand, being referred to below table:
Type User Device FileInfo
T value 0x01 0x02 0x03
Wherein, T value is indicated using hexadecimal number, and " 0x " only indicates that the value is hexadecimal number, does not represent one of T value Point.
The object for being User for type, can define the T value of three attribute type of User object;In order to make it easy to understand, It is referred to below table:
Type Gender Height Weight
T value 0x01 0x02 0x03
Wherein, T value is indicated using hexadecimal number, and " 0x " indicates that the value is hexadecimal number, does not represent one of T value Point.In addition, being converted directly into hexadecimal representation if the specific data content for being put into the area V is numerical value;If being put into the area V Specific data content be other kinds of value, then can voluntarily according to service definition be hexadecimal representation.
By TLV format, a User object can be defined, such as " gender, female ", TLV format indicates are as follows: 010101, be Facilitate understanding, be referred to below table:
Area's type T L V (1: male;2: female)
Zones values 0x01 0x01 0x01
Wherein, the V value of the T value in the area T, the L value in the area L and the area V is all made of hexadecimal number expression, and " 0x " indicates that the value is ten Senary number does not represent a part of zones values.
" height, 178 ", TLV format indicate are as follows: 0201B2 is referred to below table for convenience of understanding:
Area's type T L V
Zones values 0x02 0x 01 0x B2
Wherein, the V value of the T value in the area T, the L value in the area L and the area V is all made of hexadecimal number expression, and " 0x " indicates that the value is ten Senary number does not represent a part of zones values.
" weight, 70 ", TLV format indicate are as follows: 030146, for convenience of understanding, it is referred to below table:
Area's type T L V
Value 0x03 0x 01 0x 46
Wherein, the V value of the T value in the area T, the L value in the area L and the area V is all made of hexadecimal number expression, and " 0x " indicates that the value is ten Senary number does not represent a part of zones values.
To by the data of transmitting terminal: gender, male, height 178, weight 70 are transmitted to be received using default TLV agreement End can form a User object for the above rule, then the TLV format of User object indicates are as follows: 01090101010201B2030146 will be decoded in receiving end waiting are as follows: gender, male, height 178, weight 70.Referring to Fig. 4, figure The area T of entire data packet is " 01 " in 4, indicates the object of User type.The area L of entire data packet is " 09 ", indicates this number Byte length according to the area V of packet is 9.The area V of entire data packet is made of the subdata packet of three TLV formats, wherein first In the subdata of TLV format, the area T is " 01 ", indicates the object of " gender " attribute type;The area L is " 01 ", indicates first TLV The byte length in the area V of the subdata of format is 1;The area V is " 01 ", indicates that " gender " is " male ".The subnumber of second TLV format In, the area T is " 02 ", indicates the object of " height " attribute type;The area L is " 01 ", indicates the subdata of first TLV format The byte length in the area V is 1;The area V is " B2 ", indicates that " height " is " 178 ".In the subdata of third TLV format, the area T is " 03 " indicates the object of " weight " attribute type;The area L is " 01 ", indicates the byte in the area V of the subdata of first TLV format Length is 1;The area V is " 46 ", indicates that " weight " is " 70 ".
The transmission data packet is transmitted to receiving end waiting by step S30, so that end group to be received is in default TLV agreement pair The transmission data packet is decoded to obtain the data to be transmitted.
Data to be transmitted will form transmission data packet by coding is carried out according to default TLV agreement in transmitting terminal, then pass Transport to receiving end waiting;Termination to be received receives the transmission data packet of transmitting terminal transmission, by transmission data packet according to default TLV agreement Coding rule be decoded, data to be transmitted is obtained after decoding.To realize that completing data using default TLV agreement is transmitted across Journey.
Wherein, data packet is transmitted, refers to that data to be transmitted is encoded in receiving end waiting according to default TLV agreement, it is to be passed Data after transmission of data is encoded are to transmit data packet.
In the present embodiment, data to be transmitted is subjected to coding according to default TLV agreement in transmitting terminal and forms transmission data Packet, is then transmit to receiving end waiting;After termination to be received receives transmission data packet, it is decoded according to default TLV agreement, it is to be passed Transmission of data completes data transmission procedure using default TLV agreement to realize.By using default TLV agreement transmit data, The T value in the area T defines the area V data to be transmitted type in transmission data packet, the V value in the area V defines specific data content, because of T value and V value For customized numerical value, and not reference data, byte length relative datum data shared by customized numerical value are much smaller, so as to Greatly reduce transmission data package size, improves efficiency of transmission.In addition, because of the T for representing institute's wire data type or attribute in the area T Value and to represent the V value of specific data content in the area V be customized value, even if data are intercepted in transmission process, does not have There is Protocol document control, can not understand meaning in data packet, to improve the safety of data transmission to a certain extent.
Further, in data transmission method second embodiment of the present invention, Fig. 3 the embodiment described, step S20 are based on Include:
Step S21 indicates the data type of the data to be transmitted using hexadecimal number according to default TLV agreement, with Obtain the label thresholding of the data to be transmitted;
The specific data content for analyzing data to be transmitted, determines number to be transmitted according to the specific data content of data to be transmitted According to data type determine the T of data to be transmitted according to data type representated by T value predetermined in default TLV agreement Value determines the label thresholding of data to be transmitted;Wherein, determine that T value can be one according to the data type of data to be transmitted Or it is multiple, each T value has paired a L value and a V value.In a set of paired T value, L value and V value, V value table Show specific data content, T value indicates that the data type of V value, L value indicate the byte length of V value;Each V value can be again by T value, L value and the V value composition of multiple groups pairing.Wherein, T value is the numerical value that hexadecimal number indicates.Such as, it presets pre- in TLV agreement The T value first defined is hexadecimal " 1B ", represents the data type " age " of data to be transmitted;T value is hexadecimal " 1C ", generation The data type " gender " of table data to be transmitted.
Further, step S21 includes:
Step A10 determines the data type of the data to be transmitted according to default TLV agreement, and uses hexadecimal number It indicates the data type, obtains the first label thresholding;
According to default TLV agreement, the specific data content of data to be transmitted is analyzed, according to fixed in advance in default TLV agreement Data type representated by each T value of justice, the data class of data to be transmitted is determined according to the specific data content of data to be transmitted Type, selected from each T value predetermined in default TLV agreement T value corresponding with the data type of data to be transmitted as First label thresholding.Wherein, the first label thresholding, refer in default TLV agreement it is customized, for indicating data to be transmitted The hexadecimal values of data type.
Step A20, judge the data to be transmitted whether be the data type set;
In default TLV agreement, in order to make to indicate specific data content data type T value occupy byte as far as possible Reduction, do not include the identical data of two or more data types or data group as far as possible in a kind of definition of data type, keep away Exempting from the data type that combination is formed excessively causes the custom field of T value excessive, needs to occupy multiple bytes.If the area V needs The data to be transmitted are the identical data of multiple data types or data group, then the T value in the area T increases a mark to judge V Data are the identical data of the multiple data types of the identical data of data type or data group in area.Judge that data to be transmitted is wrapped The specific data content contained whether be data type set, that is, determine data to be transmitted included specific data content whether For the identical data of multiple data types or data group.Data type such as Fig. 5, the expression of three T values is completely the same, only will The T value of the data type of default TLV protocol definition is respectively as second T value, third T value, by default TLV agreement The T value of the data type of definition increases a mark and is used as first T value;So as to by identical two data of data type Or data group is encoded to a transmission data packet, is transmitted as a whole, and decoding group is combined into a set entirety.If Do not increase mark judgement in T value, then the subdata packet of two TLV formats in entire transmission data packet can only be split as Fig. 6 In shown in two transmission data packets, individually transmit, set entirety cannot be combined into when receiving decoding.
For example, the data type of data to be transmitted is transmission personal information " name, gender, age ", work as data to be transmitted For multiple people personal information when, need to transmit multiple " name, gender, ages ", then data to be transmitted is data to be transmitted The set of data type.
Step A30 will indicate the first label thresholding if the data to be transmitted is the set of the data type Byte extreme higher position 1, obtain the second label thresholding;
In default TLV agreement, we are defined, and in the byte for indicating T value (i.e. label thresholding), highest order does not represent symbol Position does not also represent numerical value, and remaining seven are used to indicate T value;When the expression byte highest order of T value is 1, data to be transmitted is indicated Gather for one, the identical data of transmission multi-group data type;When the expression byte highest order of T value is 0, one group of transmission is indicated The data of data type.
If data to be transmitted include the identical data of multi-group data type, can by by the expression byte of T value most High position 1 obtains the second label thresholding.Wherein, the second label thresholding obtains after referring to the expression byte extreme higher position 1 by T value Binary number.
If data to be transmitted is not the set of the data type of data to be transmitted, the specific number of data to be transmitted is analyzed According to content, the data type of data to be transmitted is determined according to the specific data content of data to be transmitted, and uses hexadecimal number The data type for indicating data to be transmitted, obtains the first label thresholding, by the first label thresholding directly as data to be transmitted Then label thresholding is counted that is, using the label thresholding of data to be transmitted as the T value in the area T of the transmission data packet of TLV format According to transmission.
The second label thresholding is converted to hexadecimal representation, obtains the label of the data to be transmitted by step A40 Thresholding.
Second label thresholding of binary number representation, which is converted to hexadecimal number, to be indicated, to obtain data to be transmitted Then label thresholding carries out data using the label thresholding of data to be transmitted as the T value in the area T of the transmission data packet of TLV format Transmission.
In the present embodiment, increase a mark in T value to judge that data are multiple for the identical data of data type in the area V The identical data of data type or data group, so as to which the data of multiple same types or data group are encoded to same transmission Data packet is transmitted.It avoids the data of multiple same types or data group from being respectively formed multiple transmission data packets individually to transmit, Cause multiple data of same data type or data group that cannot form a data acquisition system transmission.Meanwhile when the area V needs to transmit Data when being the identical data of multiple data types or data group, judge data in the area V by increasing mark in T value For the identical data of the multiple data types of the identical data of data type or data group, the data type of specific data content is indicated T value occupy byte reduce as far as possible, without increase T value occupied by byte, improve message data to a certain extent Efficiency of transmission.
Step S22 indicates the byte length of the data to be transmitted using hexadecimal number according to default TLV agreement, with Obtain the length thresholding of the data to be transmitted;
The specific data content for analyzing data to be transmitted is analyzed to be transmitted according to the specific data content of data to be transmitted Byte length shared by the content thresholding of data, then shared by the content thresholding using hexadecimal number expression data to be transmitted Byte length obtains the L value of data to be transmitted to get the length thresholding of data to be transmitted is arrived.Wherein, according to data to be transmitted The L value that byte length shared by content thresholding determines can be one or more, and each L value has a paired T Value and a V value.Wherein, L value is the numerical value that hexadecimal number indicates.
Step S23 indicates the data to be transmitted using hexadecimal number according to default TLV agreement, with obtain it is described to Transmit the content thresholding of label thresholding and length thresholding described in every group in data;
In a set of paired T value, L value and V value, V value indicates specific data content, and T value indicates the data type of V value, L Value indicates the byte length of V value;V value can nested multiple TLV formats subdata packet, i.e., each V value can be again by multiple groups T value, L value and the V value composition of pairing.According to default TLV agreement, data to be transmitted is indicated using hexadecimal number.Then ten six Data to be transmitted after system number expression determines the V value in the T value, L value and V value of each group pairing of data to be transmitted, that is, determines The content thresholding of every group of label thresholding and length thresholding in data to be transmitted.Wherein, V value is the numerical value that hexadecimal number indicates.
Further, step S23 includes:
Step B1 indicates the data to be transmitted using hexadecimal number according to default TLV agreement;
Such as Fig. 4, outermost V value represents the full content of data to be transmitted, each V value that outermost V value is included The data for respectively representing each attribute of full content, according to the T value and V value and L of each attribute of default TLV protocol definition Value, the data of each attribute are gone out using hexadecimal representation.
Step B2 determines each thresholding group using the label thresholding of pairing and length thresholding as a thresholding group Nested layer level;
Wherein, the label thresholding and length thresholding of pairing refers to that the label thresholding represents the data attribute of certain data, then. For example, data to be transmitted is that " age, 16 " indicate that the label thresholding at " age " is 01, indicate that byte length shared by " 16 " is 1, i.e. length thresholding is 1;Then label thresholding 01 and length thresholding 1 are pairing thresholding group.Nested layer level refers to a set of paired T In value, L value and V value, the subdata packet of the nested multiple TLV formats of V value, i.e., T value, L value and the V that each V value is matched by multiple groups again Value composition.Using the label thresholding of pairing and length thresholding as a thresholding group, determine that multiple groups nested in each thresholding group are matched Pair T value, L value and V value.As data to be transmitted be " user information, gender, female, the age, 16, height, 168 ", can be by " property Not, female " indicates that wherein T value (01), L value (01) indicate one using a set of paired T value (01), L value (01) and V value (01) " gender " thresholding group;" age, 16 " using a set of paired T values (02), L value (01) and V value (01) expression, wherein T value (02), L value (01) indicates " age " thresholding group;" height, 168 " using a set of paired T value (03), L value (01) and V value (01) It indicates, wherein T value (03), L value (01) indicate " height " thresholding group;Then the T value, L value and V value of three groups of pairings constitute one Outermost layer V value 010101020101030101, " user information " is using a set of paired T value (01), L value (01) and outermost layer V Being worth (010101020101030101) indicates, wherein T value (01), L value (01) indicate " user information " thresholding group.
Step B3, according to preset nested layer level traversal order, by the data to be transmitted that hexadecimal number indicates configure to Each thresholding group, to obtain the content thresholding of each thresholding group in the data to be transmitted.
According to the nested layer level of preset nested layer level traversal order and each thresholding group, by hexadecimal number indicate Data to be transmitted configures one group of T value, L value and the V value matched to each nested layer level.
For convenience of understanding, the example for meeting above step B2 is continued to explain;According to preset nested layer level traversal order, by ten The data to be transmitted that senary number indicates is configured to each thresholding group, respectively obtains the content thresholding of " gender " thresholding group, i.e. V It is worth (01);The content thresholding of " age " thresholding group, i.e. V value (01);The content thresholding of " height " thresholding group, i.e. V value (01).
In the present embodiment, data to be transmitted is encoded by way of nested layer level, so that a data packet can To accommodate more data, so as to disposably transmit required data, the transmission of message data is improved to a certain extent Efficiency.
The label thresholding, length thresholding and content thresholding assembly coding are hexadecimal TLV format by step S24 Transmission data packet.
By being put into the data packet of TLV format for data to be transmitted, specifically, the T value of data to be transmitted is put into TLV lattice The V value of data to be transmitted is put in the area T of the data packet of formula, the area L that the L value of data to be transmitted is put into the data packet of TLV format Enter the area V of the data packet of TLV format;I.e. by the label thresholding of data to be transmitted, the length thresholding of data to be transmitted and to be passed The content thresholding of transmission of data is sequentially placed into the area T, the area L, the area V of the data packet of TLV format;To which coding forms hexadecimal TLV The transmission data packet of format.
In the present embodiment, data to be transmitted is encoded by using default TLV agreement, cataloged procedure is by benchmark Data are indicated using the default customized T value of TLV agreement and V value, so that the transmission data packet formed is numerical value, Er Feiji Quasi- data greatly reduce the occupied byte of transmission data packet, to greatly improve efficiency of transmission.By using ten Senary indicates T value, L value and V value, and the number of T value, L value and V value can be made more succinct.
Further, in data transmission method 3rd embodiment of the present invention, Fig. 3 the embodiment described, step S22 are based on Include:
Step B10 is indicated the byte length of the content thresholding using hexadecimal number, obtained according to default TLV agreement First length thresholding;
According to default TLV agreement, byte length shared by the content thresholding in the area V is indicated using hexadecimal number, obtains the One length thresholding, what the first length thresholding indicated is the real bytes length in the area V.Specifically, content thresholding accounts for a byte Then byte length is 1, and content thresholding accounts for N number of byte, and then byte length is N;By byte length shared by content thresholding with 16 into Number processed indicates.Wherein, the first length thresholding refers to byte number shared by the content thresholding indicated using hexadecimal number.
Step C20, judges whether byte number shared by the first length thresholding is greater than predetermined word joint number;
One byte is 8, maximum in binary system are as follows: 11111111, it is equal to the decimal system 128.In default TLV agreement In, we define, and in each byte for indicating L value (i.e. length thresholding), highest order does not represent sign bit and do not represent numerical value yet, remain Yu Qiwei is used to indicate L value;So it is 0~127, corresponding 16 that the denotable V section length range of a byte, which corresponds to the decimal system, The L value of system is 0~7F.So the L value that a byte can indicate is up to 7F, when L value is more than or equal to hexadecimal 80 When, range can be indicated by having exceeded a byte, and needing to increase a byte (needing two bytes) indicates hexadecimal L value 80.First determine whether the shared byte number of first length thresholding itself is greater than predetermined word joint number, if the first length thresholding sheet Byte number shared by body is greater than predetermined word joint number, then proves that predetermined word joint number cannot completely indicate of the first length thresholding itself Size;If the shared byte number of first length thresholding itself is less than or equal to predetermined word joint number, prove that predetermined word joint number can Completely to indicate size of the first length thresholding itself.Wherein, in invention the present embodiment, predetermined word joint number is 1.
Step C30, if byte number shared by the first length thresholding is greater than predetermined word joint number, increasing indicates described the The byte number of one length thresholding, until the first length thresholding complete representation, to obtain the length thresholding of the data to be transmitted.
If the shared byte number of first length thresholding itself is greater than predetermined word joint number, prove that predetermined word joint number cannot be complete Size of whole expression the first length thresholding itself, needs to increase byte representation the first length thresholding.Further, first is calculated The shared byte number of length thresholding itself, then increases corresponding byte number, and the first length thresholding is carried out using each byte It indicates and by the extreme higher position 1 of newly-increased byte, is added after the data after each byte representation are then converted to hexadecimal Obtain the length thresholding of data to be transmitted.Specifically, when expression the area V byte length shared by byte number be greater than predetermined word joint number When, byte number shared by the area V byte length is expressed by newly-increased byte, i.e., newly-increased byte finally transmits data packet L to express The L value in area.
In the present embodiment, when expressing byte number shared by the area V byte length greater than predetermined word joint number, pass through added word Section is to express byte number shared by the area V byte length, to express the L value in the final transmission area data packet L, root by increasing byte newly The expression byte in the newly-increased area L is determined whether according to the area V byte length, so that the expression byte in the area L is reduced as far as, will pass The size of transmission of data packet controls in minimum zone, improves the efficiency of transmission of data.It avoids using unified reserved byte The L value in several expression areas L, when the area V byte length is smaller, unified reserved byte number is excessive to cause byte redundancy;When the area V word When section length is larger, too small is unable to complete of unified reserved byte number indicates the area V byte length.
Further, step C30 includes:
Step C31 increases the byte for indicating the first length thresholding, until the first length thresholding complete representation, obtains Indicate the target byte of the first length thresholding;
If the shared byte number of first length thresholding itself is greater than predetermined word joint number, prove that preset byte cannot be complete Expression the first length thresholding size itself, need to increase byte representation the first length thresholding.Firstly, calculating expression first Byte number shared by length thresholding, newly-increased byte number needed for then determining, to obtain indicating the target of the first length thresholding Byte.In particular it is required that increased byte number, which is equal to calculate, indicates that byte number shared by the first length thresholding subtracts predetermined word Joint number.Such as, the first length thresholding is hexadecimal 80, then it represents that byte number shared by hexadecimal 80 is 2, and hexadecimal 80 is used 2 byte representations are as follows: 10,000,001 01111111.
Wherein, target byte refers to each byte for indicating the first length thresholding.
Step C32 uses the target word by the extreme higher position 1 of each newly-increased byte, and by the first length thresholding Section indicates, obtains the second length thresholding;
Each highest order of newly-increased byte for indicating the first length thresholding is set 1, in the extreme higher position of preset byte 0, Then the first length of binary representation thresholding is used using target byte, to obtain the second length thresholding.Wherein, target byte Highest order be 1 to indicate below there are one the first length of byte representation thresholding, the highest order of target byte is 0 to represent and indicate the The byte of one length thresholding leaves it at that, below without the byte of the first length thresholding of expression.Second length thresholding, refers to and uses mesh The first length of byte representation thresholding is marked, and by the binary number behind each newly-increased byte extreme higher position 1.
For example, the first length thresholding is hexadecimal FE, being calculated indicates byte number 3 shared by the first length thresholding, It then needs to increase 2 bytes, 3 byte representations of hexadecimal FE are as follows: 10,000,001 11,111,111 01111111 newly.Wherein, it increases newly The highest orders of two bytes set 1, the highest order of target byte is 1 to indicate that there are one the first length fields of byte representation below Value, the highest order of target byte are that 0 byte for representing the first length thresholding of expression leaves it at that, below without indicating the first length The byte of thresholding.
Step C33, the second length thresholding, which is converted to hexadecimal number, to be indicated, obtains the length of the data to be transmitted Spend thresholding.
Second length thresholding of binary number representation, which is converted to hexadecimal number, to be indicated, to obtain data to be transmitted Then length thresholding carries out data using the length thresholding of data to be transmitted as the L value in the area L of the transmission data packet of TLV format Transmission.
In the present embodiment, when expressing byte number shared by the area V byte length greater than predetermined word joint number, pass through added word Section is to express byte number shared by the area V byte length, to express the L value in the final transmission area data packet L by increasing byte newly, and By the extreme higher position 1 of newly-increased byte, so that while completely inerrably expressing the area V byte length, it can basis in decoding Indicate that the highest order of byte determines the area L range.Increase the expression byte in the area L newly by way of the extreme higher position 1 by newly-increased byte, Newly-increased byte can be determined whether according to the area V byte length, so that the expression byte in the area L is reduced as far as, will transmit The size of data packet controls in minimum zone, improves the efficiency of transmission of data.It avoids using unified reserved byte number The expression area L L value, when the area V byte length is smaller, unified reserved byte number is excessive to cause byte redundancy;When the area V byte When length is larger, too small be unable to complete of unified reserved byte number indicates the area V byte length.
Further, after step C20 further include:
Step C40, if byte number shared by the first length thresholding is less than or equal to predetermined word joint number, by described the Length thresholding of the one length thresholding as the data to be transmitted.
If the shared byte number of first length thresholding itself is less than or equal to predetermined word joint number, predetermined word joint number is proved Itself size that can completely indicate the first length thresholding does not need to increase the first length of byte representation thresholding.Then, first is long Degree thresholding is the length thresholding of data to be transmitted, directly using the length thresholding of data to be transmitted as the transmission number of TLV format L value according to the area L of packet carries out data transmission.
In the present embodiment, when expressing byte number shared by the area V byte length less than or equal to predetermined word joint number, the area L Expression byte of the preset byte as the area V byte length is directlyed adopt, the byte without increasing the area L occupies the area L most Few byte number can indicate the area V byte length, reduce the byte number of data packet to a certain extent, to reduce data The size of packet improves the efficiency of transmission of data.The L value for avoiding the expression area L using unified reserved byte number, when the area V When byte length is smaller, unified reserved byte number is excessive to cause byte redundancy.
Further, in data transmission method fourth embodiment of the present invention, data transmission method further include:
Step D1 receives the transmission data packet of transmitting terminal transmission;
Data to be transmitted will form transmission data packet by coding is carried out according to default TLV agreement in transmitting terminal, then will Transmission data packet is transmitted to receiving end waiting.Termination to be received receives the transmission data packet of transmitting terminal transmission.
Step D2 determines label thresholding, length thresholding and the content domain of the transmission data packet according to default TLV agreement Value;
After termination to be received receives the transmission data packet of transmitting terminal transmission, go out to transmit data according to default TLV protocal analysis The T value in the area Bao Zhong T transmits the label thresholding of data packet;The L value for analyzing the area L in transmission data packet, that is, transmit data packet Length thresholding;The V value for analyzing the area V in transmission data packet, that is, transmit the content thresholding of data packet.Further, V value can be embedding The subdata packet for covering multiple TLV formats determines T value, L value and the V value of the multiple groups pairing that each V value includes.
Wherein, label thresholding refers to that the T value in the area T in the data packet of TLV format, each type of the area V data content are corresponding One customized T value, i.e., each label thresholding correspond to a kind of data type.
After termination to be received receives transmission data packet, go out to transmit the T value in the area T in data packet according to default TLV protocal analysis; And data type representated by T value predetermined in default TLV agreement is compareed, determine T value (the i.e. label field of transmission data packet Value) representated by the area V data content type (i.e. transmission data packet transmission data type).Every type of the area V data content Type corresponds to a customized T value, i.e., each label thresholding corresponds to a kind of data type.Data type refers to V in data packet The type or attribute of area's data content;Such as, the area V data content is " female " in data packet, and corresponding data type is " gender ";Number It is " 35 " according to Bao Zhong V area's data content, corresponding data type is " age ".
Step D3 determines the number of the transmission data packet transmission according to the label thresholding, length thresholding and content thresholding According to content.
It is true from the label thresholding of transmission data packet according to data type representated by T value predetermined in default TLV agreement Determine data type.The byte length of the area V data content is determined from the length thresholding of transmission data packet.According in default TLV agreement Data type representated by T value predetermined, every kind of data type number representated by V value predetermined in default TLV agreement According to content, and according to the byte length of the determining area the V data content of length thresholding, determined from the content thresholding of transmission data packet The area V data content, so that decoding obtains data to be transmitted.
Specifically, if including the subdata packet of multiple TLV formats in the area V, according to above-mentioned decoding process by each subdata Data content in packet, which decodes, to be come, and the data content of multiple subdata packets forms the message data of an entire data packet.
For convenience of understanding, the example connect in step S20 below is illustrated.Referring to Fig. 4, data to be transmitted is through default TLV Protocol code forms transmission data packet: 01090101010201B2030146, and the entire area T for transmitting data packet is that " 01 " is as whole The label thresholding of a transmission data packet, may know that transmission data packet transmission by label thresholding " 01 " is pair of User type As corresponding content.The area L of entire transmission data packet is the length thresholding that " 09 " entirely transmits data packet, indicates entire transmission The byte length in the area V of data packet is 9.The area V of entire transmission data packet is made of the subdata packet of three TLV formats, wherein In the subdata packet of first TLV format, the area T be " 01 " be first TLV format subdata packet label thresholding, pass through What label thresholding " 01 " may know that transmission data packet transmission is the corresponding content of " gender " attribute type;The area L is " 01 ", is indicated The byte length in the area V of the subdata packet of first TLV format is 1;The area V is the content thresholding that " 01 " transmits data packet, table Show " male " that " 01 " represents in " gender " attribute type;According to label thresholding, the length field of the subdata packet of first TLV format Value and content thresholding, obtain data to be transmitted are as follows: " gender " is " male ".Similarly, from the subdata packet of second TLV format Data to be transmitted out are as follows: " height " is " 178 ", obtains data to be transmitted from the subdata packet of third TLV format are as follows: " body Weight " is " 70 ", and the full content of data to be transmitted can be obtained by decoding entire transmission packet content.
In the present embodiment, it is decoded by will be transmitted to the transmission data packet of receiving end waiting according to default TLV agreement Data to be transmitted is obtained, so that receiving end waiting can receive to obtain the specific data content that transmission data packet is included, to protect Card data are completely inerrably transmitted.
In addition, the embodiment of the present invention also proposes that a kind of data transmission device, data transmission device include:
Data acquisition module, for obtaining the data to be transmitted of transmitting terminal;
Data coding module, for according to TLV agreement is preset, the data to be transmitted to be encoded to hexadecimal TLV lattice The transmission data packet of formula;
Data transmission module, for the transmission data packet to be transmitted to receiving end waiting, so that end group to be received is in default TLV agreement is decoded to obtain the data to be transmitted to the transmission data packet.
Optionally, data coding module is also used to:
According to default TLV agreement, the data type of the data to be transmitted is indicated using hexadecimal number, it is described to obtain The label thresholding of data to be transmitted;
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, it is described to obtain The length thresholding of data to be transmitted;
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number, to obtain the data to be transmitted In label thresholding and length thresholding described in every group content thresholding;
It is the transmission number of hexadecimal TLV format by the label thresholding, length thresholding and content thresholding assembly coding According to packet.
Optionally, data coding module is also used to:
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number;
Using the label thresholding of pairing and length thresholding as a thresholding group, the nesting level of each thresholding group is determined Grade;
According to preset nested layer level traversal order, the data to be transmitted that hexadecimal number indicates is configured to each domain Value group, to obtain the content thresholding of each thresholding group in the data to be transmitted.
Optionally, data coding module is also used to:
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, and it is long to obtain first Spend thresholding;
Judge whether byte number shared by the first length thresholding is greater than predetermined word joint number;
If byte number shared by the first length thresholding is greater than predetermined word joint number, increasing indicates first length field The byte of value, until the first length thresholding complete representation, to obtain the length thresholding of the data to be transmitted.
Optionally, data coding module is also used to:
Increase the byte for indicating the first length thresholding, until the first length thresholding complete representation, obtains described in expression The target byte of first length thresholding;
It is indicated, is obtained using the target byte by the extreme higher position 1 of each newly-increased byte, and by the first length thresholding To the second length thresholding;
The second length thresholding, which is converted to hexadecimal number, to be indicated, the length thresholding of the data to be transmitted is obtained.
Optionally, data coding module is also used to:
If byte number shared by the first length thresholding is less than or equal to predetermined word joint number, by first length field It is worth the length thresholding as the data to be transmitted.
In addition, the embodiment of the present invention also proposes that a kind of mobile terminal, mobile terminal include: memory 109, processor 110 And it is stored in the data distributing program that can be run on memory 109 and on processor 110, data distributing program is by processor 110 the step of each embodiment of above-mentioned data transmission method is realized when executing.
In addition, the readable storage medium storing program for executing is stored with one or one the present invention also provides a kind of readable storage medium storing program for executing A procedure above, the one or more programs can also be executed by one or more than one processor for real The step of each embodiment of existing above-mentioned data transmission method.
The specific embodiment of mobile terminal and readable storage medium storing program for executing (i.e. computer readable storage medium) of the present invention is opened up It opens up content and each embodiment of above-mentioned data transmission method is essentially identical, this will not be repeated here.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal (can be mobile phone, computer, service Device, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much Form, all of these belong to the protection of the present invention.

Claims (10)

1. a kind of data transmission method, which is characterized in that the data transmission method includes:
Obtain the data to be transmitted of transmitting terminal;
According to default TLV agreement, the data to be transmitted is encoded to the transmission data packet of hexadecimal TLV format;
The transmission data packet is transmitted to receiving end waiting, for end group to be received in default TLV agreement to the transmission data Packet is decoded to obtain the data to be transmitted.
2. data transmission method as described in claim 1, which is characterized in that the basis presets TLV agreement, will be described to be passed Transmission of data is encoded to the step of transmission data packet of hexadecimal TLV format and includes:
According to default TLV agreement, the data type of the data to be transmitted is indicated using hexadecimal number, it is described to be passed to obtain The label thresholding of transmission of data;
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, it is described to be passed to obtain The length thresholding of transmission of data;
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number, it is every in the data to be transmitted to obtain The content thresholding of group the label thresholding and length thresholding;
It is the transmission data packet of hexadecimal TLV format by the label thresholding, length thresholding and content thresholding assembly coding.
3. data transmission method as claimed in claim 2, which is characterized in that the basis presets TLV agreement, using 16 into Number processed indicates the data to be transmitted, to obtain the content of label thresholding and length thresholding described in every group in the data to be transmitted The step of thresholding includes:
According to default TLV agreement, the data to be transmitted is indicated using hexadecimal number;
Using the label thresholding of pairing and length thresholding as a thresholding group, the nested layer level of each thresholding group is determined;
According to preset nested layer level traversal order, the data to be transmitted that hexadecimal number indicates is configured to each thresholding Group, to obtain the content thresholding of each thresholding group in the data to be transmitted.
4. data transmission method as claimed in claim 2, which is characterized in that the basis presets TLV agreement, using 16 into Number processed indicates the byte length of the data to be transmitted, to include: the step of obtaining the length thresholding of the data to be transmitted
According to default TLV agreement, the byte length of the data to be transmitted is indicated using hexadecimal number, obtains the first length field Value;
Judge whether byte number shared by the first length thresholding is greater than predetermined word joint number;
If byte number shared by the first length thresholding is greater than predetermined word joint number, increasing indicates the first length thresholding Byte, until the first length thresholding complete representation, to obtain the length thresholding of the data to be transmitted.
5. data transmission method as claimed in claim 4, which is characterized in that described increase indicates the first length thresholding Byte, until the first length thresholding complete representation, to include: the step of obtaining the length thresholding of the data to be transmitted
Increase the byte for indicating the first length thresholding, until the first length thresholding complete representation, obtains indicating described first The target byte of length thresholding;
It is indicated by the extreme higher position 1 of each newly-increased byte, and by the first length thresholding using the target byte, obtains the Two length thresholdings;
The second length thresholding, which is converted to hexadecimal number, to be indicated, the length thresholding of the data to be transmitted is obtained.
6. data transmission method as claimed in claim 4, which is characterized in that shared by judgement the first length thresholding Whether byte number was greater than after the step of predetermined word joint number further include:
If byte number shared by the first length thresholding is less than or equal to predetermined word joint number, the first length thresholding is made For the length thresholding of the data to be transmitted.
7. a kind of data transmission method, which is characterized in that the data transmission method further include:
Receive the transmission data packet of transmitting terminal transmission;
According to default TLV agreement, label thresholding, length thresholding and the content thresholding of the transmission data packet are determined;
According to the label thresholding, length thresholding and content thresholding, the data content of the transmission data packet transmission is determined.
8. a kind of data transmission device, which is characterized in that the data transmission device includes:
Data acquisition module, for obtaining the data to be transmitted of transmitting terminal;
Data coding module, for according to TLV agreement is preset, the data to be transmitted to be encoded to hexadecimal TLV format Transmit data packet;
Data transmission module, for the transmission data packet to be transmitted to receiving end waiting, so that end group to be received is assisted in default TLV View is decoded to obtain the data to be transmitted to the transmission data packet.
9. a kind of mobile terminal, which is characterized in that the mobile terminal includes: memory, processor and is stored in the storage It is real when the data distributing program is executed by the processor on device and the data distributing program that can run on the processor Now the step of data transmission method as described in any one of claims 1 to 7.
10. a kind of readable storage medium storing program for executing, which is characterized in that be stored with data transmission journey on the computer readable storage medium Sequence realizes the data transmission method as described in any one of claims 1 to 7 when the data distributing program is executed by processor The step of.
CN201910241759.1A 2019-03-27 2019-03-27 Data transmission method, device, mobile terminal and readable storage medium storing program for executing Pending CN109981651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910241759.1A CN109981651A (en) 2019-03-27 2019-03-27 Data transmission method, device, mobile terminal and readable storage medium storing program for executing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910241759.1A CN109981651A (en) 2019-03-27 2019-03-27 Data transmission method, device, mobile terminal and readable storage medium storing program for executing

Publications (1)

Publication Number Publication Date
CN109981651A true CN109981651A (en) 2019-07-05

Family

ID=67081000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910241759.1A Pending CN109981651A (en) 2019-03-27 2019-03-27 Data transmission method, device, mobile terminal and readable storage medium storing program for executing

Country Status (1)

Country Link
CN (1) CN109981651A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153034A (en) * 2020-09-17 2020-12-29 青岛海研电子有限公司 Data lossless compression method applied to sea surface drifting observation body
CN112491857A (en) * 2020-11-20 2021-03-12 北京人大金仓信息技术股份有限公司 Method, device and equipment for transmitting set type data
CN113612760A (en) * 2021-07-29 2021-11-05 深圳市捷诚技术服务有限公司 Control method and control device applied to serial port communication protocol of upper and lower computers
CN114301992A (en) * 2021-12-29 2022-04-08 北京半导体专用设备研究所(中国电子科技集团公司第四十五研究所) Data transmission method and storage medium
CN115495082A (en) * 2022-11-21 2022-12-20 北京天元特通科技有限公司 TLV format data automatic conversion method and related equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101599890A (en) * 2008-06-06 2009-12-09 中兴通讯股份有限公司 Data transmission system in a kind of communication system method of unifying
CN102740329A (en) * 2011-04-15 2012-10-17 中兴通讯股份有限公司 Method and apparatus of parameter distribution, and method and apparatus of parameter configuration
CN107995206A (en) * 2017-12-13 2018-05-04 大唐融合通信股份有限公司 Realization device and method for the TLV communications protocol formats of industrial big data
CN108076017A (en) * 2016-11-16 2018-05-25 腾讯科技(深圳)有限公司 The protocol analysis method and device of a kind of data packet
CN109428714A (en) * 2017-09-01 2019-03-05 迈普通信技术股份有限公司 The generation method of key in SNMPv3 agreement

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101599890A (en) * 2008-06-06 2009-12-09 中兴通讯股份有限公司 Data transmission system in a kind of communication system method of unifying
CN102740329A (en) * 2011-04-15 2012-10-17 中兴通讯股份有限公司 Method and apparatus of parameter distribution, and method and apparatus of parameter configuration
CN108076017A (en) * 2016-11-16 2018-05-25 腾讯科技(深圳)有限公司 The protocol analysis method and device of a kind of data packet
CN109428714A (en) * 2017-09-01 2019-03-05 迈普通信技术股份有限公司 The generation method of key in SNMPv3 agreement
CN107995206A (en) * 2017-12-13 2018-05-04 大唐融合通信股份有限公司 Realization device and method for the TLV communications protocol formats of industrial big data

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153034A (en) * 2020-09-17 2020-12-29 青岛海研电子有限公司 Data lossless compression method applied to sea surface drifting observation body
CN112491857A (en) * 2020-11-20 2021-03-12 北京人大金仓信息技术股份有限公司 Method, device and equipment for transmitting set type data
CN113612760A (en) * 2021-07-29 2021-11-05 深圳市捷诚技术服务有限公司 Control method and control device applied to serial port communication protocol of upper and lower computers
CN114301992A (en) * 2021-12-29 2022-04-08 北京半导体专用设备研究所(中国电子科技集团公司第四十五研究所) Data transmission method and storage medium
CN115495082A (en) * 2022-11-21 2022-12-20 北京天元特通科技有限公司 TLV format data automatic conversion method and related equipment

Similar Documents

Publication Publication Date Title
CN109981651A (en) Data transmission method, device, mobile terminal and readable storage medium storing program for executing
CN107463481A (en) Data interactive method, mobile terminal and storage medium
CN107436779A (en) A kind of application management method, equipment and computer-readable recording medium
CN107967322A (en) Document classification display methods, mobile terminal and computer-readable recording medium
CN107528369A (en) Terminal and its wireless charging control method, computer-readable recording medium
CN107517494A (en) A kind of display methods of terminal battery electricity quantity, terminal and computer-readable recording medium
CN107613489A (en) A kind of wireless charging method, hotspot equipment, terminal and storage medium
CN108566304A (en) Interface control method, electronic equipment and computer readable storage medium
CN107181700A (en) Control method, mobile terminal and the storage medium of application program for mobile terminal
CN108768775A (en) Information processing method, electronic equipment and computer storage media
CN107230058A (en) A kind of method of payment, equipment, server and computer-readable recording medium
CN106953989A (en) Incoming call reminding method and device, terminal, computer-readable recording medium
CN107707450A (en) A kind of method, apparatus and computer-readable recording medium for transmitting file
CN107239522A (en) Picture storage method, equipment and computer-readable storage medium
CN107147803A (en) A kind of way of recording, terminal device and computer-readable recording medium
CN108566484A (en) Message treatment method, terminal device and computer readable storage medium
CN107220050A (en) Adaptive display method, terminal and computer-readable recording medium
CN107104886A (en) A kind of information indicating method, equipment and computer-readable recording medium
CN107181865A (en) Processing method, terminal and the computer-readable recording medium of unread short messages
CN109379735A (en) ESIM card operating method, mobile terminal and eSIM card apparatus
CN107133151A (en) A kind of daily record data processing method, equipment and computer-readable recording medium
CN109428923A (en) Information push method, server, terminal and computer readable storage medium
CN107706981A (en) A kind of wireless charging method and wireless charging device
CN107368241A (en) A kind of information processing method, equipment and computer-readable recording medium
CN107220049A (en) Notifier processes method, mobile terminal and computer-readable recording medium in a kind of informing

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190705