CN102929608A - Interface encoding/decoding method and system - Google Patents

Interface encoding/decoding method and system Download PDF

Info

Publication number
CN102929608A
CN102929608A CN2012103807780A CN201210380778A CN102929608A CN 102929608 A CN102929608 A CN 102929608A CN 2012103807780 A CN2012103807780 A CN 2012103807780A CN 201210380778 A CN201210380778 A CN 201210380778A CN 102929608 A CN102929608 A CN 102929608A
Authority
CN
China
Prior art keywords
interface
code file
message
document
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012103807780A
Other languages
Chinese (zh)
Inventor
武兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Datang Mobile Communications Equipment Co Ltd
Original Assignee
Datang Mobile Communications Equipment 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 Datang Mobile Communications Equipment Co Ltd filed Critical Datang Mobile Communications Equipment Co Ltd
Priority to CN2012103807780A priority Critical patent/CN102929608A/en
Publication of CN102929608A publication Critical patent/CN102929608A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)

Abstract

The invention provides an interface encoding/decoding method and system, which is used for improving the encoding/decoding quality of an interface. The interface encoding/decoding method comprises the following steps of: determining interface content according to an interface requirement; compiling an interface file according to the interface content and a preset unified regulation; automatically generating an interface code file by executing an automatic code generating tool to analyze the interface file; carrying out decoding by invoking the interface code file, and generating an interface message and sending the interface message; and/or, decoding the interface message by invoking the interface code file, thus obtaining a decoded message. According to the interface encoding/decoding method and system, the interface file is compiled by adopting the unified regulation, the definitions of the interface messages are unified, the coupling among the systems are reduced, and the interface is easily extended.

Description

