CN112104441A - Method, device and system for encoding and decoding service data packet - Google Patents

Method, device and system for encoding and decoding service data packet Download PDF

Info

Publication number
CN112104441A
CN112104441A CN202011219871.4A CN202011219871A CN112104441A CN 112104441 A CN112104441 A CN 112104441A CN 202011219871 A CN202011219871 A CN 202011219871A CN 112104441 A CN112104441 A CN 112104441A
Authority
CN
China
Prior art keywords
service data
data packet
decoding
rule
space
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.)
Granted
Application number
CN202011219871.4A
Other languages
Chinese (zh)
Other versions
CN112104441B (en
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.)
Guangzhou Xuanwu Wireless Technology Co Ltd
Original Assignee
Guangzhou Xuanwu Wireless 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 Guangzhou Xuanwu Wireless Technology Co Ltd filed Critical Guangzhou Xuanwu Wireless Technology Co Ltd
Priority to CN202011219871.4A priority Critical patent/CN112104441B/en
Publication of CN112104441A publication Critical patent/CN112104441A/en
Application granted granted Critical
Publication of CN112104441B publication Critical patent/CN112104441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0057Block codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a business data packet coding method, which comprises the steps of receiving a business data packet request sent by a mobile terminal, and obtaining a locally stored business data table; reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space; when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode; and according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet. The coding method can improve the utilization rate of effective data and the success rate of sending and receiving data, reduce the cost additionally increased due to encryption operation, simultaneously can store various data types, reserve the characteristics of the data and better fit the use of services.

Description

