CN103279462B - A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message - Google Patents

A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message Download PDF

Info

Publication number
CN103279462B
CN103279462B CN201310203775.4A CN201310203775A CN103279462B CN 103279462 B CN103279462 B CN 103279462B CN 201310203775 A CN201310203775 A CN 201310203775A CN 103279462 B CN103279462 B CN 103279462B
Authority
CN
China
Prior art keywords
data
byte
section
decoding
chinese character
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.)
Expired - Fee Related
Application number
CN201310203775.4A
Other languages
Chinese (zh)
Other versions
CN103279462A (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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201310203775.4A priority Critical patent/CN103279462B/en
Publication of CN103279462A publication Critical patent/CN103279462A/en
Application granted granted Critical
Publication of CN103279462B publication Critical patent/CN103279462B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message.Original communication data are divided into several ASCII character instruction segments and binary data section by the present invention, and store with chain sheet form; Use 176 to 240 byte numerical value to change each binary data section, form standard compliant Chinese character section, and substitute the original binary data in chained list; ASCII character instruction segment in chained list and Chinese character section are combined into message data according to sequencing; Limit according to civilian agreement, be divided into by message data several to meet the communication text of Big Dipper short message requirement.During decoding, the ASCII character in message retains, and Chinese character is oppositely decoded.The present invention realizes transmitting the short message of temperature, pressure, liquid level, image etc. original binary data, and can retain the certain semantic instruction of ASCII character composition, has the features such as calculating is simple, saving code stream.

Description

A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message
Technical field
The present invention relates to communication technical field, particularly a kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message.
Background technology
Along with the raising that user is familiar with for Beidou satellite navigation system, the short message function of dipper system also starts to be widely known by the people.The key performance of Big Dipper short message system in the disaster relief processes such as Wenchuan earthquake, Zhouqu County's rubble flow, Lushan earthquake, makes its application obtain great popularization.
The civilian agreement of Big Dipper short message system serves the teletext communication that can only complete 60 Chinese characters (i.e. 120 bytes) length at every turn.In use, user is in the urgent need to improving data capacity and the information carrying capacity of short message.But because the most of Big Dipper short message terminal device appeared on the market at present only designs for transmitting the character data (comprising Chinese character and ASCII character) with certain semantic, the intercommunication mutually of the binary data such as image, field data cannot be completed.Using the transport vehicle of Big Dipper short message as a kind of industrial data, also need to solve similar problem.
In commercial Application, often use some specific English character strings to form specific interactive instruction, such as " set ", " get " etc., encode to these ASCII character characters again, usually can increase code stream, takies limited short message capacity.If the standard of use describing mode, describe a floating data as 12383.809832 needs, 12 ASCII character, and real-coded GA only needs use 4 byte to describe; If 2.3, then only need three bytes.Therefore, design one both can retain ascii character, can carry out the coding method of absolute coding again very urgent to the raw bytes data of floating type, integer data.
At present, the correlative study for the transmission of Big Dipper short message data concentrates on the compression aspect of encode Chinese characters for computer, can improve the information capacity of short message.But for the interaction protocol data transmission that industrial control field is conventional, lack corresponding coding techniques support.Solve this encoded question, should be noted that following problem: 1) how instruction code and protocol data are encoded respectively, and exportable effective mixed characters string transmits; 2) how raw bytes data-mapping to be become the Chinese character meeting the civilian protocol specification of Big Dipper short message terminal, and save communication flows as much as possible; 3) how to improve the efficiency of coding/decoding algorithm, make it to be applicable to terminal device and calculate.
Summary of the invention
The object of this invention is to provide a kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message, binary data is converted to standard Chinese character, and the ascii character with specific meanings can be retained, the data after coding are transmitted by Big Dipper short message terminal device.
Object of the present invention is achieved through the following technical solutions:
Be applicable to a data encoding/decoding method for the civilian agreement of Big Dipper short message, comprise the steps: in coding stage
Step 1: original communication data are divided into multiple ASCII character instruction segment and binary data section, using each paragraph as a node, stores according to sequencing data inserting chained list;
Step 2: by each binary data section node in data link table with three bytes for benchmark is divided into multiple subsegment according to the sequencing that data store, each subsegment is converted into two Chinese characters meeting " Chinese Character Set Code for Informati baseset " standard according to mapping algorithm; Complete and be converted to a Chinese character string, be referred to as Chinese data section; Use binary data section node corresponding in Chinese data section replacement data chained list;
Step 3: by the ASCII character instruction segment node in data link table and Chinese data section node according to the tandem in this data link table, be combined into coded data from front to back, and the byte number of calculation code data;
Step 4: coded data be divided into one or more to be no more than the restriction of Big Dipper short message civilian protocol length, is namely less than the communication text that 120 bytes, Chinese character are complete, meet the requirement of Big Dipper short message.
The mapping algorithm idiographic flow that the binary data used in above-mentioned steps 2 is converted to Chinese character is as follows:
The first step: unsigned character type (unsignedchar) the coding lookup table generating 65 byte-sized, its numerical value Hexadecimal form is from front to back: 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0,
Second step: be a coding input unit by every for binary data three bytes, each coding input unit has binary mode 24 bit data; Every four bytes are as an encoding output unit, and each encoding output unit has binary mode 32 bit data; Encoding output unit number equals binary data byte number and adds after 2 and the business of 3;
3rd step: coding input unit 24 bit data is then equally divided into 4 parts by front, is numbered 0 to 3; Every part has binary mode 6 bit data, and the numerical values recited of every part is 0 to 63, searches the coding lookup table generated in the first step, the value of correspondence be stored in byte corresponding to encoding output unit according to the numerical values recited of every part as address offset amount;
4th step: if when binary data byte number can not be divided exactly (namely byte number is not the integral multiple of 3) by 3: when remainder is 1, last two representative numerical value of last byte are multiplied by the numerical value obtained after 16 searches the coding lookup table generated in the first step as address offset amount, the value of correspondence be stored in the 1st byte of corresponding encoding output unit, latter two byte of encoding output unit uses 0xF0 to fill; When remainder is 2, last 4 representative numerical value of last byte are multiplied by the numerical value obtained after 4 searches the coding lookup table generated in the first step as address offset amount, the value of correspondence be stored in the 2nd byte of corresponding encoding output unit, last byte of corresponding output unit uses 0xF0 to fill.
A kind of binary data hybrid coding/coding/decoding method being applicable to Big Dipper short message coding stage the coded data that obtains of step 3 be divided into one or more complete no longer than 120 bytes, Chinese character, to meet the communication text idiographic flow that Big Dipper short message requires as follows:
The first step: the length L of calculation code data, rule is each Chinese character is two bytes, and each ASCII character is a byte;
Second step: by coded data by being divided into N section initial communication text after forward direction, N equals coded data byte number and adds after 119 and the business of 120; The primary data byte number l of 1 to N-1 section (1N-1)equal the business of L and N; The initial byte number l of N section nfor the byte number of remaining data;
3rd step: check the 1st section of unsigned value representated by last byte: if this value is for being greater than 0 and being less than 127, then this section processedly completes; If this value is V, and have V to be more than or equal to 176 and be less than or equal to 240 (i.e. 240>=V>=176), then calculate byte value from back to front by this byte address be more than or equal to 176 and be less than or equal to the quantity C of 240, until run into first ineligible byte or arrive the top of this section; If quantity C is even number, then this section processedly completes; If quantity C is odd number, then last byte of first paragraph removed, the section being inserted into second segment is first, and become the first byte of second segment, the first paragraph byte number after process becomes l (1N-1)-1, this section processed completes;
4th step: after processing first paragraph, if second segment byte number is greater than initial byte number and equals 121, then needs the 121st byte to remove, and the section being inserted into the 3rd section is first; The byte number of the 3rd section is made a decision, and does the same treatment with second segment; Process successively, until final stage, if the byte number handling final stage well equals 121, then need increase segmentation, the quantity of final communication text is N+1;
5th step: after completing the 4th step, if communication text quantity is constant, then do the same iterative processing of the 3rd step to 2 to N-1 section, finally complete segmentation, each section sends successively as independent Beidou communication text; If communication text quantity adds 1, then need to carry out segmentation again to coded data, by being divided into N+1 section after forward direction, the primary data byte number t of 1 to N section (1N)equal the business of L and N+1, the initial byte number t of N+1 section n+1for the byte number of remaining data;
6th step: to each data segment after segmentation again by doing iterative processing same in the 3rd step after forward direction, and finally complete segmentation, each section sends successively as independent Beidou communication text.
Be applicable to a data encoding/decoding method for the civilian agreement of Big Dipper short message, comprise the steps: at decode phase
Step 1: by the Big Dipper short message that receives according to sequencing, be then divided into several ASCII character character strings and Chinese character string by front, and store according to sequencing data inserting chained list; Unsigned character type data value corresponding to Big Dipper short message data respective byte is 0 to 127 is ASCII character number of characters value tag, and 176 to 240 is the Chinese character numerical characteristics needing decoding;
Step 2: the number N detecting each Chinese character string Chinese character in data link table cn, Chinese character number must be even number; If not being even number, needing to wait for next Big Dipper short message, decoding again after sequential concatenation;
Step 3: the byte quantity that each Chinese character string occupies is N cntwice, it is N that its decoding exports corresponding byte number binbinary data; Calculating unsigned character type data value in Chinese character string is the byte quantity N of 240 b0, then N binequal N cnbe multiplied by the business with 2 after 3;
Step 4: each Chinese character string is then divided into several decoding input blocks by front; Each decoding input block comprises two Chinese characters, totally four bytes; The quantity of decoding input block is N cnhalf; The corresponding decoding output unit of each decoding input block, each decoding output unit comprises 3 bytes, totally 24 bit data;
Step 5: judge the unsigned character type data value V that each decoding input block first character saves eif, 240>V e>=176, then this value is deducted 176 and obtain the output valve that is less than 64; Convert this output valve to six bits, be filled into the 1 to the 6 of decoding output unit; Six bits exported are filled into the 7 to the 12 of decoding output unit by same operation decodes input block second byte; Six bits exported are filled into the 13 to the 18 of decoding output unit by operation decodes input block the 3rd byte; Six bits exported are filled into the 19 to the 24 of decoding output unit by operation decodes input block the 4th byte; If the unsigned character type data value of certain byte of decoding input block is 240, then decoding ceases, it is invalid that the decoding output unit position that this byte is corresponding and subsequent data bit are;
Step 6: by the effective byte in decoding output unit corresponding for character string according to being N by the front order then byte number be filled into described in step 3 binbinary data in, thus complete the decoding of this Chinese character string;
Step 7: process each Chinese character string in data link table successively, uses the binary data obtained of decoding to substitute former Chinese character string;
Step 8: the ASCII character character string in data link table and decoding are obtained binary data and is filled into final data space according to by front order then, complete decoding.
As can be seen from above technical scheme provided by the invention, the ASCII character instruction segment needed in the communication data of coding and binary data section separately process by the present invention, and binary data section are converted into the Chinese character meeting " Chinese Character Set Code for Informati baseset " standard.Data after coding directly can be sent by Big Dipper short message terminal after segmentation.Only need during decoding just can distinguish instruction segment and data segment according to byte value feature.Whole method calculated amount is little, and coding exports volume recruitment and is less than 1/3rd, solves the problem that current most of Big Dipper terminal device can not send binary data, effectively can expand the application of Big Dipper short message.Therefore, this method has a good application prospect.
Accompanying drawing explanation
In order to be illustrated more clearly in technical scheme of the present invention, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below.Obviously, accompanying drawing described below is only some embodiments of the present invention.
Fig. 1 be in the embodiment of the present invention towards the communication of Big Dipper short message to the process flow diagram of ASCII character instruction and binary data hybrid coding;
Fig. 2 forms schematic diagram towards the communication of Big Dipper short message to the data link table that original communication data sectional generates by ASCII character instruction and binary data hybrid coding method in the embodiment of the present invention;
Fig. 3 is the coding input unit composition schematic diagram of binary data section under different byte number in the embodiment of the present invention;
Fig. 4 be in the embodiment of the present invention coding stage single encoded input block processing procedure schematic diagram;
Fig. 5 is to the process flow diagram that reception Big Dipper short message coded data is decoded in the embodiment of the present invention;
Fig. 6 is to the data link table composition schematic diagram receiving Big Dipper short message coded data segmentation generation in the embodiment of the present invention;
Fig. 7 is the processing procedure schematic diagram of the single decoding input block of decode phase in the embodiment of the present invention
Embodiment
Below in conjunction with the accompanying drawing of the embodiment of the present invention, the technical scheme in embodiment is clearly and completely described.
Embodiments provide a kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message.First introduce the workflow comprising the original communication data encoding stage of ASCII character instruction and binary data, Fig. 1 describes the related procedure of this embodiment, comprising:
101, original communication data are carried out segmentation;
The ASCII character strings of commands with certain semantic and correlation parameter corresponding to this instruction is comprised in original communication data.These correlation parameters exist in the form of binary data, are therefore referred to as binary data.In coding stage, application program and the distinct original communication data composition of relevant device, therefore staged operation does not have ambiguity.During segmentation in the present embodiment, an ASCII character instruction segment must a corresponding binary data section.Certainly, the present invention is applicable to the situation only having binary data.
102, by the ASCII character instruction segment after segmentation and binary data section stored in a data link table;
Data link table is a kind of data structure, and one of its feature has directivity.By the ASCII character instruction segment that divided and binary data section according to sequencing stored in this data link table.The composition of this data link table as shown in Figure 2, data link table there is M back end, its numbering by No. 0, No. M-1 end.ASCII character instruction segment and binary data section are staggered in chained list to be deposited, and what the 0th number node stored is ASCII character instruction segment, and a node storage is binary data section thereafter, and known M is the integral multiple of 2.
103, each binary data section in data link table is converted to GB2312 Chinese character string, and uses this Chinese character string to replace its position in chained list;
Core thinking binary data section being converted to GB2312 Chinese character string is that the binary data of three bytes is converted to two Chinese characters.Therefore, pay close attention to the multiple proportion of byte quantity in binary data section and 3, Fig. 3 shows the feature of the string of binary characters of different length.
As shown in Figure 3, a length is n, and namely byte quantity is the binary data section of n, and byte number is 0 to n-1.During conversion, from byte 0, using continuous print 3 bytes as a coding input unit.Coding output is a Chinese character string, and it can be used as a continuous print data space, and from the first byte in this space, continuous print 4 bytes are as an encoding output unit, and the quantity defining encoding output unit in this space is m.
In Fig. 3,301 when to show byte number be the integral multiple of 3, the coding input cell distribution situation in binary data section.Coding input element number is the business that N, N equal n and 3.Now, the quantity m of encoding output unit equals N.
In Fig. 3,302 show the integral multiple of byte number n than 3 when having more 2 bytes, the coding input cell distribution situation in binary data section.Coding input element number N equals the business of n and 3, but the quantity m of encoding output unit equals N+1.
In Fig. 3,303 show the integral multiple of byte number n than 3 when having more 1 byte, the coding input cell distribution situation in binary data section.Coding input element number N equals the business of n and 3, but the quantity m of encoding output unit equals N+1.
Specific to the conversion process of single encoded input block to corresponding encoding output unit, Fig. 4 shows and specifically processes details.First will obtain the coding lookup table 401 that a length is 65 bytes, this look-up table is one piece of continuous print storage space when specific implementation.The technical characteristic of the preferred embodiment of the present invention is illustrated in 401, for ensureing that the character of coding output is the basic Chinese character in GB2312 standard, the cognitive disorders with ASCII character aliasing can not be produced, adopt the numerical value of unsigned character type data value between 176 to 240 as map unit, its 16 relevant system representations are: 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0.Thus, the Chinese character string obtained after conversion only may comprise 4161 standard Chinese characters in GB2312 baseset.
Fig. 4 shows a coding input unit 402 that embodiment chooses to show transfer process, and the byte of 3 in coding input unit 402 is carried out segmentation according to 6.Using the most significant digit of byte in 402 0 as the 1st, the lowest order of byte 2 is as the 24th.Using the 1st to the 6th as the first subsegment, its numerical value is 6 of 404 correspondences, using this numerical value as addressing side-play amount, searches corresponding map unit, thus obtain the map unit 0xB6 of 409 correspondences in coding lookup table 401.By the map unit that obtains stored in 403 encoding output unit bytes 0.Equally, obtain the 7th to the 12nd the second subsegment, the map unit 410 that the numerical value 59 corresponding coding lookup table 401 in its value 405 is total, by its value 0xEB stored in 403 encoding output unit bytes 1.So, the 13rd to the 18th of coding input unit 402 is processed, the 19th to the 24th.Finally obtain two Chinese characters " high " and " osmium ".
For the situation described by 301, as above process is done to all coding input unit of binary data section and can complete conversion.
For the situation described by 302, same treatment complete coding input unit N and all input blocks before, then using byte n-2 in 302 and byte n-1 as a coding input unit, using the most significant digit of byte n-2 as the 1st, the lowest order of byte n-1 is as the 16th.1st to the 6th as the 1st subsegment, method is as Fig. 4 and above description, and the map unit obtained is stored in the byte 0 of encoding output unit; 7th to the 12nd as the 2nd subsegment, method is as Fig. 4 and above description, and the map unit obtained is stored in the byte 1 of encoding output unit; 13rd to the 16th high 4 as the 3rd field, mend 0 for low 2, the map unit obtained thus is stored in the byte 2 of encoding output unit; The byte 3 of encoding output unit uses last unit of 401 coding lookup tables and 0xF0 to fill.
For the situation described by 303, same treatment complete coding input unit N and all input blocks before, then using byte n-1 in 303 as a coding input unit, using the most significant digit of byte n-1 as the 1st, the lowest order of byte n-1 is as the 8th.1st to the 6th as the 1st subsegment, method is as Fig. 4 and above description, and the map unit obtained is stored in the byte 0 of encoding output unit; 7th to the 8th high 2 as the 2nd subsegment, mends 0 for low 4, by the byte 1 of map unit corresponding to its value stored in encoding output unit; Byte 2 and the byte 3 of encoding output unit use last unit of 401 coding lookup tables and 0xF0 to fill.
By the binary data section in data link table with reference to the respective handling method of above 301,302,303, complete conversion, obtain Chinese character string.Use the binary data section of relevant position in the Chinese character string replacement data chained list obtained, this Chinese character string is called Chinese data section.
104, the ASCII character instruction segment in data link table and the Chinese data Duan Youqian that is converted to then are formed coded data;
Data link table after conversion process only comprises ASCII character instruction segment and Chinese data section, has now satisfied the requirements all nodes in data link table to be spliced into a character string, and the principle of splicing is from front to back, and the character string obtained is coded data.
105, coded data is divided into some Beidou communication texts, the principle of decomposition is that the restriction of Big Dipper short message civilian agreement text length and Chinese character are complete;
Through 104 coded datas obtained likely in length beyond the restriction of current Big Dipper short message civilian agreement 120 byte, therefore to be decomposed into many communication texts.When decomposing, the integrality of separation place Chinese character first to be ensured.In addition, need to ensure that the communication text length after decomposing is as far as possible close.Idiographic flow is as follows:
The first step: the length L of calculation code data, rule is each Chinese character is two bytes, and each ASCII character is a byte;
Second step: by coded data by being divided into N section initial communication text after forward direction, N equals coded data byte number and adds after 119 and the business of 120; The primary data byte number l of 1 to N-1 section (1N-1)equal the business of L and N; The initial byte number l of N section nfor the byte number of remaining data;
3rd step: check the 1st section of unsigned value representated by last byte: if this value is for being greater than 0 and being less than 127, then this section processedly completes; If this value is V, and have V to be more than or equal to 176 and be less than or equal to 240 (i.e. 240>=V>=176), then calculate byte value from back to front by this byte address be more than or equal to 176 and be less than or equal to the quantity C of 240, until run into first ineligible byte or arrive the top of this section; If quantity C is even number, then this section processedly completes; If quantity C is odd number, then last byte of first paragraph removed, the section being inserted into second segment is first, and become the first byte of second segment, the first paragraph byte number after process becomes l (1N-1)-1, this section processed completes;
4th step: after processing first paragraph, if second segment byte number is greater than initial byte number and equals 121, then needs the 121st byte to remove, and the section being inserted into the 3rd section is first; The byte number of the 3rd section is made a decision, and does the same treatment with second segment; Process successively, until final stage, if the byte number handling final stage well equals 121, then need increase segmentation, the quantity of final communication text is N+1;
5th step: after completing the 4th step, if communication text quantity is constant, then do the same iterative processing of the 3rd step to 2 to N-1 section, finally complete segmentation, each section sends successively as independent Beidou communication text; If communication text quantity adds 1, then need to carry out segmentation again to coded data, by being divided into N+1 section after forward direction, the primary data byte number of 1 to N section equal the business of L and N+1, the initial byte number of N+1 section for the byte number of remaining data;
6th step: to each data segment after segmentation again by doing iterative processing same in the 3rd step after forward direction, and finally complete segmentation, each section sends successively as independent Beidou communication text.
Thus, the complete coding method illustrating the embodiment of the present invention.
Embodiments provide the data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message.Fig. 5 describes embodiment and receives the decoding process after code communication text about receiving end, specifically comprises:
501, receive Big Dipper short message, and splice the communication text of not decoding according to the sequencing received;
Know by 105, a complete communication data inclusion is likely divided into many Beidou communication texts to be transmitted.Therefore, the embodiment of the present invention stores setting up communication text pond the communication text not reaching decode condition, and by communication text to be decoded according to the sequencing splicing received.
502, be some ASCII character character strings and Chinese character string by spliced communication squitter, and stored in decoded data chained list;
Known by Fig. 1, the embodiment of the present invention remains ASCII character instruction segment in coding stage, comprises ASCII character character string and Chinese character string in coded data, and decode procedure has been the conversion to Chinese character string.According to by decomposing spliced communication text after forward direction, and by the ASCII character character string that obtains and Chinese character string, stored in decoded data chained list.
ASCII character character byte numerical characteristics is its unsigned character type numerical intervals is 0 to 127; The composition byte value feature of Chinese character is its unsigned character type numerical intervals is 176 to 240.The principle of decomposing is byte value feature mutation, as current be ASCII character character, judge downwards, when running into first character joint number value not in 0 to 127 is interval or when arriving the ending of communication text, then current string decomposition termination.
Structure in embodiment selected by the present invention in decoded data chained list forms as shown in Figure 6, ASCII character character string and Chinese character string stored interleaved, and quantity is consistent.
Whether the Chinese character quantity of last the character string 503, detected in decoded data chained list is even number;
Known by Fig. 4, after in the embodiment of the present invention, single binary data section is converted to Chinese data section, the Chinese character quantity in Chinese data section is even number.But because of the process of 105, in coded data, continuous print Chinese data section may be in two continuous print Beidou communication texts and transmit, at this moment the coding text the last item Chinese character string received may comprise odd number Chinese character, now then do not meet decode condition, need to receive next Big Dipper short message and do iterative processing again.
Therefore, whether the Chinese character quantity of last the character string detected in data link table is even number: be perform 504 downwards; Otherwise empty decoded data chained list and repeat 501 and 502.
504, the Chinese character string decoding in decoded data chained list is converted to binary data section, and uses this binary data section to replace its position in chained list;
When decoding, first calculate the Chinese character quantity N in Chinese character string cn, it is N that decoding exports a corresponding byte number binbinary data space.Then, calculating unsigned character type data value in Chinese character string storage space is the byte quantity N of 240 b0, then N binequal N cnbe multiplied by the business with 2 after 3.Each Chinese character string is then divided into several decoding input blocks by front, then processes one by one.The quantity of decoding input block is N cnhalf, the corresponding decoding output unit of each decoding input block.
In the embodiment of the present invention, process the process of single decoding input block as shown in Figure 7, decoding input block 701 comprises two Chinese characters, totally four bytes.Decoding output unit 702 comprises 3 bytes, totally 24 bit data.The most significant digit of decoding output unit 702 byte 0 is the 1st, and the lowest order of decoding output unit 702 byte 2 is the 24th.
Judge the unsigned character type data value V of decoding input block 701 byte 0 eif, 240>V e>=176, then this value is deducted 176 and obtain the output valve that is less than 64.Convert this output valve to six bits, be filled into the 1 to the 6 of decoding output unit 702.Six bits exported are filled into the 7 to the 12 of decoding output unit 702 by the byte 1 of same operation decodes input block 701.Six bits exported are filled into the 13 to the 18 of decoding output unit by operation decodes input block byte 2.Six bits exported are filled into the 19 to the 24 of decoding output unit 702 by operation decodes input block 701 byte 3.If the unsigned character type data value of certain byte of decoding input block 701 is 240, then decoding ceases, it is invalid that the decoding output unit position that this byte is corresponding and subsequent data bit are.
By the effective byte in decoding output unit corresponding for character string according to being N by front order byte of padding number then binbinary data decoding output region in, thus complete the decoding of this Chinese character string.Process each Chinese character string in decoded data chained list successively, use the binary data section obtained of decoding to substitute former Chinese character string.
505, the ASCII character instruction segment in decoded data chained list and the binary data Duan Youqian that is converted to then are formed decoded data;
506, judge whether decoded data is complete communication protocol inclusion;
In the embodiment of the present invention, Fig. 1 show original communication data encoded after will likely be divided into several Beidou communication texts transmission.Therefore must judge whether the decoded data obtained under above-mentioned steps is complete communication protocol inclusion.If the decoded data having last circulation to obtain inside ephemeral data space, then need the data in ephemeral data space to take out, and splice according to sequencing with the decoded data newly obtained.The principle judged is determined in the communication protocol design stage for embody rule, is therefore transparent and unambiguous.If complete communication protocol inclusion, then perform 507; Then then iteration performs 501 if not complete communication protocol inclusion, then need decoded data to keep in ephemeral data space.
507, decoded data is processed;
Here decoded data is through the complete communication protocol inclusion that above-mentioned iterative processing obtains, and concrete processing procedure is also determined by embody rule.
Thus, complete whole decode procedure of having set forth the embodiment of the present invention.
Be described in detail the binary data hybrid coding/coding/decoding method being applicable to the civilian agreement of Big Dipper short message that the embodiment of the present invention provides above, the explanation of above embodiment just understands method of the present invention and thought thereof for helping.Meanwhile, for those skilled in the art, according to thought of the present invention, all can change to some extent in specific embodiments and applications.Therefore, the embodiment of the present invention should not be construed as the restriction to content of the present invention.