A kind of method and system of interface coding/decoding
Technical field
The present invention relates to the communications field, particularly relate to a kind of method and system of interface coding/decoding.
Background technology
When encoding and decoding, need to consider between two related subsystems or intermodule, even down to aspects such as the Interface design between two functions, encoding and decoding, when the design of interface and subsequent modification, the quality of interface coding can cause whole system and seriously influence.
Existing interface code is defining and is realizing in the subsystem separately, having following problem:
The first because coding person's level is different with ability, can directly cause the difference in quality in Interface design and encoding-decoding process, interface code of low quality, have in addition can cause potential potential problem, whole system is buried fatal defective.
The second, can there be interface message skimble-scamble problem of the definition of byte stream in transmission course, and then causes the problem such as interface docking.
The 3rd, adopt existing interface encoded mode, coupling between system is large, when after coding is finished, needing to expand, subsystems not only needs the docking port file again to write, and interface code also will re-start definition and revise, and the change meeting of this interface directly impacts business, may cause large-area code revision, even may cause interface to expand.
Summary of the invention
The invention provides a kind of method and system of interface coding/decoding, to improve the quality of interface coding/decoding.
In order to address the above problem, the invention discloses a kind of method of interface coding/decoding, comprising:
Determine the interface content according to interface requirements;
Write interface document according to described interface content according to default unified standard;
Carry out automatic Code Generation, resolve described interface document and automatically generate the interface code file;
Call described interface code file and encode, generate interface message and transmission;
And/or, call described interface code file the interface message that receives is decoded, obtain decode messages.
Preferably, described interface document is stored in the Excel file;
Wherein, the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
Preferably, the signed integer in the described interface message is converted to isometric signless integer according to scope and sends;
Wherein, change according to following formula:
x=value-lb;
In the described formula, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
Preferably, before the described automatic generation interface code file, also comprise:
Automatic Code Generation carries out validity checking to described interface document.
Preferably, the calling interface code file is encoded or is decoded and comprises:
Calling interface;
Calling the interface code file of corresponding described interface encodes or decodes.
Preferably, said method also comprises:
When described interface requirements changes, determine new interface content according to the interface requirements after changing;
According to described new interface document corresponding to interface content modification;
Carry out automatic Code Generation, automatically generate new interface code file according to amended interface document;
Call described new interface code file and encode, generate interface message;
And/or, call described new interface code file docking port message and decode, obtain decode messages.
Preferably, described interface content comprises:
The message content of interface and structure, described message structure comprises structure title, member Name and member type.
Preferably, described default unified standard comprises the interface message stream definition standard in interface message definition standard and the transmission course.
Preferably, resolve described interface document and automatically generate after the interface code file, also comprise:
Described interface code file is integrated into engineering.
The invention also discloses a kind of system of interface coding/decoding, comprising:
Interface content determination module is used for determining the interface content according to interface requirements;
Interface document is write module, is used for writing interface document according to described interface content according to default unified standard;
The interface code file generating module be used for to be carried out automatic Code Generation, and resolves described interface document and automatically generate the interface code file;
Coding module and/or decoder module, wherein,
Coding module is used for calling described interface code file and encodes, and generates interface message and transmission;
Decoder module is used for calling described interface code file the interface message that receives is decoded, and obtains decode messages.
Preferably, said system also comprises:
Memory module is write module for interface document and has been write after the interface document, and described interface document is stored in the Excel file;
Wherein, the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
Preferably, said system also comprises:
Modular converter after coding module generation interface message, is converted to isometric signless integer with the signed integer in the described interface message according to scope;
Described modular converter is changed according to following formula:
x=value-lb;
Wherein, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
Preferably, said system also comprises:
Checking module is used for the interface code file generating module and generates before the interface code file, and described interface document is carried out validity checking.
Preferably, said system also comprises:
Interface content modification module is used for when described interface requirements changes, and determines new interface content according to the interface requirements after changing;
The interface document modified module is used for according to described new interface document corresponding to interface content modification;
Described interface code file generating module is carried out automatic Code Generation, automatically generates new interface code file according to amended interface document;
Described coding module calls described new interface code file and encodes, and generates new interface message; And/or described decoder module calls described new interface code file docking port message and decodes, and obtains new decode messages.
Compared with prior art, the present invention includes following advantage:
The first, the present invention adopts unified standard to write interface document, has unified the interface message definition, has reduced the coupling between system, and interface is easy to expansion.And the present invention carries out the automatic Code Generation automatic code generating, when reducing artificial workload, has improved the quality of coding, has avoided causing because the ability of programmer is different difference in quality in Interface design and the cataloged procedure.
The second, the present invention will be stored in according to the interface document that the interface content is write in the Excel file, carry out successfully automatic code generating of automatic Code Generation after having guaranteed.
The 3rd, the present invention is converted to isometric signless integer with the signed integer in the interface message according to scope and sends, and has guaranteed that smooth docking port message decodes.
The 4th, when needing to expand after the present invention's coding is finished, only need to revise interface document, then can automatically generate interface code according to interface document, do not need to write again interface code, reduced artificial workload, improved the efficient of system extension.
The 5th, the present invention has also defined unified interface message stream, and the message flow transformat is unified, and the interface between subsystem uses simple.
Description of drawings
Fig. 1 is the method flow diagram of a kind of interface coding/decoding of the embodiment of the invention;
Fig. 2 is the Interface design process flow diagram of the embodiment of the invention;
Fig. 3 is the process flow diagram of embodiment of the invention A subsystem interface message transmission processing;
Fig. 4 is the process flow diagram that embodiment of the invention B subsystem interface message sink is processed;
Fig. 5 is the schematic flow sheet of embodiment of the invention interface message when making amendment;
Fig. 6 is the structured flowchart of the system of a kind of interface coding/decoding of the embodiment of the invention;
Fig. 7 is the structured flowchart of the system of the another kind of interface coding/decoding of the embodiment of the invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Embodiment one:
With reference to Fig. 1, show the method flow diagram of a kind of interface coding/decoding of present embodiment, present embodiment specifically can may further comprise the steps:
S101 determines the interface content according to interface requirements;
Interface requirements is different, and the interface content is different.For example, interface requirements is to allow the client to pay an order, and then the interface content is for setting up the interface of a clear definition between system and payment liquidation center, and purpose is to allow the client to pay an order.And for example, interface requirements is Certificate Authority, and then the interface content is for setting up the interface of a clear definition between system and authentication and authorization system, and purpose is the digital certificate that the checking client submits to, can support a plurality of authentication and authorization systems, and each authentication and authorization system is stipulated its interface.
The interface content comprises: the message content of interface and structure, and described message structure comprises structure title, member Name and member type, for example:
Wherein, SOCKET_INFO_STRUCT is the structure title, and ucSrcIpAddrTag is the member Name, and UINT8 is member type.
S102 writes interface document according to described interface content according to default unified standard;
Above-mentioned interface document can be stored in the Excel file in the present embodiment, and the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
As required, interface document also can be stored in the Word file.
Default unified standard comprises the interface message stream definition standard in interface message definition standard and the transmission course in the present embodiment.
Wherein, the definition standard of interface message is as follows:
1. the message for an interface all is defined in the Excel file, and filename is the title of this interface.For example the defined file of interface SGPS_SIP is SGPS_SIP.xls.
2. only allowed a worksheet in the above-mentioned Excel file, its title is necessary for: " Sheet1 ".
In the form of above-mentioned Excel file, each Column Properties referring to table 1 is:
A B C D E F
Parameter?name Presence Range Size Data?Type Description
Each Column Properties of table 1Excel file
3. case sensitive in the above-mentioned Excel file.
4. do not allow to occur special symbol in all fields in the above-mentioned Excel file, such as "/* " " */" " // " etc.
5. can not there be the newline sign in the character string of any unit of above-mentioned Excel file, and each parameter accounts for and only account for delegation.
6. above-mentioned Excel file is except Description row and note, and can not there be the space any other position.
7. above-mentioned Excel file is except Range row and Size row partly can skies, and other any row can not be sky.
8. above-mentioned all marker characters of Excel file are capitalization.(marker character only comprises Presence and DataType row).
9. above-mentioned Excel file structure form is:
Message name 1
Structural table 1
$
&XX
Message name 2 (or structural parameters)
Structural table 2
$
...
$
#
Each unit accounts for full line in the said structure form, from first row; After each structural table finishes, with each message of " $ " symbol segmentation; Symbol “ ﹠amp; " the expression comment line, being positioned at first row, annotation information is positioned at secondary series; Symbol " # " logo file finishes.Be positioned at first row.
The below describes the standard of each Column Properties in the table 1 in detail:
IE/GroupName row standard:
A) the license character set of this row interior element is: (0~9; A~z; A~Z; _).Except comment line, message are cut apart row and end of file row.
B) underscore in these row _ do not allow to appear at first place and tail position.
C) do not allow to occur continuous underscore in these row, as _.
D) not allowing in these row to exist all is the item of numeral.
Presence row standard
A) only to allow be " M " or " O " or " C " in the first place, and the first place does not allow to occur other character.
B) if the first place is " O ", determines then whether this parameter exists or determine that the parameter of its continuous number must be same parameter.
C) if the first place is " O ", and being to represent that this did not exist at 0 o'clock with the conditional parameter of this parameter correlation, is to represent to exist in 1 o'clock, then will add end in the Presence item of this row to the IE/GroupName title of the conditional parameter of this parameter correlation, with " _ " symbol separately, correlated condition
The Range of parameter is since 0.Example is as shown in table 2:
Figure BDA00002232328800081
Table 2Presence row standard c example
D) if the first place is " O ", judge this Range that whether has parameter more than " 0 " and " 1 ", then the IE/GroupName title of this parameter is added to end in the Presence item of this row, with " _ " symbol separately, the scope that this parameter exists is added at the end.For example: O YYY (XX, XX ..), wherein YYY is parameter name, the condition of XX for existing.
Table 3Presence row standard d example
E) if the first place is " C ", will add end in the Presence item of this row to the title of the IE/GroupName item of the conditional parameter of this parameter correlation, with " _ " symbol separately, the scope that this parameter exists is added at the end.For example: O YYY (X), wherein YYY is parameter name, the condition of X for existing.And for example, shown in the table 4:
Figure BDA00002232328800091
Table 4Presence standard e example
F) if the first place is C or O, and whether this existence depends on whether a certain position of condition entry is 1, then is expressed as: C_BitFlag (﹠amp; 0x0020).
G) if the first place is " M ", DataType is " STRUCTARRAY ", " UINT8ARRAY ", " UINT16ARRAY ", " EnumARRAY ", to add end in the present item of this row to the title of the IE/GroupName item of the conditional parameter of this parameter correlation, with " _ " symbol separately, the Range of correlated condition parameter is since 1.If without the correlated condition parameter, only write Range exactly, as shown in table 5.
Figure BDA00002232328800092
Table 5Presence standard g example
H) if the first place is " M ", Data Type is " STRUCTARRAY ", " UINT8ARRAY ", " UINT16ARRAY ", " EnumARRAY ", and this item is the array of fixed length, and then the length of this array is listed in end in the present item of this row, with " _ " symbol separately.Example is as shown in table 6:
Figure BDA00002232328800101
Table 6Presence standard h example
The TYPE row of the conditional parameter of i) closelying follow behind C, O, M are necessary for following basic data type:
j)UINT8、UINT16、UINT32、ENUMERATED、BOOLEAN。Do not allow to occur other type.
Range row standard
A) DataType is UINT8, UINT16, and UINT32 type Range form is: (x..xxx).If Range is discontinuous, then standard is: (x, x, x, x ...), as shown in table 7:
Figure BDA00002232328800102
Table 7Range row standard a example
B) DataType is that the Range form of " INT8 ", " INT16 " type is: (x..xxx), as shown in table 8:
Figure BDA00002232328800111
Table 8Range row standard b example
C) DataType is that the difference of the maximal value of scope of its Range of row row of " INT8 " " INT16 " " INT32 " and minimum value must not be greater than 0xFF, 0xFFFF, 0xFFFFFFFF.
D) DataType is that the form of the Range of ENUMERATED is: and name1 (position1), name2 (position2) ..., can not there be " ... " symbol, as shown in table 9:
Figure BDA00002232328800112
Table 9Range row standard d example
Size row standard:
A) be that the Size item of the parameter line of STRUCT, STRUCTARRAY or reference type allows for sky except DataType, the Size row of all the other parameter lines can not be null term.
B) scope license character set is (1~4), does not allow to occur other character.
DataType row standard:
A) can have reference type, this reference type title must have definition in the IE/GroupNam row.And the type that is cited must appear in the message definition or the message definition with layer of root layer, and is as shown in table 10:
Parameter?name Presence Range Size Data?Type Description
UE_id M (1..8000) 2 UINT16 Indicates?a?given?UE
A_struct M STRUCT Indicates?the?CN?domain.Cs-0Ps-1
>RAB_num M (1..255) 1 UINT8 Number?of?RABs
>RABToBeModified M_RAB_num UINT32 RAB?Information
A_2 M 1 A_struct Representative is another A_struct.
Table 10 DataType row standard a example
B) except reference type, only UINT8, UINT16, UINT32, ENUMERATED, STRUCT, STRUCTARRAY, UINT8ARRAY can appear, UINT16ARRAY, ENUMARRAY, BOOLEAN, INT8, INT16, INT32.Do not allow other type to occur, and type all represents with capitalization.
Table 11 is interface documents of writing according to above-mentioned unified standard:
Figure BDA00002232328800121
Figure BDA00002232328800131
Figure BDA00002232328800141
Table 11 interface document SGPS_SIP.xls example
Interface message stream definition standard in the transmission course is as follows:
A) byte stream of each message when transmission all is as the criterion with the order in the above-mentioned Excel file.
B) mode with low address high byte order that surpasses the signless integer of 1 byte is transmitted, and the mode of above-mentioned low address high byte order refers to that highest byte is passed at first.
C) signed integer in the interface message is converted to isometric signless integer according to scope and sends; Wherein, change according to following formula: x=value-lb; In the described formula, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
Above-mentionedly signed integer in the interface message is converted to isometric signless integer according to scope sends, guaranteed that smooth docking port message decodes.
S103 carries out automatic Code Generation, resolves described interface document and automatically generates the interface code file;
Above-mentioned execution automatic Code Generation, before automatically generating the interface code file, automatic Code Generation can carry out validity checking to the interface document SGPS_SIP.xls in the above-mentioned table 11.
Validity checking generally for concrete practical problems, also can be correlated with and so on for the internal memory operational boundaries, and for example, in the time of array or pointer operation, whether value crosses the border; And for example, being used for representing weight if defined a variable, in the time of so to its relevant input, arithmetic operation, if there is negative value, is exactly illegal; For another example, whether the data type of input is consistent with the data type of regulation.Further, for example when a variable of statement, automatic Code Generation can be done an affirmation to this variable, comprise it take great memory headroom, according to the language that uses it should have which mode of operation (+,-, * ,/, remainder), these have all provided when statement.Then when in use, may just violate for various reasons top regulation.Automatic Code Generation out can report an error after these problems one by one in inspection, and this inspection is exactly the validity checking of data.In fact be not only data (variable), in the entity that occurs, a regulation arranged in using all these language such as function, structure, automatic Code Generation can carry out validity checking to any violation operation, then reports an error.After validity checking is passed through, under destination path, can automatically generate following several interface code files:
Sgps_sip_dec.c (defined file of decoding functions)
Sgps_sip_dec.h (the statement file of decoding functions) (decoding refers to generate from byte stream the process of C-structure)
Sgps_sip_def.h (defined file of interface message C data structure)
Sgps_sip_del.c (defined file of releasing memory function) (because the definition of C-structure is the pointer way of reference, it discharges the pointer that also needs to discharge every one deck, generates this file and is used for convenient the use)
Sgps_sip_del.h (defined file of releasing memory function)
Sgps_sip_enc.c (defined file of coding function) (coding refers to generate from C-structure the process of byte stream)
Sgps_sip_enc.h (the statement file of coding function)
S104 calls described interface code file and encodes, and generates interface message and transmission; And/or, call described interface code file the interface message that receives is decoded, obtain decode messages.
" and/or " represent that this step comprises 3 kinds of situations: the first situation: get "or", call described interface code file and encode, generate interface message and transmission, namely only have coded portion; The second situation: get "or", call described interface code file the interface message that receives is decoded, obtain decode messages, namely only have decoded portion; The third situation: get " with ", call described interface code file and encode, generate interface message and transmission; Calling described interface code file decodes to the interface message that receives, obtain decode messages, namely comprise coded portion and decoded portion, need to prove, system both can call described interface code file and encode, and generated interface message and sent to other system, also can receive the interface message that other system sends, the interface message that receives is decoded, obtain decode messages.
Above-mentioned calling interface code file is encoded or is decoded and comprises:
Calling interface;
Calling the interface code file of corresponding described interface encodes or decodes.
Corresponding interface at first calls according to business demand in system, according to description before: " content of an interface is written as an interface document " as can be known, the corresponding interface document of interface, again by " resolve described interface document and automatically generate the interface code file " as can be known, the corresponding interface code file of interface document, to sum up, interface has the interface code file of a correspondence.After the system call interfaces, then call the interface code file of corresponding described interface and encode or decode.Coding function when encoding in the calling interface code file, the decoding functions when decoding in the calling interface code file.
Present embodiment can obtain following effect:
At first, present embodiment one adopts unified standard to write interface document, and unified interface message definition has reduced the coupling between system, and interface is easy to expansion.And the present invention carries out the automatic Code Generation automatic code generating, when reducing artificial workload, has improved the quality of coding, has avoided causing because the ability of programmer is different difference in quality in Interface design and the cataloged procedure.
Secondly, present embodiment one is by carrying out automatic Code Generation according to the c code that the message structure of EXCEL document definition generates, and comprises that message structure etc. all is to meet c speech encoding standard fully, can use according to standard method fully.
Embodiment two:
With reference to Fig. 2, show the Interface design process flow diagram of present embodiment, specifically may further comprise the steps:
S201 determines subsystem interface content;
Can determine interface content between subsystem according to the interface requirements between subsystem.Interface requirements is different, and the interface content between corresponding subsystem is also different.The interface content comprises: the message content of interface and structure, described message structure comprises structure title, member Name and member type.
S202 writes interface document according to described interface content according to default unified standard;
Default unified standard comprises the interface message stream definition standard in interface message definition standard and the transmission course in the present embodiment.Above-mentioned interface document can be stored in the Excel file in the present embodiment, and the content of an interface is written as an interface document, and an interface document is stored in the Excel file.As required, interface document also can be stored in the Word file.
S203 carries out automatic Code Generation;
Carry out automatic Code Generation, at first above-mentioned interface document is carried out validity checking, then resolve described interface document and automatically generate the interface code file.
S204 judges whether correctly to generate the interface code file, if, enter step S205, otherwise, step S202 returned;
S205, the interface code file is integrated into engineering;
S206 compiles described engineering.
Need to prove, resolve described interface document in the present embodiment and automatically generate after the interface code file, described interface code file is integrated into engineering.Particularly, above-mentioned interface code file copy under the same engineering catalogue, is added engineering with user's alternative document, compile, can finish Interface design, for coding or decode ready.
The below introduces in detail the code of carrying out the automatic generation of automatic Code Generation in the present embodiment and how to use, and supposing has two sub-systems, and one is the A subsystem, and another is the B subsystem.The A subsystem sends message by interface message to the B subsystem, is illustrated in figure 3 as the process flow diagram of A subsystem interface message transmission processing, specifically may further comprise the steps:
S301, the A subsystem carries out logical process;
Carry out logical process according to business demand, for example, when processing the cash settlement business, carry out corresponding cash settlement logical process.
S302, calling interface;
The A subsystem at first calls corresponding interface according to business demand, according to description before: " content of an interface is written as an interface document " as can be known, the corresponding interface document of interface, again by " resolve described interface document and automatically generate the interface code file " as can be known, the corresponding interface code file of interface document, to sum up, interface has the interface code file of a correspondence.The A subsystem also has the interface of a correspondence in the present embodiment.
S303 calls the interface code file of corresponding described interface and encodes, and generates interface message;
After the A subsystem calling interface, then call the interface code file of corresponding described interface and encode.Coding function when encoding in the calling interface code file.
S304 sends described interface message.
The interface message that generates among the S303 is sent to the B subsystem.
Be illustrated in figure 4 as the process flow diagram that B subsystem interface message sink is processed, specifically may further comprise the steps:
S401, calling interface;
The B subsystem calls corresponding interface.
S402, receiving interface message;
The B subsystem receives the interface message that above-mentioned A subsystem sends.
S403 calls the interface code file docking port message of corresponding described interface and decodes, and obtains decode messages;
After the B subsystem calling interface, then call the interface code file of corresponding described interface and decode.Decoding functions when decoding in the calling interface code file.
S404 carries out logical process to described decode messages.
So far, B subsystem interface message sink flow process finishes.
Be the schematic flow sheet of the described interface message of present embodiment when making amendment such as Fig. 5, specifically may further comprise the steps:
S501 when described interface requirements changes, determines new interface content according to the interface requirements after changing;
Interface requirements is different, and the interface content is different, therefore when interface requirements changes, need to redefine the interface content according to the interface requirements after changing, namely new interface content.
S502 is according to described new interface document corresponding to interface content modification;
Interface document is to write according to default unified standard according to the interface content to obtain, when the interface content changes, and interface document that need to be corresponding according to new interface content modification.
S503 carries out automatic Code Generation, automatically generates new interface code file according to amended interface document;
Present embodiment is after having revised interface document, only need to carry out automatic Code Generation, just can automatically generate new interface code file by amended interface document, do not need again manual compiling interface code, do not need artificial docking port code to make amendment yet, reduce artificial workload, improved the efficient of system extension.And when having avoided manual amendment's interface code, because the uneven problem of the code quality that programming personnel's difference causes, improved the coupling of system.
S504 judges whether the correct new interface code file that generates, if, enter step S505, otherwise, step S502 returned;
S505 is integrated into engineering with described interface code file;
Need to prove, correctly generate new interface code file after, call described new interface code file and encode, generate interface message; And/or, call described new interface code file docking port message and decode, obtain decode messages.
S506 compiles described engineering.
So far, finished the modification of docking port message.
This shows, when needing to expand after coding is finished in the present embodiment one, only need to revise interface document, then can automatically generate interface code according to interface document, do not need to write again interface code, reduced artificial workload, improved the efficient of system extension.
Embodiment three:
As shown in Figure 6, the structured flowchart for the system of a kind of interface coding/decoding of present embodiment specifically comprises:
Interface content determination module 1001 is used for determining the interface content according to interface requirements;
Interface document is write module 1002, is used for writing interface document according to described interface content according to default unified standard; Therefore identical with described in the embodiment one of present embodiment two described unified standards repeat no more, can reference example one in to the detailed description of unified standard.
Interface code file generating module 1003 be used for to be carried out automatic Code Generation, and resolves described interface document and automatically generate the interface code file;
Coding module 1004 and/or decoder module 1005, wherein, coding module 1004 is used for calling described interface code file and encodes, and generates interface message and transmission;
Decoder module 1005 is used for calling described interface code file the interface message that receives is decoded, and obtains decode messages.
" and/or " representing to comprise 3 kinds of situations: the first situation: get "or", described system comprises coding module 1004, does not comprise decoder module 1005; The second situation: get "or", described system comprises decoder module 1005, does not comprise coding module 1004; The third situation: get " with ", described system comprises coding module 1004 and decoder module 1005, for example a system both can the calling interface code file encode, generate interface message and send to other system, also can receive the interface message that other system sends, docking port message is decoded, and obtains decode messages.
As shown in Figure 7, be a preferred embodiment at present embodiment three, described system comprises:
Interface content determination module 2001 is used for determining the interface content according to interface requirements;
Interface document is write module 2002, is used for writing interface document according to described interface content according to default unified standard; Therefore identical with described in the embodiment one of present embodiment three described unified standards repeat no more, can reference example one in to the detailed description of unified standard.
Memory module 2003 is write module for interface document and has been write after the interface document, and described interface document is stored in the Excel file;
Wherein, the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
Checking module 2004 is used for the interface code file generating module and generates before the interface code file, and described interface document is carried out validity checking.
Interface code file generating module 2005 be used for to be carried out automatic Code Generation, and resolves described interface document and automatically generate the interface code file;
Coding module 2006 and/or decoder module 2007, wherein,
Coding module 2006 is used for calling described interface code file and encodes, and generates interface message and transmission;
Decoder module 2007 is used for calling described interface code file the interface message that receives is decoded, and obtains decode messages.
Modular converter 2008 after coding module generation interface message, is converted to isometric signless integer with the signed integer in the described interface message according to scope;
Described modular converter is changed according to following formula:
x=value-lb;
Wherein, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
Interface content modification module 2009 is used for when described interface requirements changes, and determines new interface content according to the interface requirements after changing;
Interface document modified module 2010 is used for according to described new interface document corresponding to interface content modification;
Above-mentioned interface code file generating module 2005 is carried out automatic Code Generation in this preferred embodiment, automatically generates new interface code file according to amended interface document;
Above-mentioned coding module 2006 calls described new interface code file and encodes, and generates new interface message; And/or above-mentioned decoder module 2007 calls described new interface code file docking port message and decodes, and obtains new decode messages.
In the another kind of preferred embodiment of present embodiment, also comprise integration module, be used for the interface code file generating module and automatically become into after the interface code file, described interface code file is integrated into engineering.
For system embodiment because itself and embodiment of the method basic simlarity, so describe fairly simple, relevant part gets final product referring to the part explanation of Fig. 1 embodiment of the method.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.
More than to the method and system of a kind of interface coding/decoding provided by the present invention, be described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (14)