Method, device and system for encoding and decoding service data packet
Technical Field
The present invention relates to the field of computer network technologies, and in particular, to a method, an apparatus, a system, and a computer-readable storage medium for encoding and decoding a service data packet.
Background
With the increasing update speed of the intelligent mobile terminal, the development speed and the update speed of the version of the APP application program of the mobile terminal are also increasing. For a certain type of mobile management APP, when a user logs in for the first time every day, all service data packets of the day must be downloaded in advance through a network and updated to a local database for supporting service operation. Each service data packet comprises two parts of contents, namely an operation rule of the data packet; and secondly, the system updates the service data to be operated to the local database according to the operation rule of each service data packet when updating the data. However, the data content of the existing service data packet is often too large, so that the situation of downloading failure often occurs when a user downloads the data packet, and the use of the user is further influenced; in addition, the existing service data packet needs to be additionally encrypted, so that not only is the development cost increased, but also the response efficiency of the server is low due to the fact that the encrypted file is too large; meanwhile, the existing data packet is single in service type and cannot meet the scene requirements of different services.
Disclosure of Invention
The invention aims to provide a business data packet coding and decoding method, which reduces unnecessary data transmission by simplifying business data packets under the condition of not changing the existing business rules, improves the utilization rate of effective data and the success rate of sending and receiving; the service data packet compiled under the method has an encryption function, so that the resource investment additionally increased due to the need of encryption is reduced; meanwhile, the method can store various data types, can keep the characteristics of the data and is more suitable for the use of services.
In order to overcome the defects in the prior art, an embodiment of the present invention provides a service data packet encoding method, which is applied to a server, and the method includes:
receiving a service data packet request sent by a mobile terminal, and acquiring a locally stored service data table according to the service data packet request;
according to the service data table, reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space;
when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to the mobile terminal.
Further, the method further comprises:
when the service data packet request is not the first request, and the service data table is kept unchanged in the preset time period,
generating a modification rule according to the service data table, and writing the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; and circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode.
Further, when the available offset position length of the spare space is smaller than the to-be-written encoding length, a space capacity expansion request is sent to the server, so that the available offset position length of the spare space is larger than or equal to the to-be-written encoding length.
The embodiment of the invention also provides a service data packet decoding method, which is applied to a mobile terminal and comprises the following steps:
receiving a service data packet sent by a server;
sequentially decoding the segment type code and the segment operation code of the service data packet according to a shaping decoding mode and a character string decoding mode to obtain the operation type and the operation rule of the service data;
and if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
Further, before decoding the service data in an array decoding manner and storing the service data in a two-dimensional array if the segment type is the service data, the method further includes:
if the operation rule is a table, establishing a service data table which is the same as the service end according to the operation rule, and continuously reading codes and decoding;
and if the operation rule is modified, saving the operation rule.
Further, after decoding the service data in an array decoding manner and storing the service data in a two-dimensional array if the segment type is the service data, the method further includes:
and processing the two-dimensional array according to the stored modification operation rule.
The embodiment of the invention also provides a service data packet encoding device, which is applied to a server side, and the device comprises:
the data acquisition module is used for acquiring a locally stored service data table according to a service data packet request sent by a mobile terminal and the service data packet request;
the marking module is used for reserving a part of internal memory as a spare space according to the service data table and establishing an offset position mark of a subscript in the spare space;
the encoding module is used for generating a table building rule and a modifying rule according to the service data table when the service data packet request is a first request, and writing the table building rule and the modifying rule into a space in sequence according to a shaping encoding mode and a character string encoding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and the data packet generating module is used for taking the space code under the offset length as a service data packet according to the offset length of the offset position mark of the subscript in the spare space and sending the service data packet to the mobile terminal.
The embodiment of the invention also provides a service data packet decoding device, which is applied to a mobile terminal, and the device comprises:
the data packet receiving module is used for receiving a service data packet sent by the server;
the decoding module is used for decoding the segment type code and the segment operation code of the service data packet in sequence according to the shaping decoding and the character string decoding modes to obtain the operation type and the operation rule of the service data;
and the two-dimensional array generating module is used for decoding the service data in an array decoding mode if the segment type is the service data and storing the service data in a two-dimensional array.
The embodiment of the invention also provides a service data packet coding and decoding system, which comprises a service end and a mobile end,
the server is used for obtaining a locally stored service data table according to a service data packet request sent by the mobile terminal and the service data packet request; according to the service data table, reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space; when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode; and according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to the mobile terminal.
The mobile terminal is used for receiving the service data packet sent by the server terminal; sequentially decoding the segment type code and the segment operation code of the service data packet according to a shaping decoding mode and a character string decoding mode to obtain the operation type and the operation rule of the service data; and if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the service data packet encoding method and the service data packet decoding method as described in any of the above.
Compared with the prior art, the embodiment of the invention has at least the following beneficial effects:
1) the business data packet based on the structured byte stream is structurally characterized in that coding combination is carried out according to the appointed sequence and rule according to the requirement of the needed business, so that fields are not needed for describing values, characters are not needed to be separated, the data in the business data packet are basically effective data, meanwhile, under the same business behavior and in the condition of weak networks, the transmission efficiency is improved, and good user experience can be obtained
2) Different byte stream coding is adopted for different data types, so that the data characteristics are reserved, and unnecessary data transmission is reduced
3) Because the structured byte stream is binary sequence, even if the packet is grabbed by the packet grabbing tool, the sequence structure of the service data packet cannot be known, so that the transmitted content cannot be known, and even if the plaintext transmission is performed in the HTTP environment, the transmitted content is a section of messy code, no additional encryption means is required, and the security is high.
Drawings
Fig. 1 is a schematic flow chart of a service data packet encoding method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a service data packet based on a structured byte stream according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of service data provided by an embodiment of the present invention;
FIG. 4 is a diagram illustrating a structure of a data type of a character string according to an embodiment of the present invention;
fig. 5 is a schematic diagram illustrating the generation of table creation rules and data modification rules applicable to the mobile terminal according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a structure of an encoding format according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a process for generating a two-dimensional array according to an embodiment of the invention;
FIG. 8 is a format diagram of writing a two-dimensional array into space according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating a format for writing a two-dimensional array into space according to another embodiment of the present invention;
fig. 10 is a schematic diagram of an encoding format of a server-write-only data modification rule and operation data according to an embodiment of the present invention;
fig. 11 is a flowchart illustrating a method for decoding a service data packet according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a service data packet encoding apparatus according to an embodiment of the present invention;
fig. 13 is a schematic structural diagram of a service data packet decoding apparatus according to an embodiment of the present invention;
fig. 14 is a schematic structural diagram of a service data packet encoding and decoding system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
In a first aspect:
referring to fig. 1, an embodiment of the present invention provides a method for encoding a service data packet, which is applied to a server, and the method includes:
s10, receiving a service data packet request sent by a mobile terminal, and obtaining a locally stored service data table according to the service data packet request;
s20, reserving a part of internal memory as a spare space according to the service data table, and establishing an offset position mark of a subscript in the spare space;
s30, when the service data packet request is the first request, generating a table establishing rule and a modifying rule according to the service data table, and writing the table establishing rule and the modifying rule into a space in sequence according to the shaping coding and the character string coding modes; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and S40, according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to the mobile terminal.
In this embodiment, it should be noted that, at present, service data packets based on mobile applications are all described by using a structured string (JSON). The structured character string describes the content in the data packet based on the structure mode of 'field: value'. In terms of data validity, fields are only used for describing the role of values, and in order to express the characteristics of the structure, some extra characters are generally introduced to be used as separators, but in fact, these characters have no great value to the service itself, so that the data contains a large number of fields and separators, and particularly in the service data part, the fields and separators are not only numerous, but also 90% of the characters are repeated, and as a result, the service data packet is enlarged, thereby increasing the pressure of network transmission. If the weak network occurs, the situation that the whole service data packet is failed to be downloaded and the user experience is poor due to too large service data packet usually occurs. In addition, the structured character string is essentially a character string, and in the transmission process, if encryption is not performed by an additional encryption means, transmission data is easily modified, however, after encryption, under the condition of large concurrency, the server is easy to cause slow response or even no response due to overlarge resource occupation, so that both data encryption and transmission are also important factors considered in the invention. In addition, in the existing service data, the data may be of an integer type or a floating point type according to different service scene requirements, but such type can be described in a structured character string only by a character string form, so that not only the characteristics of the data are lost, but also the storage space is increased. Therefore, the method provided by the embodiment of the invention also considers how to be suitable for different scenes and maintains the data integrity.
Further, the structure of the service data packet based on the structured byte stream is roughly as shown in fig. 2:
assuming that each action is one segment, then:
a) segment type: describing the business meaning represented by the content in the section;
b) data type: the type of the service data is described in the description section;
c) data: an operation rule or operated service data is described.
Normally, a zero or a segment in the service data packet is used to describe the operated service data; at least one segment is used for describing the operation rule, and the operation rule is stored in front of the business data.
If the data is service data, the structure is roughly as shown in fig. 3:
wherein, if each action is one segment, then,
length: the data length of the row is described and each row may be composed of different types of data, with the data types necessarily being identical from row to row, relative position.
If the data type is a character string, the structure is substantially as shown in FIG. 4:
the length is used to describe how many bytes the string is made up of
If the data type is integer type or floating point type, fixing the data type to 4 bytes;
the segment type is 1 byte, the data type is 1 byte, and the length type is 4 bytes.
It should be noted that, in this embodiment, 3 basic encoding modes are given, and the subsequent encoding performs related operations based on these three basic modes:
1) shaping:
the segment type, the data type and the length are numerical values in nature, the coding modes are consistent, only the byte number is different, the binary code of the shaping variable in the memory is taken out in an address mode, and the shaping code can be obtained by reading 32 bits from the first address due to the fact that the shaping is 4 bytes and 32 bits.
2) Character string:
and carrying out UTF8 encoding on the character string to obtain a UTF8 character string and the length thereof. Coding the length in a 2.1 shaping mode to obtain a length code of the length; and converting the UTF8 into a character array, wherein each content of the character array is 1 byte and 8 bits of ASCII, circularly reading all ASCII codes, and splicing the ASCII codes after length coding to obtain the character string code.
3) Array:
circularly reading the data in the array, coding a data type code for the data in any subscript according to the data type, then coding a shaping code, a character string code or an array code according to the data code, and splicing the shaping code, the character string code or the array code together to obtain a data code and a data length; the data length is encoded and the data code is spliced behind it. And cycling to obtain array codes.
The encoding operation is started as follows:
in step S10, the server receives a request for a service data packet from the mobile terminal, and obtains a locally stored service data table;
in step S20, the server allocates a space in the memory in advance according to the configuration, and sets the offset position flag of the subscript in the space; then the server side finds out a service data table and an update log thereof in the database according to the time of the service data packet and the service table request parameter;
in step S30, it is first determined whether the request is a first request, and the first request usually includes two cases: the service table may be changed or not in the time period of requesting service data packet, but as long as the mobile terminal is the first request, the unified coding mode is adopted, the server terminal generates the table building rule and the data modification rule (both are operation rules) suitable for the mobile terminal according to the table building rule of the service table, and the table building rule and the data modification rule are integrated by a)
Shape and b) character string are written into the storage space. The table creation rule, the data modification rule and the encoding format generated and applied to the mobile terminal are respectively shown in fig. 5 and fig. 6:
then, step S30 is executed to find out all the data in the service table, and according to the insertion order in the insertion rule, all the data in each row are read in a loop and stored in the array. All data in the table are read out to form a two-dimensional array, as shown in fig. 7. Encoding the two-dimensional array in the form of c) array, generating operated data suitable for the mobile terminal, and writing the operated data into the space, as shown in fig. 8-9:
after all codes are written in, all codes in the space are taken out by taking the offset position as the length, all the codes are service data packets, and the service end sends the service data packets back to the mobile end.
The embodiment of the invention reduces the transmission of unnecessary data by simplifying the service data packet without changing the existing service rule, improves the utilization rate of effective data and the success rate of sending and receiving; the service data packet compiled under the method has an encryption function, so that the resource investment additionally increased due to the need of encryption is reduced; meanwhile, the method can store various data types, can keep the characteristics of the data and is more suitable for the use of services.
In an exemplary embodiment, when a service data packet request is not a first request and a service data table is kept unchanged in a preset time period, generating a modification rule according to the service data table, and writing the modification rule into a space in sequence according to a) shaping codes and b) a character string coding mode; and circularly reading the row data of the service data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to a 3) array coding mode, wherein the coding format is shown in fig. 10.
In an exemplary embodiment, when the available offset position length of the spare space is smaller than the length of the code to be written, that is, the offset position is not enough to accommodate the code to be written, a space capacity expansion request is sent to the server, and the server performs capacity expansion distribution on the space to ensure that the code is written in the space enough.
In a second aspect:
referring to fig. 11, in an exemplary embodiment, a method for decoding a service data packet is further provided, where the method is applied to a mobile terminal, and the method includes:
s50, receiving a service data packet sent by a server;
s60, decoding the segment type code and the segment operation code of the service data packet in sequence according to the shaping decoding and the character string decoding modes to obtain the operation type and the operation rule of the service data;
and S70, if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
It should be noted that the decoding method provided by this embodiment is based on the following three cases:
d) shaping of
Reading 4 bytes of 32-bit codes in memory, and converting into shaping by forced conversion
e) Character string
According to the appointed rule, firstly reading the length of the character string by d) shaping, then reading the code with the appointed length once from the 5 th byte, and carrying out UTF8 recoding on the read code to obtain the character string
f) Array of elements
According to the appointed rule, firstly reading the length of an array by d) shaping, then reading the code with the appointed length at one time from the 5 th byte, reading the data type of the code by d) shaping from the first byte, reading the data in any subscript by d) shaping, e) character string or f) array according to the data type, and repeating the steps to obtain the content in the array.
The decoding operation is performed beginning with:
in step S50, first, a service data packet sent by the server is received; the mobile terminal starts decoding after completely receiving the codes;
in steps S60 and S70, according to convention, first reading the segment type code and the operation rule code of the segment, decoding the operation type and the operation rule in a d) shaping and e) character string manner, at this time, if the operation type is table establishment, the mobile terminal establishes a local data table consistent with the service terminal in the local database according to the operation rule, then continuing to read the code and decode, if the operation type is modification, the mobile terminal stores the operation rule first, completely utilizes the operation rule after the service data is decoded, then continues to read the code and decode, if the segment type is service data, decodes the service data in an f) array manner, and temporarily stores the service data in a two-dimensional array; and finally, processing the two-dimensional array according to the decoded operation rule, namely finishing all decoding operations.
In a third aspect:
referring to fig. 12, in an exemplary embodiment, there is further provided a service data packet encoding apparatus, which is applied to a server, the apparatus including:
the data acquisition module 01 is used for acquiring a locally stored service data table according to a service data packet request sent by a mobile terminal and the service data packet request;
a marking module 02, configured to reserve a part of the memory as a spare space according to the service data table, and establish an offset position mark of a subscript in the spare space;
the encoding module 03 is used for generating a table building rule and a modifying rule according to the service data table when the service data packet request is a first request, and writing the table building rule and the modifying rule into a space in sequence according to a shaping encoding mode and a character string encoding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and the data packet generating module 04 is configured to use the space code with the offset length as a service data packet according to the offset length of the offset position mark of the subscript in the spare space, and send the service data packet to the mobile terminal.
Wherein the four modules perform the following operations:
in step S10, the server receives a request for a service data packet from the mobile terminal, and obtains a locally stored service data table;
in step S20, the server allocates a space in the memory in advance according to the configuration, and sets the offset position flag of the subscript in the space; then the server side finds out a service data table and an update log thereof in the database according to the time of the service data packet and the service table request parameter;
in step S30, it is first determined whether the request is a first request, and the first request usually includes two cases: the service table may be changed or not changed in the time period of requesting the service data packet, but as long as the mobile terminal is the first request, a uniform coding mode is adopted, the server terminal generates a table building rule and a data modification rule (both are operation rules) suitable for the mobile terminal according to the table building rule of the service table, and writes the table building rule and the data modification rule into the storage space in a) shaping mode and b) character string mode. The table creation rule, the data modification rule and the encoding format generated and applied to the mobile terminal are respectively shown in fig. 5 and fig. 6:
then, step S30 is executed to find out all the data in the service table, and according to the insertion order in the insertion rule, all the data in each row are read in a loop and stored in the array. All data in the table are read out to form a two-dimensional array, as shown in fig. 7. Encoding the two-dimensional array in the form of c) array, generating operated data suitable for the mobile terminal, and writing the operated data into the space, as shown in fig. 8-9:
after all codes are written in, all codes in the space are taken out by taking the offset position as the length, all the codes are service data packets, and the service end sends the service data packets back to the mobile end.
Referring to fig. 13, in an exemplary embodiment, there is further provided a service data packet decoding apparatus applied to a mobile terminal, the apparatus including:
the data packet receiving module 05 is used for receiving a service data packet sent by a server;
the decoding module 06 is configured to decode the segment type code and the segment operation code of the service data packet in sequence according to a shaping decoding mode and a character string decoding mode to obtain an operation type and an operation rule of service data;
and the two-dimensional array generating module 07 is configured to decode the service data in an array decoding manner and store the service data in a two-dimensional array if the segment type is the service data.
Wherein the three modules perform the following operations:
in step S50, first, a service data packet sent by the server is received; the mobile terminal starts decoding after completely receiving the codes;
in steps S60 and S70, according to convention, first reading the segment type code and the operation rule code of the segment, decoding the operation type and the operation rule in a d) shaping and e) character string manner, at this time, if the operation type is table establishment, the mobile terminal establishes a local data table consistent with the service terminal in the local database according to the operation rule, then continuing to read the code and decode, if the operation type is modification, the mobile terminal stores the operation rule first, completely utilizes the operation rule after the service data is decoded, then continues to read the code and decode, if the segment type is service data, decodes the service data in an f) array manner, and temporarily stores the service data in a two-dimensional array; and finally, processing the two-dimensional array according to the decoded operation rule, namely finishing all decoding operations.
In a fourth aspect:
referring to fig. 14, in an exemplary embodiment, a service data packet encoding and decoding system 100 is further provided, which includes a service end and a mobile end,
the server is used for obtaining a locally stored service data table according to a service data packet request sent by the mobile terminal and the service data packet request; according to the service data table, reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space; when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode; and according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to the mobile terminal.
The mobile terminal is used for receiving the service data packet sent by the server terminal; sequentially decoding the segment type code and the segment operation code of the service data packet according to a shaping decoding mode and a character string decoding mode to obtain the operation type and the operation rule of the service data; and if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
In a fifth aspect:
in one exemplary embodiment, there is also provided a computer terminal device including: one or more processors; a memory coupled to the processor for storing one or more programs; when executed by the one or more processors, cause the one or more processors to implement the service data packet encoding and decoding method as described above.
The processor is used for controlling the overall operation of the computer terminal equipment so as to complete all or part of the steps of the service data packet encoding and decoding method. The memory is used to store various types of data to support the operation at the computer terminal device, which data may include, for example, instructions for any application or method operating on the computer terminal device, as well as application-related data. The Memory may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
The computer terminal Device may be implemented by one or more Application Specific 1 integrated circuits (AS 1C), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic components, and is configured to perform the service data packet encoding and decoding method according to any of the embodiments described above, and achieve technical effects consistent with the methods described above.
In an exemplary embodiment, a computer readable storage medium is further provided, which includes program instructions, when executed by a processor, to implement the steps of the service data packet encoding and decoding method according to any one of the above embodiments. For example, the computer readable storage medium may be the above memory including program instructions, which are executable by a processor of a computer terminal device to perform the service data packet encoding and decoding method according to any one of the above embodiments, and achieve the technical effects consistent with the above method.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (10)