Claims (2)

1. be applicable to a data-encoding scheme for the civilian agreement of Big Dipper short message, it is characterized in that the method comprises the steps:
Step 1: original communication data are divided into multiple ASCII character instruction segment and binary data section, using each paragraph as a node, stores according to sequencing data inserting chained list;
Step 2: by each binary data section node in data link table with three bytes for benchmark is divided into multiple subsegment according to the sequencing that data store, each subsegment is converted into two Chinese characters meeting " Chinese Character Set Code for Informati baseset " standard according to mapping algorithm; Complete and be converted to a Chinese character string, be referred to as Chinese data section; Use binary data section node corresponding in Chinese data section replacement data chained list;
Step 3: by the ASCII character instruction segment node in data link table and Chinese data section node according to the tandem in this data link table, be combined into coded data from front to back, and the byte number of calculation code data;
Step 4: coded data be divided into one or more to be no more than the restriction of Big Dipper short message civilian protocol length, is namely less than the communication text that 120 bytes, Chinese character are complete, meet the requirement of Big Dipper short message;
Wherein to be converted to the mapping algorithm idiographic flow of Chinese character as follows for binary data:
The first step: the unsigned character type coding lookup table generating 65 byte-sized, its numerical value Hexadecimal form is from front to back: 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0,
Second step: be a coding input unit by every for binary data three bytes, each coding input unit has binary mode 24 bit data; Every four bytes are as an encoding output unit, and each encoding output unit has binary mode 32 bit data; Encoding output unit number equals binary data byte number and adds after 2 and the business of 3;
3rd step: coding input unit 24 bit data is then equally divided into 4 parts by front, is numbered 0 to 3; Every part has binary mode 6 bit data, and the numerical values recited of every part is 0 to 63, searches the coding lookup table generated in the first step, the value of correspondence be stored in byte corresponding to encoding output unit according to the numerical values recited of every part as address offset amount;
4th step: if when binary data byte number can not be divided exactly by 3: when remainder is 1, last two representative numerical value of last byte are multiplied by the numerical value obtained after 16 searches the coding lookup table generated in the first step as address offset amount, the value of correspondence be stored in the 1st byte of corresponding encoding output unit, latter two byte of encoding output unit uses 0xF0 to fill; When remainder is 2, last 4 representative numerical value of last byte are multiplied by the numerical value obtained after 4 searches the coding lookup table generated in the first step as address offset amount, the value of correspondence be stored in the 2nd byte of corresponding encoding output unit, last byte of corresponding output unit uses 0xF0 to fill;
Coded data is divided into one or more as follows no longer than 120 bytes, Chinese character communication text idiographic flow that is complete, that meet the requirement of Big Dipper short message:
The first step: the byte number L of calculation code data, rule is each Chinese character is two bytes, and each ASCII character is a byte;
Second step: by coded data by being divided into N section initial communication text after forward direction, N equals coded data byte number and adds after 119 and the business of 120; The primary data byte number l of 1 to N-1 section (1N-1)equal the business of L and N; The initial byte number l of N section nfor the byte number of remaining data;
3rd step: check the 1st section of unsigned value representated by last byte: if this value is for being greater than 0 and being less than 127, then this section processedly completes; If this value is V, and there is V to be more than or equal to 176 and be less than or equal to 240, then calculating byte value from back to front by this byte address and be more than or equal to 176 and be less than or equal to the quantity C of 240, until run into first ineligible byte or arrive the top of this section; If quantity C is even number, then this section processedly completes; If quantity C is odd number, then last byte of first paragraph removed, the section being inserted into second segment is first, and become the first byte of second segment, the first paragraph byte number after process becomes l (1N-1)-1, this section processed completes;
4th step: after processing first paragraph, if second segment byte number is greater than initial byte number and equals 121, then needs the 121st byte to remove, and the section being inserted into the 3rd section is first; The byte number of the 3rd section is made a decision, and does the same treatment with second segment; Process successively, until final stage, if the byte number handling final stage well equals 121, then need increase segmentation, the quantity of final communication text is N+1;
5th step: after completing the 4th step, if communication text quantity is constant, then do the same iterative processing of the 3rd step to 2 to N-1 section, finally complete segmentation, each section sends successively as independent Beidou communication text; If communication text quantity adds 1, then need to carry out segmentation again to coded data, by being divided into N+1 section after forward direction, the primary data byte number t of 1 to N section (1N)equal the business of L and N+1, the initial byte number t of N+1 section n+1for the byte number of remaining data;
6th step: to each data segment after segmentation again by doing iterative processing same in the 3rd step after forward direction, and finally complete segmentation, each section sends successively as independent Beidou communication text.
2. be applicable to a data decoding method for the civilian agreement of Big Dipper short message, it is characterized in that the method comprises the steps:
Step 1: by the Big Dipper short message that receives according to sequencing, be then divided into several ASCII character character strings and Chinese character string by front, and store according to sequencing data inserting chained list; Unsigned character type data value corresponding to Big Dipper short message data respective byte is 0 to 127 is ASCII character number of characters value tag, and 176 to 240 is the Chinese character numerical characteristics needing decoding;
Step 2: the number N detecting each Chinese character string Chinese character in data link table cn, Chinese character number must be even number; If not being even number, needing to wait for next Big Dipper short message, decoding again after sequential concatenation;
Step 3: the byte quantity that each Chinese character string occupies is N cntwice, it is N that its decoding exports corresponding byte number binbinary data; Calculating unsigned character type data value in Chinese character string is the byte quantity N of 240 b0, then N binequal N cnbe multiplied by the business with 2 after 3;
Step 4: each Chinese character string is then divided into several decoding input blocks by front; Each decoding input block comprises two Chinese characters, totally four bytes; The quantity of decoding input block is N cnhalf; The corresponding decoding output unit of each decoding input block, each decoding output unit comprises 3 bytes, totally 24 bit data;
Step 5: judge the unsigned character type data value V that each decoding input block first character saves eif, 240>V e>=176, then this value is deducted 176 and obtain the output valve that is less than 64; Convert this output valve to six bits, be filled into the 1 to the 6 of decoding output unit; Six bits exported are filled into the 7 to the 12 of decoding output unit by same operation decodes input block second byte; Six bits exported are filled into the 13 to the 18 of decoding output unit by operation decodes input block the 3rd byte; Six bits exported are filled into the 19 to the 24 of decoding output unit by operation decodes input block the 4th byte; If the unsigned character type data value of certain byte of decoding input block is 240, then decoding ceases, it is invalid that the decoding output unit position that this byte is corresponding and subsequent data bit are;
Step 6: by the effective byte in decoding output unit corresponding for character string according to being N by the front order then byte number be filled into described in step 3 binbinary data in, thus complete the decoding of this Chinese character string;
Step 7: process each Chinese character string in data link table successively, uses the binary data obtained of decoding to substitute former Chinese character string;
Step 8: the ASCII character character string in data link table and decoding are obtained binary data and is filled into final data space according to by front order then, complete decoding.
CN201310203775.4A 2013-05-28 2013-05-28 A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message Expired - Fee Related CN103279462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310203775.4A CN103279462B (en) 2013-05-28 2013-05-28 A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310203775.4A CN103279462B (en) 2013-05-28 2013-05-28 A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message