1. the method for an interface coding/decoding is characterized in that, comprising:
Determine the interface content according to interface requirements;
Write interface document according to described interface content according to default unified standard;
Carry out automatic Code Generation, resolve described interface document and automatically generate the interface code file;
Call described interface code file and encode, generate interface message and transmission;
And/or, call described interface code file the interface message that receives is decoded, obtain decode messages.
2. method according to claim 1 is characterized in that:
Described interface document is stored in the Excel file;
Wherein, the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
3. method according to claim 1 is characterized in that, the signed integer in the described interface message is converted to isometric signless integer according to scope and sends;
Wherein, change according to following formula:
x=value-lb;
In the described formula, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
4. method according to claim 1 is characterized in that, before the described automatic generation interface code file, also comprises:
Automatic Code Generation carries out validity checking to described interface document.
5. method according to claim 1 is characterized in that, the calling interface code file is encoded or decoded and comprises:
Calling interface;
Calling the interface code file of corresponding described interface encodes or decodes.
6. method according to claim 1 is characterized in that, also comprises:
When described interface requirements changes, determine new interface content according to the interface requirements after changing;
According to described new interface document corresponding to interface content modification;
Carry out automatic Code Generation, automatically generate new interface code file according to amended interface document;
Call described new interface code file and encode, generate interface message;
And/or, call described new interface code file docking port message and decode, obtain decode messages.
7. method according to claim 1 is characterized in that, described interface content comprises:
The message content of interface and structure, described message structure comprises structure title, member Name and member type.
8. method according to claim 1 is characterized in that:
Described default unified standard comprises the interface message stream definition standard in interface message definition standard and the transmission course.
9. method according to claim 1 is characterized in that, resolves described interface document and automatically generates after the interface code file, also comprises:
Described interface code file is integrated into engineering.
10. the system of an interface coding/decoding is characterized in that, comprising:
Interface content determination module is used for determining the interface content according to interface requirements;
Interface document is write module, is used for writing interface document according to described interface content according to default unified standard;
The interface code file generating module be used for to be carried out automatic Code Generation, and resolves described interface document and automatically generate the interface code file;
Coding module and/or decoder module, wherein,
Coding module is used for calling described interface code file and encodes, and generates interface message and transmission;
Decoder module is used for calling described interface code file the interface message that receives is decoded, and obtains decode messages.
11. system according to claim 10 is characterized in that, also comprises:
Memory module is write module for interface document and has been write after the interface document, and described interface document is stored in the Excel file;
Wherein, the content of an interface is written as an interface document, and an interface document is stored in the Excel file.
12. method according to claim 10 is characterized in that, also comprises:
Modular converter after coding module generation interface message, is converted to isometric signless integer with the signed integer in the described interface message according to scope;
Described modular converter is changed according to following formula:
x=value-lb;
Wherein, x is the signless integer that is transformed in the byte stream, and value is the front signed integer of conversion, and lb is the lower boundary of this signed integer.
13. system according to claim 10 is characterized in that, also comprises:
Checking module is used for the interface code file generating module and generates before the interface code file, and described interface document is carried out validity checking.
14. system according to claim 10 is characterized in that, also comprises:
Interface content modification module is used for when described interface requirements changes, and determines new interface content according to the interface requirements after changing;
The interface document modified module is used for according to described new interface document corresponding to interface content modification;
Described interface code file generating module is carried out automatic Code Generation, automatically generates new interface code file according to amended interface document;
Described coding module calls described new interface code file and encodes, and generates new interface message; And/or described decoder module calls described new interface code file docking port message and decodes, and obtains new decode messages.
CN2012103807780A 2012-10-09 2012-10-09 Interface encoding/decoding method and system Pending CN102929608A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012103807780A CN102929608A (en) 2012-10-09 2012-10-09 Interface encoding/decoding method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012103807780A CN102929608A (en) 2012-10-09 2012-10-09 Interface encoding/decoding method and system