1. A service data packet coding method is applied to a server, and the method comprises the following steps:
receiving a service data packet request sent by a mobile terminal, and acquiring a locally stored service data table according to the service data packet request;
according to the service data table, reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space;
when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to the mobile terminal.
2. The method of claim 1, further comprising:
when the service data packet request is not the first request, and the service data table is kept unchanged in the preset time period,
generating a modification rule according to the service data table, and writing the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; and circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode.
3. The service data packet encoding method of claim 1,
when the available offset position length of the spare space is smaller than the length of the code to be written, sending a space capacity expansion request to a server, so that the available offset position length of the spare space is larger than or equal to the length of the code to be written.
4. A method for decoding service data packets, which is applied to a mobile terminal, the method comprising:
receiving a service data packet sent by a server;
sequentially decoding the segment type code and the segment operation code of the service data packet according to a shaping decoding mode and a character string decoding mode to obtain the operation type and the operation rule of the service data;
and if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
5. The method as claimed in claim 4, wherein before decoding the service data in an array decoding manner and storing the service data in a two-dimensional array if the segment type is service data, the method further comprises:
if the operation rule is a table, establishing a service data table which is the same as the service end according to the operation rule, and continuously reading codes and decoding;
and if the operation rule is modified, saving the operation rule.
6. The method as claimed in claim 5, wherein after decoding the service data in an array decoding manner and storing the service data in a two-dimensional array if the segment type is service data, the method further comprises:
and processing the two-dimensional array according to the stored modification operation rule.
7. A service data packet encoding device, applied to a server, the device comprising:
the data acquisition module is used for acquiring a locally stored service data table according to a service data packet request sent by a mobile terminal and the service data packet request;
the marking module is used for reserving a part of internal memory as a spare space according to the service data table and establishing an offset position mark of a subscript in the spare space;
the encoding module is used for generating a table building rule and a modifying rule according to the service data table when the service data packet request is a first request, and writing the table building rule and the modifying rule into a space in sequence according to a shaping encoding mode and a character string encoding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode;
and the data packet generating module is used for taking the space code under the offset length as a service data packet according to the offset length of the offset position mark of the subscript in the spare space and sending the service data packet to the mobile terminal.
8. A service data packet decoding apparatus, applied to a mobile terminal, the apparatus comprising:
the data packet receiving module is used for receiving a service data packet sent by the server;
the decoding module is used for decoding the segment type code and the segment operation code of the service data packet in sequence according to the shaping decoding and the character string decoding modes to obtain the operation type and the operation rule of the service data;
and the two-dimensional array generating module is used for decoding the service data in an array decoding mode if the segment type is the service data and storing the service data in a two-dimensional array.
9. A service data packet coding and decoding system is characterized in that it comprises a service end and a mobile end,
the server is used for obtaining a locally stored service data table according to a service data packet request sent by the mobile terminal and the service data packet request; according to the service data table, reserving a part of internal memory as a spare space, and establishing an offset position mark of a subscript in the spare space; when the service data packet request is a first request, generating a table building rule and a modification rule according to the service data table, and writing the table building rule and the modification rule into a space in sequence according to a shaping coding mode and a character string coding mode; circularly reading the row data of the business data table to obtain a two-dimensional array, and writing the two-dimensional array into a space according to an array coding mode; according to the offset length of the offset position mark of the subscript in the spare space, taking the space code under the offset length as a service data packet and sending the service data packet to a mobile terminal;
the mobile terminal is used for receiving the service data packet sent by the server terminal; sequentially decoding the segment type code and the segment operation code of the service data packet according to a shaping decoding mode and a character string decoding mode to obtain the operation type and the operation rule of the service data; and if the segment type is the service data, decoding the service data in an array decoding mode and storing the service data in a two-dimensional array.
10. A computer-readable storage medium, on which a computer program is stored, the computer program being executed by a processor to implement the service data packet encoding method according to any one of claims 1 to 3 and the service data packet decoding method according to any one of claims 4 to 6.
CN202011219871.4A 2020-11-05 2020-11-05 Method, device and system for encoding and decoding service data packet Active CN112104441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011219871.4A CN112104441B (en) 2020-11-05 2020-11-05 Method, device and system for encoding and decoding service data packet

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011219871.4A CN112104441B (en) 2020-11-05 2020-11-05 Method, device and system for encoding and decoding service data packet

