Summary of the invention
The invention provides a kind of implementation method of terminal shared host, solve the problem that the different types of terminals product can not be shared a main frame.
The inventive method comprises:
In host memory storage feature index table, the call number of the function that terminal had of setting and this main-machine communication;
Storage terminal feature index table in described terminal comprises the call number of the function correspondence that it has and the related command information of each function;
When main frame is carried out a feature operation to terminal, carry out following steps:
A: main frame by and terminal between interface issue a functional inquiry message to terminal, this query messages carries the call number of this function;
B: described terminal is searched its feature index table according to call number, if match identical call number, then the command information with its corresponding function returns to main frame;
C: main frame is carried out described feature operation according to the command information of returning to described terminal.
According to said method of the present invention,, then return error message to main frame if terminal does not match identical call number.
Described interface is the handshake passing interface between main frame and the terminal.
Described functional inquiry message is carried the inquiry sign of main frame and terminal agreement.
According to said method of the present invention, after terminal receives a piece of news, inquire about marking matchedly, if match the inquiry sign of agreement, then confirm as functional inquiry message, continue execution in step B and step C; Otherwise confirm that current message is normal handshake information, carry out the corresponding flow process of handshake information.
The inquiry of described agreement is designated character string or random number.
Described command information comprises: total command word, subsystem identification code and/or subsystem internal command word.
Described call number is Arabic numerals or any character.
Adopt method of the present invention can realize that the shared main frame of different types of terminals product communicates.
Embodiment
Below in conjunction with accompanying drawing, the inventive method step is provided detailed description.
Step 11: store up a repertoire concordance list at host memory, the call number of the various difference in functionalitys that all types of terminal had of setting and this main-machine communication.Specify as follows:
As shown in Table 1, suppose that main frame need communicate with two types terminal, is respectively terminal one and terminal two.Terminal one has function 1 and function 2, and terminal two has function 1 and function 3, then needs to be provided with the pairing call number of repertoire (function 1, function 2 and function 3) in Table 1; As in the table one, " 1 " is the call number of function 1, and " 2 " are the call number of function 2, and " 3 " are the call number of function 3.
Table one:
Call number |
Realize function |
1 |
Function 1 |
2 |
Function 2 |
3 |
Function 3 |
Step 12: in described all types of terminals, store a termination function concordance list respectively, comprise the call number of the function correspondence that this terminal itself is had and the related command information of each function.Specify as follows:
As shown in Table 2, termination function concordance list for terminal one storage, comprise the function 1 that terminal one is had and the call number " 1 " and the call number " 2 " of function 2 correspondences in this table, and the command information of memory function 1 such as the command information such as the command word CMD_CODE2 of command word CMD_CODE1 and function 2 simultaneously.
Table two:
Call number |
Command word |
1 |
CMD_CODE 1 |
2 |
CMD_CODE 2 |
Same, terminal two also needs to store a termination function concordance list, as shown in Table 3, comprise the function 1 that terminal two is had and the call number " 1 " and the call number " 3 " of function 3 correspondences in this table, and the command information of memory function 1 such as the command information such as the command word CMD_CODE3 of command word CMD_CODE1 and function 3 simultaneously.
Table three:
Call number |
Command word |
1 |
CMD_CODE 1 |
3 |
CMD_CODE 3 |
Step 13: main frame by with the handshake information passing interface of terminal, issue the functional inquiry message and the handshake information of carrying call number.Specify as follows:
Before main frame is carried out a function to terminal, need inquire about earlier whether terminal has this function, main frame can by and terminal between interface issue a functional inquiry message to terminal and realize inquiry.
In order to make full use of existing equipments resources, making simultaneously all can be normally mutual between dissimilar terminals and the same main frame, should seek a public information interactive interface.Considering between terminal and the main frame needs to shake hands constantly, therefore can issue functional inquiry message by the handshake passing interface between terminal and the main frame and realize functional inquiry.Adopting the handshake passing interface only to be one at this gives an example, in the practical application, can adopt other interface type or a new special purpose interface is set.
Normal handshake information is not disturbed by functional inquiry between terminal and the main frame in order to make, and can allow functional inquiry message carry specific sign (sign of agreement between main frame and terminal in advance), can arrange a character string or certain random number.
Step 14: judge whether current message is functional inquiry message, and concrete grammar is:
Terminal is after the message that receives from the handshake passing interface, and the coupling of advanced line character string or random number if coupling is unsuccessful, shows that then this message is normal handshake information, execution in step 15; Otherwise confirm as this message is functional inquiry message, execution in step 16.
Step 15: the normal running flow process of carrying out handshake information.
Step 16: read the call number of the correlation function that carries in this message, continue step 17;
Step 17: terminal is searched the termination function concordance list of oneself according to this call number, if do not match identical call number, then execution in step 18, otherwise, execution in step 19;
Step 18: return an error message to main frame, the expression terminal is not supported this function, and main frame can not provide this function to the user.
Step 19: the command information of call number corresponding function is returned to main frame, continue step 20.
Step 20: main frame receives orders after the information, confirms that terminal supports this function; The command word that main frame can return according to terminal is initiated the information of uploading of order or receiving terminal to terminal.
The command information that terminal is returned comprises: the information of All hosts needs such as total command word, subsystem identification code and/or subsystem internal command word.If polytype terminal all has a certain function, as long as the function manipulative indexing is number identical, even the command information difference that each terminal is returned, main frame also can issue corresponding order according to the command word that each terminal is returned fully, so just reached the purpose of the shared main frame of different terminals.
Be one of the functional inquiry message that issues of main frame and the command information of terminal to report embodiment below:
typedef struct
{
uint16index;
}cmd_req_type;
The information format that reports after the inquiry:
typedef struct
{
uint16 index;
uint8 cmd;
uint8 sub_sys_id;
uint16 sub_sys_cmd;
uint16 event_id;
uint16 sub_event_id;
uint16 log_id;
uint16 sub_log_id;
}cmd_rsp_type;
Parameter wherein: the call number of index presentation function correspondence; Cmd represents total command word of this type of function; Sub_sys_id represents subsystem ID (identification code); Sub_sys_cmd represents the command word at certain subsystem inside; Event_id represents the presumable event id of this function; Log_id represents that the presumable Log of this function (daily record) reports ID; Sub_log_id represents sub-Log Id that this function can have or the like.
Be example still with above-mentioned terminal one and terminal two, if index is the voice master calling function of arranging between 1 expression main frame and the terminal, cmd is 75, sub_sys_id is 14, sub_sys_cmd is 0xff00, and this function does not have incident or Log information to report, and a pair of index of terminal is this function of 1 so, and the form description that can preserve is as follows:
const test_qcmd_cmd_type cmd_list[]=
{
1,75,14,0xff00,0,0,0,0
}
Terminal two also should be preserved and terminal one similar form, just must be identical except the call number of identical function, other all fields all can be different.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.