Publications (1)

Publication Number Publication Date
CN102929608A true CN102929608A (en) 2013-02-13

Family

ID=47644421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012103807780A Pending CN102929608A (en) 2012-10-09 2012-10-09 Interface encoding/decoding method and system

Country Status (1)

Country Link
CN (1) CN102929608A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116500A (en) * 2013-03-11 2013-05-22 北京首钢自动化信息技术有限公司 Method and device for structural body definition and structure output
CN103279358A (en) * 2013-06-08 2013-09-04 北京首钢自动化信息技术有限公司 Interpreted dynamic business component construction method for industrial applications
CN106775607A (en) * 2015-11-24 2017-05-31 中国直升机设计研究所 A kind of method that ICD is automatically generated header file data-interface
CN110188135A (en) * 2019-05-30 2019-08-30 中国联合网络通信集团有限公司 Document generating method and equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1929461A (en) * 2006-10-09 2007-03-14 华为技术有限公司 Coding/decoding method for communication system information and coder/decoder
CN101122854A (en) * 2007-09-13 2008-02-13 上海交通大学 Structured code automatic configuration method and device
CN101631126A (en) * 2009-08-06 2010-01-20 中兴通讯股份有限公司 Self-adaptive coding/decoding method and self-adaptive coding/decoding device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1929461A (en) * 2006-10-09 2007-03-14 华为技术有限公司 Coding/decoding method for communication system information and coder/decoder
CN101122854A (en) * 2007-09-13 2008-02-13 上海交通大学 Structured code automatic configuration method and device
CN101631126A (en) * 2009-08-06 2010-01-20 中兴通讯股份有限公司 Self-adaptive coding/decoding method and self-adaptive coding/decoding device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116500A (en) * 2013-03-11 2013-05-22 北京首钢自动化信息技术有限公司 Method and device for structural body definition and structure output
CN103279358A (en) * 2013-06-08 2013-09-04 北京首钢自动化信息技术有限公司 Interpreted dynamic business component construction method for industrial applications
CN103279358B (en) * 2013-06-08 2016-04-27 北京首钢自动化信息技术有限公司 A kind of explanation type Service Component dynamic fixing method of Industry-oriented application
CN106775607A (en) * 2015-11-24 2017-05-31 中国直升机设计研究所 A kind of method that ICD is automatically generated header file data-interface
CN110188135A (en) * 2019-05-30 2019-08-30 中国联合网络通信集团有限公司 Document generating method and equipment
CN110188135B (en) * 2019-05-30 2021-07-27 中国联合网络通信集团有限公司 File generation method and equipment