Publications (2)

Publication Number Publication Date
CN112104441A true CN112104441A (en) 2020-12-18
CN112104441B CN112104441B (en) 2021-02-12

Family

ID=73785448

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011219871.4A Active CN112104441B (en) 2020-11-05 2020-11-05 Method, device and system for encoding and decoding service data packet

Country Status (1)

Country Link
CN (1) CN112104441B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7751482B1 (en) * 2004-02-27 2010-07-06 Vbrick Systems, Inc. Phase correlation based motion estimation in hybrid video compression
CN103595415A (en) * 2012-08-16 2014-02-19 中兴通讯股份有限公司 Coding method, decoding method, coding system and decoding system
CN104023057A (en) * 2014-05-30 2014-09-03 天津三星通信技术研究有限公司 Data sharing method and data sharing system
US20160070917A1 (en) * 2014-09-08 2016-03-10 Protegrity Corporation Tokenization of structured data
CN107247695A (en) * 2017-05-31 2017-10-13 深圳市长亮科技股份有限公司 Coding rule generation method, system and storage device
CN109428602A (en) * 2017-08-30 2019-03-05 前海中科芯片控股(深圳)有限公司 A kind of data-encoding scheme, device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7751482B1 (en) * 2004-02-27 2010-07-06 Vbrick Systems, Inc. Phase correlation based motion estimation in hybrid video compression
CN103595415A (en) * 2012-08-16 2014-02-19 中兴通讯股份有限公司 Coding method, decoding method, coding system and decoding system
CN104023057A (en) * 2014-05-30 2014-09-03 天津三星通信技术研究有限公司 Data sharing method and data sharing system
US20160070917A1 (en) * 2014-09-08 2016-03-10 Protegrity Corporation Tokenization of structured data
CN107247695A (en) * 2017-05-31 2017-10-13 深圳市长亮科技股份有限公司 Coding rule generation method, system and storage device
CN109428602A (en) * 2017-08-30 2019-03-05 前海中科芯片控股(深圳)有限公司 A kind of data-encoding scheme, device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ABDULLAH AI MAMUN,ETC: "Efficient Position Encoding in Hard Disk Drive using Dual Frequency Servo Bursts", 《IECON"01. 27TH ANNUAL CONFERENCE OF THE IEEE INDUSTRIAL ELECTRONICS SOCIETY》 *
姬伟: "面向业务的空间信息服务应用开发体系链", 《中国优秀博士学位论文全文数据库》 *

