Let's see how it works. The Timer is continually looking for information that the antenna may send to the application. The diagram summarizes the major part of this procedure.

 

 

So if anything happens, we can see that we have two options: receive a screen of the terminal or the terminal asking us for a screen.

If received, the procedure is as follows:

procedure TForm1.ReceiveScreen(TerminalID,ScrName:String);
begin
T_RefreshScreen(TerminalId, ScrName);
DoScreen(ScrName);
//Here you have the information, from this point on your application will use the information as it may be necessary

end;

This procedure updates the variables in the PC with the variables introduced in the terminal. After a refresh and a DoScreen the variables are updated on the PC. At this point the information has already been received, which will end the call TIMER.

The other option is as AskScreen. First we must know when to produce and how. The possibilities are many, in general all the functions that have as parameter the name of a screen will produce an AskScreen.


Another situation is when a reset is done on the terminal and a key is pressed, the screen where the question is layed down is always the default 'start'. The PC can then send screens (as many as it wants to) and send them as non-executable (in the Function T_InitScreen with different flags scr_flag_execute) and the last as executable (scr_flag_execute).


At this point the terminal starts to operate as off-line and with its functionality programmed.

The other situations work in an analogous way to this example:

In the procedure DoScreen are designed screens, so the possibilities are many. Look at the following example:

procedure TForm1.DoScreen(ScrName:String);
begin
if Pchar(ScrName)='LE REF'
then
begin

T_Say('>');
T_GetText(barcode,10,GetText_flag_Barcode + GetText_flag_ExitEnter);
T_NewLine;
T_PrintString('>');
T_PrintString(Description);

T_Beep(50,50);
T_Read;
T_SendScreenToPc('LE REF', scr_flag_update_pc_now + scr_flag_auto_destroy );
T_GotoScreen('LE REF');
end;
end;

There are many things that need a review, but the last function (T_GotoScree) tells the terminal to go to the screen LE REF. What happens is that the terminal calls the screen, which in this case it's itself. Here a AskScreen is produced because the screen had been destroyed with scr_flag_auto_destroy and must be loaded again. It may be that the the screen the program wants is in memory, which will avoid the AskScreen to happen. It may also be sent any number of screens that the programmer must believes necessary.

 

The majority of programs, when a AskScreen happens, follow this sequence:

1. They are initialized or they give value to the variables (those which have reference to this screen) and then a T_InitScreen is done.
2. The screen is created (DoScreen).
3. The screen is sent T_SendScreen.

This is the usual procedure of AskScreen.