Data sending, data receiving method, device, equipment and storage medium
By encoding the data format, size and content to generate verification codes, and using verification codes instead of data transmission, the problem of limited data transmission rate in the prior art is solved, and more efficient data transmission is achieved.
Patent Information
- Application Number
- CN202210027541.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-11
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-01-11
AI Technical Summary
In the prior art, the data transmission rate is limited by the data compression space, and the transmission time is limited, making it difficult to meet the needs of high-speed data transmission.
By encoding the format, size and content of the data, a verification code is generated, and using the verification code instead of the data for transmission, the receiving end restores the data based on the verification code.
Reduce the amount and time of transmission of data, improve data transmission efficiency, and achieve faster data transmission.
Smart Images

Figure CN114362887B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a method, device, equipment and storage medium for sending and receiving data. Background Art
[0002] With the development of communication technology, the requirements for data transmission rate are getting higher and higher. How to quickly transmit data is an important topic in the field of communication technology.
[0003] In the related art, data is compressed to reduce the time required for data transmission, thereby increasing the transmission rate.
[0004] However, the data compression space is limited, and the transmission time that can be reduced by compressing the data is small, which limits the increase in the data transmission rate. Summary of the invention
[0005] The embodiments of the present application provide a data transmission and data reception method, device, equipment and storage medium, which can be used to solve the problems in the related technology. The technical solution is as follows:
[0006] On the one hand, an embodiment of the present application provides a data sending method, the method comprising:
[0007] Get the data to be transmitted;
[0008] Encode the data to obtain a check code corresponding to the data, the check code comprising a first code, a second code and a third code, the first code is used to indicate a format of the data, the second code is used to indicate a size of the data, and the third code is used to indicate a content of the data;
[0009] The verification code is sent.
[0010] In a possible implementation, encoding the data to obtain a check code corresponding to the data includes: encoding the format information of the data to obtain the first code; encoding the size information of the data to obtain the second code; encoding the content of the data to obtain the third code; and concatenating the first code, the second code and the third code to obtain the check code.
[0011] In a possible implementation, encoding the content of the data to obtain the third code includes: segmenting the content of the data to obtain at least two sub-data; encoding each of the at least two sub-data to obtain at least two sub-codes; and obtaining the third code based on the at least two sub-codes.
[0012] In a possible implementation, obtaining the third code based on the at least two sub-codes includes: acquiring a quantity code corresponding to the quantity of the at least two sub-data; and obtaining the third code based on the at least two sub-codes and the quantity code.
[0013] In one possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the content of the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented.
[0014] A data receiving method is also provided, the method comprising:
[0015] Receive verification code;
[0016] Parsing the check code to obtain a first code, a second code and a third code, wherein the first code is used to indicate a format of the data, the second code is used to indicate a size of the data, and the third code is used to indicate a content of the data;
[0017] Decoding the first code to obtain format information of the data;
[0018] Decoding the second code to obtain size information of the data;
[0019] The third code is decoded to obtain the content of the data.
[0020] In a possible implementation, decoding the third code to obtain the content of the data includes: segmenting the third code to obtain at least two sub-codes; obtaining at least two sub-data based on the at least two sub-codes; splicing the at least two sub-data, and obtaining the content of the data according to the splicing result.
[0021] In a possible implementation, the third code also includes a quantity code corresponding to the quantity of the at least two sub-data, and segmenting the third code to obtain at least two sub-codes includes: parsing the third code to obtain the quantity code; and segmenting the codes in the third code except the quantity code based on the quantity code to obtain the at least two sub-codes.
[0022] In a possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented; the decoding of the third code to obtain the content of the data includes: segmenting the third code based on the fourth code to obtain the at least two sub-codes; based on the at least two sub-codes, obtaining at least two sub-data; splicing the at least two sub-data, and obtaining the content of the data according to the splicing result.
[0023] In a possible implementation, obtaining at least two sub-data based on the at least two sub-codes includes: matching each sub-code with a code in a code database; and using the content of the data corresponding to the successfully matched sub-code as the sub-data corresponding to the sub-code, to obtain at least two sub-data.
[0024] In another aspect, a data sending device is provided, the device comprising:
[0025] An acquisition module, used for acquiring data to be transmitted;
[0026] an encoding module, used to encode the data to obtain a check code corresponding to the data, wherein the check code includes a first code, a second code and a third code, wherein the first code is used to indicate a format of the data, the second code is used to indicate a size of the data, and the third code is used to indicate a content of the data;
[0027] The sending module is used to send the verification code.
[0028] In a possible implementation, the encoding module is used to encode the format information of the data to obtain the first code; encode the size information of the data to obtain the second code; encode the content of the data to obtain the third code; and concatenate the first code, the second code and the third code to obtain the check code.
[0029] In a possible implementation, the encoding module is used to segment the content of the data to obtain at least two sub-data; encode each of the at least two sub-data to obtain at least two sub-codes; and obtain the third code based on the at least two sub-codes.
[0030] In a possible implementation, the encoding module is used to obtain a quantity code corresponding to the quantity of the at least two sub-data; and obtain the third code based on the at least two sub-codes and the quantity code.
[0031] In one possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the content of the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented.
[0032] A data receiving device is also provided, the device comprising:
[0033] A receiving module, used for receiving a check code;
[0034] A parsing module, used for parsing the check code to obtain a first code, a second code and a third code, wherein the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data;
[0035] A first decoding module, used for decoding the first code to obtain format information of the data;
[0036] A second decoding module, used for decoding the second code to obtain size information of the data;
[0037] The third decoding module is used to decode the third code to obtain the content of the data.
[0038] In a possible implementation, the third decoding module is used to segment the third code to obtain at least two sub-codes; obtain at least two sub-data based on the at least two sub-codes; splice the at least two sub-data, and obtain the content of the data according to the splicing result.
[0039] In a possible implementation, the third code also includes a quantity code corresponding to the quantity of the at least two sub-data, and the third decoding module is used to parse the third code to obtain the quantity code; based on the quantity code, the code in the third code except the quantity code is segmented to obtain the at least two sub-codes.
[0040] In a possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented; the third decoding module is used to segment the third code based on the fourth code to obtain the at least two sub-codes; based on the at least two sub-codes, obtain at least two sub-data; splice the at least two sub-data, and obtain the content of the data according to the splicing result.
[0041] In a possible implementation, the third decoding module is used to match each sub-code with a code in a code database; and use the content of the data corresponding to the successfully matched sub-code as the sub-data corresponding to the sub-code to obtain at least two sub-data.
[0042] On the other hand, a data transmission system is provided, the system comprising a data sending device and a data receiving device, the data sending device is used to execute any one of the above data sending methods, and the data receiving device is used to execute any one of the above data receiving methods.
[0043] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the computer device implements any of the above-mentioned data sending methods or data receiving methods.
[0044] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned data sending methods or data receiving methods.
[0045] On the other hand, a computer program product is also provided, which includes a computer program or computer instructions, and the computer program or the computer instructions are loaded and executed by a processor to enable a computer to implement any of the above-mentioned data sending methods or data receiving methods.
[0046] The technical solution provided by the embodiments of the present application brings at least the following beneficial effects:
[0047] The technical solution provided in the embodiment of the present application obtains a corresponding check code based on the format and size of the data and the data, and then uses the check code to replace the data for transmission, thereby reducing the amount of data transmitted and improving the efficiency of data transmission. In addition, after receiving the check code, the receiving end restores the data based on the check code, thereby realizing data transmission. Therefore, the method of using the check code instead of data for transmission reduces the time required for data transmission and also reduces the amount of data transmitted, thereby improving transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0049] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;
[0050] Figure 2 is a flow chart of a data sending method provided in an embodiment of the present application;
[0051] Figure 3 is a flow chart of a data receiving method provided in an embodiment of the present application;
[0052] Figure 4 It is a schematic diagram of a process of transmitting data from a data sending device to a data receiving device provided by an embodiment of the present application;
[0053] Figure 5 is a schematic diagram of a data sending device provided in an embodiment of the present application;
[0054] Figure 6 is a schematic diagram of a data receiving device provided in an embodiment of the present application;
[0055] Figure 7 It is a structural diagram of a server provided in an embodiment of the present application;
[0056] Figure 8 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0058] It should be noted that the terms "first", "second", etc. (if any) in the specification and claims of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0059] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by an embodiment of the present application. The implementation environment may include: a data sending device 11 and a data receiving device 12.
[0060] The data sending device 11 may convert the data into a check code, and the data sending device 11 may send the check code to the data receiving device 12. The data receiving device 12 may receive the check code sent by the data sending device 11. The data receiving device 12 may restore the check code to data.
[0061] The data sending method provided in the embodiment of the present application can be executed by the data sending device 11, and the data receiving device 12 can also be used as the data sending device 11 to send data, and the embodiment of the application does not limit this.
[0062] The data receiving method provided in the embodiment of the present application may be executed by the data receiving device 12 , and the data sending device 11 may also be used as the data receiving device 12 to receive data, and the embodiment of the application does not impose any limitation on this.
[0063] Optionally, the data sending device 11 and the data receiving device 12 can be any electronic product that can interact with the user through one or more methods such as keyboard, touch pad, touch screen, remote control, voice interaction or handwriting device, such as PC (Personal Computer), mobile phone, smart phone, PDA (Personal Digital Assistant), wearable device, PPC (Pocket PC), tablet computer, smart car machine, etc. Alternatively, the data sending device 11 and the data receiving device 12 can be a server, a server cluster composed of multiple servers, or a cloud computing service center. The data sending device 11 and the data receiving device 12 establish a communication connection through a wired or wireless network.
[0064] Those skilled in the art should understand that the above-mentioned data sending device 11 and data receiving device 12 are only examples, and other existing or future terminals or servers that are applicable to the present application should also be included in the protection scope of the present application and are included here by reference.
[0065] Based on the above Figure 1 In the implementation environment shown, the present application embodiment provides a data sending method, taking the method applied to the data sending device 11 as an example. Figure 2 As shown, the method provided in the embodiment of the present application may include the following steps 201 to 203.
[0066] In step 201, data to be transmitted is obtained.
[0067] The embodiment of the present application does not limit the format and size of the data to be transmitted. For example, the data to be transmitted is video data, that is, the format of the data is avi (audio video interleaved). For example, the size of the data to be transmitted is 200GB (gigabyte), where GB can be replaced by G.
[0068] The data to be transmitted may be stored in the memory of the data transmission device 11, or in the memory of other devices outside the data transmission device 11 or in cloud storage, and this application does not impose any limitation on this. In an exemplary embodiment, the data to be transmitted is stored in the memory of the data transmission device 11, and obtaining the data to be transmitted includes: determining the data to be transmitted from the data stored in the data transmission device 11. In another exemplary embodiment, the data to be transmitted is stored in the memory of other devices outside the data transmission device 11 or in cloud storage, and in this case, obtaining the data to be transmitted includes: determining the data to be transmitted and downloading the data.
[0069] In step 202, the data to be transmitted is encoded to obtain a check code corresponding to the data, the check code includes a first code, a second code and a third code, the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data.
[0070] In an exemplary embodiment, data to be transmitted is encoded to obtain a check code corresponding to the data, including: encoding the format information of the data to obtain a first code; encoding the size information of the data to obtain a second code; encoding the content of the data to obtain a third code; and concatenating the first code, the second code, and the third code to obtain a check code corresponding to the data.
[0071] In an exemplary embodiment, the format information of the data is encoded to obtain a first code, including: inputting the format of the data into a format encoding function, and the format encoding function generates a corresponding first code based on the format. Among them, the encoding rules corresponding to the format encoding function are not limited in the embodiment of the present application. Optionally, the format encoding function encodes the format of the data to be transmitted into a first code including two bytes, and different byte contents correspond to different formats. For example, the format of the data to be transmitted is avi, and the corresponding first code is 01. For another example, the format of the data to be transmitted is PDF (Portable Document Format), and the corresponding first code is 02. The embodiment of the present application does not limit the number of bytes included in the first code, and the format of the data to be transmitted and the first code can be achieved in a one-to-one correspondence. Optionally, the number of bytes included in the first code is 3 bytes, or 4 bytes, or 5 bytes, etc. Exemplarily, the amount of data in the first code is not greater than the amount of data directly sending the format information.
[0072] In an exemplary embodiment, the size information of the data is encoded to obtain a second code, including: inputting the size of the data into a size coding function, and the size coding function generates a corresponding second code based on the size of the data. The embodiment of the present application does not limit the coding rules corresponding to the size coding function. Optionally, the size coding function encodes the size of the data to be transmitted into a second code including six bytes. Among them, the first five bytes represent the numbers corresponding to the size of the data to be transmitted, and the sixth byte represents the unit corresponding to the size of the data. For example, for a 200G data, the second code obtained after being processed by the size coding function is 00200G. Optionally, the second code may include 7 bytes, or 8 bytes, or 9 bytes, etc. The embodiment of the present application does not limit the number of bytes included in the second code. Exemplarily, the amount of data in the second code is not greater than the amount of data directly sending the format information.
[0073] In an exemplary embodiment, encoding the content of the data to be transmitted to obtain a third code includes: inputting the content of the data into a first data encoding function, and the first data encoding function generates a third code based on the content of the data. The encoding rule corresponding to the first data encoding function is not limited in the embodiment of the present application, and a third code uniquely corresponding to the content of the data can be generated based on the content of the data. Exemplarily, the amount of data of the third code is not greater than the amount of data of the content of the directly transmitted data.
[0074] Optionally, the calculation rule corresponding to the first data encoding function may be the calculation rule corresponding to CRC (Cyclic Redundancy Check), or the calculation rule corresponding to MD5 (Message-Digest Algorithm 5), or the calculation rule corresponding to Hash (Hash check algorithm), or the calculation rule corresponding to SHA1 (Secure Hash Algorithm).
[0075] In an exemplary embodiment, the third code corresponding to the content of the data to be transmitted includes a small number of bytes, and the third code obtained by directly calculating the third code corresponding to the content of the data usually does not exceed 25 bytes. For the current transmission protocol, the time required to transmit 25 bytes is in milliseconds. Therefore, converting the content of the data to be transmitted into the third code for transmission can help achieve millisecond-level transmission of the data.
[0076] In another exemplary embodiment, in order to make the content of the data to be transmitted be converted into the third code more quickly, the content of the data is segmented and encoded when encoding the content of the data. At this time, the process of encoding the content of the data to be transmitted to obtain the third code includes: segmenting the content of the data to obtain at least two sub-data; encoding each of the at least two sub-data to obtain at least two sub-codes; and obtaining the third code based on the at least two sub-codes.
[0077] Segmenting the content of the data to be transmitted can better utilize the computing power of the data sending device 11 and speed up the conversion of the content of the data into the third encoding. The embodiment of the present application does not limit the number of segments of the content of the data to be transmitted, and can be determined according to the ability of the data sending device 11 to process data simultaneously. Exemplarily, the sending end device has the highest efficiency when processing 3 groups of data at the same time, and the content of the data to be transmitted is divided into 3 segments, that is, the content of the data to be transmitted is divided into 3 sub-data. The embodiment of the present application does not limit the manner in which the content of the data to be transmitted is segmented, and the content of the data to be transmitted can be evenly distributed to each sub-data, for example, the content of 300G data is equally divided into 3 100G sub-data. Alternatively, the distribution is carried out in a manner of increasing the sub-data after each sub-data reaches a certain size. For example, it is set that each sub-data reaches 100G and then divides other sub-data. For the content of 240G data to be transmitted, the segmented sub-data includes two 100G sub-data and one 40G sub-data.
[0078] In an exemplary embodiment, the first data encoding function is composed of at least two second data encoding functions, and when the sub-data obtained by segmenting the content of the data are encoded, it is based on the second data encoding function corresponding to each sub-data. Therefore, encoding each of the at least two sub-data to obtain at least two sub-codes includes: inputting each sub-data into the corresponding second data encoding function, and the second data encoding function generates a sub-code based on the corresponding sub-data to obtain at least two sub-codes. Among them, one second data encoding function corresponds to one sub-data.
[0079] The embodiment of the present application does not limit the encoding rule corresponding to the second data encoding function, and the sub-data can be converted into a unique corresponding sub-code. Since the third code uniquely corresponds to the content of the data for obtaining the third code, in another exemplary embodiment, the calculation rule corresponding to the second data encoding function can be any calculation rule for calculating the third code of the data. For example, the calculation rule corresponding to a second data encoding function is the calculation rule corresponding to CRC, and the calculation rule corresponding to another second data encoding function is the calculation rule corresponding to Hash.
[0080] In an exemplary embodiment, if the number of sub-data obtained by segmenting the content of the data is the same as the number of second data encoding functions included in at least two second data encoding functions, each sub-data is input into the corresponding second data encoding function, and the second data encoding function generates a sub-code based on the corresponding sub-data, including: generating a sub-code corresponding to the first sub-data based on the first second data encoding function, generating a sub-code corresponding to the second sub-data based on the second second data encoding function, and then generating a sub-code for the corresponding sub-data based on each second data encoding function in turn.
[0081] Exemplarily, the first data encoding function is composed of three second data encoding functions, the calculation rule of the first second data encoding function pair is the calculation rule corresponding to CRC, the calculation rule corresponding to the second second data encoding function is the calculation rule corresponding to Hash, and the calculation rule corresponding to the third second data encoding function is the calculation rule corresponding to MD5. The number of content segments of the data to be transmitted is 3, namely sub-data 1, sub-data 2 and sub-data 3. Then the sub-coding includes: sub-coding 1 calculated by sub-data 1 based on the calculation rule corresponding to CRC, sub-coding 2 calculated by sub-data 2 according to the calculation rule corresponding to Hash, and sub-coding 3 calculated by sub-data 3 according to the calculation rule corresponding to MD5.
[0082] In an exemplary embodiment, for the calculation rule corresponding to the same second data encoding function, the number of bytes included in the subcode obtained by encoding the subdata based on the calculation rule is independent of the subdata. The number of bytes included in the subcodes calculated based on the same calculation rule for different subdata is the same, that is, the lengths of the subcodes calculated based on the same calculation rule for different subdata are the same.
[0083] If the subcodes of the same length corresponding to the sub-data are directly concatenated to obtain the third code, the third code is not easy to be decoded, and the number of subcodes included in the third code cannot be determined directly based on the third code. Therefore, in an exemplary embodiment, the third code is obtained based on at least two subcodes, including: obtaining a quantity code corresponding to the number of at least two sub-data; and obtaining the third code based on at least two subcodes and the quantity code. Since the third code includes the quantity code corresponding to the number of sub-data, the number of subcodes can be determined directly based on the quantity code when the third code is decoded, and then each subcode can be accurately decomposed.
[0084] In an exemplary embodiment, based on at least two subcodes and a quantity code, a third code is obtained, including: splicing the subcodes and quantity codes corresponding to the sub-data to obtain the third code. Exemplarily, when splicing the subcodes and quantity codes, the quantity code is located at the head of the third code, followed by each subcode in turn. For example, the quantity code is 3, the first subcode is aaaaa, the second subcode is bbbbb, and the third subcode is ccccc, then the spliced third code is: 3aaaaabbbbbccccc.
[0085] In another exemplary embodiment, the check code corresponding to the data to be transmitted also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented, and in this case, the third code includes at least two sub-codes but does not include a quantity code. Therefore, when decoding the third code corresponding to the content of the data, the third code can be evenly segmented based on the number indicated by the fourth code to obtain at least two sub-codes. In other words, both the fourth code and the quantity code can indicate the number of sub-data obtained after the content of the data is segmented, and the number of sub-data can be indicated by the number of codes in the third code, or an independent fourth code can be used outside the third code to indicate the number of sub-data.
[0086] In an exemplary embodiment, at least two second data encoding functions included in the first data encoding function correspond to the same calculation rule, and the function corresponding to the calculation rule is f0(content[n]), and the calculation rule can be a calculation rule for any calculation sub-code, where content[n] corresponds to the nth sub-data. When the first data encoding function includes n (n is a positive integer not less than 2) second data encoding functions, the first data encoding function is Formula 1:
[0087] F=f0(content[1])+…+f0(content[n]) (Formula 1)
[0088] In an exemplary embodiment, the number of sub-data included in the at least two sub-data is the same as the number of second data encoding functions included in the at least two second data encoding functions. After the sub-data is calculated based on the first data encoding function shown in Formula 1, the length of the sub-code corresponding to each sub-data is the same, that is, the number of bytes included in the sub-code corresponding to each sub-data is the same. The third code obtained by splicing the sub-codes at this time can directly decode each sub-code according to the number of sub-data when decoding.
[0089] For example, the third code is 3aaaaabbbbbccccc, where 3 is the quantity code, aaaaabbbbbccccc is the code after the three sub-codes are spliced, and aaaaabbbbbccccc is divided into three segments according to the quantity code 3, and the three second data codes are aaaaa, bbbbb, and ccccc. The embodiment of the present application does not limit the number of bytes included in the quantity code. Optionally, the quantity code includes 1 byte. Exemplarily, if the electronic device 11 allows encoding of more than 10 groups and less than 100 groups of data at the same time, the number of bytes included in the quantity code can be two bytes so that the quantity code matches the number of sub-data.
[0090] The number of bytes included in the subcodes corresponding to the calculation rules of different second data encoding functions may be different. Therefore, when at least two second data encoding functions include two or more different second data encoding functions, after the subcodes are obtained by processing the subdata based on the at least two second data encoding functions, the lengths of the subcodes may be different. The third code obtained by directly splicing subcodes of different lengths is not conducive to decomposing each subcode based on the third code in the data receiving device 12. Therefore, in view of the problem that the lengths of the subcodes are different, making the spliced third code difficult to decompose, the solutions provided by the embodiments of the present application include Solution 1 and Solution 2.
[0091] Solution 1: Determine the target subcode that includes the largest number of bytes in the subcode; fill the subcodes other than the target subcode with 0s until the length is the same as the target subcode.
[0092] Among them, the position of the 0-filling can be at the head of the subcode or at the tail of the subcode. The embodiment of the present application is not limited by comparison. Filling 0 is only a way to fill the length of the subcode, and the 0-filling can also be modified to 1, or modified to a, or modified to A, etc. The embodiment of the present application does not limit which specific content is the supplemented content, and it can be determined based on the content that is not in the subcode. For example, if there is no a in the subcode, a is added to the subcodes except the target subcode. Supplementing the content that is not in the subcode is conducive to the subsequent removal of this part of the supplemented content.
[0093] When the lengths of the subcodes are the same, the concatenated third code is easier to decompose into individual subcodes. For example, the third code can be directly divided into the same number of parts as the number of sub-data, and then the supplementary part in each code is removed to obtain the individual subcodes.
[0094] Solution 2: perform corresponding encoding on the second data encoding function; after obtaining the corresponding sub-code based on the second data encoding function, concatenate the code corresponding to the second data encoding function to the head of the sub-code to obtain the concatenated sub-code.
[0095] Exemplarily, the first data encoding function is composed of three second data encoding functions, namely, second data encoding function 1, second data encoding function 2, and second data encoding function 3. The number of content segments of the data to be transmitted is 3, namely, sub-data 1, sub-data 2, and sub-data 3. Among them, sub-data 1 is processed by the second data encoding function 1 to obtain sub-code 1 including 5 bytes, sub-data 2 is processed by the second data encoding function 2 to obtain sub-code 2 including 6 bytes, and sub-data 3 is processed by the second data encoding function 3 to obtain sub-code 3 including 4 bytes. For another example, sub-code 1 is aaabb, sub-code 2 is baaabb, and sub-code 3 is bbaa. If sub-codes 1-3 are directly spliced, the third code obtained is aaabbbaaabbbbaa. Based on the third code, it is impossible to determine the length corresponding to each sub-code, and therefore, it is impossible to parse out each sub-code.
[0096] At this time, the second data encoding function 1 is encoded as 01, the second data encoding function 2 is encoded as 02, and the second data encoding function 3 is encoded as 03 in the manner provided by solution 2, and the encoding of the second data encoding function is spliced with the corresponding sub-code, and the spliced sub-code 1 is 01aaabb, the spliced sub-code 2 is 02baaabb, and the spliced sub-code 3 is 03bbaa. The third code obtained by splicing the spliced sub-codes at this time is: 01aaabb02baaabb03bbaa. Based on the third code at this time, each sub-code can be restored. For example, based on the first two codes 01 of the third code, it can be determined that the subsequent 5-bit content is the content corresponding to sub-code 1, that is, aaabb is sub-code 1; at this time, the remaining codes are 02baaabb03bbaa, based on 02, it can be determined that the subsequent 6-bit content is the content corresponding to sub-code 2, that is, baaabb is sub-code 2; at this time, the remaining code is 03bbaa, based on 03, it can be determined that the subsequent 4-bit content is the content corresponding to sub-code 3, that is, bbaa is sub-code 3.
[0097] In an exemplary embodiment, after obtaining the first code corresponding to the format information of the data, the second code corresponding to the size information, and the third code corresponding to the content of the data, the first code, the second code, and the third code are spliced to obtain the check code corresponding to the data. Among them, the third code includes at least two sub-codes and a quantity code. Exemplarily, the format of the data is avi format, the corresponding first code is 01, the size of the data is 200G, the corresponding second code is 00200G, and the third code corresponding to the content of the data is 3aaaaabbbbbccccc, then the check code obtained after splicing is: 0100200G3aaaaabbbbbccccc.
[0098] In step 203, a verification code is sent.
[0099] In an exemplary embodiment, after obtaining the check code corresponding to the data to be transmitted, the check code is transmitted instead of the data to be transmitted, and the data transmitting device 11 sends the check code to the data receiving device 12 .
[0100] In an embodiment of the present application, a corresponding check code is obtained based on the format, size and content of the data to be transmitted, and the check code is then used to replace the data for transmission, thereby reducing the time required to transmit the data, reducing the amount of data transmitted, and increasing transmission efficiency.
[0101] Based on the above Figure 1 In the implementation environment shown, the present application embodiment provides a data receiving method, which is executed by a data receiving device 12, such as Figure 3As shown, the data receiving method provided in the embodiment of the present application includes the following steps 301 to 303.
[0102] In step 301, a verification code is received.
[0103] In an exemplary embodiment, the verification code uniquely corresponds to the data, and receiving the verification code includes: the data receiving device 12 receives the verification code sent by the data sending device 11 .
[0104] In step 302, the check code is parsed to obtain a first code, a second code and a third code, wherein the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data.
[0105] In an exemplary embodiment, the check code includes a first code, a second code and a third code, and thus, the first code, the second code and the third code can be obtained by parsing the check code. The first code is obtained by encoding the format information of the data, so the first code is used to indicate the format of the data; the second code is obtained by encoding the size information of the data, so the second code is used to indicate the size of the data; the third code is obtained by encoding the content of the data, so the third code is used to indicate the content of the data.
[0106] In an exemplary embodiment, the check code is parsed to obtain a first code, a second code, and a third code, including: decomposing the first code from the check code according to the number of bytes included in the first code; then decomposing the second code from the remaining code after decomposing the first code from the check code according to the number of bytes included in the second code; thereafter, the remaining code is the third code.
[0107] In step 303, the first code is decoded to obtain format information of the data, the second code is decoded to obtain size information of the data, and the third code is decoded to obtain content of the data.
[0108] In an exemplary embodiment, decoding the first code to obtain the format information of the data includes inputting the first code into a format decoding function, and the format decoding function obtains the format information of the data based on the first code. Exemplarily, the first code is 01, and the format information obtained after being processed by the format decoding function is avi. Figure 2 The format encoding function mentioned in the corresponding embodiment corresponds to, for example, the format encoding function encodes the avi format into 01, and the format information decoded by the format decoding function based on 01 is avi.
[0109] In an exemplary embodiment, decoding the second code to obtain the size information of the data includes inputting the second code into a size decoding function, and the size decoding function obtains the size information of the data based on the second code. Exemplarily, the second code is 00200G, and the size information obtained after being processed by the size decoding function indicates that the size of the data is 200G. Figure 2 The size encoding function mentioned in the corresponding embodiment corresponds to, for example, the size encoding function encodes 200G into 00200G, and the size information decoded by the size decoding function based on 00200G is 200G.
[0110] In an exemplary embodiment, the speed of decoding the third code into data content is accelerated by decoding the third code in segments. At this time, the third code is decoded to obtain the data content, including: segmenting the third code to obtain at least two sub-codes; based on the at least two sub-codes, obtaining at least two sub-data; splicing the at least two sub-data, and obtaining the data content according to the splicing result.
[0111] When segmenting the third code, it is necessary to determine how many subcodes the third code includes. Therefore, in an exemplary embodiment, the third code includes at least two subcodes and also includes quantity codes corresponding to the quantity of at least two sub-data. At this time, in an exemplary embodiment, segmenting the third code to obtain at least two subcodes includes: parsing the third code to obtain the quantity code; and segmenting the codes other than the quantity code in the third code based on the quantity code to obtain at least two subcodes.
[0112] In an exemplary embodiment, the quantity code is located at the head of the third code and the quantity code includes one byte. At this time, parsing the third code to obtain the quantity code includes: obtaining the first code of the third code to obtain the quantity code. In an exemplary embodiment, the code other than the quantity code in the third code is segmented based on the quantity code to obtain at least two sub-codes, including, based on the number indicated by the quantity code, the code other than the quantity code in the third code is segmented evenly to obtain at least two sub-codes. For example, the third code is 3aaaaabbbbbccccc, then according to the first code as the quantity code, the number indicated by the quantity code is 3, and then the code other than the quantity code in the third code is segmented evenly to obtain three sub-codes: aaaaa, bbbbb, ccccc. It should be noted that, based on the quantity code, the code other than the quantity code in the third code is segmented evenly to obtain at least two sub-codes, which needs to satisfy the same length of each sub-code, that is, the number of bytes included in each sub-code is the same.
[0113] It should also be noted that, in some embodiments, the quantity code may be located at other positions in the third code.
[0114] In another exemplary embodiment, the third code includes at least two subcodes, one subcode is used to indicate a subdata obtained after the content of the data is segmented, and the check code includes, in addition to the first code, the second code, and the third code, a fourth code is used to indicate the number of subdata obtained after the content of the data is segmented. At this time, decoding the third code to obtain the content of the data includes: segmenting the third code based on the fourth code to obtain at least two subcodes; obtaining at least two subdata based on the at least two subcodes; splicing the at least two subdata, and obtaining the content of the data according to the splicing result.
[0115] In an exemplary embodiment, the third code is segmented based on the fourth code to obtain at least two sub-codes, including: the third code is segmented evenly based on the number indicated by the fourth code to obtain at least two sub-codes. Exemplarily, the fourth code is 3, and the third code is aaaaabbbbbccccc. The third code is segmented evenly to obtain 3 sub-codes including 5 bytes, namely: aaaaa, bbbbb, ccccc. It should be noted that the third code is segmented evenly based on the number indicated by the fourth code to obtain at least two sub-codes, which needs to satisfy that the length of each sub-code is the same, that is, the number of bytes included in each sub-code is the same.
[0116] In another exemplary embodiment, the third code includes at least two spliced subcodes, each of which includes a subcode corresponding to the subdata and a code corresponding to the second coding function that edits the subdata into the subcode. Exemplarily, the spliced subcode corresponding to a subdata is 01aaaaa, where 01 is the code corresponding to the second coding function corresponding to the subdata, and aaaaa is the subcode obtained after the subdata is processed by the second coding function. At this time, segmenting the third code to obtain at least two subcodes includes: decoding each subcode in turn based on the code corresponding to the second coding function to obtain at least two subcodes.
[0117] Exemplarily, the codes corresponding to the three second coding functions are 01, 02, and 03, the subcodes corresponding to the three sub-data are aaaa, bbbbbb, and ccccc, and the third code is: 01aaaa02bbbbbb03ccccc. At this time, based on the first two codes 01 of the third code, it can be known that the subsequent 4-bit code of 01 is the first subcode, that is, aaaa is the first subcode, and then the remaining code is 02bbbbbb03ccccc, and then based on 02, it can be determined that the subsequent 6-bit code is the second subcode, that is, bbbbbb is the second subcode, and then the remaining code is 03ccccc, and then based on 03, it can be determined that the subsequent 5-bit code is the third subcode, that is, ccccc is the third subcode. At this point, the decoding of the third code is completed, and 3 subcodes are obtained.
[0118] In an exemplary embodiment, based on at least two subcodes, obtaining at least two sub-data includes: matching each subcode with a code in a code database; using data corresponding to the successfully matched subcode as sub-data corresponding to the subcode, and obtaining at least two sub-data. In an exemplary embodiment, the subcode successfully matches the code in the code database, including: when a subcode is consistent with a code in the code database, determining that the subcode successfully matches the code in the code database. At this time, using the content of the data corresponding to the successfully matched subcode as the sub-data corresponding to the subcode includes: using the content of the data corresponding to the code in the code database that is consistent with the subcode as the sub-data of the subcode.
[0119] In another exemplary embodiment, based on at least two subcodes, obtaining at least two sub-data includes: decoding each subcode included in the at least two subcodes to obtain at least two sub-data. In an exemplary embodiment, the method of decoding each subcode included in the at least two subcodes includes: inputting the subcode into a decoding function corresponding to a second data encoding function that generates the subcode, decoding the subcode based on the decoding function, and obtaining sub-data corresponding to the subcode. The second data encoding function that generates the subcode is Figure 2 The second data encoding function mentioned in the corresponding embodiment.
[0120] In an exemplary embodiment, after obtaining at least two sub-data, the at least two sub-data are sequentially concatenated to obtain the content of the data corresponding to the third code, and then the data corresponding to the received check code is restored based on the content, format information, and size information of the data.
[0121] In another exemplary embodiment, the process of transmitting data from the data transmitting device 11 to the data receiving device 12 is as follows: Figure 4As shown, in the data sending device 11, a first code corresponding to the format of the data is obtained based on the format of the data, a second code corresponding to the size of the data is obtained based on the size of the data, and n subcodes are obtained based on the content of the data. Afterwards, the first code, the second code and the n subcodes are concatenated to obtain a check code corresponding to the data. Afterwards, the data sending device 11 sends the check code to the data receiving device 12.
[0122] After receiving the check code, the data receiving device 12 parses the check code to obtain the format, size and content of the data. The process of obtaining the content of the data includes: parsing the check code to obtain n sub-codes; performing a database collision on each sub-code in the code database to obtain the sub-data corresponding to each sub-code; splicing the n sub-data to obtain the content of the data. Afterwards, the data is restored based on the format, size and content of the data.
[0123] In the embodiment of the present application, by restoring the data through the check code corresponding to the received data, the data reception can be completed more quickly, the time required to transmit the data is reduced, and the transmission efficiency is increased.
[0124] See also Figure 5 , an embodiment of the present application provides a data sending device, the device comprising:
[0125] An acquisition module 501 is used to acquire data to be transmitted;
[0126] The encoding module 502 is used to encode the data to obtain a check code corresponding to the data, where the check code includes a first code, a second code and a third code, where the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data;
[0127] The sending module 503 is used to send a verification code.
[0128] In a possible implementation, the encoding module 502 is used to encode the format information of the data to obtain a first code; encode the size information of the data to obtain a second code; encode the content of the data to obtain a third code; and concatenate the first code, the second code, and the third code to obtain a check code.
[0129] In a possible implementation, the encoding module 502 is used to segment the content of the data to obtain at least two sub-data; encode each of the at least two sub-data to obtain at least two sub-codes; and obtain a third code based on the at least two sub-codes.
[0130] In a possible implementation, the encoding module 502 is configured to obtain a quantity code corresponding to the quantity of at least two sub-data; and obtain a third code based on the at least two sub-codes and the quantity code.
[0131] In one possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the data content is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the data content is segmented.
[0132] In the embodiment of the present application, the corresponding check code is obtained based on the format, size and content of the data to be transmitted, and then the check code is used to replace the data for transmission. Using the check code to replace the data for transmission reduces the time required to transmit the data and increases the transmission efficiency.
[0133] See also Figure 6 , an embodiment of the present application provides a data receiving device, the device comprising:
[0134] Receiving module 601, used for receiving a verification code;
[0135] The parsing module 602 is used to parse the check code to obtain a first code, a second code and a third code, wherein the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data;
[0136] A first decoding module 603, used to decode the first code to obtain format information of the data;
[0137] A second decoding module 604 is used to decode the second code to obtain size information of the data;
[0138] The third decoding module 605 is used to decode the third code to obtain data content.
[0139] In a possible implementation, the third decoding module 605 is used to segment the third code to obtain at least two sub-codes; obtain at least two sub-data based on the at least two sub-codes; splice the at least two sub-data, and obtain the data content according to the splicing result.
[0140] In a possible implementation, the third code also includes quantity codes corresponding to the quantities of at least two sub-data, and the third decoding module 605 is used to parse the third code to obtain the quantity code; based on the quantity code, the code in the third code except the quantity code is segmented to obtain at least two sub-codes.
[0141] In one possible implementation, the third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented; the third decoding module 605 is used to segment the third code based on the fourth code to obtain at least two sub-codes; based on the at least two sub-codes, obtain at least two sub-data; splice the at least two sub-data, and obtain the content of the data according to the splicing result.
[0142] In a possible implementation, the third decoding module 605 is used to match each sub-code with a code in the code database; and use the content of the data corresponding to the successfully matched sub-code as the sub-data corresponding to the sub-code to obtain at least two sub-data.
[0143] In the embodiment of the present application, by restoring the data through the check code corresponding to the received data, the data reception can be completed more quickly, the time required to transmit the data is reduced, and the transmission efficiency is increased.
[0144] It should be noted that the device provided in the above embodiment only uses the division of the above functional modules as an example to implement its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0145] Figure 7 It is a structural diagram of a server provided in an embodiment of the present application. The server may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 701 and one or more memories 702, wherein at least one computer program is stored in the one or more memories 702, and the at least one computer program is loaded and executed by the one or more processors 701, so that the server implements the data sending method or data receiving method provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be repeated here.
[0146] Figure 81 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may be a terminal, and the terminal may be: a smart phone, a tablet computer, an MP3 (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Compression Standard Audio Layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) player, a laptop computer or a desktop computer. The terminal may also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0147] Typically, the terminal includes: a processor 801 and a memory 802 .
[0148] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0149] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one instruction, which is used to be executed by the processor 801 so that the terminal implements the data sending method or data receiving method provided in the method embodiment of the present application.
[0150] In some embodiments, the terminal may further optionally include: a peripheral device interface 803 and at least one peripheral device. The processor 801, the memory 802 and the peripheral device interface 803 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 803 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, a positioning assembly 808 and a power supply 809.
[0151] The peripheral device interface 803 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0152] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 804 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 804 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0153] The display screen 805 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 805 is a touch display screen, the display screen 805 also has the ability to collect touch signals on the surface or above the surface of the display screen 805. The touch signal can be input to the processor 801 as a control signal for processing. At this time, the display screen 805 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 805 can be one, set on the front panel of the terminal; in other embodiments, the display screen 805 can be at least two, respectively set on different surfaces of the terminal or in a folding design; in other embodiments, the display screen 805 can be a flexible display screen, set on a curved surface or a folding surface of the terminal. Even, the display screen 805 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 805 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode) and the like.
[0154] The camera assembly 806 is used to capture images or videos. Optionally, the camera assembly 806 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0155] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 801 for processing, or input them into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 may also include a headphone jack.
[0156] The positioning component 808 is used to locate the current geographical location of the terminal to implement navigation or LBS (Location Based Service). The positioning component 808 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, Russia's Grenas system or the European Union's Galileo system.
[0157] The power supply 809 is used to power various components in the terminal. The power supply 809 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 809 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0158] In some embodiments, the terminal further includes one or more sensors 810 , including but not limited to: an acceleration sensor 811 , a gyroscope sensor 812 , a pressure sensor 813 , a fingerprint sensor 814 , an optical sensor 815 , and a proximity sensor 816 .
[0159] The acceleration sensor 811 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal. For example, the acceleration sensor 811 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 801 can control the display screen 805 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 can also be used to collect game or user motion data.
[0160] The gyroscope sensor 812 can detect the body direction and rotation angle of the terminal, and the gyroscope sensor 812 can cooperate with the acceleration sensor 811 to collect the user's 3D actions on the terminal. The processor 801 can implement the following functions based on the data collected by the gyroscope sensor 812: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0161] The pressure sensor 813 can be set in the side frame of the terminal and / or the lower layer of the display screen 805. When the pressure sensor 813 is set in the side frame of the terminal, the user's holding signal of the terminal can be detected, and the processor 801 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is set in the lower layer of the display screen 805, the processor 801 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 805. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0162] The fingerprint sensor 814 is used to collect the user's fingerprint, and the processor 801 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 801 authorizes the user to perform relevant sensitive operations, which include unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 814 can be set on the front, back or side of the terminal. When a physical button or a manufacturer logo is set on the terminal, the fingerprint sensor 814 can be integrated with the physical button or the manufacturer logo.
[0163] The optical sensor 815 is used to collect the ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 according to the ambient light intensity collected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is reduced. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 according to the ambient light intensity collected by the optical sensor 815.
[0164] The proximity sensor 816, also known as a distance sensor, is usually arranged on the front panel of the terminal. The proximity sensor 816 is used to collect the distance between the user and the front of the terminal. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front of the terminal is gradually decreasing, the processor 801 controls the display screen 805 to switch from the screen-on state to the screen-off state; when the proximity sensor 816 detects that the distance between the user and the front of the terminal is gradually increasing, the processor 801 controls the display screen 805 to switch from the screen-off state to the screen-on state.
[0165] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0166] In an exemplary embodiment, a computer device is also provided, the computer device comprising a processor and a memory, wherein at least one computer program is stored in the memory. The at least one computer program is loaded and executed by one or more processors, so that the computer device implements any of the above-mentioned data sending methods or data receiving methods.
[0167] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor of a computer device to enable the computer to implement any of the above-mentioned data sending methods or data receiving methods.
[0168] In one possible implementation, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0169] In an exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program or computer instructions. The computer program or computer instructions are loaded and executed by a processor to enable a computer to implement any of the above-mentioned data sending methods or data receiving methods.
[0170] In an exemplary embodiment, a data transmission system is also provided, which includes a data sending device 11 and a data receiving device 12. The data sending device 11 is used to execute any of the above data sending methods, and the data receiving device 12 is used to execute any of the above data receiving methods.
[0171] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0172] The above description is only an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The method comprises: Get the data to be transmitted; Encoding the format information of the data to obtain a first code; Encoding the size information of the data to obtain a second code; Segmenting the content of the data to obtain at least two sub-data; inputting each sub-data into a corresponding second data encoding function, and generating a sub-code based on the corresponding sub-data by the second data encoding function to obtain at least two sub-codes, one second data encoding function corresponds to one sub-data, and at least two second data encoding functions constitute a first data encoding function; and obtaining a third code based on the at least two sub-codes; concatenate the first code, the second code and the third code to obtain a check code corresponding to the data, the check code comprising the first code, the second code and the third code, the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data; Sending the verification code; Among them, the data volume of the first encoding is not greater than the data volume of directly sending the format information, the data volume of the second encoding is not greater than the data volume of directly sending the size information, and the data volume of the third encoding is not greater than the data volume of directly sending the content of the data.
2. The method according to claim 1, characterized in that: The obtaining the third code based on the at least two sub-codes includes: Obtaining a quantity code corresponding to the quantity of the at least two sub-data; The third code is obtained based on the at least two sub-codes and the quantity code.
3. The method according to claim 1 or 2, characterized in that: The third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the content of the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented.
4. A data receiving method, characterized in that: The method comprises: Receive verification code; Parsing the check code to obtain a first code, a second code and a third code, wherein the first code is used to indicate a format of the data, the second code is used to indicate a size of the data, and the third code is used to indicate a content of the data; Decoding the first code to obtain format information of the data; Decoding the second code to obtain size information of the data; Decoding the third code to obtain the content of the data; The first code is obtained by encoding the format information of the data, the second code is obtained by encoding the size information of the data, the third code is obtained according to at least two sub-codes, and the at least two sub-codes are obtained by inputting at least two sub-data obtained by segmenting the content of the data into corresponding second data encoding functions for encoding, one second data encoding function corresponds to one sub-data, and at least two second data encoding functions constitute the first data encoding function; Among them, the data volume of the first encoding is not greater than the data volume of directly sending the format information, the data volume of the second encoding is not greater than the data volume of directly sending the size information, and the data volume of the third encoding is not greater than the data volume of directly sending the content of the data.
5. The method according to claim 4, characterized in that The decoding of the third code to obtain the content of the data includes: Segmenting the third code to obtain at least two sub-codes; Based on the at least two sub-codes, obtaining at least two sub-data; The at least two sub-data are spliced together, and the content of the data is obtained according to the splicing result.
6. The method according to claim 5, characterized in that The third code also includes a quantity code corresponding to the quantity of the at least two sub-data, and the segmenting of the third code to obtain at least two sub-codes includes: Parsing the third code to obtain the quantity code; The codes other than the number code in the third code are segmented based on the number code to obtain the at least two sub-codes.
7. The method according to claim 4, characterized in that The third code includes at least two sub-codes, one sub-code is used to indicate a sub-data obtained after the data is segmented, and the check code also includes a fourth code, and the fourth code is used to indicate the number of sub-data obtained after the content of the data is segmented; The decoding of the third code to obtain the content of the data includes: Segmenting the third code based on the fourth code to obtain the at least two sub-codes; Based on the at least two sub-codes, obtaining at least two sub-data; The at least two sub-data are spliced together, and the content of the data is obtained according to the splicing result.
8. The method according to claim 5 or 7, characterized in that: The acquiring at least two sub-data based on the at least two sub-codes includes: Match each subcode with a code in the coding database; The content of the data corresponding to the successfully matched sub-code is used as the sub-data corresponding to the sub-code, and at least two sub-data are obtained.
9. A data sending device, characterized in that: The device comprises: An acquisition module, used for acquiring data to be transmitted; A coding module, used for encoding the format information of the data to obtain a first code; encoding the size information of the data to obtain a second code; segmenting the content of the data to obtain at least two sub-data; inputting each sub-data into a corresponding second data coding function, and generating a sub-code based on the corresponding sub-data by the second data coding function to obtain at least two sub-codes, one second data coding function corresponds to one sub-data, and at least two second data coding functions constitute a first data coding function; obtaining a third code based on the at least two sub-codes; splicing the first code, the second code and the third code to obtain a check code corresponding to the data, the check code including the first code, the second code and the third code, the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data; A sending module, used for sending the verification code; Among them, the data volume of the first encoding is not greater than the data volume of directly sending the format information, the data volume of the second encoding is not greater than the data volume of directly sending the size information, and the data volume of the third encoding is not greater than the data volume of directly sending the content of the data.
10. A data receiving device, characterized in that: The device comprises: A receiving module, used for receiving a check code; A parsing module, used for parsing the check code to obtain a first code, a second code and a third code, wherein the first code is used to indicate the format of the data, the second code is used to indicate the size of the data, and the third code is used to indicate the content of the data; A first decoding module, used for decoding the first code to obtain format information of the data; A second decoding module, used for decoding the second code to obtain size information of the data; A third decoding module, used for decoding the third code to obtain the content of the data; The first code is obtained by encoding the format information of the data, the second code is obtained by encoding the size information of the data, the third code is obtained according to at least two sub-codes, and the at least two sub-codes are obtained by inputting at least two sub-data obtained by segmenting the content of the data into corresponding second data encoding functions for encoding, one second data encoding function corresponds to one sub-data, and at least two second data encoding functions constitute the first data encoding function; Among them, the data volume of the first encoding is not greater than the data volume of directly sending the format information, the data volume of the second encoding is not greater than the data volume of directly sending the size information, and the data volume of the third encoding is not greater than the data volume of directly sending the content of the data.
11. A computer device, characterized in that: The computer device includes a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the computer device implements the data sending method as described in any one of claims 1 to 3, or the data receiving method as described in any one of claims 4 to 8.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that the computer implements the data sending method as described in any one of claims 1 to 3, or the data receiving method as described in any one of claims 4 to 8.
13. A computer program product, characterized in that The computer program product includes a computer program or computer instructions, and the computer program or the computer instructions are loaded and executed by a processor to enable a computer to implement the data sending method as described in any one of claims 1 to 3, or the data receiving method as described in any one of claims 4 to 8.