Publications (2)

Publication Number Publication Date
CN103279462A CN103279462A (en) 2013-09-04
CN103279462B true CN103279462B (en) 2016-02-17

Family

ID=49061987

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310203775.4A Expired - Fee Related CN103279462B (en) 2013-05-28 2013-05-28 A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message

Country Status (1)

Country Link
CN (1) CN103279462B (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104007841A (en) * 2014-06-12 2014-08-27 瞿照洋 Chinese character coding and decoding method based on transmission of keyboard input interface
CN104066117A (en) * 2014-07-02 2014-09-24 中国人民解放军电子工程学院 Civil air defense emergency alert information message compression encoding method based on Beidou communication functions
CN104202324A (en) * 2014-09-10 2014-12-10 四川九洲电器集团有限责任公司 Method and device for transmitting data codes in messages
CN104333850B (en) * 2014-09-25 2018-02-16 北京华力创通科技股份有限公司 Short message read method based on Big Dipper communication
CN105868194A (en) * 2015-01-19 2016-08-17 阿里巴巴集团控股有限公司 Methods and devices for text data compression and decompression
CN104883670A (en) * 2015-04-23 2015-09-02 叶宁 Internet system and data transmission method
CN105049094B (en) * 2015-07-16 2018-09-28 陈飞 A kind of method and system of the multigroup parameter transcoding transmission of complexity
CN106953717B (en) * 2017-04-27 2020-01-07 上海海事大学 Method and system for efficiently decoding AIS (automatic identification System) data of ships in large batch
CN109274720B (en) * 2018-08-24 2022-04-22 网宿科技股份有限公司 Method and system for transmitting data
US10645561B1 (en) 2019-01-29 2020-05-05 Honeywell International Inc. Methods and systems for vehicle position reporting and emergency messaging
CN110289934A (en) * 2019-05-13 2019-09-27 湖北智途北斗空间信息技术有限公司 A kind of data transmission coding coding/decoding method and system based on Big Dipper short message
CN110266436B (en) * 2019-06-26 2021-11-23 重庆金美通信有限责任公司 Binary data stream transmission method based on Beidou
CN110740427B (en) * 2019-10-24 2022-02-11 中国林业科学研究院资源信息研究所 Method and device for generating short message information and electronic equipment
CN111600610B (en) * 2020-05-26 2023-04-28 北京思特奇信息技术股份有限公司 Universal coding method, system and electronic equipment for variable-length integers
CN112019518A (en) * 2020-08-05 2020-12-01 杭州木链物联网科技有限公司 Industrial control protocol data compression method and device
CN112165354A (en) * 2020-09-29 2021-01-01 青岛网信信息科技有限公司 Method for simplifying Beidou positioning satellite short message communication by utilizing big data
CN112650448B (en) * 2020-12-21 2024-04-05 中国航天科工集团八五一一研究所 FPGA-based large-data-volume storage file management method
CN113438226B (en) * 2021-06-23 2022-08-12 上海星融汽车科技有限公司 Message generating and analyzing method, device and system based on hybrid transmission protocol
CN116456290B (en) * 2023-06-14 2023-09-12 南京北斗创新应用科技研究院有限公司 Beidou position information message compression coding method and system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253395A (en) * 2011-04-12 2011-11-23 广州广嘉北斗电子科技有限公司佛山市南海分公司 Communicator applied to Beidou satellites and method thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8780788B2 (en) * 2009-09-25 2014-07-15 Com Dev International Ltd. Systems and methods for decoding automatic identification system signals

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253395A (en) * 2011-04-12 2011-11-23 广州广嘉北斗电子科技有限公司佛山市南海分公司 Communicator applied to Beidou satellites and method thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于北斗二代的车辆监控系统研究与应用;孙超奇 等;《科协论坛(下半月)》;20121031(第10期);第77-78页 *

Also Published As

Publication number Publication date
CN103279462A (en) 2013-09-04

Similar Documents

Publication Publication Date Title
CN103279462B (en) A kind of data encoding/decoding method being applicable to the civilian agreement of Big Dipper short message
WO2021103928A1 (en) Data transmission method and apparatus, terminal device and storage medium
CN102592160B (en) Character two-dimension code encoding and decoding method for short message
CN104737142A (en) Multislot link layer flit
CN105450232A (en) Encoding method, decoding method, encoding device and decoding device
CN101986584A (en) Rate de-matching device and method in 3GPP LTE
CN102780628B (en) On-chip interconnection network routing method oriented to multi-core microprocessor
CN101610089B (en) Methods and devices for secondly interlacing and deinterlacing
CN103875206A (en) Data transmission method, and data forwarding equipment and system
CN107919943A (en) Coding, coding/decoding method and the device of binary data
CN105740215A (en) Data communication coding and decoding method
WO2021103640A1 (en) Data transmission method and apparatus, terminal device, and storage medium
CN101848239B (en) High-timeliness distributed service integration calling system
CN100555879C (en) A kind of encoder apparatus of LDPC sign indicating number and coding method
CN101310447B (en) Memory efficient erasure information table for decoding of mpe-fec frames
CN104240747B (en) The method and device that a kind of multi-medium data is obtained
CN105450359A (en) Methods for sending and receiving user-defined binary structured protocol data
CN108876628A (en) Financial quantitative analysis data transmission method
CN105793842B (en) Conversion method and device between serialized message
CN110519004A (en) A kind of coding method and relevant device
CN105446666A (en) Full digital sequence storage method and system based on mobile terminal
JP5384210B2 (en) Data transmission device, data reception device, and data transmission system
CN101834614A (en) Multielement LDPC code coding method and device capable of saving storage resource
CN103279442A (en) Message filtering system and message filtering method of high-speed interconnection bus
JP2011164834A (en) Data transfer apparatus, data transmitting/receiving apparatus and image forming apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160217

Termination date: 20160528