Similar Documents

Publication Publication Date Title
US8589873B2 (en) Software engineering system and method for self-adaptive dynamic software components
CN103365847B (en) A kind of generation method and apparatus of self-defined web page files
CN110870249A (en) System and method for compiling high-level language code into scripts executable on a blockchain platform
CN101311925B (en) Web page development and maintenance method and its device
CN103631632A (en) Transplantation method and source to source compiler
CN101788906B (en) Resource management method and system thereof
CN102929608A (en) Interface encoding/decoding method and system
CN103870308A (en) Data processing method and device
Behrens MDSD for the iPhone: developing a domain-specific language and IDE tooling to produce real world applications for mobile devices
Innes et al. On machine learning and programming languages
Shah et al. An aspect-oriented security framework
CN104679793A (en) Dynamic invoice template invoice issuing system
US7814414B2 (en) Relative attributes of floating objects
CN101944133B (en) XML metadata objectification analysis method and system
KR101460794B1 (en) Method and system for generating media art contents
CN112347534B (en) Water conservancy and hydropower engineering BIM model conversion method based on IFC extension
CN102541544A (en) Method, device and system for processing tree control
CN202143092U (en) Message processing system
CN103577573A (en) Intelligent document engine technology for generating dynamic complicated tables on basis of Word 2007/Open XML
CN101561884B (en) Method and device for achieving script in variable data printing process
CN116774993A (en) Code conversion method, device and storage medium
CN102566993B (en) Method and device for editing interface
CN106815003A (en) The interactive system and exchange method of a kind of computer language
US7464370B2 (en) Creating a method from a block of code
CN110705209A (en) Method and system for on-line amending manuscript

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20130213

RJ01 Rejection of invention patent application after publication