Also Published As

Publication number Publication date
CN112104441B (en) 2021-02-12

Similar Documents

Publication Publication Date Title
CN108845816B (en) Application program updating method, system, computer device and storage medium
US9471646B2 (en) Method and server device for exchanging information items with a plurality of client entities
CN109981595B (en) Resource acquisition method, resource return method, server and storage medium
CN109104405B (en) Binary protocol encoding and decoding method and device
CN111262876A (en) Data processing method, device and equipment based on block chain and storage medium
CN111111214B (en) Game archiving processing method, device and system
US20210019418A1 (en) Technique for authentication and prerequisite checks for software updates
CN111967244A (en) FAST protocol decoding method, device and equipment based on FPGA
CN112165331A (en) Data compression method and device, data decompression method and device, storage medium and electronic equipment
CN109951514A (en) Document handling method, system and computer equipment based on cloud storage
CN103731472A (en) Method and system for downloading files by adopting P2P technology and client-side
CN110958024A (en) Serial port data encoding method and device, embedded device and communication system
JP2014526098A (en) Method and system for downloading font files
CN112153042A (en) Method, system, equipment and medium for preventing downloading of Web end audio online playing
CN112104441B (en) Method, device and system for encoding and decoding service data packet
CN115409507A (en) Block processing method, block processing device, computer equipment and storage medium
US20120246264A1 (en) Data Exchange Between Communicating Computing Equipment Using Differential Information
CN113986313A (en) Software upgrading method and device, electronic equipment and storage medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN114356386A (en) Block differential upgrading method, terminal equipment and computer readable storage medium
CN111061682B (en) Data caching method, reading method, electronic equipment and storage medium
CN113900991A (en) Data interaction method, device, equipment and storage medium
CN113900990A (en) File fragment storage method, device, equipment and storage medium
CN114489737A (en) Multi-firmware OTA (over the air) upgrading method and device, server and storage medium
KR20020003255A (en) Method of efficiently updating softwares on the network

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
GR01 Patent grant
GR01 Patent grant
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 510000 room 23bd, No. 109, TIYU West Road, Tianhe District, Guangzhou City, Guangdong Province

Patentee after: GUANGZHOU XUANWU WIRELESS TECHNOLOGY Co.,Ltd.

Address before: 32B, no.103b, TianLiHe Road, Guangzhou, 510000

Patentee before: GUANGZHOU XUANWU WIRELESS TECHNOLOGY Co.,Ltd.